Преглед изворни кода

feat(merchant): 阿里巴巴产品控制器增加商户ID过滤和入库状态标识

- 在产品列表查询中添加商户ID过滤条件
- 为每个产品项添加是否已入库的状态标识
- 查询店铺产品表判断产品入库状态
- 修复重复分号语法错误
shichen пре 3 месеци
родитељ
комит
87e0f39098
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      app/controller/merchant/alibaba/Product.php

+ 9 - 1
app/controller/merchant/alibaba/Product.php

@@ -23,6 +23,8 @@ class Product extends BaseController
23 23
         $limit   = (int)($request->param('limit', 20));
24 24
         $keyword = $request->param('keyword', '');
25 25
         $status  = $request->param('status', '');
26
+        $merId = $this->request->merId();
27
+        // $merId = 3447;
26 28
 
27 29
         $query = Db::name('alibaba_import_goods');
28 30
 
@@ -73,6 +75,11 @@ class Product extends BaseController
73 75
             $item['markup_rate'] = $productInfo['markupRate'] ?? 0;
74 76
             $item['original_min_price'] = $productInfo['originalMinPrice'] ?? 0;
75 77
             $item['original_max_price'] = $productInfo['originalMaxPrice'] ?? 0;
78
+
79
+            // 是否已入库
80
+            $item['isStoreProduct'] = 0;
81
+            $storeProduct = Db::name('store_product')->where(['spu_id' => $item['product_id'], 'mer_id' => $merId])->find();
82
+            if ($storeProduct) $item['isStoreProduct'] = 1;
76 83
         }
77 84
         unset($item);
78 85
 
@@ -187,7 +194,8 @@ class Product extends BaseController
187 194
             return json(['code' => 400, 'message' => '参数错误:id格式不正确']);
188 195
         }
189 196
 
190
-        $merId = $this->request->merId();;
197
+        $merId = $this->request->merId();
198
+        // $merId = 3447;
191 199
 
192 200
         $successList = [];
193 201
         $failList    = [];