diff --git a/app/admin/model/Store.php b/app/admin/model/Store.php index 3ae7de12..d4824e29 100644 --- a/app/admin/model/Store.php +++ b/app/admin/model/Store.php @@ -93,8 +93,8 @@ class Store extends StoreModel 'parent_id' => 0, 'sort' => 100, 'menus' => [ - 10034,10035,10204,10038,10036,10037,10141,10043,10044,10045, - 10046,10047,10048,10049,10243,10244,10246,10245,10050,10051, + 10034,10035,10204,10038,10036,10037,10141,10044,10045, + 10046,10243,10244,10246,10245,10050,10051, 10052,10205,10054,10189,10055,10223,10139,10252,10056,10058, 10059,10057,10201,10238,10241,10239,10240,10242,10202,10203, 10206,10207,10208,10209,10213,10210,10211,10115 diff --git a/app/job/controller/goods/GoodsStoreImport.php b/app/job/controller/goods/GoodsStoreImport.php index 4c450006..b788d5a1 100644 --- a/app/job/controller/goods/GoodsStoreImport.php +++ b/app/job/controller/goods/GoodsStoreImport.php @@ -44,6 +44,6 @@ class GoodsStoreImport extends BaseJob echo "\n ---- adminImport ---- {$time} ---- \n"; $service = new GoodsStoreImportService; - return $service->batch($data['list'], $data['recordId'], $data['storeId']); + return $service->batch($data['list'], $data['recordId'], $data['storeId'], $data['merchantId']); } } \ No newline at end of file diff --git a/app/job/service/goods/GoodsStoreImport.php b/app/job/service/goods/GoodsStoreImport.php index d8e9dd38..af041165 100644 --- a/app/job/service/goods/GoodsStoreImport.php +++ b/app/job/service/goods/GoodsStoreImport.php @@ -99,12 +99,12 @@ class GoodsStoreImport extends BaseService * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function batch(array $list, int $recordId, int $storeId): bool + public function batch(array $list, int $recordId, int $storeId, int $merchantId): bool { $service = new \app\job\service\goods\Collector(); foreach ($list as $item) { //sku存在了就不抓取了 - $info = GoodsModel::where('goods_no', $item['C'])->where('store_id', $storeId)->where('channel', $item['channel'])->where('is_delete',0)->find(); + $info = GoodsModel::where('goods_no', $item['C'])->where('store_id', $storeId)->where('merchant_id', $merchantId)->where('channel', $item['channel'])->where('is_delete',0)->find(); if ($info) { $this->successCount++; continue; diff --git a/app/store/controller/goods/Import.php b/app/store/controller/goods/Import.php index 787565fe..c34edd1e 100644 --- a/app/store/controller/goods/Import.php +++ b/app/store/controller/goods/Import.php @@ -32,7 +32,9 @@ class Import extends Controller public function list(): Json { $model = new ImportModel; - $list = $model->getList($this->request->param()); + $params = $this->request->param(); + $params['merchant_id'] = $this->merchantId; + $list = $model->getList($params); return $this->renderSuccess(compact('list')); } @@ -47,6 +49,7 @@ class Import extends Controller { $form = $this->postData(); $form['store_id'] = $this->storeId; + $form['merchant_id'] = $this->merchantId; // 新增记录 $model = new ImportModel; if ($model->storeBatch($form)) { diff --git a/app/store/model/goods/Import.php b/app/store/model/goods/Import.php index e5927c1a..b84b6819 100644 --- a/app/store/model/goods/Import.php +++ b/app/store/model/goods/Import.php @@ -66,6 +66,7 @@ class Import extends ImportModel $filter = []; $params['status'] > -1 && $filter[] = ['status', '=', (int)$params['status']]; isset($params['store_id']) && $params['store_id'] > -1 && $filter[] = ['store_id', '=', (int)$params['store_id']]; + isset($params['merchant_id']) && $params['merchant_id'] > -1 && $filter[] = ['merchant_id', '=', (int)$params['merchant_id']]; return $filter; } /** @@ -137,6 +138,7 @@ class Import extends ImportModel $this->checkLimit($execlData); self::$storeId = $form['store_id'] ?? 0; + self::$merchantId = $form['merchant_id'] ?? 0; foreach ($execlData as &$value) { $value['channel'] = $form['channel']??'zy'; } @@ -409,6 +411,7 @@ class Import extends ImportModel 'list' => $data, 'recordId' => $recordId, 'storeId' => self::$storeId, + 'merchantId' => self::$merchantId, ]); } } @@ -472,6 +475,7 @@ class Import extends ImportModel 'fail_log' => [], 'status' => GoodsImportStatusEnum::NORMAL, 'store_id' => self::$storeId, + 'merchant_id' => self::$merchantId, 'channel' => $channel, ]); return (int)$this['id']; diff --git a/config/allowapi.php b/config/allowapi.php index babc3798..eb5dfe08 100644 --- a/config/allowapi.php +++ b/config/allowapi.php @@ -1,4 +1,5 @@