Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
26742971
Commit
26742971
authored
Jun 04, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wechat pay return more
parent
59872c69
Pipeline
#24465
passed with stage
in 11 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
5 deletions
+43
-5
institution.js
app/service/course/v5/institution.js
+3
-0
user.js
app/service/course/v5/user.js
+22
-5
wechat.js
app/service/course/v5/wechat.js
+18
-0
No files found.
app/service/course/v5/institution.js
View file @
26742971
...
...
@@ -454,6 +454,7 @@ class InstitutionSubService extends Service {
}
results
.
push
({
title
:
'体验课'
,
value
:
1
,
class
:
classList
,
});
...
...
@@ -465,6 +466,7 @@ class InstitutionSubService extends Service {
}
results
.
push
({
title
:
'低价课'
,
value
:
2
,
class
:
classList
,
});
...
...
@@ -476,6 +478,7 @@ class InstitutionSubService extends Service {
}
results
.
push
({
title
:
'精品课'
,
value
:
3
,
class
:
classList
,
});
...
...
app/service/course/v5/user.js
View file @
26742971
...
...
@@ -375,9 +375,10 @@ class UserService extends Service {
ctx
.
failed
(
'课程不存在'
);
}
const
orderNo
=
'12'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
);
if
(
ctx
.
isEmpty
(
order
))
{
const
data
=
{
order_no
:
'11'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
)
,
order_no
:
orderNo
,
user_uuid
:
userUuid
,
class_id
:
id
,
pay
:
classInfo
.
pay_price
,
...
...
@@ -387,9 +388,9 @@ class UserService extends Service {
order
=
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
findOne
({
where
:
{
user_uuid
:
userUuid
,
class_id
:
id
,
is_deleted
:
0
},
order
:
[[
'id'
,
'asc'
]]
});
}
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
update
({
pay
:
classInfo
.
pay_price
,
type
:
1
,
redeem
:
''
,
status
:
0
},
{
where
:
{
id
:
order
.
id
}
});
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
update
({
pay
:
classInfo
.
pay_price
,
order_no
:
orderNo
,
type
:
1
,
redeem
:
''
,
status
:
0
},
{
where
:
{
id
:
order
.
id
}
});
let
response
=
await
this
.
service
.
course
.
v5
.
wechat
.
pay
({
pay
:
order
.
pay
,
order_no
:
order
.
order_no
,
body
:
`趣选课-
${
order
.
order_n
o
}
`
});
let
response
=
await
this
.
service
.
course
.
v5
.
wechat
.
pay
({
pay
:
order
.
pay
,
order_no
:
order
No
,
body
:
`趣选课-订单
${
orderN
o
}
`
});
response
=
await
ctx
.
helper
.
xmlTojson
(
response
);
if
(
ctx
.
isEmpty
(
response
))
{
...
...
@@ -401,13 +402,29 @@ class UserService extends Service {
if
(
response
.
result_code
[
0
]
===
'FAIL'
)
{
ctx
.
failed
(
response
.
err_code_des
[
0
]);
}
const
appId
=
await
this
.
service
.
course
.
v5
.
wechat
.
getAppId
();
const
timeStamp
=
moment
().
unix
();
const
arr
=
[
`appId=
${
appId
}
`
,
`timeStamp=
${
timeStamp
}
`
,
`nonceStr=
${
response
.
nonce_str
[
0
]}
`
,
`package=prepay_id=
${
response
.
prepay_id
[
0
]}
`
];
const
signType
=
await
this
.
service
.
course
.
v5
.
wechat
.
sign
(
arr
);
const
ret
=
{
trade_type
:
response
.
trade_type
[
0
],
prepay_id
:
response
.
prepay_id
[
0
],
appId
,
timeStamp
,
nonceStr
:
response
.
nonce_str
[
0
],
package
:
`prepay_id=
${
response
.
prepay_id
[
0
]}
`
,
signType
,
};
return
ret
;
}
// 我的订单列表
async
getUserOrderList
()
{
const
{
ctx
}
=
this
;
}
}
module
.
exports
=
UserService
;
app/service/course/v5/wechat.js
View file @
26742971
...
...
@@ -366,6 +366,24 @@ class WechatService extends Service {
ret
=
ret
.
replace
(
/^
\u
feff/i
,
''
).
replace
(
/^
\u
fffe/i
,
''
);
return
ret
;
}
// 签名
async
sign
(
arr
)
{
const
{
ctx
}
=
this
;
if
(
ctx
.
isEmpty
(
arr
))
{
return
''
;
}
arr
.
sort
();
let
sign
=
ctx
.
helper
.
md5
(
arr
.
join
(
'&'
)
+
'&key=xuepenQuXuanKeweixinzhifu2020063'
);
sign
=
sign
.
toUpperCase
();
return
sign
;
}
async
getAppId
()
{
return
'wx07a5f0ed5bdf4751'
;
}
}
module
.
exports
=
WechatService
;
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