作者 anyv
1 个管道 的构建 通过 耗费 0 秒

9

... ... @@ -181,8 +181,12 @@ class IndexController extends WeChatBaseController
*/
public function search_salesman_goods(){
$book_name = $_POST['book_name'];
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("type =2 ") -> where('book_name','like',"%".$book_name."%") -> select() -> toArray();
if(empty($_POST['book_name'])){
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("type =2 ") -> select() -> toArray();
}else{
$book_name = $_POST['book_name'];
$data_salesman_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("type =2 ") -> where('book_name','like',"%".$book_name."%") -> select() -> toArray();
}
if(!empty($data_salesman_goods)){
foreach ($data_salesman_goods as $key => $val){
$price = explode('.',$data_salesman_goods[$key]['price']);
... ...