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
ddb60cb1
authored
Sep 04, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
备份数据
parent
c82a7549
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Services/DealImageService.php
app/Http/routes.php
app/Console/Commands/SetSupplierFollowUp.php
View file @
ddb60cb1
...
...
@@ -3,6 +3,7 @@
namespace
App\Console\Commands
;
use
App\Http\Services\DataService
;
use
App\Http\Services\DealImageService
;
use
App\Http\Services\StatisticsSkuUploadService
;
use
Illuminate\Console\Command
;
use
Illuminate\Foundation\Inspiring
;
...
...
@@ -31,9 +32,8 @@ class SetSupplierFollowUp extends Command
*/
public
function
handle
()
{
$service
=
new
DataService
();
$service
->
exportSupplierDataForLevel
();
//$uploadService = new StatisticsSkuUploadService();
//$uploadService->statisticBrandSkuNum();
//DealImageService::dealNewsImage();
DealImageService
::
dealCmsImage
();
//DealImageService::dealSkuDetailAndImage();
}
}
app/Http/Services/DealImageService.php
View file @
ddb60cb1
...
...
@@ -43,6 +43,7 @@ class DealImageService
public
static
function
dealNewsImage
()
{
$newsList
=
DB
::
connection
(
'liexin'
)
->
table
(
'article'
)
->
where
(
'deal_status'
,
'!='
,
1
)
->
orderBy
(
'art_id'
,
'desc'
)
->
limit
(
100
)
->
get
();
$redis
=
new
RedisModel
();
foreach
(
$newsList
as
$news
)
{
$addon
=
DB
::
connection
(
'liexin'
)
->
table
(
'article_addon'
)
->
where
(
'art_id'
,
$news
[
'art_id'
])
->
first
();
if
(
empty
(
$addon
))
{
...
...
@@ -58,6 +59,9 @@ class DealImageService
if
(
empty
(
$imageUrls
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'image_news_backup_xian'
,
$news
[
'art_id'
]))
{
$redis
->
hset
(
'image_news_backup_xian'
,
$news
[
'art_id'
],
$news
[
'body'
]);
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap
=
self
::
downloadAndUploadToPicServer
(
$imageUrls
);
...
...
@@ -75,7 +79,7 @@ class DealImageService
]);
dump
(
$news
[
'art_id'
]);
dump
(
'处理文章id : '
.
$news
[
'art_id'
]);
}
}
...
...
@@ -83,6 +87,7 @@ class DealImageService
//处理cms的图片链接
public
static
function
dealCmsImage
()
{
$redis
=
new
RedisModel
();
//先去找出所有带有图片的cms数据
$bcatIdList
=
DB
::
connection
(
'mysql'
)
->
table
(
'lie_base_cat'
)
->
where
(
'bcat_name'
,
'like'
,
"%爱智%"
)
->
pluck
(
'bcat_id'
);
$baseList
=
DB
::
connection
(
'mysql'
)
->
table
(
'lie_base'
)
->
whereIn
(
'bcat_id'
,
$bcatIdList
)
->
where
(
'images'
,
'!='
,
''
)
->
limit
(
1000
)
->
get
();
...
...
@@ -91,6 +96,9 @@ class DealImageService
if
(
empty
(
$imageUrl
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'image_cms_backup_xian'
,
$base
[
'base_id'
]))
{
$redis
->
hset
(
'image_cms_backup_xian'
,
$base
[
'base_id'
],
$base
[
'images'
]);
}
$imageMap
=
self
::
downloadAndUploadToPicServer
([
$imageUrl
]);
//进行全局替换
foreach
(
$imageMap
as
$originImage
=>
$newImage
)
{
...
...
@@ -137,6 +145,9 @@ class DealImageService
if
(
empty
(
$imageUrls
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'image_sku_detail_backup_xian'
,
$skuId
))
{
$redis
->
hset
(
'image_sku_detail_backup_xian'
,
$skuId
,
$detail
);
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap
=
self
::
downloadAndUploadToPicServer
(
$imageUrls
);
//进行全局替换
...
...
@@ -162,6 +173,11 @@ class DealImageService
if
(
empty
(
$imageUrl
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'image_sku_detail_backup_xian'
,
$skuId
))
{
$redis
->
hset
(
'image_goods_backup_xian'
,
$skuId
,
$skuDBData
[
'goods_images'
]);
}
$imageMap
=
self
::
downloadAndUploadToPicServer
([
$imageUrl
]);
//进行全局替换
foreach
(
$imageMap
as
$originImage
=>
$newImage
)
{
...
...
@@ -187,13 +203,13 @@ class DealImageService
{
$host
=
request
()
->
getHost
();
if
(
strpos
(
$host
,
'ichunt.com'
)
!==
false
)
{
return
'https://icso.ichunt.com
/search/es/searchSku
'
;
return
'https://icso.ichunt.com'
;
}
else
{
return
'http://search.liexindev.net'
;
}
}
p
rivate
static
function
searchIedgeSku
(
$page
=
1
)
p
ublic
static
function
searchIedgeSku
(
$page
=
1
)
{
$url
=
self
::
getSearchDomain
()
.
'/search/es/searchSku'
;
$map
[
'p'
]
=
$page
;
...
...
app/Http/routes.php
View file @
ddb60cb1
...
...
@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
\App\Http\Services\DealImageService
::
deal
SkuDetailAnd
Image
();
\App\Http\Services\DealImageService
::
deal
Cms
Image
();
//\App\Http\Services\SupplierAddressService::initUnitedAddress();
//\App\Http\Services\DataService::checkSupplierBandAccount();
//(new CompanyService())->checkSupplierCompanyAndAddress(11042);
...
...
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