Merge branch 'feature/ufo-coupon' into 'release/6.8.2'
Feature/ufo coupon See merge request !1587
Showing
5 changed files
with
36 additions
and
5 deletions
@@ -71,6 +71,7 @@ exports.bottombar = function(req, res, next) { | @@ -71,6 +71,7 @@ exports.bottombar = function(req, res, next) { | ||
71 | */ | 71 | */ |
72 | exports.couponSend = (req, res, next) => { | 72 | exports.couponSend = (req, res, next) => { |
73 | let token = req.query.token || '', | 73 | let token = req.query.token || '', |
74 | + coupontype = req.query.coupontype, | ||
74 | uid = req.user.uid, | 75 | uid = req.user.uid, |
75 | app = req.query.app || {}; | 76 | app = req.query.app || {}; |
76 | 77 | ||
@@ -100,8 +101,11 @@ exports.couponSend = (req, res, next) => { | @@ -100,8 +101,11 @@ exports.couponSend = (req, res, next) => { | ||
100 | if (uid === '' || uid === 0 || token === '' || token === 0) { | 101 | if (uid === '' || uid === 0 || token === '' || token === 0) { |
101 | return res.jsonp(resultData); | 102 | return res.jsonp(resultData); |
102 | } | 103 | } |
104 | + const promise = coupontype === 'ufo' ? | ||
105 | + req.ctx(model).couponSendUFO(uid, token) : | ||
106 | + req.ctx(model).couponSend(uid, token); | ||
103 | 107 | ||
104 | - req.ctx(model).couponSend(uid, token).then(result => { | 108 | + promise.then(result => { |
105 | res.set({ | 109 | res.set({ |
106 | 'Cache-Control': 'no-cache', | 110 | 'Cache-Control': 'no-cache', |
107 | Pragma: 'no-cache', | 111 | Pragma: 'no-cache', |
1 | 'use strict'; | 1 | 'use strict'; |
2 | const _ = require('lodash'); | 2 | const _ = require('lodash'); |
3 | const api = global.yoho.API; | 3 | const api = global.yoho.API; |
4 | +const UfoApi = global.yoho.UfoAPI; | ||
4 | const helpers = global.yoho.helpers; | 5 | const helpers = global.yoho.helpers; |
5 | const yasProcess = require('../../../utils/yas-process'); | 6 | const yasProcess = require('../../../utils/yas-process'); |
6 | 7 | ||
@@ -451,6 +452,29 @@ class featureModel extends global.yoho.BaseModel { | @@ -451,6 +452,29 @@ class featureModel extends global.yoho.BaseModel { | ||
451 | }); | 452 | }); |
452 | } | 453 | } |
453 | 454 | ||
455 | + /** | ||
456 | + * 领取UFO优惠券 | ||
457 | + */ | ||
458 | + couponSendUFO(uid, token) { | ||
459 | + let data = { | ||
460 | + method: 'app.coupons.send', | ||
461 | + uid: uid, | ||
462 | + coupon_tokens: token, | ||
463 | + }; | ||
464 | + | ||
465 | + return this.get({ | ||
466 | + url: 'coupon', | ||
467 | + data, | ||
468 | + api: UfoApi | ||
469 | + }).then(result => { | ||
470 | + if (!result) { | ||
471 | + result.code = 404; | ||
472 | + result.message = '出错啦~'; | ||
473 | + } | ||
474 | + | ||
475 | + return result; | ||
476 | + }); | ||
477 | + } | ||
454 | getTplPraiseInfo(ids, udid) { | 478 | getTplPraiseInfo(ids, udid) { |
455 | return this.get({ | 479 | return this.get({ |
456 | data: { | 480 | data: { |
@@ -29,6 +29,7 @@ const domains = { | @@ -29,6 +29,7 @@ const domains = { | ||
29 | service: 'http://api-test3.dev.yohocorp.com/', | 29 | service: 'http://api-test3.dev.yohocorp.com/', |
30 | liveApi: 'http://testapi.live.yohops.com:9999/', | 30 | liveApi: 'http://testapi.live.yohops.com:9999/', |
31 | singleApi: 'http://api-test3.dev.yohocorp.com/', | 31 | singleApi: 'http://api-test3.dev.yohocorp.com/', |
32 | + ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/', | ||
32 | 33 | ||
33 | imSocket: 'wss://imsocket.yohobuy.com:443', | 34 | imSocket: 'wss://imsocket.yohobuy.com:443', |
34 | imCs: 'https://imhttp.yohobuy.com/api', | 35 | imCs: 'https://imhttp.yohobuy.com/api', |
@@ -179,6 +180,7 @@ if (isProduction) { | @@ -179,6 +180,7 @@ if (isProduction) { | ||
179 | assetUrl: '//cdn.yoho.cn/yohobuywap-node/', | 180 | assetUrl: '//cdn.yoho.cn/yohobuywap-node/', |
180 | domains: { | 181 | domains: { |
181 | api: 'http://api.yoho.yohoops.org/', | 182 | api: 'http://api.yoho.yohoops.org/', |
183 | + ufo: 'http://2.yohobuy.com/', | ||
182 | service: 'http://api.yoho.yohoops.org/', | 184 | service: 'http://api.yoho.yohoops.org/', |
183 | global: 'http://api-global.yohobuy.com', | 185 | global: 'http://api-global.yohobuy.com', |
184 | store: 'http://openstore.yohobuy.com', | 186 | store: 'http://openstore.yohobuy.com', |
@@ -289,6 +291,7 @@ if (isProduction) { | @@ -289,6 +291,7 @@ if (isProduction) { | ||
289 | assetUrl: '//cdn.yoho.cn/yohobuywap-node/', | 291 | assetUrl: '//cdn.yoho.cn/yohobuywap-node/', |
290 | domains: { | 292 | domains: { |
291 | api: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/', | 293 | api: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/', |
294 | + ufo: process.env.UFO_API || 'http://2.yohobuy.com/', | ||
292 | service: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/', | 295 | service: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/', |
293 | global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/', | 296 | global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/', |
294 | store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/wechat/', | 297 | store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/wechat/', |
@@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
88 | "xml2js": "^0.4.19", | 88 | "xml2js": "^0.4.19", |
89 | "yoho-express-session": "^2.0.0", | 89 | "yoho-express-session": "^2.0.0", |
90 | "yoho-md5": "^2.0.0", | 90 | "yoho-md5": "^2.0.0", |
91 | - "yoho-node-lib": "=0.6.40", | 91 | + "yoho-node-lib": "=0.6.41", |
92 | "yoho-zookeeper": "^1.0.10" | 92 | "yoho-zookeeper": "^1.0.10" |
93 | }, | 93 | }, |
94 | "devDependencies": { | 94 | "devDependencies": { |
@@ -11102,9 +11102,9 @@ yoho-md5@^2.0.0: | @@ -11102,9 +11102,9 @@ yoho-md5@^2.0.0: | ||
11102 | version "2.1.0" | 11102 | version "2.1.0" |
11103 | resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.1.0.tgz#f0c00d343f775e77952ebce0826863ac52e0ad50" | 11103 | resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.1.0.tgz#f0c00d343f775e77952ebce0826863ac52e0ad50" |
11104 | 11104 | ||
11105 | -yoho-node-lib@=0.6.40: | ||
11106 | - version "0.6.40" | ||
11107 | - resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.40.tgz#3e9729bdb059f352afd1f72f29d524b37554db90" | 11105 | +yoho-node-lib@=0.6.41: |
11106 | + version "0.6.41" | ||
11107 | + resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.41.tgz#43351fd7e63a9a2f9e7435e16e13a42b1f560cd4" | ||
11108 | dependencies: | 11108 | dependencies: |
11109 | dnscache "^1.0.1" | 11109 | dnscache "^1.0.1" |
11110 | handlebars "^4.0.5" | 11110 | handlebars "^4.0.5" |
-
Please register or login to post a comment