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

分类价格排序

... ... @@ -113,15 +113,15 @@ class ClassifyController extends WeChatBaseController{
}
if(!empty($_POST['lable_id'])){
$where['label_id'] = $_POST['lable_id'];
}else{
$where['label_id'] = 0;
}
$data = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where($where) -> order('a.price 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.price 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);
... ...