Authored by 毕凯

火星帐号适配

... ... @@ -43,8 +43,6 @@ module.exports = () => {
pageChannel: {}
};
let ua = (req.get('User-Agent') || '').toLowerCase();
const channel = req.query.channel || req.cookies._Channel || 'boys';
// IP 地址
... ... @@ -62,8 +60,9 @@ module.exports = () => {
req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || '');
yoho.isMobile = /(nokia|iphone|android|ipad|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220)/i.test(req.get('User-Agent') || ''); // eslint-disable-line
yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || '');
yoho.isWeibo = ua.indexOf('weibo') !== -1;
yoho.isWeibo = /weibo/i.test(req.get('User-Agent') || '');
yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || '');
yoho.isMarsApp = /yohomars/i.test(req.get('User-Agent') || '');
Object.assign(res.locals, yoho);
Object.assign(req.yoho, yoho);
... ...
... ... @@ -8,7 +8,7 @@ const config = global.yoho.config;
module.exports = () => {
return (req, res, next) => {
if (!req.yoho.isApp) {
if (!req.yoho.isApp && !req.yoho.isMarsApp) {
// 从 SESSION 中获取到当前登录用户的 UID
if (req.session && _.isNumber(req.session.LOGIN_UID)) {
// 调用接口传参时切勿使用toString获得字符串
... ... @@ -77,6 +77,8 @@ module.exports = () => {
res.cookie('app_version', appVersion);
res.cookie('app_client_type', appSessionType);
}
next();
};
};
... ...