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
e25ab601
Commit
e25ab601
authored
Jul 10, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加mobile字段
parent
b91f656f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
40 deletions
+41
-40
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
+41
-40
No files found.
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
View file @
e25ab601
...
@@ -32,17 +32,18 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -32,17 +32,18 @@ class UtilsUcommuneService extends AppServiceBase {
var
url
=
settings
.
ucommuneUrl
()
+
"third/getUserInfo"
;
// 调用优客工场接口 获取用户信息
var
url
=
settings
.
ucommuneUrl
()
+
"third/getUserInfo"
;
// 调用优客工场接口 获取用户信息
// 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用
// 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用
let
result
=
await
this
.
restPostWithHAuthorizationUrl
(
pobj
,
actionBody
.
userToken
,
url
);
let
result
=
await
this
.
restPostWithHAuthorizationUrl
(
pobj
,
actionBody
.
userToken
,
url
);
if
(
result
.
retCode
==
0
)
{
// 0成功 1失败
if
(
result
.
retCode
==
0
)
{
// 0成功 1失败
pobj
.
actionType
=
"getLoginByUserName"
;
pobj
.
actionType
=
"getLoginByUserName"
;
pobj
.
actionBody
.
channelUserId
=
result
.
data
.
nationalCode
+
"-"
+
result
.
data
.
mobile
;
// 即:86_18512345678
pobj
.
actionBody
.
channelUserId
=
result
.
data
.
nationalCode
+
"-"
+
result
.
data
.
mobile
;
// 即:86_18512345678
pobj
.
actionBody
.
userName
=
result
.
data
.
name
;
pobj
.
actionBody
.
userName
=
result
.
data
.
name
;
pobj
.
actionBody
.
mobile
:
result
.
data
.
mobile
;
pobj
.
actionBody
.
headUrl
=
result
.
data
.
headImg
;
pobj
.
actionBody
.
headUrl
=
result
.
data
.
headImg
;
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
return
tmpOpResult
;
return
tmpOpResult
;
}
}
return
system
.
getResultSuccess
({
userpin
:
tmpOpResult
.
data
.
userpin
?
tmpOpResult
.
data
.
userpin
:
pobj
.
actionBody
.
userpin
})
return
system
.
getResultSuccess
({
userpin
:
tmpOpResult
.
data
.
userpin
?
tmpOpResult
.
data
.
userpin
:
pobj
.
actionBody
.
userpin
})
}
else
{
}
else
{
// 获取用户信息失败
// 获取用户信息失败
return
system
.
getResult
(
null
,
result
);
return
system
.
getResult
(
null
,
result
);
...
@@ -85,23 +86,23 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -85,23 +86,23 @@ class UtilsUcommuneService extends AppServiceBase {
pobj
.
actionType
=
"getPayOrderInfo"
// 获取订单详细信息 用来拼接字符串 totalsum为总金额,返回给前端
pobj
.
actionType
=
"getPayOrderInfo"
// 获取订单详细信息 用来拼接字符串 totalsum为总金额,返回给前端
var
reqUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
var
reqUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
var
orderResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
orderResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
orderResult
.
status
!=
0
)
{
if
(
orderResult
.
status
!=
0
)
{
// return system.getResult(null, "Failed to get orderResult or order has been paid 100470");
// return system.getResult(null, "Failed to get orderResult or order has been paid 100470");
return
system
.
getResult
(
null
,
orderResult
);
return
system
.
getResult
(
null
,
orderResult
);
}
else
{
}
else
{
if
(
actionBody
.
payWay
==
1
)
{
// 支付宝
if
(
actionBody
.
payWay
==
1
)
{
// 支付宝
try
{
try
{
let
creatPayRequrl
=
"https://yf-api.gongsibao.com/pay/v1/aliPay/getPrePayIdAliPay"
;
let
creatPayRequrl
=
"https://yf-api.gongsibao.com/pay/v1/aliPay/getPrePayIdAliPay"
;
let
params
=
{
let
params
=
{
"app"
:
"ukgc"
,
//固定
"app"
:
"ukgc"
,
//固定
'body'
:
orderResult
.
data
.
orderProduct
.
channelItemName
,
'body'
:
orderResult
.
data
.
orderProduct
.
channelItemName
,
"key"
:
"a1519e2eab53dfb909e4c32a86b2ea2b"
,
//固定
"key"
:
"a1519e2eab53dfb909e4c32a86b2ea2b"
,
//固定
"notifyUrl"
:
this
.
centerChannelUrl
+
"orderNotify/aliPayNotify"
,
"notifyUrl"
:
this
.
centerChannelUrl
+
"orderNotify/aliPayNotify"
,
"outTradeNo"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
(),
"outTradeNo"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
(),
"productCode"
:
orderResult
.
data
.
orderProduct
.
channelItemCode
,
"productCode"
:
orderResult
.
data
.
orderProduct
.
channelItemCode
,
"subject"
:
orderResult
.
data
.
orderProduct
.
channelItemName
,
"subject"
:
orderResult
.
data
.
orderProduct
.
channelItemName
,
"timeoutExpress"
:
'10m'
,
"timeoutExpress"
:
'10m'
,
"totalAmount"
:
orderResult
.
data
.
receiptVoucher
.
totalSum
,
"totalAmount"
:
orderResult
.
data
.
receiptVoucher
.
totalSum
,
}
}
var
sign
=
JSON
.
stringify
(
params
);
var
sign
=
JSON
.
stringify
(
params
);
// sign += "ab53dfb909e4c32a"
// sign += "ab53dfb909e4c32a"
...
@@ -109,7 +110,7 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -109,7 +110,7 @@ class UtilsUcommuneService extends AppServiceBase {
sign
=
md5
(
sign
).
toUpperCase
()
sign
=
md5
(
sign
).
toUpperCase
()
params
.
sign
=
sign
params
.
sign
=
sign
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
return
system
.
getResultSuccess
(
res
.
data
)
return
system
.
getResultSuccess
(
res
.
data
)
}
}
...
@@ -213,7 +214,7 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -213,7 +214,7 @@ class UtilsUcommuneService extends AppServiceBase {
// let alipayResponse = await this.alipay.exec('alipay.trade.app.pay', params);
// let alipayResponse = await this.alipay.exec('alipay.trade.app.pay', params);
// console.log(alipayResponse);
// console.log(alipayResponse);
}
}
if
(
actionBody
.
payWay
==
3
)
{
// 微信
if
(
actionBody
.
payWay
==
3
)
{
// 微信
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
let
creatPayRequrl
=
"https://yf-api.gongsibao.com/pay/v1/createSign"
;
let
creatPayRequrl
=
"https://yf-api.gongsibao.com/pay/v1/createSign"
;
let
params
=
{
let
params
=
{
...
@@ -221,51 +222,51 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -221,51 +222,51 @@ class UtilsUcommuneService extends AppServiceBase {
"key"
:
"a1519e2eab53dfb909e4c32a86b2ea2b"
,
"key"
:
"a1519e2eab53dfb909e4c32a86b2ea2b"
,
"payParam"
:
[
"payParam"
:
[
{
{
"name"
:
"appid"
,
"name"
:
"appid"
,
// 后期修改
// 后期修改
// "value":"1"
// "value":"1"
"value"
:
"wx6f3ebe44defe336a"
"value"
:
"wx6f3ebe44defe336a"
},
},
{
{
"name"
:
"mch_id"
,
"name"
:
"mch_id"
,
// "value":"1"
// "value":"1"
"value"
:
"1232813602"
"value"
:
"1232813602"
},
},
{
{
"name"
:
"device_info"
,
"name"
:
"device_info"
,
"value"
:
"1000"
"value"
:
"1000"
},
},
{
{
"name"
:
"body"
,
"name"
:
"body"
,
"value"
:
"商标"
"value"
:
"商标"
// "value":orderResult.data.orderProduct.channelItemName
// "value":orderResult.data.orderProduct.channelItemName
},
},
{
{
"name"
:
"nonce_str"
,
"name"
:
"nonce_str"
,
// "value":"ibuaiVcKdpRxkhJA"
// "value":"ibuaiVcKdpRxkhJA"
"value"
:
WxPayUtil
.
generateNonceString
()
"value"
:
WxPayUtil
.
generateNonceString
()
},
},
{
{
"name"
:
"openid"
,
"name"
:
"openid"
,
"value"
:
"o7kgSs_2cuJxyBoIEWMwRUPfobLg"
"value"
:
"o7kgSs_2cuJxyBoIEWMwRUPfobLg"
},
},
{
{
"name"
:
"notify_url"
,
"name"
:
"notify_url"
,
"value"
:
"http://"
"value"
:
"http://"
// "value":this.centerChannelUrl + "orderNotify/wxPayNotify",
// "value":this.centerChannelUrl + "orderNotify/wxPayNotify",
},
},
{
{
"name"
:
"out_trade_no"
,
"name"
:
"out_trade_no"
,
// "value": "OT37202006221758koyn-37-69"
// "value": "OT37202006221758koyn-37-69"
"value"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
()
"value"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
()
},
},
{
{
"name"
:
"sign_type"
,
"name"
:
"sign_type"
,
"value"
:
"MD5"
"value"
:
"MD5"
},
},
{
{
"name"
:
"total_fee"
,
"name"
:
"total_fee"
,
"value"
:
"399"
"value"
:
"399"
// "value":orderResult.data.receiptVoucher.totalSum,
// "value":orderResult.data.receiptVoucher.totalSum,
},
},
// {
// {
...
@@ -274,8 +275,8 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -274,8 +275,8 @@ class UtilsUcommuneService extends AppServiceBase {
// "Value": '192.168.2.210',
// "Value": '192.168.2.210',
// },
// },
{
{
"name"
:
"trade_type"
,
"name"
:
"trade_type"
,
"value"
:
"JSAPI"
"value"
:
"JSAPI"
}
}
],
],
"paymentType"
:
"3"
"paymentType"
:
"3"
...
@@ -297,7 +298,7 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -297,7 +298,7 @@ class UtilsUcommuneService extends AppServiceBase {
params
.
sign
=
sign
params
.
sign
=
sign
console
.
log
(
params
)
console
.
log
(
params
)
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
return
system
.
getResultSuccess
(
res
.
data
)
return
system
.
getResultSuccess
(
res
.
data
)
}
}
...
@@ -427,13 +428,13 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -427,13 +428,13 @@ class UtilsUcommuneService extends AppServiceBase {
* @param {*} actionBody orderNo orderIndo订单号
* @param {*} actionBody orderNo orderIndo订单号
*/
*/
async
orderConfirmValidate
(
pobj
,
actionBody
)
{
async
orderConfirmValidate
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
// 订单号
if
(
!
actionBody
.
orderNo
)
{
// 订单号
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100430"
);
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100430"
);
}
}
if
(
!
actionBody
.
payWay
)
{
// 支付方式 1 支付宝 3微信
if
(
!
actionBody
.
payWay
)
{
// 支付方式 1 支付宝 3微信
return
system
.
getResult
(
null
,
"actionBody.payWay can not be empty,100440"
);
return
system
.
getResult
(
null
,
"actionBody.payWay can not be empty,100440"
);
}
}
if
(
actionBody
.
payWay
!=
1
||
actionBody
.
payWay
!=
3
)
{
// payway 非1非3
if
(
actionBody
.
payWay
!=
1
||
actionBody
.
payWay
!=
3
)
{
// payway 非1非3
return
system
.
getResult
(
null
,
"actionBody.payWay is eoor values,100450"
);
return
system
.
getResult
(
null
,
"actionBody.payWay is eoor values,100450"
);
}
}
}
}
...
@@ -455,7 +456,7 @@ class UtilsUcommuneService extends AppServiceBase {
...
@@ -455,7 +456,7 @@ class UtilsUcommuneService extends AppServiceBase {
// 之前写的 调用wx/alipay的方法,后续用不到会删掉
// 之前写的 调用wx/alipay的方法,后续用不到会删掉
PayUtil
=
{
PayUtil
=
{
getSign
:
async
function
(
appid
,
paymentType
)
{
getSign
:
async
function
(
appid
,
paymentType
)
{
let
requrl
=
"https://yf-api.gongsibao.com/pay/v1/createSign"
let
requrl
=
"https://yf-api.gongsibao.com/pay/v1/createSign"
let
params
=
{
let
params
=
{
"app"
:
"ukgc"
,
"app"
:
"ukgc"
,
...
@@ -493,7 +494,7 @@ PayUtil = {
...
@@ -493,7 +494,7 @@ PayUtil = {
signstr
=
md5
(
signstr
).
toUpperCase
()
signstr
=
md5
(
signstr
).
toUpperCase
()
params
.
sign
=
signstr
params
.
sign
=
signstr
let
res
=
await
axios
.
post
(
requrl
,
params
)
let
res
=
await
axios
.
post
(
requrl
,
params
)
if
(
res
.
data
.
code
=
200
)
{
if
(
res
.
data
.
code
=
200
)
{
return
res
.
data
.
value
return
res
.
data
.
value
}
}
return
system
.
getResult
(
null
,
"Failed to get sign, 100460"
);
return
system
.
getResult
(
null
,
"Failed to get sign, 100460"
);
...
@@ -503,7 +504,7 @@ PayUtil = {
...
@@ -503,7 +504,7 @@ PayUtil = {
module
.
exports
=
UtilsUcommuneService
;
module
.
exports
=
UtilsUcommuneService
;
WxPayUtil
=
{
WxPayUtil
=
{
generateNonceString
:
function
(
length
)
{
generateNonceString
:
function
(
length
)
{
var
chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
;
var
chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
;
var
maxPos
=
chars
.
length
;
var
maxPos
=
chars
.
length
;
var
noceStr
=
""
;
var
noceStr
=
""
;
...
...
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