Authored by 陈峰

commit

1 export default [{ 1 export default [{
2 path: '/ufo/order/:orderId(\\d+)', 2 path: '/ufo/order/:orderId(\\d+)',
3 name: 'order', 3 name: 'order',
4 - component: () => import(/* webpackChunkName: "order" */ './order') 4 + component: () => import('./order')
5 }]; 5 }];
@@ -46,7 +46,7 @@ const getContext = (req) => { @@ -46,7 +46,7 @@ const getContext = (req) => {
46 }; 46 };
47 }; 47 };
48 48
49 -const getCacheKey = (urlPath, cackeKey) => { 49 +const getCacheKey = (urlPath, cackeKey = '') => {
50 const urlObj = url.parse(urlPath); 50 const urlObj = url.parse(urlPath);
51 51
52 return md5(cackeKey 52 return md5(cackeKey
@@ -2,7 +2,21 @@ const _ = require('lodash'); @@ -2,7 +2,21 @@ const _ = require('lodash');
2 const config = global.yoho.config; 2 const config = global.yoho.config;
3 3
4 module.exports = (req, res, next) => { 4 module.exports = (req, res, next) => {
5 - if (!req.user.uid && 5 + if (!req.yoho.isApp) {
  6 + if (req.session && _.isNumber(req.session.LOGIN_UID_)) {
  7 + // 调用接口传参时切勿使用toString获得字符串
  8 + req.user.uid = {
  9 + toString: () => {
  10 + return _.parseInt(req.session.LOGIN_UID_);
  11 + },
  12 + sessionKey: req.session.SESSION_KEY,
  13 + appSessionType: req.session.SESSION_TYPE
  14 + };
  15 + let userData = _.get(req.session, 'USER', {});
  16 +
  17 + _.merge(req.user, userData);
  18 + }
  19 + } else if (!req.user.uid &&
6 req.cookies.app_uid && 20 req.cookies.app_uid &&
7 req.cookies.app_uid !== '0' && 21 req.cookies.app_uid !== '0' &&
8 req.cookies.app_session_key && 22 req.cookies.app_session_key &&