Authored by 陈峰

Merge branch 'hotfix/limit' into 'release/6.7.9'

Hotfix/limit



See merge request !385
@@ -77,6 +77,9 @@ app.use((req, res, next) => { @@ -77,6 +77,9 @@ app.use((req, res, next) => {
77 next(); 77 next();
78 }); 78 });
79 79
  80 +app.use(favicon(path.join(__dirname, '/favicon.ico')));
  81 +app.use(express.static(path.join(__dirname, 'static')));
  82 +
80 // 添加请求上下文 83 // 添加请求上下文
81 app.use(global.yoho.httpCtx()); 84 app.use(global.yoho.httpCtx());
82 85
@@ -90,8 +93,6 @@ app.use(global.yoho.hbs({ @@ -90,8 +93,6 @@ app.use(global.yoho.hbs({
90 cb: hbsEvent.cb 93 cb: hbsEvent.cb
91 })); 94 }));
92 95
93 -app.use(favicon(path.join(__dirname, '/favicon.ico')));  
94 -app.use(express.static(path.join(__dirname, 'static')));  
95 app.use(bodyParser.json()); 96 app.use(bodyParser.json());
96 app.use(bodyParser.urlencoded({extended: false})); 97 app.use(bodyParser.urlencoded({extended: false}));
97 app.use(cookieParser()); 98 app.use(cookieParser());
@@ -83,17 +83,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -83,17 +83,17 @@ module.exports = class extends global.yoho.BaseModel {
83 let saltedToken = sign.makeToken(saltedUid); 83 let saltedToken = sign.makeToken(saltedUid);
84 let publicToken = saltedToken + salt; 84 let publicToken = saltedToken + salt;
85 85
86 - let data = userInfo.data; 86 + let data = userInfo.data || {};
87 87
88 - if (!data) {  
89 - throw Error('app.passport.profile api error'); 88 + if (!userInfo.data) { // 个新信息接口可能限流,即使限流也仍然可以登录
  89 + logger.error(`app.passport.profile api error${uid}】`);
90 } 90 }
91 91
92 - let encryptionUid = aes.encryptionUid(data.uid); 92 + let encryptionUid = aes.encryptionUid(uid);
93 93
94 94
95 let uidCookie = 95 let uidCookie =
96 - `${encodeURIComponent(data.profile_name)}::${encryptionUid}::${_.get(data, 'vip_info.title', '')}::${saltedToken}`; // eslint-disable-line 96 + `${encodeURIComponent(data.profile_name || '')}::${encryptionUid}::${_.get(data, 'vip_info.title', '')}::${saltedToken}`; // eslint-disable-line
97 let isStudent = _.get(data, 'vip_info.is_student') || 0; 97 let isStudent = _.get(data, 'vip_info.is_student') || 0;
98 98
99 res.cookie('_UID', uidCookie, { 99 res.cookie('_UID', uidCookie, {
@@ -353,12 +353,13 @@ function getShopInfoAsync(domain, channel, params) { @@ -353,12 +353,13 @@ function getShopInfoAsync(domain, channel, params) {
353 if (shopId) { // 带id访问 353 if (shopId) { // 带id访问
354 let result = yield this.api.getShopInfo(shopId); 354 let result = yield this.api.getShopInfo(shopId);
355 355
356 - data = result.data; 356 + data = result.data || {};
357 357
358 // 根据店铺ID,未取到店铺信息,跳转至首页 358 // 根据店铺ID,未取到店铺信息,跳转至首页
359 - if (result.code !== 200 || _.isEmpty(data)) {  
360 - return {redirect: helpers.urlFormat('')};  
361 - } 359 + // if (result.code !== 200 || _.isEmpty(data)) {
  360 + // return {redirect: helpers.urlFormat('')};
  361 + // }
  362 + // intro接口可能被限流但页面要展示
362 363
363 let lowerDomain = _.toLower(data.shop_domain); 364 let lowerDomain = _.toLower(data.shop_domain);
364 365