From 55548799272e8aa429349758650bdff241f1978c Mon Sep 17 00:00:00 2001 From: anyv <anyu@bronet.cn> Date: Mon, 3 Jun 2019 08:49:16 +0800 Subject: [PATCH] 6 --- app/portal/controller/IndexController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/portal/controller/IndexController.php b/app/portal/controller/IndexController.php index a1d1f0a..8eb6906 100644 --- a/app/portal/controller/IndexController.php +++ b/app/portal/controller/IndexController.php @@ -203,7 +203,14 @@ class IndexController extends WeChatBaseController $search_content = $_POST['search_content']; $search_content_data = 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',"%".$search_content."%") -> order('sales desc') -> select() -> toArray(); - dump($search_content_data);die; + if(!empty($search_content_data)){ + foreach ($search_content_data as $key => $val){ + $price = explode('.',$search_content_data[$key]['price']); + $search_content_data[$key]['price0'] = $price[0]; + $search_content_data[$key]['price1'] = $price[1]; + } + } + return json_encode($search_content_data); } -- libgit2 0.24.0