Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
周少峰
7 years ago
Commit
9164a0f5870327459eda495d39531cd8b7f07996
2 parents
6c91907d
c94bf1ea
Merge branch 'release/1026'
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
doraemon/models/header.js
package.json
doraemon/models/header.js
View file @
9164a0f
...
...
@@ -229,12 +229,15 @@ const THIRTY_MINUTES = 1000 * 60 * 10;
async
function
requestHeaderData
(
type
)
{
let
resData
=
{};
let
_html
;
if
(
!
cacheHeaderHtml
[
type
])
{
type
=
'boys'
;
}
if
(
_
.
isEmpty
(
cacheHeaderHtml
[
type
][
0
])
||
((
new
Date
()
-
cacheHeaderHtml
[
type
][
1
])
>
THIRTY_MINUTES
))
{
let
cacheData
=
cacheHeaderHtml
[
type
];
if
(
_
.
isEmpty
(
cacheData
[
0
])
||
((
new
Date
()
-
cacheData
[
1
])
>
THIRTY_MINUTES
))
{
let
channelNum
=
(
function
()
{
switch
(
type
)
{
case
'boys'
:
...
...
@@ -253,7 +256,6 @@ async function requestHeaderData(type) {
let
res
=
await
Promise
.
all
([
getHeaderNavAsync
(),
getHotSearchAsync
(
channelNum
)
]);
resData
.
headerData
=
{};
...
...
@@ -275,16 +277,17 @@ async function requestHeaderData(type) {
});
}
resData
=
template
(
resData
);
if
(
!
_
.
isEmpty
(
res
[
0
].
data
)
&&
!
_
.
isEmpty
(
res
[
1
].
data
))
{
cacheHeaderHtml
[
type
]
=
[
resData
,
new
Date
()];
if
(
_
.
isEmpty
(
_
.
get
(
resData
,
'headerData.navbars'
))
&&
cacheData
[
0
])
{
_html
=
cacheData
[
0
];
}
else
{
_html
=
template
(
resData
);
cacheHeaderHtml
[
type
]
=
[
_html
,
new
Date
()];
}
}
else
{
resData
=
cacheHeaderHtml
[
type
]
[
0
];
_html
=
cacheData
[
0
];
}
return
Promise
.
resolve
({
headerData
:
resData
});
return
Promise
.
resolve
({
headerData
:
_html
});
}
module
.
exports
=
{
...
...
package.json
View file @
9164a0f
...
...
@@ -57,7 +57,7 @@
"urlencode"
:
"^1.1.0"
,
"uuid"
:
"^2.0.2"
,
"yoho-express-session"
:
"^2.0.0"
,
"yoho-node-lib"
:
"=0.5.1
8
"
,
"yoho-node-lib"
:
"=0.5.1
9
"
,
"yoho-zookeeper"
:
"^1.0.8"
},
"devDependencies"
:
{
...
...
Please
register
or
login
to post a comment