Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
6 years ago
Commit
64e6f3bf0e88a8c78e840cb76b50e3f10772fdf0
1 parent
a30ca97f
commit
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
apps/pages/single/ufo/order/index.js
doraemon/middleware/ssr.js
doraemon/middleware/user.js
apps/pages/single/ufo/order/index.js
View file @
64e6f3b
export
default
[{
path
:
'/ufo/order/:orderId(\\d+)'
,
name
:
'order'
,
component
:
()
=>
import
(
/* webpackChunkName: "order" */
'./order'
)
component
:
()
=>
import
(
'./order'
)
}];
...
...
doraemon/middleware/ssr.js
View file @
64e6f3b
...
...
@@ -46,7 +46,7 @@ const getContext = (req) => {
};
};
const
getCacheKey
=
(
urlPath
,
cackeKey
)
=>
{
const
getCacheKey
=
(
urlPath
,
cackeKey
=
''
)
=>
{
const
urlObj
=
url
.
parse
(
urlPath
);
return
md5
(
cackeKey
...
...
doraemon/middleware/user.js
View file @
64e6f3b
...
...
@@ -2,7 +2,21 @@ const _ = require('lodash');
const
config
=
global
.
yoho
.
config
;
module
.
exports
=
(
req
,
res
,
next
)
=>
{
if
(
!
req
.
user
.
uid
&&
if
(
!
req
.
yoho
.
isApp
)
{
if
(
req
.
session
&&
_
.
isNumber
(
req
.
session
.
LOGIN_UID_
))
{
// 调用接口传参时切勿使用toString获得字符串
req
.
user
.
uid
=
{
toString
:
()
=>
{
return
_
.
parseInt
(
req
.
session
.
LOGIN_UID_
);
},
sessionKey
:
req
.
session
.
SESSION_KEY
,
appSessionType
:
req
.
session
.
SESSION_TYPE
};
let
userData
=
_
.
get
(
req
.
session
,
'USER'
,
{});
_
.
merge
(
req
.
user
,
userData
);
}
}
else
if
(
!
req
.
user
.
uid
&&
req
.
cookies
.
app_uid
&&
req
.
cookies
.
app_uid
!==
'0'
&&
req
.
cookies
.
app_session_key
&&
...
...
Please
register
or
login
to post a comment