feat(feature): 只有UFO优惠券才做校验
Showing
1 changed file
with
23 additions
and
20 deletions
@@ -30,24 +30,27 @@ let captchaReq = new models.DescribeCaptchaResultRequest(); | @@ -30,24 +30,27 @@ let captchaReq = new models.DescribeCaptchaResultRequest(); | ||
30 | */ | 30 | */ |
31 | module.exports = function(req, res, next) { | 31 | module.exports = function(req, res, next) { |
32 | 32 | ||
33 | - const params = { | ||
34 | - AppSecretKey, | ||
35 | - CaptchaAppId: appId, | ||
36 | - CaptchaType: 9, | ||
37 | - UserIp: req.yoho.clientIp, | ||
38 | - Ticket: req.query.ticket, | ||
39 | - Randstr: req.query.randstr | ||
40 | - }; | ||
41 | - captchaReq.from_json_string(`${params}`); | ||
42 | - | ||
43 | - | ||
44 | - // eslint-disable-next-line new-cap | ||
45 | - client.DescribeCaptchaResult(captchaReq, function(errMsg) { | ||
46 | - | ||
47 | - if (errMsg) { | ||
48 | - return res.jsonp({code: 400, message: errMsg.Message}); | ||
49 | - } | ||
50 | - | ||
51 | - next(); | ||
52 | - }); | 33 | + if (req.query.coupontype === 'ufo') { |
34 | + const params = { | ||
35 | + AppSecretKey, | ||
36 | + CaptchaAppId: appId, | ||
37 | + CaptchaType: 9, | ||
38 | + UserIp: req.yoho.clientIp, | ||
39 | + Ticket: req.query.ticket, | ||
40 | + Randstr: req.query.randstr | ||
41 | + }; | ||
42 | + | ||
43 | + captchaReq.from_json_string(JSON.stringify(params)); | ||
44 | + | ||
45 | + // eslint-disable-next-line new-cap | ||
46 | + client.DescribeCaptchaResult(captchaReq, function(errMsg) { | ||
47 | + if (errMsg) { | ||
48 | + return res.jsonp({code: 400, message: errMsg.Message}); | ||
49 | + } | ||
50 | + next(); | ||
51 | + }); | ||
52 | + } else { | ||
53 | + // eslint-disable-next-line callback-return | ||
54 | + next(); | ||
55 | + } | ||
53 | }; | 56 | }; |
-
Please register or login to post a comment