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

5

@@ -234,8 +234,24 @@ class IndexController extends WeChatBaseController @@ -234,8 +234,24 @@ class IndexController extends WeChatBaseController
234 234
235 } 235 }
236 236
  237 + /**
  238 + * 首页搜索结果页 综合
  239 + */
  240 + public function search_synthesis_order(){
237 241
  242 + $book_name = $_POST['search_content'];
  243 + $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();
  244 + if(!empty($data_salesman_goods)){
  245 + foreach ($data_salesman_goods as $key => $val){
  246 + $price = explode('.',$data_salesman_goods[$key]['price']);
  247 + $data_salesman_goods[$key]['price0'] = $price[0];
  248 + $data_salesman_goods[$key]['price1'] = $price[1];
  249 + $data_salesman_goods[$key]['show_img'] = cmf_get_image_url($data_salesman_goods[$key]['show_img']);
  250 + }
  251 + }
  252 + return json_encode($data_salesman_goods);
238 253
  254 + }
239 255
240 256
241 257
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 <!-- 搜索导航 --> 38 <!-- 搜索导航 -->
39 <div class="se_nav"> 39 <div class="se_nav">
40 <ul> 40 <ul>
41 - <li class="se_navactvie">综合</li> 41 + <li class="se_navactvie" onclick="classify_synthesis()">综合</li>
42 <li onclick="classify_sales()">销量 42 <li onclick="classify_sales()">销量
43 <img src="__TMPL__/public/assets/images/24.png" alt=""> 43 <img src="__TMPL__/public/assets/images/24.png" alt="">
44 </li> 44 </li>
@@ -114,6 +114,21 @@ @@ -114,6 +114,21 @@
114 }); 114 });
115 } 115 }
116 116
  117 + /**
  118 + * 点击综合
  119 + */
  120 + function classify_synthesis(){
  121 + search_content = $("input[name='search_content']").val();
  122 + $.post("{:url('Index/search_synthesis_order')}",{search_content:search_content},function(data){
  123 + $('.in_hotLi').remove();
  124 + data_arr = JSON.parse(data);
  125 + for(var i=0;i<data_arr.length;i++){
  126 + show_img = data_arr[i].show_img;
  127 + url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
  128 + $('.se_con').append("<div class='in_hotLi'><a href='"+url+"'><div class='in_hotImg'><img src='"+show_img+"'></div><div class='in_hotText'><div class='in_hotName txt-cut'><span></span>"+data_arr[i].book_name+"</div><div class='in_cam_shopPrice'><div class='in_hotPrice1'>¥<span>"+data_arr[i].price0+"</span>."+data_arr[i].price1+"</div></div></div></a></div>");
  129 + }
  130 + });
  131 + }
117 </script> 132 </script>
118 </body> 133 </body>
119 134