Authored by 郭成尧

Merge remote-tracking branch 'origin/master' into feature/vipdouble

@@ -157,3 +157,4 @@ nbproject/* @@ -157,3 +157,4 @@ nbproject/*
157 .scannerwork 157 .scannerwork
158 package-lock.json 158 package-lock.json
159 yarn.lock 159 yarn.lock
  160 +yoho-yohobuy-wap.tar.gz
  1 +############################################################
  2 +# Dockerfile to build hystrix + turbin Installed Containers
  3 +# Based on centos 6.7
  4 +# How to build new image: docker build -t yoho-hystrix-qcloud .
  5 +# the hystrix alert need to post events to influxdb.yohoops.org.
  6 +# nginx version: 1.12.0
  7 +############################################################
  8 +
  9 +#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
  10 +FROM ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
  11 +
  12 +MAINTAINER xiaoxiao.hao <xiaoxiao.hao@yoho.cn>
  13 +
  14 +ENV NODE_ENV=production \
  15 + NODE_HOME=/home
  16 +
  17 +# COPY turbine configuration files
  18 +COPY yoho-yohobuy-wap.tar.gz /home
  19 +
  20 +RUN cd /home && \
  21 + mkdir -p /home/yoho-yohobuy-wap && \
  22 + tar -xzvf yoho-yohobuy-wap.tar.gz -C /home/yoho-yohobuy-wap && \
  23 + rm -rf yoho-yohobuy-wap.tar.gz
  24 +
  25 +WORKDIR /home/yoho-yohobuy-wap
  26 +
  27 +#expose port
  28 +EXPOSE 6001
  29 +
  30 +CMD ["node","/home/yoho-yohobuy-wap/app.js"]
@@ -171,6 +171,11 @@ try { @@ -171,6 +171,11 @@ try {
171 app.use(downloadBar()); 171 app.use(downloadBar());
172 app.use(riskManagement()); 172 app.use(riskManagement());
173 173
  174 + // docker验证项目是否正常发布
  175 + app.use('/node/status.html', (req, res) => {
  176 + return res.status(204).end();
  177 + });
  178 +
174 require('./dispatch')(app); 179 require('./dispatch')(app);
175 app.all('*', errorHanlder.notFound()); // 404 180 app.all('*', errorHanlder.notFound()); // 404
176 181
@@ -56,7 +56,7 @@ function droitHtml(contents) { @@ -56,7 +56,7 @@ function droitHtml(contents) {
56 {title: '特权介绍', data: ['金卡及以上会员享受限定次数的免费送达服务。']}, 56 {title: '特权介绍', data: ['金卡及以上会员享受限定次数的免费送达服务。']},
57 {title: '使用说明', data: [ 57 {title: '使用说明', data: [
58 '金卡会员每月可享3次普通快递免邮,白金会员每月可享5次顺丰快递免邮(顺丰无法触达地区将改发其他快递)。', 58 '金卡会员每月可享3次普通快递免邮,白金会员每月可享5次顺丰快递免邮(顺丰无法触达地区将改发其他快递)。',
59 - '免邮次数每月一日更新,会员等级升级时,免邮次数当天更新。', '金卡会员可消耗一次免邮次数将已达到免邮门槛的普通快递订单升级至顺丰快递。']}, 59 + '免邮次数每月一日更新,会员等级升级时,免邮次数当天更新。']},
60 ], 60 ],
61 interlocution: [] 61 interlocution: []
62 }; 62 };
@@ -44,5 +44,4 @@ router.get('/channel/2fb054e8315300a1ae1f80c3a4fda862.html', custom.zhihui); @@ -44,5 +44,4 @@ router.get('/channel/2fb054e8315300a1ae1f80c3a4fda862.html', custom.zhihui);
44 // 自定义频道 44 // 自定义频道
45 router.get('/channel/:id.html', custom.index); 45 router.get('/channel/:id.html', custom.index);
46 46
47 -  
48 module.exports = router; 47 module.exports = router;
@@ -33,10 +33,9 @@ const index = (req, res, next) => { @@ -33,10 +33,9 @@ const index = (req, res, next) => {
33 }); 33 });
34 34
35 _.forEach(result, item => { 35 _.forEach(result, item => {
36 - item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url;  
37 feed.addItem({ 36 feed.addItem({
38 title: item.title, 37 title: item.title,
39 - link: `${item.url}&ref=rss`, 38 + link: `https://m.yohobuy.com/guang/${item.id}.html?ref=rss`,
40 description: item.intro, 39 description: item.intro,
41 author: [{ 40 author: [{
42 name: (item.author && item.author.name) || ' ' 41 name: (item.author && item.author.name) || ' '
@@ -60,7 +59,7 @@ const rss = (req, res, next, gmt) => { @@ -60,7 +59,7 @@ const rss = (req, res, next, gmt) => {
60 return next(); 59 return next();
61 } 60 }
62 _.forEach(result, item => { 61 _.forEach(result, item => {
63 - item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url; 62 + item.url = `https://m.yohobuy.com/guang/${item.id}.html?ref=rss`;
64 let time = new Date(item.publishTimeLong && 63 let time = new Date(item.publishTimeLong &&
65 parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm')); 64 parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm'));
66 let format = gmt ? 'ddd, MM MMM YYYY hh:mm:ss +0800' : 'YYYY-MM-DD hh:mm:ss +0800'; 65 let format = gmt ? 'ddd, MM MMM YYYY hh:mm:ss +0800' : 'YYYY-MM-DD hh:mm:ss +0800';
@@ -33,16 +33,16 @@ class RssModel extends global.yoho.BaseModel { @@ -33,16 +33,16 @@ class RssModel extends global.yoho.BaseModel {
33 if (value.text) { // 文字 33 if (value.text) { // 文字
34 result += htmlProcess.removeHtml(htmlProcess.escapeToHtml(value.text.data.text)) + '<br/>'; 34 result += htmlProcess.removeHtml(htmlProcess.escapeToHtml(value.text.data.text)) + '<br/>';
35 } else if (value.singleImage) { // 单张图 35 } else if (value.singleImage) { // 单张图
36 - result += `<img src="${helpers.image(value.singleImage.data[0].src, 640, 640)}"/><br/>`; 36 + result += `<img src="https:${helpers.image(value.singleImage.data[0].src, 640, 640)}"/><br/>`;
37 } else if (value.smallPic && value.smallPic.data) { // 多张小图 37 } else if (value.smallPic && value.smallPic.data) { // 多张小图
38 value.smallPic.data.forEach((small) => { 38 value.smallPic.data.forEach((small) => {
39 - result += `<img src="${helpers.image(small.src, 315, 420)}"/>`; 39 + result += `<img src="https:${helpers.image(small.src, 315, 420)}"/>`;
40 }); 40 });
41 result += '<br/>'; 41 result += '<br/>';
42 } 42 }
43 }); 43 });
44 44
45 - result += `<a href="http://guang.m.yohobuy.com/info/index?id=${id}">查看原文</a>`; 45 + result += `<a href="https://m.yohobuy.com/guang/${id}.html?ref=rss">查看原文</a>`;
46 return result; 46 return result;
47 } 47 }
48 }); 48 });
1 <?xml version='1.0' encoding='utf-8'?> 1 <?xml version='1.0' encoding='utf-8'?>
2 <rss version='2.0'> 2 <rss version='2.0'>
3 <channel> 3 <channel>
4 - <language>zh-cn</language> 4 + <language>zh-cn</language>
5 <title><![CDATA[有货逛]]></title> 5 <title><![CDATA[有货逛]]></title>
6 <link><![CDATA[http://yohobuy.com]]></link> 6 <link><![CDATA[http://yohobuy.com]]></link>
7 <description><![CDATA[Yoho!Buy有货 | 年轻人潮流购物中心]]></description> 7 <description><![CDATA[Yoho!Buy有货 | 年轻人潮流购物中心]]></description>
@@ -17,13 +17,13 @@ @@ -17,13 +17,13 @@
17 {{# items}} 17 {{# items}}
18 <item> 18 <item>
19 <title><![CDATA[{{title}}]]></title> 19 <title><![CDATA[{{title}}]]></title>
20 - <link><![CDATA[{{{url}}}&ref=rss]]></link> 20 + <link><![CDATA[{{{url}}}]]></link>
21 <description><![CDATA[{{{intro}}}]]></description> 21 <description><![CDATA[{{{intro}}}]]></description>
22 <pubDate><![CDATA[{{publishTime}}]]></pubDate> 22 <pubDate><![CDATA[{{publishTime}}]]></pubDate>
23 <source><![CDATA[有货逛]]></source> 23 <source><![CDATA[有货逛]]></source>
24 <author>有货</author> 24 <author>有货</author>
25 </item> 25 </item>
26 {{/items}} 26 {{/items}}
27 - 27 +
28 </channel> 28 </channel>
29 -</rss>  
  29 +</rss>
@@ -412,7 +412,7 @@ function getRealIP(req) { @@ -412,7 +412,7 @@ function getRealIP(req) {
412 var realIP = req.headers['x-real-ip']; 412 var realIP = req.headers['x-real-ip'];
413 var forwardedFor = req.headers['x-forwarded-for'] || ''; 413 var forwardedFor = req.headers['x-forwarded-for'] || '';
414 414
415 - return realIP || forwardedFor.split(',')[0] || req.connection.remoteAddress; 415 + return req.yoho.clientIp || forwardedFor.split(',')[0] || realIP || req.connection.remoteAddress;
416 } 416 }
417 417
418 const activateService = (req, res, next) => { 418 const activateService = (req, res, next) => {
@@ -197,10 +197,13 @@ const common = { @@ -197,10 +197,13 @@ const common = {
197 if (req.session2 && req.session2.reset) { 197 if (req.session2 && req.session2.reset) {
198 req.session2.reset(); 198 req.session2.reset();
199 } 199 }
200 - if (req.session && req.session.regenerate) { 200 +
  201 + if (req.session && req.session.regenerate && req.sessionStore) {
201 return req.session.regenerate(() => { 202 return req.session.regenerate(() => {
202 return next(); 203 return next();
203 }); 204 });
  205 + } else {
  206 + return next();
204 } 207 }
205 208
206 // if (req.session) { 209 // if (req.session) {
@@ -210,7 +213,6 @@ const common = { @@ -210,7 +213,6 @@ const common = {
210 // delete req.session.TOKEN; 213 // delete req.session.TOKEN;
211 // delete req.session.LOGIN_UID; 214 // delete req.session.LOGIN_UID;
212 // } 215 // }
213 - // return next();  
214 }, 216 },
215 isLoginUser: (req, res, next) => { 217 isLoginUser: (req, res, next) => {
216 // 微信里边已经登录的时候,不再跳转登录 218 // 微信里边已经登录的时候,不再跳转登录
@@ -67,12 +67,6 @@ module.exports = { @@ -67,12 +67,6 @@ module.exports = {
67 index: '//m.yohobuy.com' 67 index: '//m.yohobuy.com'
68 }, 68 },
69 useCache: false, 69 useCache: false,
70 - memcache: {  
71 - master: ['127.0.0.1:11211'],  
72 - session: ['127.0.0.1:11211'],  
73 - timeout: 1000,  
74 - retries: 0  
75 - },  
76 interfaceShunt: { 70 interfaceShunt: {
77 open: false 71 open: false
78 }, 72 },
@@ -80,9 +74,12 @@ module.exports = { @@ -80,9 +74,12 @@ module.exports = {
80 infoFile: { 74 infoFile: {
81 close: true, 75 close: true,
82 name: 'info', 76 name: 'info',
83 - level: 'error', 77 + level: 'info',
84 filename: 'logs/info.log', 78 filename: 'logs/info.log',
85 - maxFiles: 7 79 + maxFiles: 7,
  80 + timestamp() {
  81 + return new Date().toString();
  82 + }
86 }, 83 },
87 errorFile: { 84 errorFile: {
88 close: true, 85 close: true,
@@ -90,7 +87,10 @@ module.exports = { @@ -90,7 +87,10 @@ module.exports = {
90 level: 'error', 87 level: 'error',
91 filename: 'logs/error.log', 88 filename: 'logs/error.log',
92 handleExceptions: true, 89 handleExceptions: true,
93 - maxFiles: 7 90 + maxFiles: 7,
  91 + timestamp() {
  92 + return new Date().toString();
  93 + }
94 }, 94 },
95 console: { 95 console: {
96 level: 'debug', 96 level: 'debug',
@@ -132,19 +132,27 @@ module.exports = { @@ -132,19 +132,27 @@ module.exports = {
132 connect: { 132 connect: {
133 host: '127.0.0.1', 133 host: '127.0.0.1',
134 port: '6379', 134 port: '6379',
  135 + password: '',
  136 + enable_offline_queue: false,
135 retry_strategy(options) { 137 retry_strategy(options) {
136 if (options.error && options.error.code === 'ECONNREFUSED') { 138 if (options.error && options.error.code === 'ECONNREFUSED') {
137 - console.log('redis连接不成功'); 139 + console.log('connect redis server fail');
138 } 140 }
139 - if (options.total_retry_time > 1000 * 60 * 60 * 6) {  
140 - console.log('redis连接超时');  
141 - return;  
142 - }  
143 - if (options.attempt > 10) {  
144 - return 1000 * 60 * 60 * 0.5; 141 +
  142 + if (options.attempt < 10) {
  143 + return Math.min(options.attempt * 100, 1000);
  144 + } else if (options.attempt > 10 && options.attempt < 100) {
  145 + return 1000;
  146 + } else {
  147 + return 1000 * 10;
145 } 148 }
146 - return Math.min(options.attempt * 100, 1000);  
147 } 149 }
  150 + },
  151 + session: {
  152 + host: '127.0.0.1',
  153 + port: '6379',
  154 + pass: '',
  155 + prefix: 'yohobuy_session:'
148 } 156 }
149 }, 157 },
150 REQUEST_LIMIT: { 158 REQUEST_LIMIT: {
@@ -180,24 +188,6 @@ if (isProduction) { @@ -180,24 +188,6 @@ if (isProduction) {
180 extstore: 'http://extstore.yohobuy.com', 188 extstore: 'http://extstore.yohobuy.com',
181 yohoNowApi: 'http://new.yohoboys.com/' 189 yohoNowApi: 'http://new.yohoboys.com/'
182 }, 190 },
183 - memcache: {  
184 - master: [  
185 - 'memcache1.yohoops.org:12111',  
186 - 'memcache2.yohoops.org:12111',  
187 - 'memcache3.yohoops.org:12111',  
188 - 'memcache4.yohoops.org:12111'  
189 - ],  
190 - session: [  
191 - 'memcache1.yohoops.org:12111',  
192 - 'memcache2.yohoops.org:12111',  
193 - 'memcache3.yohoops.org:12111',  
194 - 'memcache4.yohoops.org:12111'  
195 - ],  
196 - poolSize: 100,  
197 - reconnect: 5000,  
198 - timeout: 1000,  
199 - retries: 0  
200 - },  
201 useCache: true, 191 useCache: true,
202 interfaceShunt: { 192 interfaceShunt: {
203 open: false, 193 open: false,
@@ -226,21 +216,29 @@ if (isProduction) { @@ -226,21 +216,29 @@ if (isProduction) {
226 }, 216 },
227 redis: { 217 redis: {
228 connect: { 218 connect: {
229 - host: 'web.redis.yohoops.org'  
230 - },  
231 - port: '6379',  
232 - retry_strategy(options) {  
233 - if (options.error && options.error.code === 'ECONNREFUSED') {  
234 - console.log('redis连接不成功');  
235 - }  
236 - if (options.total_retry_time > 1000 * 60 * 60 * 6) {  
237 - console.log('redis连接超时');  
238 - return;  
239 - }  
240 - if (options.attempt > 10) {  
241 - return 1000 * 60 * 60 * 0.5; 219 + host: 'redis.web.yohoops.org',
  220 + port: '6379',
  221 + password: 'redis9646',
  222 + enable_offline_queue: false,
  223 + retry_strategy(options) {
  224 + if (options.error && options.error.code === 'ECONNREFUSED') {
  225 + console.log('connect redis server fail');
  226 + }
  227 +
  228 + if (options.attempt < 10) {
  229 + return Math.min(options.attempt * 100, 1000);
  230 + } else if (options.attempt > 10 && options.attempt < 100) {
  231 + return 1000;
  232 + } else {
  233 + return 1000 * 10;
  234 + }
242 } 235 }
243 - return Math.min(options.attempt * 100, 1000); 236 + },
  237 + session: {
  238 + host: 'redis.web.yohoops.org',
  239 + port: '6379',
  240 + pass: 'redis9646',
  241 + prefix: 'yohobuy_session:'
244 } 242 }
245 }, 243 },
246 report: { 244 report: {
@@ -250,21 +248,26 @@ if (isProduction) { @@ -250,21 +248,26 @@ if (isProduction) {
250 }, 248 },
251 loggers: { 249 loggers: {
252 infoFile: { 250 infoFile: {
253 - close: true,  
254 name: 'info', 251 name: 'info',
255 - level: 'error',  
256 - filename: 'logs/info.log',  
257 - maxFiles: 7 252 + level: 'info',
  253 + filename: '/Data/log/yoho-yohobuy-wap/info.log',
  254 + maxFiles: 7,
  255 + timestamp() {
  256 + return new Date().toString();
  257 + }
258 }, 258 },
259 errorFile: { 259 errorFile: {
260 - close: true,  
261 name: 'error', 260 name: 'error',
262 level: 'error', 261 level: 'error',
263 - filename: 'logs/error.log', 262 + filename: '/Data/log/yoho-yohobuy-wap/error.log',
264 handleExceptions: true, 263 handleExceptions: true,
265 - maxFiles: 7 264 + maxFiles: 7,
  265 + timestamp() {
  266 + return new Date().toString();
  267 + }
266 }, 268 },
267 console: { 269 console: {
  270 + close: true,
268 level: 'info', 271 level: 'info',
269 colorize: 'all', 272 colorize: 'all',
270 prettyPrint: true, 273 prettyPrint: true,
@@ -287,13 +290,6 @@ if (isProduction) { @@ -287,13 +290,6 @@ if (isProduction) {
287 extstore: 'http://extstore-test1.yohops.com', 290 extstore: 'http://extstore-test1.yohops.com',
288 yohoNowApi: process.env.YOHO_NOW_API || 'http://yohonow-test.yohops.com:9999/' 291 yohoNowApi: process.env.YOHO_NOW_API || 'http://yohonow-test.yohops.com:9999/'
289 }, 292 },
290 - memcache: {  
291 - master: ['127.0.0.1:12111'],  
292 - session: ['127.0.0.1:12111'],  
293 - timeout: 100,  
294 - reconnect: 5000,  
295 - retries: 0  
296 - },  
297 useCache: true, 293 useCache: true,
298 alipayConfig: { 294 alipayConfig: {
299 payUrl: 'https://mapi.alipay.com/gateway.do', 295 payUrl: 'https://mapi.alipay.com/gateway.do',
  1 +#!/bin/bash
  2 +wordir=$2
  3 +cd $wordir
  4 +rm -rf yoho-yohobuy-wap.tar.gz
  5 +if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]];then
  6 +yarn
  7 +yarn build
  8 +else
  9 +npm i --production
  10 +fi
  11 +tar -czvf yoho-yohobuy-wap.tar.gz *
@@ -53,19 +53,7 @@ const limiter = (rule, policy, context) => { @@ -53,19 +53,7 @@ const limiter = (rule, policy, context) => {
53 }; 53 };
54 54
55 module.exports = (req, res, next) => { 55 module.exports = (req, res, next) => {
56 - let remoteIp = req.get('X-Forwarded-For') || req.get('X-Real-IP') || '';  
57 -  
58 - if (remoteIp.indexOf(',') > 0) {  
59 - let arr = remoteIp.split(',');  
60 -  
61 - remoteIp = arr[arr.length - 1];  
62 - }  
63 -  
64 - remoteIp = _.trim(remoteIp);  
65 -  
66 - if (_.startsWith(remoteIp, '10.66.')) {  
67 - remoteIp = req.get('X-Real-IP');  
68 - } 56 + let remoteIp = req.yoho.clientIp || '';
69 57
70 // 排除条件:ip白名单/路径白名单/异步请求/登录用户 58 // 排除条件:ip白名单/路径白名单/异步请求/登录用户
71 const excluded = _.includes(IP_WHITE_LIST, remoteIp) || 59 const excluded = _.includes(IP_WHITE_LIST, remoteIp) ||
@@ -14,7 +14,7 @@ const net = require('net'); @@ -14,7 +14,7 @@ const net = require('net');
14 * @param {*} req 14 * @param {*} req
15 */ 15 */
16 const _getClientIp = req => { 16 const _getClientIp = req => {
17 - let remoteIp = req.get('X-Forwarded-For') || req.get('X-Real-IP') || req.ip; 17 + let remoteIp = req.get('X-Yoho-Real-IP') || req.get('X-Forwarded-For') || req.get('X-Real-IP') || req.ip;
18 18
19 if (remoteIp.indexOf(',') > 0) { 19 if (remoteIp.indexOf(',') > 0) {
20 let arr = remoteIp.split(','); 20 let arr = remoteIp.split(',');
1 const config = global.yoho.config; 1 const config = global.yoho.config;
2 -const memcachedSession = require('yoho-express-session'); 2 +const session = require('yoho-express-session');
3 const _ = require('lodash'); 3 const _ = require('lodash');
4 const uuid = require('uuid'); 4 const uuid = require('uuid');
5 5
6 const cookieSession = require('client-sessions'); 6 const cookieSession = require('client-sessions');
7 -const memcached = require('connect-memcached');  
8 -const MemcachedStore = memcached(memcachedSession); 7 +const connectRedis = require('connect-redis');
  8 +const RedisStore = connectRedis(session);
9 9
10 /** 10 /**
11 - * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 memcached 出错了,使用 cookie session 11 + * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session
12 * @param opts.backSession cookieSession 的键名 12 * @param opts.backSession cookieSession 的键名
13 * @returns {function(*=, *=, *)} 13 * @returns {function(*=, *=, *)}
14 */ 14 */
15 function yohoSession(opts) { 15 function yohoSession(opts) {
16 return (req, res, next) => { 16 return (req, res, next) => {
17 - let notUseMemcached = _.get(req.app.locals.wap, 'session.removeMemcached', false); 17 + let notUseRedis = _.get(req.app.locals.wap, 'session.removeMemcached', false);
18 18
19 opts.backSession = opts.backSession || 'session2'; 19 opts.backSession = opts.backSession || 'session2';
20 20
21 - if (req.session && !notUseMemcached) { 21 + if (req.session && !notUseRedis) {
22 req.sessionError = false; 22 req.sessionError = false;
23 } else { 23 } else {
24 // 重建 session 24 // 重建 session
@@ -26,8 +26,8 @@ function yohoSession(opts) { @@ -26,8 +26,8 @@ function yohoSession(opts) {
26 req.sessionError = true; 26 req.sessionError = true;
27 27
28 req.sessionID = req.sessionID || uuid.v4(); 28 req.sessionID = req.sessionID || uuid.v4();
29 - req.session = new memcachedSession.Session(req, req[opts.backSession].sessionBack);  
30 - req.session.cookie = new memcachedSession.Cookie({ 29 + req.session = new session.Session(req, req[opts.backSession].sessionBack);
  30 + req.session.cookie = new session.Cookie({
31 domain: 'yohobuy.com', 31 domain: 'yohobuy.com',
32 httpOnly: true 32 httpOnly: true
33 }); 33 });
@@ -51,7 +51,7 @@ function yohoSession(opts) { @@ -51,7 +51,7 @@ function yohoSession(opts) {
51 } 51 }
52 52
53 module.exports = (app) => { 53 module.exports = (app) => {
54 - app.use(memcachedSession({ // eslint-disable-line 54 + app.use(session({ // eslint-disable-line
55 proxy: true, 55 proxy: true,
56 resave: false, 56 resave: false,
57 saveUninitialized: true, 57 saveUninitialized: true,
@@ -65,13 +65,7 @@ module.exports = (app) => { @@ -65,13 +65,7 @@ module.exports = (app) => {
65 domain: 'yohobuy.com', 65 domain: 'yohobuy.com',
66 httpOnly: true 66 httpOnly: true
67 }, 67 },
68 - store: new MemcachedStore({  
69 - hosts: config.memcache.session,  
70 - prefix: 'yohobuy_session:',  
71 - reconnect: 5000,  
72 - timeout: 1000,  
73 - retries: 0  
74 - }) 68 + store: new RedisStore(config.redis.session)
75 })); 69 }));
76 70
77 app.use(cookieSession({ // eslint-disable-line 71 app.use(cookieSession({ // eslint-disable-line
1 { 1 {
2 "name": "yohobuywap-node", 2 "name": "yohobuywap-node",
3 - "version": "6.5.34", 3 + "version": "6.5.35",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -46,8 +46,8 @@ @@ -46,8 +46,8 @@
46 "cheerio": "^0.22.0", 46 "cheerio": "^0.22.0",
47 "client-sessions": "^0.8.0", 47 "client-sessions": "^0.8.0",
48 "compression": "^1.7.0", 48 "compression": "^1.7.0",
49 - "connect-memcached": "^0.2.0",  
50 "connect-multiparty": "^2.0.0", 49 "connect-multiparty": "^2.0.0",
  50 + "connect-redis": "^3.3.3",
51 "cookie-parser": "^1.4.3", 51 "cookie-parser": "^1.4.3",
52 "cssnano": "^3.10.0", 52 "cssnano": "^3.10.0",
53 "express": "^4.15.4", 53 "express": "^4.15.4",
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 "xml2js": "^0.4.19", 74 "xml2js": "^0.4.19",
75 "yoho-express-session": "^2.0.0", 75 "yoho-express-session": "^2.0.0",
76 "yoho-md5": "^2.0.0", 76 "yoho-md5": "^2.0.0",
77 - "yoho-node-lib": "=0.6.3", 77 + "yoho-node-lib": "=0.6.8",
78 "yoho-zookeeper": "^1.0.9" 78 "yoho-zookeeper": "^1.0.9"
79 }, 79 },
80 "devDependencies": { 80 "devDependencies": {
@@ -21,6 +21,7 @@ let $useCoupon = $('#useCoupon'); @@ -21,6 +21,7 @@ let $useCoupon = $('#useCoupon');
21 let $notUseCoupon = $('#notUseCoupon'); 21 let $notUseCoupon = $('#notUseCoupon');
22 22
23 let winH = $(window).height(); 23 let winH = $(window).height();
  24 +let linkUrl = document.referrer;
24 25
25 require('common'); 26 require('common');
26 require('cart/cartbuynow/select-coupon'); 27 require('cart/cartbuynow/select-coupon');
@@ -40,7 +41,11 @@ function fixedLayOut() { @@ -40,7 +41,11 @@ function fixedLayOut() {
40 } 41 }
41 42
42 function goToBack() { 43 function goToBack() {
43 - history.go(-1); 44 + if (linkUrl) {
  45 + window.location.href = linkUrl;
  46 + } else {
  47 + history.go(-1);
  48 + }
44 } 49 }
45 50
46 /** 51 /**
@@ -20,6 +20,7 @@ let $useCoupon = $('#useCoupon'); @@ -20,6 +20,7 @@ let $useCoupon = $('#useCoupon');
20 let $notUseCoupon = $('#notUseCoupon'); 20 let $notUseCoupon = $('#notUseCoupon');
21 21
22 let winH = $(window).height(); 22 let winH = $(window).height();
  23 +let linkUrl = document.referrer;
23 24
24 require('common'); 25 require('common');
25 require('cart/cartbuynow/select-coupon'); 26 require('cart/cartbuynow/select-coupon');
@@ -39,7 +40,11 @@ function fixedLayOut() { @@ -39,7 +40,11 @@ function fixedLayOut() {
39 } 40 }
40 41
41 function goToBack() { 42 function goToBack() {
42 - history.go(-1); 43 + if (linkUrl) {
  44 + window.location.href = linkUrl;
  45 + } else {
  46 + history.go(-1);
  47 + }
43 } 48 }
44 49
45 /** 50 /**
@@ -88,6 +93,7 @@ $useCoupon.on('click', function() { @@ -88,6 +93,7 @@ $useCoupon.on('click', function() {
88 } 93 }
89 94
90 orderInfo('couponCode', couponCodeArray.join(',')); 95 orderInfo('couponCode', couponCodeArray.join(','));
  96 +
91 if (couponCodeArray.length > 0) { 97 if (couponCodeArray.length > 0) {
92 goToBack(); 98 goToBack();
93 } else { 99 } else {