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

5

... ... @@ -234,8 +234,24 @@ class IndexController extends WeChatBaseController
}
/**
* 首页搜索结果页 综合
*/
public function search_synthesis_order(){
$book_name = $_POST['search_content'];
$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']);
$data_salesman_goods[$key]['price0'] = $price[0];
$data_salesman_goods[$key]['price1'] = $price[1];
$data_salesman_goods[$key]['show_img'] = cmf_get_image_url($data_salesman_goods[$key]['show_img']);
}
}
return json_encode($data_salesman_goods);
}
... ...
... ... @@ -38,7 +38,7 @@
<!-- 搜索导航 -->
<div class="se_nav">
<ul>
<li class="se_navactvie">综合</li>
<li class="se_navactvie" onclick="classify_synthesis()">综合</li>
<li onclick="classify_sales()">销量
<img src="__TMPL__/public/assets/images/24.png" alt="">
</li>
... ... @@ -114,6 +114,21 @@
});
}
/**
* 点击综合
*/
function classify_synthesis(){
search_content = $("input[name='search_content']").val();
$.post("{:url('Index/search_synthesis_order')}",{search_content:search_content},function(data){
$('.in_hotLi').remove();
data_arr = JSON.parse(data);
for(var i=0;i<data_arr.length;i++){
show_img = data_arr[i].show_img;
url = "{:url('Goodsdetails/Goods_details')}?goods_id="+data_arr[i].id;
$('.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>");
}
});
}
</script>
</body>
... ...