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
04a284ba
Commit
04a284ba
authored
Aug 29, 2022
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openapi 震坤行
parent
4cfaac69
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
20 deletions
+92
-20
server/app/Repositories/Eloquent/PlatformDataEntriesRepositoryEloquent.php
...tories/Eloquent/PlatformDataEntriesRepositoryEloquent.php
+8
-0
server/app/Services/PlatformDataEntriesService.php
server/app/Services/PlatformDataEntriesService.php
+5
-0
server/app/Services/ThirdPlatform/Api/ZhenkhApiService.php
server/app/Services/ThirdPlatform/Api/ZhenkhApiService.php
+4
-0
server/app/Services/ThirdPlatform/PlatformAbstractService.php
...er/app/Services/ThirdPlatform/PlatformAbstractService.php
+5
-0
server/app/Services/ZhenKhService.php
server/app/Services/ZhenKhService.php
+70
-20
No files found.
server/app/Repositories/Eloquent/PlatformDataEntriesRepositoryEloquent.php
View file @
04a284ba
...
...
@@ -47,4 +47,12 @@ class PlatformDataEntriesRepositoryEloquent extends BaseRepository implements Pl
],
$entries
);
}
public
function
removeEntries
(
$platformId
,
$key
)
{
return
$this
->
deleteWhere
([
'platform_id'
=>
$platformId
,
'data_key'
=>
$key
]);
}
}
server/app/Services/PlatformDataEntriesService.php
View file @
04a284ba
...
...
@@ -34,4 +34,9 @@ class PlatformDataEntriesService
{
return
$this
->
entiresRepository
->
getEntriesValues
(
$platformId
,
$key
);
}
public
function
removeEntriesValues
(
$platformId
,
$key
)
{
return
$this
->
entiresRepository
->
removeEntries
(
$platformId
,
$key
);
}
}
server/app/Services/ThirdPlatform/Api/ZhenkhApiService.php
View file @
04a284ba
...
...
@@ -350,6 +350,10 @@ class ZhenkhApiService extends PlatformAbstractService
if
(
$decodeResponse
){
if
(
$decodeResponse
[
'code'
]
==
'200'
&&
$decodeResponse
[
'isSuccess'
]
==
true
){
return
$decodeResponse
[
'data'
]
==
NULL
?
true
:
$decodeResponse
;
}
elseif
(
$decodeResponse
[
'code'
]
==
'403'
&&
$decodeResponse
[
'msg'
]
==
'token 已经失效'
){
//删除当前token
$this
->
removePlatformDataEntries
(
'zkh_api_token'
);
return
[
'reset'
=>
true
];
}
}
return
false
;
...
...
server/app/Services/ThirdPlatform/PlatformAbstractService.php
View file @
04a284ba
...
...
@@ -109,4 +109,9 @@ abstract class PlatformAbstractService
{
return
$this
->
dataEntriesService
->
storeEntries
(
$this
->
getPlatformInfo
(
'id'
),
$dataKey
,
$dataValues
);
}
public
function
removePlatformDataEntries
(
$dataKey
)
{
return
$this
->
dataEntriesService
->
removeEntriesValues
(
$dataKey
);
}
}
server/app/Services/ZhenKhService.php
View file @
04a284ba
...
...
@@ -54,18 +54,28 @@ class ZhenKhService
try
{
$product
=
$this
->
rhawnService
->
getRawProductsThroughPid
(
$goods
[
'zg_r_pid'
]);
if
(
$product
){
$this
->
apiService
->
updateReportProductPrice
([
while
(
true
){
$result
=
$this
->
apiService
->
updateReportProductPrice
([
'price'
=>
round
(
bcmul
(
$product
->
p_price
,
0.5
,
2
),
1
),
'price_unit'
=>
$goods
[
'zg_unit'
],
'sku'
=>
$goods
[
'zg_sku'
]
],
$this
->
getToken
());
if
(
!
$result
[
'reset'
]
||
$result
[
'reset'
]
!=
true
){
break
;
}
}
$this
->
apiService
->
updateReportProductStock
([
while
(
true
){
$result
=
$this
->
apiService
->
updateReportProductStock
([
'warehouse'
=>
'上海货仓'
,
'address'
=>
[
'0'
=>
$goods
[
'zg_addr'
]],
'qty'
=>
$product
->
p_stock
,
'sku'
=>
$goods
[
'zg_sku'
]
],
$this
->
getToken
());
if
(
!
$result
[
'reset'
]
||
$result
[
'reset'
]
!=
true
){
break
;
}
}
}
$this
->
rhawnService
->
updateSyncRunTime
(
$goods
);
...
...
@@ -91,7 +101,12 @@ class ZhenKhService
$sendContent
=
[];
while
(
true
){
$pageSize
=
$this
->
apiService
->
getPlatformInfo
()[
'platform_params'
][
'page_size'
];
while
(
true
){
$goodsList
=
$this
->
apiService
->
getUpdateGoods
(
$page
,
$pageSize
,
$this
->
getToken
());
if
(
!
isset
(
$goodsList
[
'reset'
])
||
$goodsList
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$goodsList
&&
count
(
$goodsList
[
'list'
])
>
0
){
$sendContent
=
[
'params'
=>
[
'goods'
=>
$goodsList
[
'list'
]],
...
...
@@ -137,7 +152,12 @@ class ZhenKhService
$pageSize
=
$this
->
apiService
->
getPlatformInfo
()[
'platform_params'
][
'page_size'
];
$postParams
[
'page_size'
]
=
$pageSize
;
$postParams
[
'page_no'
]
=
$page
;
while
(
true
){
$orderList
=
$this
->
apiService
->
getUpdateOrders
(
$postParams
,
$this
->
getToken
());
if
(
!
isset
(
$orderList
[
'reset'
])
||
$orderList
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$orderList
&&
count
(
$orderList
[
'list'
])
>
0
){
foreach
(
$orderList
[
'list'
][
'data'
]
as
$order
){
if
(
$order
[
'orderStatus'
]
==
0
){
...
...
@@ -215,7 +235,12 @@ class ZhenKhService
$order
=
$params
[
'orders'
];
try
{
if
(
$order
[
'orderStatus'
]
==
0
){
while
(
true
){
$orderDetail
=
$this
->
apiService
->
getUpdateOrdersDetail
(
$order
[
'purchaseOrderId'
],
$this
->
getToken
());
if
(
!
isset
(
$orderDetail
[
'reset'
])
||
$orderDetail
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$orderDetail
){
$result
=
$this
->
rhawnOrderService
->
updateZhenkhOrders
(
$order
,
$orderDetail
);
}
...
...
@@ -242,7 +267,12 @@ class ZhenKhService
if
(
$orderDelivery
){
$expressArray
=
$this
->
apiService
->
getPlatformDataEntries
(
'zkh_order_express'
,
'data_values'
);
if
(
empty
(
$expressArray
)){
while
(
true
){
$expressList
=
$this
->
apiService
->
expressLogistics
(
$this
->
getToken
());
if
(
!
isset
(
$expressList
[
'reset'
])
||
$expressList
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$expressList
){
//$sysDefault = ['JD', 'SF', 'ZT', 'YD', 'ZJS', 'DBL', 'YTO', 'YZPY', 'AN', 'STO', 'HHTT', 'WL', 'ziti'];
foreach
(
$expressList
as
$express
){
...
...
@@ -265,7 +295,12 @@ class ZhenKhService
}
}
$orderNo
=
current
(
$orderDelivery
)
->
so_cus_po
;
while
(
true
){
$deliveryOrderDetail
=
$this
->
apiService
->
sendDeliveryOrder
(
$orderNo
,
$this
->
getToken
());
if
(
!
isset
(
$deliveryOrderDetail
[
'reset'
])
||
$deliveryOrderDetail
[
'reset'
]
!=
true
){
break
;
}
}
$deliveryDetail
=
[];
if
(
$deliveryOrderDetail
){
foreach
(
$deliveryOrderDetail
[
'lines'
]
as
$order
){
...
...
@@ -312,8 +347,13 @@ class ZhenKhService
}
}
$deliveryPost
[
'itemList'
]
=
$resetItemList
;
while
(
true
){
//确认发货
$deliveryResult
=
$this
->
apiService
->
ackDeliveryOrder
(
$deliveryPost
,
$this
->
getToken
());
if
(
!
isset
(
$deliveryResult
[
'reset'
])
||
$deliveryResult
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$deliveryResult
){
$this
->
apiService
->
storePlatformDataEntries
(
'zkh_delivery_code_'
.
$deliveryCode
,[
'code'
=>
$deliveryResult
[
'data'
]]);
}
...
...
@@ -338,7 +378,12 @@ class ZhenKhService
SimpleLogs
::
writeLog
(
$deliveryCode
.
'送货单无法匹配'
,
__CLASS__
.
':getDeliveryOrderPdf'
,
'error'
);
return
false
;
}
while
(
true
){
$deliveryInfo
=
$this
->
apiService
->
getDeliveryOrderDetailForPDF
(
$zkhDeliveryCode
[
'code'
][
'deliveryCode'
],
$this
->
getToken
());
if
(
!
isset
(
$result
[
'reset'
])
||
$result
[
'reset'
]
!=
true
){
break
;
}
}
if
(
$deliveryInfo
){
$this
->
apiService
->
storePlatformDataEntries
(
'zkh_order_delivery_pdf_'
.
$deliveryCode
,[
'pdf'
=>
$deliveryInfo
]);
return
$deliveryInfo
;
...
...
@@ -360,7 +405,12 @@ class ZhenKhService
try
{
$orderDetail
=
$this
->
rhawnOrderService
->
getSorderDetail
(
$orderNo
);
if
(
$orderDetail
){
return
$this
->
apiService
->
orderConfirm
(
current
(
$orderDetail
)[
'so_cus_po'
],
$this
->
getToken
());
while
(
true
){
$result
=
$this
->
apiService
->
orderConfirm
(
current
(
$orderDetail
)[
'so_cus_po'
],
$this
->
getToken
());
if
(
!
isset
(
$result
[
'reset'
])
||
$result
[
'reset'
]
!=
true
){
break
;
}
}
}
return
false
;
}
catch
(
\Throwable
$exception
){
...
...
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