正在显示
1 个修改的文件
包含
6 行增加
和
2 行删除
@@ -181,8 +181,12 @@ class IndexController extends WeChatBaseController | @@ -181,8 +181,12 @@ class IndexController extends WeChatBaseController | ||
181 | */ | 181 | */ |
182 | public function search_salesman_goods(){ | 182 | public function search_salesman_goods(){ |
183 | 183 | ||
184 | - $book_name = $_POST['book_name']; | ||
185 | - $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(); | 184 | + if(empty($_POST['book_name'])){ |
185 | + $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(); | ||
186 | + }else{ | ||
187 | + $book_name = $_POST['book_name']; | ||
188 | + $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(); | ||
189 | + } | ||
186 | if(!empty($data_salesman_goods)){ | 190 | if(!empty($data_salesman_goods)){ |
187 | foreach ($data_salesman_goods as $key => $val){ | 191 | foreach ($data_salesman_goods as $key => $val){ |
188 | $price = explode('.',$data_salesman_goods[$key]['price']); | 192 | $price = explode('.',$data_salesman_goods[$key]['price']); |
-
请 注册 或 登录 后发表评论