Authored by htoooth

Merge branch 'master' into release/5.9

@@ -16,11 +16,19 @@ const index = co(function* (channel) { @@ -16,11 +16,19 @@ const index = co(function* (channel) {
16 16
17 const removeBlack = (remoteIp) => { 17 const removeBlack = (remoteIp) => {
18 let key = `pc:limiter:${remoteIp}`, 18 let key = `pc:limiter:${remoteIp}`,
19 - key10m = `pc:limiter:10m:${remoteIp}`; 19 + key10m = `pc:limiter:10m:${remoteIp}`,
  20 + keyMax = `pc:limiter:max:${remoteIp}`,
  21 + key10mMax = `pc:limiter:10m:max:${remoteIp}`,
  22 + synchronizeKey = `pc:limiter:synchronize:${remoteIp}`,
  23 + spiderKey = `pc:limiter:spider:${remoteIp}`;
20 24
21 return Promise.all([ 25 return Promise.all([
22 cache.delAsync(key), 26 cache.delAsync(key),
23 - cache.delAsync(key10m) 27 + cache.delAsync(key10m),
  28 + cache.delAsync(keyMax),
  29 + cache.delAsync(key10mMax),
  30 + cache.delAsync(synchronizeKey),
  31 + cache.delAsync(spiderKey)
24 ]); 32 ]);
25 }; 33 };
26 34
@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 税      号: 122 税      号:
123 </span> 123 </span>
124 <div class="row-content"> 124 <div class="row-content">
125 - <input id="company-tax-num" class="company-tax-num" type="text" placeholder="请输入纳税人识别号"> 125 + <input id="company-tax-num" class="company-tax-num" type="text" placeholder="请输入正确的纳税人识别号">
126 <span class="input-tip company-tax-tip red hide"> 126 <span class="input-tip company-tax-tip red hide">
127 <span class="iconfont">&#xe629;</span> 127 <span class="iconfont">&#xe629;</span>
128 <em>请填写纳税人识别号</em> 128 <em>请填写纳税人识别号</em>
@@ -295,7 +295,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -295,7 +295,7 @@ module.exports = class extends global.yoho.BaseModel {
295 ht = `${params.keywords}`; 295 ht = `${params.keywords}`;
296 } else { 296 } else {
297 nav = _this._getNav(params.id, menuData, params.url); 297 nav = _this._getNav(params.id, menuData, params.url);
298 - ht = _.last(nav).name; 298 + ht = _.get(_.last(nav), 'name', '');
299 } 299 }
300 300
301 return { 301 return {
@@ -42,11 +42,14 @@ const index = (req, res, next) => { @@ -42,11 +42,14 @@ const index = (req, res, next) => {
42 return res.render('search/no-result', resData); 42 return res.render('search/no-result', resData);
43 } 43 }
44 44
45 - Object.assign(resData, {  
46 - title: `${queryKey}价格_图片_品牌_怎么样-YOHO!BUY有货`,  
47 - keywords: `${queryKey},${queryKey}价格,${queryKey}图片,${queryKey}怎么样,${queryKey}品牌,YOHO!BUY有货`,  
48 - description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(resData, 'search.totalCount', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货` // eslint-disable-line  
49 - }); 45 + if (queryKey) {
  46 + Object.assign(resData, {
  47 + title: `${queryKey}价格_图片_品牌_怎么样-YOHO!BUY有货`,
  48 + keywords: `${queryKey},${queryKey}价格,${queryKey}图片,${queryKey}怎么样,${queryKey}品牌,YOHO!BUY有货`,
  49 + description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(resData, 'search.totalCount', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货` // eslint-disable-line
  50 + });
  51 + }
  52 +
50 res.render('search/index', resData); 53 res.render('search/index', resData);
51 54
52 }); 55 });
@@ -11,7 +11,7 @@ module.exports = (url, width, height) => { @@ -11,7 +11,7 @@ module.exports = (url, width, height) => {
11 <a href="javascript:;" class="video-close-btn"></a> 11 <a href="javascript:;" class="video-close-btn"></a>
12 <object id="video_0" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" 12 <object id="video_0" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
13 classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> 13 classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
14 - <param value="http://rescdn.yohoboys.com/res/new/boys/swf/util/VideoPlayerNew.swf?id=video_0&amp;url=${url}&amp;language=1&amp;sharepic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg?imageMogr2/thumbnail/738x424|watermark/1/image/aHR0cDovL3Jlc2Nkbi55b2hvYm95cy5jb20vcmVzL25ldy9ib3lzL2ltYWdlcy9iYW5uZXJwbGF5LnBuZw==/dissolve/100/gravity/Center/dx/10/dy/10&amp;title1=Meet...Cody Sanderson &amp;shareurl=http://www.yohoboys.com/channel/detail/index/id/10657/time/1478052894&amp;coverpic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg" 14 + <param value="//cdn.yoho.cn/tool/VideoPlayerNew.swf?id=video_0&amp;url=${url}&amp;language=1&amp;sharepic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg?imageMogr2/thumbnail/738x424|watermark/1/image/aHR0cDovL3Jlc2Nkbi55b2hvYm95cy5jb20vcmVzL25ldy9ib3lzL2ltYWdlcy9iYW5uZXJwbGF5LnBuZw==/dissolve/100/gravity/Center/dx/10/dy/10&amp;title1=Meet...Cody Sanderson &amp;shareurl=http://www.yohoboys.com/channel/detail/index/id/10657/time/1478052894&amp;coverpic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg"
15 name="movie"> 15 name="movie">
16 <param value="high" name="quality"> 16 <param value="high" name="quality">
17 <param value="#ffffff" name="bgcolor"> 17 <param value="#ffffff" name="bgcolor">
@@ -21,7 +21,7 @@ module.exports = (url, width, height) => { @@ -21,7 +21,7 @@ module.exports = (url, width, height) => {
21 <embed style="width: ${width}px;height: ${height}px;" id="flash" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" 21 <embed style="width: ${width}px;height: ${height}px;" id="flash" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer"
22 type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" loop="false" 22 type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" loop="false"
23 play="true" bgcolor="#ffffff" quality="high" wmode="transparent" name="vMessage" 23 play="true" bgcolor="#ffffff" quality="high" wmode="transparent" name="vMessage"
24 - src="http://rescdn.yohoboys.com/res/new/boys/swf/util/VideoPlayerNew.swf?id=video_0&amp;url=${url}&amp;language=1&amp;sharepic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg?imageMogr2/thumbnail/738x424|watermark/1/image/aHR0cDovL3Jlc2Nkbi55b2hvYm95cy5jb20vcmVzL25ldy9ib3lzL2ltYWdlcy9iYW5uZXJwbGF5LnBuZw==/dissolve/100/gravity/Center/dx/10/dy/10&amp;title1=Meet...Cody Sanderson &amp;shareurl=http://www.yohoboys.com/channel/detail/index/id/10657/time/1478052894&amp;coverpic=${url}?vframe/jpg/offset/0"> 24 + src="//cdn.yoho.cn/tool/VideoPlayerNew.swf?id=video_0&amp;url=${url}&amp;language=1&amp;sharepic=http://img01.yohoboys.com/contentimg/2016/06/12/14/0183fabea5332c5902cdd1d0d7fb63df04.jpg?imageMogr2/thumbnail/738x424|watermark/1/image/aHR0cDovL3Jlc2Nkbi55b2hvYm95cy5jb20vcmVzL25ldy9ib3lzL2ltYWdlcy9iYW5uZXJwbGF5LnBuZw==/dissolve/100/gravity/Center/dx/10/dy/10&amp;title1=Meet...Cody Sanderson &amp;shareurl=http://www.yohoboys.com/channel/detail/index/id/10657/time/1478052894&amp;coverpic=${url}?vframe/jpg/offset/0">
25 </object> 25 </object>
26 </div> `; 26 </div> `;
27 }; 27 };
@@ -64,7 +64,7 @@ const setSearchData = (result, params, channel) => { @@ -64,7 +64,7 @@ const setSearchData = (result, params, channel) => {
64 _.get(finalResult, 'search.leftContent.sort', {})); 64 _.get(finalResult, 'search.leftContent.sort', {}));
65 65
66 filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions, 66 filters.checkedConditions.conditions = _.concat(filters.checkedConditions.conditions,
67 - finalResult.search.leftContent.checked); 67 + _.get(finalResult, 'search.leftContent.checked', []));
68 68
69 Object.assign(finalResult.search, 69 Object.assign(finalResult.search,
70 searchHandler.handlePathNavData({total: result[2].data.total }, params, 'search', channel), 70 searchHandler.handlePathNavData({total: result[2].data.total }, params, 'search', channel),
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 7
8 'use strict'; 8 'use strict';
9 const aes = require('./aes-pwd'); 9 const aes = require('./aes-pwd');
  10 +const helpers = global.yoho.helpers;
10 const common = require('../../../config/common'); 11 const common = require('../../../config/common');
11 const clientApi = require('../models/client-api'); 12 const clientApi = require('../models/client-api');
12 const clientService = require('../models/client-service'); 13 const clientService = require('../models/client-service');
@@ -16,10 +17,11 @@ const clientService = require('../models/client-service'); @@ -16,10 +17,11 @@ const clientService = require('../models/client-service');
16 */ 17 */
17 const index = (req, res, next) => { 18 const index = (req, res, next) => {
18 let type = 2; 19 let type = 2;
  20 + let uid = req.user.uid;
19 let reg = /MSIE\s?[987]\.0/i; 21 let reg = /MSIE\s?[987]\.0/i;
20 let userAgent = req.headers['user-agent']; 22 let userAgent = req.headers['user-agent'];
21 let unSupport = reg.test(userAgent); 23 let unSupport = reg.test(userAgent);
22 - let encryptedUid = aes.encryptionUid(req.user.uid); 24 + let encryptedUid = aes.encryptionUid(uid);
23 let domains = common.domains; 25 let domains = common.domains;
24 let imCs = domains.imCs; 26 let imCs = domains.imCs;
25 let imSocket = domains.imSocket; 27 let imSocket = domains.imSocket;
@@ -36,8 +38,11 @@ const index = (req, res, next) => { @@ -36,8 +38,11 @@ const index = (req, res, next) => {
36 layout: false 38 layout: false
37 }); 39 });
38 } else { 40 } else {
39 - clientService.getClientData(type, encryptedUid) 41 + clientService.getClientData(uid, type, encryptedUid)
40 .then(result => { 42 .then(result => {
  43 + if (result.code === 401) {
  44 + return res.redirect(helpers.urlFormat('/signin.html'));
  45 + }
41 res.render('client', Object.assign(data, result)); 46 res.render('client', Object.assign(data, result));
42 }).catch(next); 47 }).catch(next);
43 } 48 }
@@ -58,10 +63,11 @@ const domains = (req, res) => { @@ -58,10 +63,11 @@ const domains = (req, res) => {
58 * @param next 63 * @param next
59 */ 64 */
60 const history = (req, res, next) => { 65 const history = (req, res, next) => {
61 - const encId = aes.encryptionUid(req.user.uid); 66 + const uid = req.user.uid;
  67 + const encId = aes.encryptionUid(uid);
62 const endTime = req.body.endTime; 68 const endTime = req.body.endTime;
63 69
64 - clientApi.getMsgHistory(encId, endTime) 70 + clientApi.getMsgHistory(uid, encId, endTime)
65 .then(result => { 71 .then(result => {
66 res.json(result); 72 res.json(result);
67 }).catch(next); 73 }).catch(next);
@@ -74,7 +80,10 @@ const history = (req, res, next) => { @@ -74,7 +80,10 @@ const history = (req, res, next) => {
74 * @param next 80 * @param next
75 */ 81 */
76 const saveEval = (req, res, next) => { 82 const saveEval = (req, res, next) => {
77 - const params = {}; 83 + const uid = req.user.uid;
  84 + const params = {
  85 + uid
  86 + };
78 87
79 params.stars = req.body.stars; 88 params.stars = req.body.stars;
80 params.promoter = req.body.promoter; 89 params.promoter = req.body.promoter;
@@ -102,9 +111,12 @@ const saveEval = (req, res, next) => { @@ -102,9 +111,12 @@ const saveEval = (req, res, next) => {
102 * @param next 111 * @param next
103 */ 112 */
104 const queryReason = (req, res, next) => { 113 const queryReason = (req, res, next) => {
  114 + const uid = req.user.uid;
105 const type = req.body.type; 115 const type = req.body.type;
  116 + const encryptedUid = aes.encryptionUid(uid);
  117 +
106 118
107 - clientApi.queryReason(type) 119 + clientApi.queryReason(uid, encryptedUid, type)
108 .then(result => { 120 .then(result => {
109 res.json(result); 121 res.json(result);
110 }).catch(next); 122 }).catch(next);
@@ -117,11 +129,12 @@ const queryReason = (req, res, next) => { @@ -117,11 +129,12 @@ const queryReason = (req, res, next) => {
117 * @param next 129 * @param next
118 */ 130 */
119 const saveMessage = (req, res, next) => { 131 const saveMessage = (req, res, next) => {
  132 + const uid = req.user.uid;
120 const content = req.body.content; 133 const content = req.body.content;
121 const encId = req.body.encryptedUid; 134 const encId = req.body.encryptedUid;
122 const cvId = req.body.conversationId; 135 const cvId = req.body.conversationId;
123 136
124 - clientApi.saveMessage(content, encId, cvId) 137 + clientApi.saveMessage(content, encId, cvId, uid)
125 .then(result => { 138 .then(result => {
126 res.json(result); 139 res.json(result);
127 }).catch(next); 140 }).catch(next);
@@ -32,8 +32,9 @@ let urls = { @@ -32,8 +32,9 @@ let urls = {
32 * @param { string } encryptedUid 用户ID 32 * @param { string } encryptedUid 用户ID
33 * @return { Object } 最近10条订单 33 * @return { Object } 最近10条订单
34 */ 34 */
35 -const getLastTenOrders = (encryptedUid) => { 35 +const getLastTenOrders = (uid, encryptedUid) => {
36 return api.post(urls.lastTen, { 36 return api.post(urls.lastTen, {
  37 + uid,
37 encryptedUid 38 encryptedUid
38 }); 39 });
39 }; 40 };
@@ -43,8 +44,11 @@ const getLastTenOrders = (encryptedUid) => { @@ -43,8 +44,11 @@ const getLastTenOrders = (encryptedUid) => {
43 * @function getQas 44 * @function getQas
44 * @return { Object } 问答列表 45 * @return { Object } 问答列表
45 */ 46 */
46 -const getQas = () => {  
47 - return api.post(urls.qas, {}); 47 +const getQas = (uid, encryptedUid) => {
  48 + return api.post(urls.qas, {
  49 + uid,
  50 + encryptedUid
  51 + });
48 }; 52 };
49 53
50 /** 54 /**
@@ -65,8 +69,10 @@ const getCsSetting = (type) => { @@ -65,8 +69,10 @@ const getCsSetting = (type) => {
65 * @param { string } endTime 截止时间 69 * @param { string } endTime 截止时间
66 * @return { Array } 历史聊天记录 70 * @return { Array } 历史聊天记录
67 */ 71 */
68 -const getMsgHistory = (encryptedUid, endTime) => { 72 +const getMsgHistory = (uid, encryptedUid, endTime) => {
  73 +
69 let params = { 74 let params = {
  75 + uid,
70 encryptedUid 76 encryptedUid
71 }; 77 };
72 78
@@ -91,9 +97,11 @@ const saveEval = (params) => { @@ -91,9 +97,11 @@ const saveEval = (params) => {
91 * @param cvId 97 * @param cvId
92 * @returns {*} 98 * @returns {*}
93 */ 99 */
94 -const queryReason = (type) => { 100 +const queryReason = (uid, encryptedUid, type) => {
95 const params = { 101 const params = {
96 - type 102 + uid,
  103 + type,
  104 + encryptedUid
97 }; 105 };
98 106
99 return api.post(urls.evalReason, params); 107 return api.post(urls.evalReason, params);
@@ -106,8 +114,9 @@ const queryReason = (type) => { @@ -106,8 +114,9 @@ const queryReason = (type) => {
106 * @param cvId 会话ID 114 * @param cvId 会话ID
107 * @returns {*} 115 * @returns {*}
108 */ 116 */
109 -const saveMessage = (content, encId, cvId) => { 117 +const saveMessage = (content, encId, cvId, uid) => {
110 const params = { 118 const params = {
  119 + uid,
111 content, 120 content,
112 encryptedUid: encId, 121 encryptedUid: encId,
113 conversationId: cvId 122 conversationId: cvId
@@ -17,7 +17,7 @@ const clientAPI = require('./client-api'); @@ -17,7 +17,7 @@ const clientAPI = require('./client-api');
17 * @param { string } encryptedUid 17 * @param { string } encryptedUid
18 * @return { Object } 客服设置 18 * @return { Object } 客服设置
19 */ 19 */
20 -const getClientData = (type, encryptedUid) => { 20 +const getClientData = (uid, type, encryptedUid) => {
21 const logoSize = '136x40'; 21 const logoSize = '136x40';
22 const qcSize = '135x135'; 22 const qcSize = '135x135';
23 const advSize = '160x335'; 23 const advSize = '160x335';
@@ -25,9 +25,9 @@ const getClientData = (type, encryptedUid) => { @@ -25,9 +25,9 @@ const getClientData = (type, encryptedUid) => {
25 25
26 let apiMethod = [ 26 let apiMethod = [
27 clientAPI.getCsSetting(type), 27 clientAPI.getCsSetting(type),
28 - clientAPI.getMsgHistory(encryptedUid),  
29 - clientAPI.getLastTenOrders(encryptedUid),  
30 - clientAPI.getQas() 28 + clientAPI.getMsgHistory(uid, encryptedUid),
  29 + clientAPI.getLastTenOrders(uid, encryptedUid),
  30 + clientAPI.getQas(uid, encryptedUid)
31 ]; 31 ];
32 32
33 return Promise.all(apiMethod) 33 return Promise.all(apiMethod)
@@ -38,6 +38,14 @@ const getClientData = (type, encryptedUid) => { @@ -38,6 +38,14 @@ const getClientData = (type, encryptedUid) => {
38 let records = []; 38 let records = [];
39 let hasHistory = false; 39 let hasHistory = false;
40 40
  41 + if (res[1].code === 401 ||
  42 + res[2].code === 401 ||
  43 + res[3].code === 401) {
  44 + return {
  45 + code: 401
  46 + };
  47 + }
  48 +
41 if (res[0] && res[0].code === 200) { 49 if (res[0] && res[0].code === 200) {
42 if (res[0].data.config) { 50 if (res[0].data.config) {
43 csSetting = res[0].data.config; 51 csSetting = res[0].data.config;
@@ -5,6 +5,7 @@ const logger = global.yoho.logger; @@ -5,6 +5,7 @@ const logger = global.yoho.logger;
5 const ip = require('./rules/ip-list'); 5 const ip = require('./rules/ip-list');
6 const userAgent = require('./rules/useragent'); 6 const userAgent = require('./rules/useragent');
7 const qpsLimiter = require('./rules/qps-limit'); 7 const qpsLimiter = require('./rules/qps-limit');
  8 +const asynchronous = require('./rules/asynchronous');
8 9
9 // const fakerLimiter = require('./rules/faker-limit'); 10 // const fakerLimiter = require('./rules/faker-limit');
10 const captchaPolicy = require('./policies/captcha'); 11 const captchaPolicy = require('./policies/captcha');
@@ -53,7 +54,8 @@ module.exports = (req, res, next) => { @@ -53,7 +54,8 @@ module.exports = (req, res, next) => {
53 Promise.all([ 54 Promise.all([
54 limiter(userAgent, captchaPolicy, context), 55 limiter(userAgent, captchaPolicy, context),
55 limiter(ip, captchaPolicy, context), 56 limiter(ip, captchaPolicy, context),
56 - limiter(qpsLimiter, captchaPolicy, context) 57 + limiter(qpsLimiter, captchaPolicy, context),
  58 + limiter(asynchronous, captchaPolicy, context)
57 59
58 // limiter(fakerLimiter, reporterPolicy, context) 60 // limiter(fakerLimiter, reporterPolicy, context)
59 ]).then((results) => { 61 ]).then((results) => {
  1 +'use strict';
  2 +
  3 +const cache = global.yoho.cache.master;
  4 +const _ = require('lodash');
  5 +const logger = global.yoho.logger;
  6 +
  7 +
  8 +const ASYNCHRONOUSPAGES = {
  9 + '/product/index/isFavoriteShop': 1,
  10 + '/common/suggestfeedback': 1,
  11 + '/product/detail/hotarea': 1,
  12 + '/common/getbanner': 1,
  13 + '/passport/cert/headerTip': 1
  14 +};
  15 +
  16 +function isNormalSpider(userAgent) {
  17 + let normalReg = /(spider)|(bot.html)/i;
  18 +
  19 + if (normalReg.test(userAgent)) {
  20 + return true;
  21 + } else {
  22 + return false;
  23 + }
  24 +
  25 +}
  26 +
  27 +module.exports = (limiter, policy) => {
  28 + const ua = limiter.req.header('User-Agent');
  29 + const synchronizeKey = `pc:limiter:synchronize:${limiter.remoteIp}`; // 同步
  30 + const asynchronousKey = `pc:limiter:asynchronous:${limiter.remoteIp}`; // 异步
  31 + const spiderKey = `pc:limiter:spider:${limiter.remoteIp}`; // 异步
  32 +
  33 + // 正常蜘蛛直接过
  34 + if (isNormalSpider(ua)) {
  35 + return Promise.resolve(true);
  36 + }
  37 +
  38 +
  39 + const req = limiter.req,
  40 + res = limiter.res;
  41 +
  42 + res.on('render', function() {
  43 + cache.incrAsync(synchronizeKey, 1).catch(e=>console.log(e)); // eslint-disable-line
  44 + });
  45 +
  46 + return cache.getMultiAsync([synchronizeKey, asynchronousKey, spiderKey]).then((results) => {
  47 + logger.debug(results);
  48 +
  49 + if (results[spiderKey]) {
  50 + return Promise.resolve(policy);
  51 + }
  52 +
  53 + // 默认数据设置
  54 + if (!results[synchronizeKey] && !_.isNumber(results[synchronizeKey])) {
  55 + cache.setAsync(synchronizeKey, 1, 600);
  56 + }
  57 +
  58 + // 默认数据设置
  59 + if (ASYNCHRONOUSPAGES[req.path] > 0) {
  60 + cache.setAsync(asynchronousKey, 1, 600);
  61 + cache.setAsync(synchronizeKey, 1, 600);
  62 + }
  63 +
  64 + if (results[synchronizeKey] > 10 && !results[asynchronousKey]) {
  65 + cache.setAsync(spiderKey, 1, 60 * 60 * 24);
  66 + return Promise.resolve(policy);
  67 + }
  68 +
  69 + return Promise.resolve(true);
  70 +
  71 + });
  72 +};
1 { 1 {
2 "name": "yohobuy-node", 2 "name": "yohobuy-node",
3 - "version": "5.8.4", 3 + "version": "5.8.7",
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": {
@@ -237,6 +237,7 @@ function _loadPage() { @@ -237,6 +237,7 @@ function _loadPage() {
237 237
238 // 接入人工客服需要评价 238 // 接入人工客服需要评价
239 processInfo.manual = true; 239 processInfo.manual = true;
  240 + processInfo.savedEval = false;
240 241
241 // 显示评价&隐藏人工 242 // 显示评价&隐藏人工
242 edit.setIcons({ 243 edit.setIcons({
@@ -607,6 +608,12 @@ function _loadPage() { @@ -607,6 +608,12 @@ function _loadPage() {
607 608
608 serviceApi.history(data) 609 serviceApi.history(data)
609 .done(function(res) { 610 .done(function(res) {
  611 + if (res && res.code === 401) {
  612 + window.onbeforeunload = null;
  613 + return location.href = '//www.yohobuy.com/signin.html?refer=' + // eslint-disable-line
  614 + encodeURIComponent(location.href);
  615 + }
  616 +
610 if (res && res.code === 200) { 617 if (res && res.code === 200) {
611 if (processInfo.hasMore) { 618 if (processInfo.hasMore) {
612 msgList = res.data.records || []; 619 msgList = res.data.records || [];
@@ -690,7 +697,13 @@ function _loadPage() { @@ -690,7 +697,13 @@ function _loadPage() {
690 encryptedUid: encryptedUid, 697 encryptedUid: encryptedUid,
691 conversationId: socketConfCM.conversationId 698 conversationId: socketConfCM.conversationId
692 }) 699 })
693 - .done(function() {}) 700 + .done(function(res) {
  701 + if (res && res.code === 401) {
  702 + window.onbeforeunload = null;
  703 + return location.href = '//www.yohobuy.com/signin.html?refer=' + // eslint-disable-line
  704 + encodeURIComponent(location.href);
  705 + }
  706 + })
694 .always(function() { 707 .always(function() {
695 lMsg.modal('hide'); 708 lMsg.modal('hide');
696 }); 709 });
@@ -36,6 +36,12 @@ var _fetchReason = (function() { @@ -36,6 +36,12 @@ var _fetchReason = (function() {
36 type: YOHO_CS 36 type: YOHO_CS
37 }) 37 })
38 .done(function(res) { 38 .done(function(res) {
  39 + if (res && res.code === 401) {
  40 + window.onbeforeunload = null;
  41 + return location.href = '//www.yohobuy.com/signin.html?refer=' + // eslint-disable-line
  42 + encodeURIComponent(location.href);
  43 + }
  44 +
39 if (res.code === 200) { 45 if (res.code === 200) {
40 cache = res.data; 46 cache = res.data;
41 render(cache); 47 render(cache);
@@ -131,6 +137,12 @@ function _evalSubmit() { @@ -131,6 +137,12 @@ function _evalSubmit() {
131 $btnEval.hide(); 137 $btnEval.hide();
132 processSign.savedEval = true; 138 processSign.savedEval = true;
133 139
  140 + if (res && res.code === 401) {
  141 + window.onbeforeunload = null;
  142 + return location.href = '//www.yohobuy.com/signin.html?refer=' + // eslint-disable-line
  143 + encodeURIComponent(location.href);
  144 + }
  145 +
134 if (res && res.code === 200) { 146 if (res && res.code === 200) {
135 send.completeEval(); 147 send.completeEval();
136 self.close(); 148 self.close();
@@ -1675,7 +1675,7 @@ @@ -1675,7 +1675,7 @@
1675 } 1675 }
1676 1676
1677 input { 1677 input {
1678 - width: 210px; 1678 + width: 220px;
1679 height: 30px; 1679 height: 30px;
1680 padding: 0 10px; 1680 padding: 0 10px;
1681 background: #f5f5f5; 1681 background: #f5f5f5;
1 User-Agent: * 1 User-Agent: *
2 -Disallow: /*?*  
3 Disallow: /passport/ 2 Disallow: /passport/
4 Disallow: /help 3 Disallow: /help
5 Disallow: signin.html 4 Disallow: signin.html