diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index 2b05a80c..d6d9e43e 100644 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.php @@ -33,7 +33,9 @@ class Goods extends Controller { // 获取列表记录 $model = new GoodsModel; - $list= $model->getList($this->request->param()); + $params = $this->request->param(); + $params['store_id'] = 0; + $list= $model->getList($params); return $this->renderSuccess(compact('list')); } diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index 1c328d58..148503ad 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -177,6 +177,7 @@ class Goods extends BaseModel */ public function getList(array $param = [], int $listRows = 15) { + // 筛选条件 $query = $this->getQueryFilter($param); // 设置显示的销量 goods_sales @@ -305,10 +306,10 @@ class Goods extends BaseModel !empty($params['goodsNo']) && $filter[] = ['goods_no', 'like', "%{$params['goodsNo']}%"]; //wmc - if (isset($param['is_brand']) && $param['is_brand'] != '') { + if (isset($param['is_brand']) && $param['is_brand'] !== '') { $filter[] = ['is_brand', '=', $param['is_brand']]; } - if (isset($param['is_new']) && $param['is_new'] != '') { + if (isset($param['is_new']) && $param['is_new'] !== '') { $filter[] = ['is_new', '=', $param['is_new']]; } if (!empty($param['store_id']) && $a == 0) { @@ -320,10 +321,13 @@ class Goods extends BaseModel $query->order('paihang asc'); } //是否店内 - if (isset($param['is_in_store']) && $param['is_in_store'] != '') { + if (isset($param['is_in_store']) && $param['is_in_store'] !== '') { $filter[] = ['is_in_store', '=', $params['is_in_store']]; } - + + if (isset($param['store_id']) && $param['store_id'] !== '') { + $filter[] = ['goods.store_id', '=', $params['store_id']]; + } // 实例化新查询对象 return $query->where($filter); } diff --git a/app/job/service/goods/Collector.php b/app/job/service/goods/Collector.php index 2ccfe71b..18d0bfe2 100644 --- a/app/job/service/goods/Collector.php +++ b/app/job/service/goods/Collector.php @@ -284,7 +284,7 @@ class Collector extends BaseService 'newSkuList' => [], 'store_id' => $storeId, ]; - if (isset($form['channel']) { + if (isset($form['channel'])) { $data['channel'] = $form['channel']; } // 整理商品的价格和库存总量 diff --git a/app/store/model/goods/Import.php b/app/store/model/goods/Import.php index ef553737..5158324c 100644 --- a/app/store/model/goods/Import.php +++ b/app/store/model/goods/Import.php @@ -75,22 +75,10 @@ class Import extends ImportModel $this->checkLimit($execlData); self::$storeId = 0; - // $service = new \app\job\service\goods\Collector(); - // foreach ($execlData as $item) { - // $data = [ - // 'cmmdty_model' => $item["A"], - // 'channel' => "jd", - // 'goods_no' => $item["C"], - // 'categoryIds' => explode(",", $item["E"]), - // 'imageStorage' => 10,//下载图片到本地 - // 'goods_type' => 10,//实物 - // 'goods_status' => 10,//上架 - // 'store_id' => self::$storeId, - // ]; - // $service->single($item['D'], $data, self::$storeId); - // } // 新增商品导入记录 $recordId = $this->addRecord(\count($execlData)); + + // 调度计划任务 $this->adminDispatchJob($execlData, $recordId); return true;