Ver código fonte

refactor(product): 重构产品价格更新命令中的数据结构

- 移除注释掉的代码块
- 重新排列更新数组中的字段顺序
- 添加 image、slider_image、store_name 等新字段到更新数据中
- 保留原有的 attr 和 attrValue 字段配置
- 整理字段顺序以提高代码可读性
shichen 4 meses atrás
pai
commit
ba2a594a5c
1 arquivos alterados com 31 adições e 20 exclusões
  1. 31 20
      app/command/ProductPriceUpdate.php

+ 31 - 20
app/command/ProductPriceUpdate.php

@@ -54,36 +54,47 @@ class ProductPriceUpdate extends Command
54 54
             $attrValue[0]['price'] = $attrValue[0]['price'] + self::NUMBER;
55 55
             $content = Db::name('store_product_content')->where(['product_id' => $product['product_id']])->field('content')->find();
56 56
 
57
+            // $update = [
58
+            //
59
+            //     'couponData' => [],
60
+            //
61
+            //     'is_gift_bag' => $product['is_gift_bag'],
62
+            // ];
63
+
64
+
65
+
57 66
             $update = [
58
-                'attr' => [],
59
-                'attrValue' => $attrValue,
67
+                'image' => $product['image'],
68
+                'slider_image' => explode(',',$product['slider_image']),
69
+                'store_name' => $product['store_name'],
70
+                'store_info' => $product['store_info'],
71
+                'keyword' => $product['keyword'],
72
+                'bar_code' => 0,
60 73
                 'brand_id' => $product['brand_id'],
61 74
                 'cate_id' => $product['cate_id'],
62
-                'commission' => $product['commission'],
75
+                'mer_cate_id' => [],
76
+                'unit_name' => $product['unit_name'],
77
+                'sort' => $product['sort'],
78
+                'is_good' => $product['is_good'],
79
+                'video_link' => '',
80
+                'temp_id' => $product['temp_id'],
63 81
                 'content' => $content['content'],
64
-                'couponData' => [],
82
+                'spec_type' => $product['spec_type'],
65 83
                 'extension_type' => $product['extension_type'],
66
-                'ficti' => $product['ficti'],
84
+                'attr' => [],
85
+                'attrValue' => $attrValue,
67 86
                 'give_coupon_ids' => [],
68
-                'icon_type' => [],
69
-                'image' => $product['image'],
70
-                'is_gift_bag' => $product['is_gift_bag'],
71
-                'is_good' => $product['is_good'],
72
-                'keyword' => $product['keyword'],
73
-                'mer_cate_id' => [],
87
+                'volunteer' => $product['volunteer'],
88
+                'type' => $product['type'],
74 89
                 'pension' => $product['pension'],
90
+                'commission' => $product['commission'],
75 91
                 'pension_is' => $product['pension_is'],
76 92
                 'share_is' => $product['share_is'],
77
-                'slider_image' => explode(',',$product['slider_image']),
78
-                'sort' => $product['sort'],
79
-                'spec_type' => $product['spec_type'],
80
-                'store_info' => $product['store_info'],
81
-                'store_name' => $product['store_name'],
82
-                'temp_id' => $product['temp_id'],
83
-                'type' => $product['type'],
84
-                'unit_name' => $product['unit_name'],
85
-                'volunteer' => $product['volunteer']
93
+                'ficti' => $product['ficti'],
94
+                'icon_type' => [],
95
+                'status' => $product['status']
86 96
             ];
97
+
87 98
             $repository->update($product['product_id'],$update,self::MER_ID);
88 99
             Db::name('product_share')->where('product_id',$product['product_id'])->where('share_channel',1)->update(['url'=>'']);
89 100
         }