|
|
@@ -88,6 +88,9 @@ class Take
|
|
88
|
88
|
];
|
|
89
|
89
|
$this->add($seveData);
|
|
90
|
90
|
$goods_id_list[] = $goodsInfo['spu_id'];
|
|
|
91
|
+
|
|
|
92
|
+
|
|
|
93
|
+ $this->updata_product_img($goodsInfo['spu_id']);
|
|
91
|
94
|
}
|
|
92
|
95
|
|
|
93
|
96
|
$goodsIds = array_diff($spu_id_list, $goods_id_list);
|
|
|
@@ -101,6 +104,43 @@ class Take
|
|
101
|
104
|
}
|
|
102
|
105
|
}
|
|
103
|
106
|
|
|
|
107
|
+ public function updata_product_img($spu_id){
|
|
|
108
|
+ $product_id = Db::name('store_product')->where('spu_id',$spu_id)->value('product_id');
|
|
|
109
|
+ if(!$product_id) return true;
|
|
|
110
|
+
|
|
|
111
|
+ $data = Db::name('douhuomall')->where('spu_id',$spu_id)->find();
|
|
|
112
|
+
|
|
|
113
|
+ //商品主图
|
|
|
114
|
+ $spuId_info=json_decode($data['spuId_info'],true);
|
|
|
115
|
+ $slider_image=$spuId_info['detail_img_list']??'';
|
|
|
116
|
+ $image=$spuId_info['cover_url']??'';
|
|
|
117
|
+ try {
|
|
|
118
|
+ $slider_image = implode(',',json_decode($slider_image,true));
|
|
|
119
|
+ }catch (\Exception $exception){
|
|
|
120
|
+ $slider_image = $image;
|
|
|
121
|
+ }
|
|
|
122
|
+
|
|
|
123
|
+ //更新产品图片数据
|
|
|
124
|
+ $product_insert_data=[
|
|
|
125
|
+ 'image'=>$image,
|
|
|
126
|
+ 'slider_image'=>$slider_image,
|
|
|
127
|
+ ];
|
|
|
128
|
+ Db::name('store_product')->where('product_id',$product_id)->update($product_insert_data);
|
|
|
129
|
+ echo '更新产品图片数据成功'.json_encode($product_insert_data);
|
|
|
130
|
+ $detail = $spuId_info['detail'];
|
|
|
131
|
+ if(!is_null(json_decode($detail))){
|
|
|
132
|
+ $detail_list = json_decode($detail);
|
|
|
133
|
+ $detail = '';
|
|
|
134
|
+ foreach($detail_list as $value){
|
|
|
135
|
+ $detail .= '<img src="'.$value.'"></img>';
|
|
|
136
|
+ }
|
|
|
137
|
+ }
|
|
|
138
|
+ Db::name('store_product_content')->where('product_id',$product_id)->update(['content'=>$detail]);
|
|
|
139
|
+ return true;
|
|
|
140
|
+ }
|
|
|
141
|
+
|
|
|
142
|
+
|
|
|
143
|
+
|
|
104
|
144
|
public function seveImg($goods_id, $img_url, $targetDir)
|
|
105
|
145
|
{
|
|
106
|
146
|
if(!$img_url) return $img_url;
|
|
|
@@ -232,7 +272,7 @@ class Take
|
|
232
|
272
|
]);
|
|
233
|
273
|
// 删除商品管理对应的数据
|
|
234
|
274
|
Db::name('store_product')->whereIn('spu_id', $goodsIds)->update([
|
|
235
|
|
- 'is_del' => 1,
|
|
|
275
|
+ // 'is_del' => 1,
|
|
236
|
276
|
'is_show' => 0
|
|
237
|
277
|
]);
|
|
238
|
278
|
Db::commit();
|