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
012e9ec9
authored
Sep 05, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复文章缩略图
parent
29992d45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
4 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Services/DealImageService.php
app/Http/routes.php
app/Console/Commands/SetSupplierFollowUp.php
View file @
012e9ec9
...
...
@@ -33,7 +33,8 @@ class SetSupplierFollowUp extends Command
public
function
handle
()
{
//DealImageService::dealNewsImage();
DealImageService
::
dealNewsImage
();
//
DealImageService::dealNewsImage();
//DealImageService::dealSkuDetailAndImage();
DealImageService
::
dealNewsPic
();
}
}
app/Http/Services/DealImageService.php
View file @
012e9ec9
...
...
@@ -113,6 +113,32 @@ class DealImageService
}
}
//处理新闻的缩略图
public
static
function
dealNewsPic
()
{
$newsList
=
DB
::
connection
(
'liexin'
)
->
table
(
'article'
)
->
orderBy
(
'art_id'
,
'desc'
)
->
limit
(
20
)
->
get
();
$redis
=
new
RedisModel
();
foreach
(
$newsList
as
$news
)
{
$imageUrl
=
self
::
checkImage
(
$news
[
'litpic'
]);
if
(
empty
(
$imageUrl
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'pic_news_backup_xian'
,
$news
[
'art_id'
]))
{
$redis
->
hset
(
'pic_news_backup_xian'
,
$news
[
'art_id'
],
$news
[
'litpic'
]);
}
$imageMap
=
self
::
downloadAndUploadToPicServer
([
$imageUrl
]);
//进行全局替换
foreach
(
$imageMap
as
$originImage
=>
$newImage
)
{
$news
[
'litpic'
]
=
str_replace
(
$originImage
,
$newImage
,
$news
[
'litpic'
]);
}
dump
(
$news
[
'art_id'
]);
//回写到数据库
DB
::
connection
(
'liexin'
)
->
table
(
'article'
)
->
where
(
'art_id'
,
$news
[
'art_id'
])
->
update
([
'litpic'
=>
$news
[
'litpic'
]
]);
}
}
//处理sku详细描述
public
static
function
dealSkuDetailAndImage
()
{
...
...
@@ -175,7 +201,7 @@ class DealImageService
if
(
empty
(
$imageUrl
))
{
continue
;
}
if
(
!
$redis
->
hget
(
'image_
sku_detail
_backup_xian'
,
$skuId
))
{
if
(
!
$redis
->
hget
(
'image_
goods
_backup_xian'
,
$skuId
))
{
$redis
->
hset
(
'image_goods_backup_xian'
,
$skuId
,
$skuDBData
[
'goods_images'
]);
}
...
...
@@ -204,7 +230,7 @@ class DealImageService
public
static
function
getSearchDomain
()
{
$host
=
request
()
->
getHost
();
if
(
strpos
(
$host
,
'ichunt.
com
'
)
!==
false
)
{
if
(
strpos
(
$host
,
'ichunt.
net
'
)
!==
false
)
{
return
'https://icso.ichunt.com'
;
}
else
{
return
'http://search.liexindev.net'
;
...
...
app/Http/routes.php
View file @
012e9ec9
...
...
@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
\App\Http\Services\DealImageService
::
dealNews
Image
();
\App\Http\Services\DealImageService
::
dealNews
Pic
();
//\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