Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
姜枫
2016-09-08 17:19:49 +0800
Commit
0e53761943908f6911f17ea4e87bfdde1d71dbd1
1 parent
322f72c0
添加检查微信支付状态 定时器
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
4 deletions
.sonar/.sonar_lock
.sonar/report-task.txt
apps/shopping/controllers/pay.js
apps/shopping/router.js
apps/shopping/views/action/weixin-pay.hbs
config/common.js
public/js/shopping/wxpay.page.js
sonar-project.properties
.sonar/.sonar_lock
0 → 100644
View file @
0e53761
.sonar/report-task.txt
0 → 100644
View file @
0e53761
projectKey=fe:yohoblk
serverUrl=http://localhost:9009
dashboardUrl=http://localhost:9009/dashboard/index/fe:yohoblk
ceTaskId=AVbF8e0O_lOupzaXV3Wr
ceTaskUrl=http://localhost:9009/api/ce/task?id=AVbF8e0O_lOupzaXV3Wr
...
...
apps/shopping/controllers/pay.js
View file @
0e53761
...
...
@@ -122,6 +122,26 @@ const weixinQr = (req, res, next) => {
}).
catch
(
next
);
};
const
weixinPayState
=
(
req
,
res
)
=>
{
let
code
=
req
.
query
.
code
;
let
uid
=
req
.
user
.
uid
;
OrderData
.
orderDetail
(
uid
,
code
).
then
(
result
=>
{
if
(
result
&&
result
.
data
&&
result
.
data
.
payment_status
===
'Y'
)
{
res
.
json
({
code
:
200
,
data
:
{
href
:
helpers
.
urlFormat
(
'/me/order/detail'
,
{
orderCode
:
code
})
}
});
}
else
{
return
res
.
json
({});
}
}).
catch
(()
=>
{
return
res
.
json
({});
});
};
/**
* 支付成功回调
* @param req
...
...
@@ -165,5 +185,6 @@ module.exports = {
online
,
callback
,
toPay
,
weixinQr
weixinQr
,
weixinPayState
};
...
...
apps/shopping/router.js
View file @
0e53761
...
...
@@ -33,6 +33,7 @@ router.post('/order/submit', auth, order.orderSub);
// 支付
router
.
get
(
'/pay/online'
,
auth
,
pay
.
online
);
router
.
get
(
'/pay/online/weixin'
,
auth
,
pay
.
weixinQr
);
router
.
get
(
'/pay/online/weixin/state'
,
auth
,
pay
.
weixinPayState
);
router
.
post
(
'/pay/online/go'
,
auth
,
pay
.
toPay
);
// 支付回调
...
...
apps/shopping/views/action/weixin-pay.hbs
View file @
0e53761
...
...
@@ -47,6 +47,6 @@
{{/
order
}}
<div
class=
"qr-content"
>
<div
class=
"qr-code"
data-qr=
"
{{
url
}}
"
></div>
<div
class=
"qr-code"
data-qr=
"
{{
url
}}
"
data-code=
"
{{
order
.
orderCode
}}
"
></div>
</div>
</div>
...
...
config/common.js
View file @
0e53761
...
...
@@ -23,8 +23,8 @@ module.exports = {
cookieDomain
:
'yohoblk.com'
,
domains
:
{
singleApi
:
'http://single.yoho.cn/'
,
api
:
'http://api.yoho.yohoops.org/'
,
service
:
'http://service.yoho.yohoops.org/'
,
api
:
'http://dev-api.yohops.com:9999/'
,
service
:
'http://dev-service.yohops.com:9999/'
,
search
:
'http://search.yohoops.org/yohosearch/'
},
useOneapm
:
false
,
...
...
public/js/shopping/wxpay.page.js
View file @
0e53761
...
...
@@ -14,4 +14,16 @@ $(function() {
text
:
$
(
this
).
data
(
'qr'
)
});
});
function
queryOrderState
()
{
var
code
=
$
(
'.qr-code'
).
data
(
'code'
);
$
.
get
(
'/shopping/pay/online/weixin/state'
,
{
code
:
code
},
function
(
data
)
{
if
(
data
&&
data
.
code
===
200
)
{
location
.
href
=
data
.
data
.
href
;
}
});
}
setInterval
(
queryOrderState
,
1000
);
});
...
...
sonar-project.properties
0 → 100644
View file @
0e53761
sonar.projectKey
=
fe:yohoblk
# this is the name displayed in the SonarQube UI
sonar.projectName
=
yoho-blk
sonar.projectVersion
=
0.0.1
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources
=
apps
...
...
Please
register
or
login
to post a comment