|
|
@@ -407,9 +407,9 @@ class ProductService extends AlibabaAgentBaseService
|
|
407
|
407
|
->where('is_del', 0)
|
|
408
|
408
|
->value('product_id');
|
|
409
|
409
|
|
|
410
|
|
- if ($exists) {
|
|
411
|
|
- return ['code' => 400, 'msg' => '商品已入库,product_id=' . $exists, 'product_id' => $exists];
|
|
412
|
|
- }
|
|
|
410
|
+ // if ($exists) {
|
|
|
411
|
+ // return ['code' => 400, 'msg' => '商品已入库,product_id=' . $exists, 'product_id' => $exists];
|
|
|
412
|
+ // }
|
|
413
|
413
|
|
|
414
|
414
|
// 3. 解析 product_info JSON
|
|
415
|
415
|
$productInfo = json_decode($importGoods['product_info'], true) ?: [];
|
|
|
@@ -433,9 +433,14 @@ class ProductService extends AlibabaAgentBaseService
|
|
433
|
433
|
$prices = array_column($skuList, 'price');
|
|
434
|
434
|
$minPrice = !empty($prices) ? (float)min($prices) : 0;
|
|
435
|
435
|
$maxPrice = !empty($prices) ? (float)max($prices) : 0;
|
|
436
|
|
-
|
|
437
|
436
|
// 成本价取第一个SKU的成本价
|
|
438
|
437
|
$costPrice = $skuList[0]['costPrice'] ?? 0;
|
|
|
438
|
+ if (empty($skuList)) {
|
|
|
439
|
+ $prices = $productInfo['price'];
|
|
|
440
|
+ $minPrice = $prices;
|
|
|
441
|
+ $maxPrice = $prices;
|
|
|
442
|
+ $costPrice = $prices;
|
|
|
443
|
+ }
|
|
439
|
444
|
|
|
440
|
445
|
// 7. 写入 store_product 表
|
|
441
|
446
|
$productData = [
|