更新云商品列表

This commit is contained in:
shengchanzhe 2023-12-25 15:54:11 +08:00
parent 3752de112f
commit 7a3903dfec

View File

@ -454,10 +454,27 @@ class Product extends BaseController
public function cloud_product_list(){
[$page, $limit] = $this->getPage();
$product_ids=Db::name('cloud_product')->where('mer_id',$this->request->merId())
->page($page)->limit($limit)->column('product_id');
$select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$product_ids)->select()->toArray();
$cloud_product_arr=Db::name('cloud_product')->where('mer_id',$this->request->merId())
->page($page)->limit($limit)->field('product_id,mer_labels')->select();
$cloud_product = [];
foreach ($cloud_product_arr as $key => $value) {
$cloud_product[] = $value['product_id'];
}
$select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$cloud_product)->select()->toArray();
$count = Db::name('cloud_product')->where('mer_id',$this->request->merId())->count();
if ($select) {
foreach ($cloud_product_arr as $key => $value) {
foreach ($select as $k => $v) {
if ($value['product_id'] == $v['product_id']) {
if ($value['mer_labels'] == ',5,') {
$select[$k]['mer_labels_name'] = '五日达';
} else {
$select[$k]['mer_labels_name'] = '次日达';
}
}
}
}
}
return app('json')->success(['list'=>$select,'count'=>$count]);
}