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
f4ff2838
authored
Sep 02, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
暂存
parent
c4c3a2c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
6 deletions
app/Http/Services/DealImageService.php
app/Http/routes.php
config/database.php
app/Http/Services/DealImageService.php
View file @
f4ff2838
...
...
@@ -6,6 +6,7 @@ namespace App\Http\Services;
//后台用户相关信息服务
use
App\Model\SupplierBlacklistModel
;
use
App\Model\SupplierChannelModel
;
use
http\Exception\InvalidArgumentException
;
use
Illuminate\Support\Facades\DB
;
//处理多个系统的图片替换问题
...
...
@@ -114,9 +115,9 @@ 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
();
dd
(
$skuDetail
);
$detail
=
$skuDetail
[
'detail'
];
if
(
empty
(
$detail
))
{
continue
;
...
...
@@ -149,9 +150,19 @@ class DealImageService
}
public
static
function
getSearchDomain
()
{
$host
=
request
()
->
getHost
();
if
(
strpos
(
$host
,
'ichunt.com'
)
!==
false
)
{
return
'https://icso.ichunt.com/search/es/searchSku'
;
}
else
{
return
'http://search.liexindev.net'
;
}
}
private
static
function
searchIedgeSku
(
$page
=
1
)
{
$url
=
config
(
'website.search_domain_new'
)
.
'/search/es/searchSku'
;
$url
=
self
::
getSearchDomain
(
)
.
'/search/es/searchSku'
;
$map
[
'p'
]
=
$page
;
$map
[
'show_status'
]
=
1
;
...
...
@@ -161,10 +172,28 @@ class DealImageService
$map
[
'admin'
]
=
1
;
// 后台搜索
$map
[
'no_rule'
]
=
"1122"
;
// 后台搜索
$map
[
'org_id/eq'
]
=
3
;
$res
=
Http
::
get
(
$url
,
$map
)
->
body
();
$data
=
json_decode
(
$res
,
true
);
$client
=
new
\GuzzleHttp\Client
();
//$res = Http::get($url, $map)->body();
//$data = json_decode($res, true);
$response
=
$client
->
request
(
'POST'
,
$url
,
[
'form_params'
=>
$map
]);
if
(
$response
->
getStatusCode
()
!=
200
)
{
throw
new
InvalidArgumentException
(
'搜索服务不正常!'
);
}
$content
=
$response
->
getBody
()
->
getContents
();
$content
=
json_decode
(
$content
,
true
);
$code
=
array_get
(
$content
,
'error_code'
,
-
1
);
if
(
$code
!==
0
)
{
return
[];
}
return
$
data
;
return
$
content
;
}
//根据url下载图片并且上传到图片服务
...
...
app/Http/routes.php
View file @
f4ff2838
...
...
@@ -84,7 +84,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
\App\Http\Services\DealImageService
::
deal
CmsImage
();
\App\Http\Services\DealImageService
::
deal
SkuDetail
();
//\App\Http\Services\SupplierAddressService::initUnitedAddress();
//\App\Http\Services\DataService::checkSupplierBandAccount();
//(new CompanyService())->checkSupplierCompanyAndAddress(11042);
...
...
config/database.php
View file @
f4ff2838
...
...
@@ -356,6 +356,18 @@ return [
'prefix'
=>
'lie_'
,
'strict'
=>
false
,
],
'mongo'
=>
[
'driver'
=>
'mongodb'
,
'host'
=>
env
(
'MONGO_HOST'
),
'port'
=>
27017
,
'username'
=>
env
(
'MONGO_USERNAME'
),
'password'
=>
env
(
'MONGO_PASSWORD'
),
'database'
=>
env
(
'MONGO_DB_SELF_SIMILAR_DATABASE'
),
'options'
=>
[
'database'
=>
env
(
'MONGO_DB_SELF_SIMILAR_DATABASE'
),
//不加导致auth fail
]
],
'rabbitmq'
=>
[
'driver'
=>
'rabbitmq'
,
'host'
=>
env
(
'RABBITMQ_HOST'
,
'127.0.0.1'
),
...
...
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