Authored by 郝肖肖

'防止多次请求'

... ... @@ -78,6 +78,7 @@ let _getCoin = function(data) {
});
};
let isSendCoupon = false;
let _getCoupon = function(data){
data.app = utils.queryString();
... ... @@ -86,10 +87,16 @@ let _getCoupon = function(data){
data.app.client_type = data.app.client_type || cookies.cookie('app_client_type');
data.app.session_key = data.app.session_key || cookies.cookie('app_session_key');
if (isSendCoupon) {
return;
}
isSendCoupon = true;
jsonp({
url: '//m.yohobuy.com/activity/feature/couponSend?callback=?',
data: data
}).then(function(res) {
isSendCoupon = false;
if (res.code === 200) {
utils.showTip({
title: '领取成功',
... ... @@ -110,6 +117,7 @@ let _getCoupon = function(data){
});
}
}, function(){
isSendCoupon = false;
utils.showTip({
title: '领取失败<br>请刷新重新领取',
content: '如多次领取失败,请联系客服人员<br>带来不便敬请谅解',
... ...