Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c82a7549
authored
Sep 03, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
恢复批量处理
parent
524b055f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
app/Http/Services/DealImageService.php
app/Http/Services/DealImageService.php
View file @
c82a7549
...
...
@@ -126,29 +126,29 @@ class DealImageService
if
(
empty
(
$itemList
[
'data'
][
'goods_id'
]))
{
continue
;
}
//
foreach ($itemList['data']['goods_id'] as $skuId) {
//
$skuDetail = DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->first();
//
$detail = $skuDetail['detail'];
//
if (empty($detail)) {
//
continue;
//
}
//
//替换图片地址并且上传
//
$imageUrls = self::getAllImage($detail);
//
if (empty($imageUrls)) {
//
continue;
//
}
//
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
//
$imageMap = self::downloadAndUploadToPicServer($imageUrls);
//
//进行全局替换
//
foreach ($imageMap as $originImage => $newImage) {
//
$detail = str_replace($originImage, $newImage, $detail);
//
}
//
//回写到mongo
//
DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->update([
//
'update_time' => time(),
//
'detail' => $detail,
//
]);
//
}
foreach
(
$itemList
[
'data'
][
'goods_id'
]
as
$skuId
)
{
$skuDetail
=
DB
::
connection
(
'mongo'
)
->
table
(
'sku_detail'
)
->
where
(
'sku_id'
,
(
string
)
$skuId
)
->
first
();
$detail
=
$skuDetail
[
'detail'
];
if
(
empty
(
$detail
))
{
continue
;
}
//替换图片地址并且上传
$imageUrls
=
self
::
getAllImage
(
$detail
);
if
(
empty
(
$imageUrls
))
{
continue
;
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap
=
self
::
downloadAndUploadToPicServer
(
$imageUrls
);
//进行全局替换
foreach
(
$imageMap
as
$originImage
=>
$newImage
)
{
$detail
=
str_replace
(
$originImage
,
$newImage
,
$detail
);
}
//回写到mongo
DB
::
connection
(
'mongo'
)
->
table
(
'sku_detail'
)
->
where
(
'sku_id'
,
(
string
)
$skuId
)
->
update
([
'update_time'
=>
time
(),
'detail'
=>
$detail
,
]);
}
//break;
foreach
(
$itemList
[
'data'
][
'goods_id'
]
as
$skuId
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment