This commit is contained in:
mkm 2023-11-08 15:01:13 +08:00
parent 2c72112def
commit e4847c0e7e

View File

@ -106,46 +106,8 @@ class CloudWarehouse extends BaseController
'mer_status' => 1,
];
if (!$cloud_product && $category_id==0) {
$list=[];
$count=0;
if($location){
[$lon,$lat]=explode(',',$location);
if($page==1){
$limit=0;
}else{
$limit=$page*10;
}
$where=[
'type_id'=>13,
'is_de'=>0,
'mer_state'=>1
];
$mer_id=Db::name('merchant')->where($where)->column('mer_id');
// $select=Db::query("select mer_id,mer_name ,ST_Distance(coordinates, POINT($lon,$lat)) AS distance from eb_merchant where coordinates !='' and type_id= 13 and is_del=0 and mer_state=1 ORDER BY distance LIMIT 100;");
// halt($select);
if ($mer_id) {
$where['mer_id']=$mer_id;
$select = Db::name('store_product')->where($where)
->withAttr('sku', function ($value, $data) {
$find = Db::name('store_product_attr_value')->where('mer_id', $data['mer_id'])->where('product_id', $data['product_id'])->find();
return ['' => $find];
})
->withAttr('merchant', function ($value, $data) {
$find= Db::name('merchant')->where('mer_id', $data['mer_id'])->field('mer_id,mer_name')->find();
return $find;
})
->select();
// foreach ($product_list as $k1 => $v1){
// $arr=$v1;
// $v['distance']=round($v['distance'],2).'km';
// $arr['merchant']=$v;
// $list[]=$arr;
// }
}
}
return app('json')->success(['count' => $count, 'list' => $list]);
return app('json')->success(['count' => 0, 'list' => []]);
}
$count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count();
$select = Db::name('store_product')->whereIn('product_id', $cloud_product)->where($where)