Merge branch 'hotfix/activity' into 'gray'
get-app-info See merge request !1111
Showing
4 changed files
with
36 additions
and
17 deletions
@@ -85,18 +85,18 @@ exports.couponSend = (req, res, next) => { | @@ -85,18 +85,18 @@ exports.couponSend = (req, res, next) => { | ||
85 | } | 85 | } |
86 | 86 | ||
87 | // 接口要加 session 校验,跨域异步请求未添加相关参数 | 87 | // 接口要加 session 校验,跨域异步请求未添加相关参数 |
88 | - // if (req.yoho.isApp) { | ||
89 | - // if (app.app_version && app.client_type && app.session_key && app.uid) { | ||
90 | - // uid = { | ||
91 | - // toString: () => { | ||
92 | - // return _.parseInt(app.uid); | ||
93 | - // }, | ||
94 | - // sessionKey: app.session_key, | ||
95 | - // appVersion: app.app_version, | ||
96 | - // appSessionType: app.client_type | ||
97 | - // }; | ||
98 | - // } | ||
99 | - // } | 88 | + if (req.yoho.isApp) { |
89 | + if (app.app_version && app.client_type && app.session_key && app.uid) { | ||
90 | + uid = { | ||
91 | + toString: () => { | ||
92 | + return _.parseInt(app.uid); | ||
93 | + }, | ||
94 | + sessionKey: app.session_key, | ||
95 | + appVersion: app.app_version, | ||
96 | + appSessionType: app.client_type | ||
97 | + }; | ||
98 | + } | ||
99 | + } | ||
100 | 100 | ||
101 | model.couponSend(uid, token, app).then(result => { | 101 | model.couponSend(uid, token, app).then(result => { |
102 | res.set({ | 102 | res.set({ |
1 | 'use strict'; | 1 | 'use strict'; |
2 | const moment = require('moment'); | 2 | const moment = require('moment'); |
3 | +const _ = require('lodash'); | ||
3 | const model = require('../models/individuation'); | 4 | const model = require('../models/individuation'); |
4 | const channels = { | 5 | const channels = { |
5 | boys: 1, | 6 | boys: 1, |
@@ -73,6 +74,18 @@ exports.productLst = function(req, res, next) { | @@ -73,6 +74,18 @@ exports.productLst = function(req, res, next) { | ||
73 | exports.coupon = function(req, res, next) { | 74 | exports.coupon = function(req, res, next) { |
74 | let activity_template_id = req.query.activity_id; | 75 | let activity_template_id = req.query.activity_id; |
75 | let uid = req.user.uid || req.query.uid; | 76 | let uid = req.user.uid || req.query.uid; |
77 | + let app = req.query.app; | ||
78 | + | ||
79 | + if (app && app.app_version && app.client_type && app.session_key && app.uid) { | ||
80 | + uid = { | ||
81 | + toString: () => { | ||
82 | + return _.parseInt(app.uid); | ||
83 | + }, | ||
84 | + sessionKey: app.session_key, | ||
85 | + appVersion: app.app_version, | ||
86 | + appSessionType: app.client_type | ||
87 | + }; | ||
88 | + } | ||
76 | 89 | ||
77 | if (!uid || !activity_template_id) { | 90 | if (!uid || !activity_template_id) { |
78 | return res.jsonp({ | 91 | return res.jsonp({ |
@@ -109,7 +109,7 @@ module.exports = { | @@ -109,7 +109,7 @@ module.exports = { | ||
109 | maxQps: 1200, | 109 | maxQps: 1200, |
110 | maxQps10m: 2500, | 110 | maxQps10m: 2500, |
111 | geetestJs: '//static.geetest.com/static/tools/gt.js', | 111 | geetestJs: '//static.geetest.com/static/tools/gt.js', |
112 | - jsSdk: '//cdn.yoho.cn/js-sdk/1.2.7/jssdk.js', | 112 | + jsSdk: '//cdn.yoho.cn/js-sdk/1.2.8/jssdk.js', |
113 | redis: { | 113 | redis: { |
114 | connect: { | 114 | connect: { |
115 | host: '127.0.0.1', | 115 | host: '127.0.0.1', |
@@ -2,6 +2,8 @@ var $ = require('yoho-jquery'); | @@ -2,6 +2,8 @@ var $ = require('yoho-jquery'); | ||
2 | var lazyLoad = require('yoho-jquery-lazyload'); | 2 | var lazyLoad = require('yoho-jquery-lazyload'); |
3 | var Swiper = require('yoho-swiper'); | 3 | var Swiper = require('yoho-swiper'); |
4 | var yoho = require('../yoho-app'); | 4 | var yoho = require('../yoho-app'); |
5 | +const qs = require('yoho-qs'); | ||
6 | +const cookie = require('yoho-cookie'); | ||
5 | 7 | ||
6 | global.jQuery = $; | 8 | global.jQuery = $; |
7 | 9 | ||
@@ -218,10 +220,14 @@ function persenalCouponInit() { | @@ -218,10 +220,14 @@ function persenalCouponInit() { | ||
218 | let data = { | 220 | let data = { |
219 | activity_id: $('.feature-page').data('id') | 221 | activity_id: $('.feature-page').data('id') |
220 | }; | 222 | }; |
221 | - let href = '//activity.yoho.cn/individuation/coupon'; | ||
222 | 223 | ||
223 | - if (location.hostname === 'm.yohobuy.com') { | ||
224 | - href = '//m.yohobuy.com/activity/individuation/coupon'; | 224 | + if (yoho.isApp) { |
225 | + data.app = { | ||
226 | + uid: cookie.get('app_uid') || qs.uid, | ||
227 | + app_version: cookie.get('app_version') || qs.app_version, | ||
228 | + client_type: cookie.get('app_client_type') || qs.client_type, | ||
229 | + session_key: cookie.get('app_session_key') || qs.session_key | ||
230 | + }; | ||
225 | } | 231 | } |
226 | 232 | ||
227 | $('.yoho-conpon').each(function() { | 233 | $('.yoho-conpon').each(function() { |
@@ -229,7 +235,7 @@ function persenalCouponInit() { | @@ -229,7 +235,7 @@ function persenalCouponInit() { | ||
229 | 235 | ||
230 | if ($this.data('persenal-enable')) { | 236 | if ($this.data('persenal-enable')) { |
231 | $.ajax({ | 237 | $.ajax({ |
232 | - url: href, | 238 | + url: '//m.yohobuy.com/activity/individuation/coupon', |
233 | dataType: 'jsonp', | 239 | dataType: 'jsonp', |
234 | data: data, | 240 | data: data, |
235 | success: function(res) { | 241 | success: function(res) { |
-
Please register or login to post a comment