...
|
...
|
@@ -82,19 +82,19 @@ class ClassifyController extends WeChatBaseController{ |
|
|
'a.type' => 1
|
|
|
];
|
|
|
if(!empty($_POST['classify_id'])){
|
|
|
$where['classify_id'] = $_POST['classify_id'];
|
|
|
$where['a.classify_id'] = $_POST['classify_id'];
|
|
|
}
|
|
|
if(!empty($_POST['lable_id'])){
|
|
|
$where['label_id'] = $_POST['lable_id'];
|
|
|
}else{
|
|
|
$where['label_id'] = 0;
|
|
|
$where['b.label_id'] = $_POST['lable_id'];
|
|
|
}
|
|
|
$data = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> order('a.sales desc') -> select() -> toArray();
|
|
|
$data = Db::name('goods') -> alias('a') -> field("a.*") -> join('goods_label b','a.id = b.goods_id','LEFT') -> where($where) -> order('a.sales desc') -> select() -> toArray();
|
|
|
$data_classify_name = Db::name('classification') -> where('id',$_POST['classify_id']) -> find();
|
|
|
foreach($data as $key => $val){
|
|
|
$price = explode('.',$data[$key]['price']);
|
|
|
$data[$key]['price0'] = $price[0];
|
|
|
$data[$key]['price01'] = $price[1];
|
|
|
$data[$key]['show_img'] = cmf_get_image_url($data[$key]['show_img']);
|
|
|
$data[$key]['name'] = $data_classify_name['name'];
|
|
|
}
|
|
|
return json_encode($data);
|
|
|
|
...
|
...
|
|