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
6b9b573f19d661bff0f325f07f266b8537a3330a
2 parents
0703bd73
efa61b8c
Merge branch 'gray'
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
doraemon/models/header.js
doraemon/models/header.js
View file @
6b9b573
...
...
@@ -218,12 +218,19 @@ const getHeaderNavAsync = () => {
* @param {String} 频道类型
* @return {promise}
*/
let
cacheHeaderHtml
=
{};
const
cacheHeaderHtml
=
{
boys
:
[],
girls
:
[],
kids
:
[],
lifestyle
:
[]
};
const
THIRTY_MINUTES
=
1000
*
60
*
10
;
async
function
requestHeaderData
(
type
)
{
let
resData
=
{};
if
(
_
.
isEmpty
(
cacheHeaderHtml
[
type
]))
{
if
(
_
.
isEmpty
(
cacheHeaderHtml
[
type
]
[
0
])
||
((
new
Date
()
-
cacheHeaderHtml
[
type
][
1
])
>
THIRTY_MINUTES
))
{
let
channelNum
=
(
function
()
{
switch
(
type
)
{
case
'boys'
:
...
...
@@ -270,17 +277,12 @@ async function requestHeaderData(type) {
cacheHeaderHtml
[
type
]
=
resData
;
}
}
else
{
resData
=
cacheHeaderHtml
[
type
];
resData
=
cacheHeaderHtml
[
type
]
[
0
]
;
}
return
Promise
.
resolve
({
headerData
:
resData
});
}
setInterval
(
function
()
{
cacheHeaderHtml
=
{};
},
60
*
10
*
1000
);
module
.
exports
=
{
requestHeaderData
};
...
...
Please
register
or
login
to post a comment