|
|
@@ -167,7 +167,7 @@ class Take
|
|
167
|
167
|
foreach ($img_url as $value) {
|
|
168
|
168
|
$new_img_url[] = $this->seveImgUrl($goods_id, $value, $targetDir);
|
|
169
|
169
|
}
|
|
170
|
|
- }else{
|
|
|
170
|
+ }else{
|
|
171
|
171
|
$new_img_url = $this->seveImgUrl($goods_id, $img_url, $targetDir);
|
|
172
|
172
|
}
|
|
173
|
173
|
return $new_img_url;
|
|
|
@@ -178,17 +178,17 @@ class Take
|
|
178
|
178
|
// 目标路径(确保目录存在)
|
|
179
|
179
|
$targetDirTow = rand(1000, 10000). $this->upImgName(basename($remoteImageUrl));
|
|
180
|
180
|
$targetPath = $targetDir . $targetDirTow; // 使用basename获取文件名
|
|
181
|
|
-
|
|
|
181
|
+
|
|
182
|
182
|
// 检查目标目录是否存在,如果不存在则创建
|
|
183
|
183
|
if (!is_dir($targetDir)) {
|
|
184
|
184
|
mkdir($targetDir, 0777, true); // 第二个参数是权限,第三个参数是递归创建
|
|
185
|
185
|
}
|
|
186
|
186
|
|
|
187
|
187
|
ini_set("max_execution_time", 2);
|
|
188
|
|
-
|
|
|
188
|
+
|
|
189
|
189
|
// 获取远程图片内容
|
|
190
|
190
|
$imageContent = @file_get_contents($remoteImageUrl);
|
|
191
|
|
-
|
|
|
191
|
+
|
|
192
|
192
|
// 检查是否成功获取内容
|
|
193
|
193
|
if ($imageContent !== false) {
|
|
194
|
194
|
// 保存图片到指定路径
|
|
|
@@ -220,7 +220,7 @@ class Take
|
|
220
|
220
|
|
|
221
|
221
|
// 打开目录
|
|
222
|
222
|
$files = scandir($dir);
|
|
223
|
|
-
|
|
|
223
|
+
|
|
224
|
224
|
// 遍历目录中的所有文件
|
|
225
|
225
|
foreach ($files as $file) {
|
|
226
|
226
|
// 如果是文件(排除 . 和 ..)
|
|
|
@@ -238,7 +238,7 @@ class Take
|
|
238
|
238
|
|
|
239
|
239
|
public function add($data)
|
|
240
|
240
|
{
|
|
241
|
|
- $findData = Db::name('douhuomall')->field('id,spu_id,status')->where('spu_id', $data['spu_id'])->find();
|
|
|
241
|
+ $findData = Db::name('douhuomall')->where('spu_id', $data['spu_id'])->find();
|
|
242
|
242
|
try {
|
|
243
|
243
|
$data['create_time'] = date('Y-m-d H:i:s');
|
|
244
|
244
|
$data['update_time'] = date('Y-m-d H:i:s');
|
|
|
@@ -267,7 +267,7 @@ class Take
|
|
267
|
267
|
->where('is_status','=', 0)
|
|
268
|
268
|
->count();
|
|
269
|
269
|
if ($count) {
|
|
270
|
|
- Db::name('store_product')->whereIn('spu_id', $data['spu_id'])->update([
|
|
|
270
|
+ Db::name('store_product')->where('spu_id','=', $data['spu_id'])->update([
|
|
271
|
271
|
'is_show' => 1
|
|
272
|
272
|
]);
|
|
273
|
273
|
}
|
|
|
@@ -296,7 +296,7 @@ class Take
|
|
296
|
296
|
return false;
|
|
297
|
297
|
}
|
|
298
|
298
|
}
|
|
299
|
|
-
|
|
|
299
|
+
|
|
300
|
300
|
|
|
301
|
301
|
public function remove($goodsIds)
|
|
302
|
302
|
{
|