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) => {
next();
});
app.use(favicon(path.join(__dirname, '/favicon.ico')));
app.use(express.static(path.join(__dirname, 'static')));
// 添加请求上下文
app.use(global.yoho.httpCtx());
... ... @@ -90,8 +93,6 @@ app.use(global.yoho.hbs({
cb: hbsEvent.cb
}));
app.use(favicon(path.join(__dirname, '/favicon.ico')));
app.use(express.static(path.join(__dirname, 'static')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use(cookieParser());
... ...
... ... @@ -83,17 +83,17 @@ module.exports = class extends global.yoho.BaseModel {
let saltedToken = sign.makeToken(saltedUid);
let publicToken = saltedToken + salt;
let data = userInfo.data;
let data = userInfo.data || {};
if (!data) {
throw Error('app.passport.profile api error');
if (!userInfo.data) { // 个新信息接口可能限流,即使限流也仍然可以登录
logger.error(`app.passport.profile api error${uid}】`);
}
let encryptionUid = aes.encryptionUid(data.uid);
let encryptionUid = aes.encryptionUid(uid);
let uidCookie =
`${encodeURIComponent(data.profile_name)}::${encryptionUid}::${_.get(data, 'vip_info.title', '')}::${saltedToken}`; // eslint-disable-line
`${encodeURIComponent(data.profile_name || '')}::${encryptionUid}::${_.get(data, 'vip_info.title', '')}::${saltedToken}`; // eslint-disable-line
let isStudent = _.get(data, 'vip_info.is_student') || 0;
res.cookie('_UID', uidCookie, {
... ...
... ... @@ -353,12 +353,13 @@ function getShopInfoAsync(domain, channel, params) {
if (shopId) { // 带id访问
let result = yield this.api.getShopInfo(shopId);
data = result.data;
data = result.data || {};
// 根据店铺ID,未取到店铺信息,跳转至首页
if (result.code !== 200 || _.isEmpty(data)) {
return {redirect: helpers.urlFormat('')};
}
// if (result.code !== 200 || _.isEmpty(data)) {
// return {redirect: helpers.urlFormat('')};
// }
// intro接口可能被限流但页面要展示
let lowerDomain = _.toLower(data.shop_domain);
... ...