Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
2b6ee36c
Commit
2b6ee36c
authored
Dec 07, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取360最低价
parent
7a1427b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
42 deletions
+64
-42
center-channel/app/base/api/impl/action/product.js
+4
-0
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
+60
-42
No files found.
center-channel/app/base/api/impl/action/product.js
View file @
2b6ee36c
...
@@ -5,6 +5,7 @@ class ProductAPI extends WEBBase {
...
@@ -5,6 +5,7 @@ class ProductAPI extends WEBBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
utilsProductSve
=
system
.
getObject
(
"service.utilsSve.utilsProductSve"
);
this
.
utilsProductSve
=
system
.
getObject
(
"service.utilsSve.utilsProductSve"
);
this
.
utils360Sve
=
system
.
getObject
(
"service.utilsSve.utils360Sve"
);
}
}
/**
/**
* 接口跳转-POST请求
* 接口跳转-POST请求
...
@@ -43,6 +44,9 @@ class ProductAPI extends WEBBase {
...
@@ -43,6 +44,9 @@ class ProductAPI extends WEBBase {
// case "updateProductPrice":
// case "updateProductPrice":
// opResult = await this.utilsProductSve.updateProductPrice(pobj,pobj.actionBody);
// opResult = await this.utilsProductSve.updateProductPrice(pobj,pobj.actionBody);
// break;
// break;
case
"getGoodsLowestPrice"
:
opResult
=
await
this
.
utils360Sve
.
getGoodsLowestPrice
(
pobj
.
actionBody
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
View file @
2b6ee36c
...
@@ -3,7 +3,7 @@ var settings = require("../../../../config/settings");
...
@@ -3,7 +3,7 @@ var settings = require("../../../../config/settings");
const
AppServiceBase
=
require
(
"../../app.base"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
md5
=
require
(
'md5'
)
const
md5
=
require
(
'md5'
)
//
阿里支付类
//
360 接口
class
utils360Sve
extends
AppServiceBase
{
class
utils360Sve
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
...
@@ -13,45 +13,45 @@ class utils360Sve extends AppServiceBase {
...
@@ -13,45 +13,45 @@ class utils360Sve extends AppServiceBase {
}
}
//组合参数,由前端传到360
//组合参数,由前端传到360
async
getParamsFor360
(
pobj
,
actionBody
)
{
async
getParamsFor360
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
}
pobj
.
actionType
=
"getPayOrderInfo"
;
pobj
.
actionType
=
"getPayOrderInfo"
;
let
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
let
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
let
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
let
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
orderResult
.
status
!=
0
)
{
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
return
orderResult
;
}
}
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
var
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
var
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
deliveryResult
.
status
!=
0
)
{
if
(
deliveryResult
.
status
!=
0
)
{
return
deliveryResult
;
return
deliveryResult
;
}
}
let
sku_id
=
orderResult
.
data
.
orderProduct
.
itemCode
;
let
sku_id
=
orderResult
.
data
.
orderProduct
.
itemCode
;
let
price
=
Number
(
orderResult
.
data
.
orderProduct
.
price
)
*
100
;
let
price
=
Number
(
orderResult
.
data
.
orderProduct
.
price
)
*
100
;
let
quantity
=
orderResult
.
data
.
orderProduct
.
quantity
;
let
quantity
=
orderResult
.
data
.
orderProduct
.
quantity
;
let
amount
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
let
amount
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
let
order_id
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
let
order_id
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
let
consignee
=
deliveryResult
.
data
.
orderContact
.
contactName
;
let
consignee
=
deliveryResult
.
data
.
orderContact
.
contactName
;
let
mobile
=
deliveryResult
.
data
.
orderContact
.
mobile
;
let
mobile
=
deliveryResult
.
data
.
orderContact
.
mobile
;
let
email
=
deliveryResult
.
data
.
orderContact
.
email
;
let
email
=
deliveryResult
.
data
.
orderContact
.
email
;
let
singStr
=
sku_id
+
quantity
+
price
+
amount
+
order_id
+
pobj
.
appInfo
.
uapp_secret
;
let
singStr
=
sku_id
+
quantity
+
price
+
amount
+
order_id
+
pobj
.
appInfo
.
uapp_secret
;
let
sign
=
md5
(
singStr
).
toUpperCase
();
let
sign
=
md5
(
singStr
).
toUpperCase
();
let
result
=
{
let
result
=
{
sku_id
,
sku_id
,
price
,
price
,
quantity
,
quantity
,
amount
,
amount
,
order_id
,
order_id
,
consignee
,
consignee
,
mobile
,
mobile
,
email
,
email
,
sign
sign
}
return
system
.
getResult
(
result
);
}
}
return
system
.
getResult
(
result
);
}
//更新订单状态到360
//更新订单状态到360
async
pushOrderStatus
(
pobj
)
{
async
pushOrderStatus
(
pobj
)
{
...
@@ -62,17 +62,17 @@ class utils360Sve extends AppServiceBase {
...
@@ -62,17 +62,17 @@ class utils360Sve extends AppServiceBase {
// }
// }
// var interface_params_info = verifyResult.data;
// var interface_params_info = verifyResult.data;
let
token
=
await
this
.
utilsAuthSve
.
get360Token
();
let
token
=
await
this
.
utilsAuthSve
.
get360Token
();
let
url
=
settings
.
pushUrl360
()
+
'api/v1/eshop/GsbOrderUpdate?token='
+
token
.
access_token
;
let
url
=
settings
.
pushUrl360
()
+
'api/v1/eshop/GsbOrderUpdate?token='
+
token
.
access_token
;
let
order_id
=
pobj
.
actionBody
.
orderNo
;
let
order_id
=
pobj
.
actionBody
.
orderNo
;
let
ApplicationStatus
=
pobj
.
pushObj
.
ApplicationStatus
;
let
ApplicationStatus
=
pobj
.
pushObj
.
ApplicationStatus
;
let
status
=
30
;
let
status
=
30
;
if
(
Number
(
ApplicationStatus
)
>
510
)
{
if
(
Number
(
ApplicationStatus
)
>
510
)
{
status
=
40
;
status
=
40
;
}
}
let
pushObj
=
{
let
pushObj
=
{
order_id
,
order_id
,
status
,
status
,
sub_status
:
ApplicationStatus
sub_status
:
ApplicationStatus
}
}
let
result
=
await
this
.
restPostUrl
(
pushObj
,
url
);
let
result
=
await
this
.
restPostUrl
(
pushObj
,
url
);
if
(
result
.
code
==
200
)
{
if
(
result
.
code
==
200
)
{
...
@@ -124,6 +124,24 @@ class utils360Sve extends AppServiceBase {
...
@@ -124,6 +124,24 @@ class utils360Sve extends AppServiceBase {
return
verify
;
return
verify
;
}
}
//获取360最低价格
async
getGoodsLowestPrice
(
actionBody
)
{
if
(
!
actionBody
.
itemCode
)
{
return
system
.
getResultFail
(
-
1
,
'itemCode 不能为空!'
)
}
let
params
=
actionBody
.
itemCode
.
join
(
','
);
let
url
=
settings
.
requestUrl360
()
+
`/api/v1/eshop/GetGoodsLowestPrice?sku_ids=
${
params
}
`
;
let
rtn
=
await
this
.
restClient
.
execGet
(
""
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restGet data is empty"
);
}
let
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
code
!=
200
){
return
system
.
getResultFail
(
-
1
,
result
.
msg
)
}
return
system
.
getResultSuccess
(
result
.
data
);
}
}
}
module
.
exports
=
utils360Sve
;
module
.
exports
=
utils360Sve
;
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