Authored by 陈峰

Merge branch 'feature/ufo-coupon' into 'release/6.8.2'

Feature/ufo coupon



See merge request !1587
... ... @@ -71,6 +71,7 @@ exports.bottombar = function(req, res, next) {
*/
exports.couponSend = (req, res, next) => {
let token = req.query.token || '',
coupontype = req.query.coupontype,
uid = req.user.uid,
app = req.query.app || {};
... ... @@ -100,8 +101,11 @@ exports.couponSend = (req, res, next) => {
if (uid === '' || uid === 0 || token === '' || token === 0) {
return res.jsonp(resultData);
}
const promise = coupontype === 'ufo' ?
req.ctx(model).couponSendUFO(uid, token) :
req.ctx(model).couponSend(uid, token);
req.ctx(model).couponSend(uid, token).then(result => {
promise.then(result => {
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
... ...
'use strict';
const _ = require('lodash');
const api = global.yoho.API;
const UfoApi = global.yoho.UfoAPI;
const helpers = global.yoho.helpers;
const yasProcess = require('../../../utils/yas-process');
... ... @@ -451,6 +452,29 @@ class featureModel extends global.yoho.BaseModel {
});
}
/**
* 领取UFO优惠券
*/
couponSendUFO(uid, token) {
let data = {
method: 'app.coupons.send',
uid: uid,
coupon_tokens: token,
};
return this.get({
url: 'coupon',
data,
api: UfoApi
}).then(result => {
if (!result) {
result.code = 404;
result.message = '出错啦~';
}
return result;
});
}
getTplPraiseInfo(ids, udid) {
return this.get({
data: {
... ...
... ... @@ -29,6 +29,7 @@ const domains = {
service: 'http://api-test3.dev.yohocorp.com/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.dev.yohocorp.com/',
ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
imSocket: 'wss://imsocket.yohobuy.com:443',
imCs: 'https://imhttp.yohobuy.com/api',
... ... @@ -179,6 +180,7 @@ if (isProduction) {
assetUrl: '//cdn.yoho.cn/yohobuywap-node/',
domains: {
api: 'http://api.yoho.yohoops.org/',
ufo: 'http://2.yohobuy.com/',
service: 'http://api.yoho.yohoops.org/',
global: 'http://api-global.yohobuy.com',
store: 'http://openstore.yohobuy.com',
... ... @@ -289,6 +291,7 @@ if (isProduction) {
assetUrl: '//cdn.yoho.cn/yohobuywap-node/',
domains: {
api: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/',
ufo: process.env.UFO_API || 'http://2.yohobuy.com/',
service: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/',
global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/',
store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/wechat/',
... ...
... ... @@ -88,7 +88,7 @@
"xml2js": "^0.4.19",
"yoho-express-session": "^2.0.0",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.6.40",
"yoho-node-lib": "=0.6.41",
"yoho-zookeeper": "^1.0.10"
},
"devDependencies": {
... ...
... ... @@ -11102,9 +11102,9 @@ yoho-md5@^2.0.0:
version "2.1.0"
resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.1.0.tgz#f0c00d343f775e77952ebce0826863ac52e0ad50"
yoho-node-lib@=0.6.40:
version "0.6.40"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.40.tgz#3e9729bdb059f352afd1f72f29d524b37554db90"
yoho-node-lib@=0.6.41:
version "0.6.41"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.41.tgz#43351fd7e63a9a2f9e7435e16e13a42b1f560cd4"
dependencies:
dnscache "^1.0.1"
handlebars "^4.0.5"
... ...