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
4d2c8cbb
Commit
4d2c8cbb
authored
Jun 22, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucommune orderConfirm api
parent
e932d231
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
33 deletions
+121
-33
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
+8
-25
center-channel/app/config/routes/api.js
+104
-0
center-channel/package-lock.json
+7
-7
center-channel/package.json
+2
-1
No files found.
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
View file @
4d2c8cbb
...
...
@@ -174,32 +174,15 @@ class UtilsUcommuneService extends AppServiceBase {
}
if
(
actionBody
.
payWay
==
3
)
{
// 微信
let
sign
=
await
PayUtil
.
getSign
(
'wx6f3ebe44defe336a'
,
"3"
)
let
params
=
{
// "partner" : "2019022163300183" ,
// "seller_id" : "353494220@qq.com" ,
// "out_trade_no" : orderResult.data.channelOrderNo ,
// "subject" : orderResult.data.channelItemName ,
// "body" : orderResult.data.channelItemName ,
// "total_fee" : orderResult.data.payTotalSum ,
// "service" : "alipay.trade.app.pay" ,
// "payment_type" : "1" ,
// "_input_charset" : "utf-8" ,
// "it_b_pay" : "10m" ,
// "notify_url" : this.centerChannelUrl + "orderNotify/aliPayNotify" ,
// "enable_paymethod" : "balance,moneyFund,coupon,pcredit,pcreditpayInstallment,creditCard,creditCardExpress,creditCardCartoon,credit_group,debitCardExpress,mcard,pcard,promotion" ,
// "sign" : sign ,
// "sign_type" : "RSA2",
}
let
str
=
""
;
for
(
var
k
in
params
)
{
console
.
log
(
k
)
str
+=
k
+
"=
\"
"
+
params
[
k
]
+
"
\"
&"
;
let
wxpayJson
=
{
"appid"
:
"wx05b764a334ca0472"
,
"noncestr"
:
"fdbe012e2e11314b96402b32c0df26b7"
,
"package"
:
"Sign=WXPay"
,
"partnerid"
:
"1525494731"
,
"prepayid"
:
"wx221007210600552805dae6511340418300"
,
"sign"
:
"7BACA717B040DEEA7A8940CEC94A3318"
,
"timestamp"
:
"1592791641"
}
str
=
str
.
substr
(
0
,
str
.
length
-
1
)
console
.
log
(
str
)
return
system
.
getResultSuccess
(
str
);
// let wxAgentInformation = await this.redisClient.get("wxAgentInformation")
// if(!wxAgentInformation) {
// console.log("11111")
...
...
center-channel/app/config/routes/api.js
View file @
4d2c8cbb
...
...
@@ -4,6 +4,10 @@ const utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
const
utilsFeishuSve
=
system
.
getObject
(
"service.utilsSve.utilsFeishuSve"
);
var
axios
=
require
(
'axios'
);
var
md5
=
require
(
'md5'
);
var
xml2js
=
require
(
'xml2js'
);
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式---------web---------开始
...
...
@@ -441,4 +445,103 @@ module.exports = function (app) {
});
}
});
app
.
post
(
'/pay/test'
,
async
function
(
req
,
res
)
{
var
unifiedorderUrl
=
"https://api.mch.weixin.qq.com/pay/unifiedorder"
;
var
opts
=
{};
opts
.
nonce_str
=
WxPayUtil
.
generateNonceString
();
opts
.
appid
=
'wx05b764a334ca0472'
;
opts
.
mch_id
=
'1232813602'
;
opts
.
device_info
=
"WEB"
;
opts
.
sign
=
'CE7022B710720E681230CE61CC3F6D9625115E07B3EFF1E740174F5EBC22026D'
;
opts
.
body
=
"1111"
;
opts
.
out_trade_no
=
"123123123"
;
opts
.
total_fee
=
123123
;
opts
.
spbill_create_ip
=
"192.169.1.1"
;
opts
.
notify_url
=
"https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1"
,
opts
.
trade_type
=
"APP"
var
postXml
=
WxPayUtil
.
buildXML
({
xml
:
opts
});
// console.log("微信付款单请求postXml",postXml);
axios
.
post
(
unifiedorderUrl
,
postXml
).
then
(
function
(
result
)
{
// console.log("微信付款单请求result.data",result.data);
WxPayUtil
.
parseXML
(
result
.
data
,
function
(
json
){
console
.
log
(
json
)
});
}).
catch
(
function
(
error
){
console
.
log
(
"微信生成付款单错误"
,
error
);
})
})
};
WxPayUtil
=
{
generateNonceString
:
function
(
length
)
{
var
chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
;
var
maxPos
=
chars
.
length
;
var
noceStr
=
""
;
for
(
var
i
=
0
;
i
<
(
length
||
32
);
i
++
)
{
noceStr
+=
chars
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
maxPos
));
}
return
noceStr
;
},
mix
:
function
()
{
var
root
=
arguments
[
0
];
if
(
arguments
.
length
==
1
)
{
return
root
;
}
for
(
var
i
=
1
;
i
<
arguments
.
length
;
i
++
)
{
for
(
var
k
in
arguments
[
i
])
{
root
[
k
]
=
arguments
[
i
][
k
];
}
}
return
root
;
},
encodeUTF8
:
function
(
str
)
{
var
temp
=
""
,
rs
=
""
;
for
(
var
i
=
0
,
len
=
str
.
length
;
i
<
len
;
i
++
)
{
temp
=
str
.
charCodeAt
(
i
).
toString
(
16
);
rs
+=
"
\\
u"
+
new
Array
(
5
-
temp
.
length
).
join
(
"0"
)
+
temp
;
}
return
rs
;
},
buildXML
:
function
(
json
)
{
var
builder
=
new
xml2js
.
Builder
();
return
builder
.
buildObject
(
json
);
},
parseXML
:
function
(
xml
,
func
)
{
// var parser = new xml2js.Parser({ trim: true, explicitArray: false, explicitRoot: false });
xml2js
.
parseString
(
xml
,
{
trim
:
true
,
explicitArray
:
false
,
explicitRoot
:
false
},
function
(
err
,
result
){
if
(
err
){
console
.
log
(
err
);
}
else
{
func
(
result
)
}
});
},
sign
:
function
(
param
)
{
var
querystring
=
Object
.
keys
(
param
).
filter
(
function
(
key
)
{
return
param
[
key
]
!==
undefined
&&
param
[
key
]
!==
''
&&
[
'pfx'
,
'partner_key'
,
'sign'
,
'key'
].
indexOf
(
key
)
<
0
;
}).
sort
().
map
(
function
(
key
)
{
return
key
+
'='
+
param
[
key
];
}).
join
(
"&"
)
+
"&key="
+
config
.
wechat
.
pay
.
partnerKey
;
// console.log("sign:");
// console.log(querystring);
var
hash
=
md5
(
querystring
).
toUpperCase
();
return
hash
},
}
\ No newline at end of file
center-channel/package-lock.json
View file @
4d2c8cbb
...
...
@@ -8134,18 +8134,18 @@
}
},
"xml2js"
:
{
"version"
:
"0.4.
19
"
,
"resolved"
:
"https://registry.npmjs.org/xml2js/-/xml2js-0.4.
19
.tgz"
,
"integrity"
:
"sha512-
esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q
=="
,
"version"
:
"0.4.
23
"
,
"resolved"
:
"https://registry.npmjs.org/xml2js/-/xml2js-0.4.
23
.tgz"
,
"integrity"
:
"sha512-
ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug
=="
,
"requires"
:
{
"sax"
:
">=0.6.0"
,
"xmlbuilder"
:
"~
9.0.1
"
"xmlbuilder"
:
"~
11.0.0
"
}
},
"xmlbuilder"
:
{
"version"
:
"
9.0.7
"
,
"resolved"
:
"https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-
9.0.7
.tgz"
,
"integrity"
:
"sha
1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0
="
"version"
:
"
11.0.1
"
,
"resolved"
:
"https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-
11.0.1
.tgz"
,
"integrity"
:
"sha
512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=
="
},
"xmlhttprequest-ssl"
:
{
"version"
:
"1.5.5"
,
...
...
center-channel/package.json
View file @
4d2c8cbb
...
...
@@ -55,7 +55,8 @@
"
socket.io
"
:
"^2.1.1"
,
"
tenpay
"
:
"^2.1.18"
,
"
uuid
"
:
"^3.2.1"
,
"
wx-pay
"
:
"^1.0.2"
"
wx-pay
"
:
"^1.0.2"
,
"
xml2js
"
:
"^0.4.23"
},
"devDependencies"
:
{
"
element-theme
"
:
"^2.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