Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
044ea405
Commit
044ea405
authored
Oct 23, 2024
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新提交
parent
bbb50c62
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
302 additions
and
60 deletions
+302
-60
server/app/Services/ThirdPlatform/Api/WuxiApiNewService.php
server/app/Services/ThirdPlatform/Api/WuxiApiNewService.php
+295
-0
server/app/Services/ThirdPlatform/WuxiLabNewService.php
server/app/Services/ThirdPlatform/WuxiLabNewService.php
+7
-60
No files found.
server/app/Services/ThirdPlatform/Api/WuxiApiNewService.php
0 → 100644
View file @
044ea405
This diff is collapsed.
Click to expand it.
server/app/Services/ThirdPlatform/WuxiLabNewService.php
View file @
044ea405
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Services\ThirdPlatform
;
use
App\ImportExport\WuxiLab\WuxiLabExport
;
use
App\Repositories\Contracts\ThirdApiPlatformRepository
;
use
App\Rhawn\Services\RhawnProductService
;
use
App\Services\ThirdPlatform\Api\WuxiApiService
;
use
App\Services\ThirdPlatform\Api\WuxiApi
New
Service
;
use
App\Support\Facades\SimpleLogs
;
class
WuxiLabNewService
...
...
@@ -22,7 +13,7 @@ class WuxiLabNewService
public
function
__construct
()
{
$this
->
apiService
=
(
new
WuxiApiService
(
app
(
ThirdApiPlatformRepository
::
class
)));
$this
->
apiService
=
(
new
WuxiApi
New
Service
(
app
(
ThirdApiPlatformRepository
::
class
)));
$this
->
rhawnChemicalsService
=
app
(
RhawnProductService
::
class
);
}
...
...
@@ -67,7 +58,7 @@ class WuxiLabNewService
$this
->
apiService
->
pushQueue
([
'params'
=>
[
'rawList'
=>
$rawList
,
'packageList'
=>
$newPackages
],
'consumer'
=>
__CLASS__
,
'method'
=>
'batchUpdateTo
WuxiLab
'
'method'
=>
'batchUpdateTo'
],
'wuxilab'
);
}
...
...
@@ -122,50 +113,6 @@ class WuxiLabNewService
}
}
public
function
test
(
$rawCode
)
{
try
{
$rawsList
=
$this
->
rhawnChemicalsService
->
getChemicalRawThroughtCode
(
$rawCode
);
if
(
$rawsList
){
foreach
(
$rawsList
as
$raw
)
{
$rawIdList
[]
=
$raw
[
'r_id'
];
}
$packages
=
$this
->
rhawnChemicalsService
->
getChemicalPackage
(
$rawIdList
);
$newPackages
=
[];
if
(
$packages
){
foreach
(
$packages
as
$pack
){
$newPackages
[
$pack
[
'r_code'
]]
=
$pack
;
}
}
/*$path = app(WuxiLabExport::class)->saveExcel(
['rawList' => $rawsList,'packageList' => $newPackages],
'package'
);
if($path){
list($file,$expend) = explode('.',$path);
$newPath = $file.'.'.strtolower($expend);
$cmd = 'mv '.storage_path('app/'.$path).' '.storage_path('app/'.$newPath);
trim(shell_exec("$cmd 2>&1"));
$filePathList = explode('/',$file);
$fileName = $filePathList[count($filePathList) - 1];
$result = $this->apiService->pushBatchUploadFile('package',$fileName, $this->apiService->backgroundLogin());
if($result){
$cmd = 'rm -rf '.storage_path('app/'.$newPath);
trim(shell_exec("$cmd 2>&1"));
SimpleLogs::writeLog('文件名为:'.$fileName.'路径:'.$newPath.'药明康德后台上传完成', __CLASS__.':processNotExistProductsUpdate');
}
}*/
$result
=
$this
->
apiService
->
pushBatchUpdateProduct
([
'rawList'
=>
$rawsList
,
'packageList'
=>
$newPackages
]);
var_dump
(
$result
);
}
}
catch
(
\Throwable
$exception
){
var_dump
(
$exception
->
getMessage
());
SimpleLogs
::
writeLog
(
$exception
->
getMessage
(),
__CLASS__
.
':processNotExistProductsUpdate'
,
'error'
);
}
}
/**
* 批量更新新的商品
*/
...
...
@@ -399,19 +346,19 @@ class WuxiLabNewService
* @批量更新商品
* @param $updateData
*/
public
function
batchUpdateTo
WuxiLab
(
$updateData
)
public
function
batchUpdateTo
(
$updateData
)
{
if
(
!
isset
(
$updateData
[
'rawList'
])
||
empty
(
$updateData
[
'rawList'
])){
if
(
empty
(
$updateData
[
'rawList'
])){
return
false
;
}
if
(
!
isset
(
$updateData
[
'packageList'
])
||
empty
(
$updateData
[
'packageList'
])){
if
(
empty
(
$updateData
[
'packageList'
])){
return
false
;
}
try
{
$result
=
$this
->
apiService
->
pushBatchUpdateProduct
(
$updateData
);
if
(
$result
){
//处理更新不成功的商品
if
(
isset
(
$result
[
'errorProduct'
])
&&
!
empty
(
$result
[
'errorProduct'
])){
if
(
!
empty
(
$result
[
'errorProduct'
])){
$storeEntries
=
$this
->
apiService
->
getPlatformDataEntries
(
'wuxiLab_not_exist_products'
,
'data_values'
);
if
(
isset
(
$storeEntries
)
&&
!
empty
(
$storeEntries
)){
if
(
count
(
$storeEntries
[
'products'
])
>=
$this
->
apiService
->
getPlatformInfo
(
'platform_params'
)[
'excelCreateLimit'
]){
...
...
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