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
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
5b78e04ffc64526b46becb971e77b94aa1d70923
1 parent
8d21b43b
link
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletions
apps/about/controllers/about.js
apps/about/models/about.js
apps/about/controllers/about.js
View file @
5b78e04
...
...
@@ -72,7 +72,7 @@ const link = (req, res, next) => {
req
.
ctx
(
aboutModel
).
link
(),
]).
then
(
result
=>
{
responseData
.
headerData
=
_
.
get
(
result
,
'[0].headerData'
);
console
.
log
(
result
)
console
.
log
(
result
);
res
.
render
(
'link'
,
Object
.
assign
(
_
.
get
(
result
,
'[1]'
,
{}),
responseData
));
}).
catch
(
next
);
};
...
...
apps/about/models/about.js
0 → 100644
View file @
5b78e04
/**
* about model
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/11/20
*/
const
redis
=
global
.
yoho
.
redis
;
const
_
=
require
(
'lodash'
);
const
logger
=
global
.
yoho
.
logger
;
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
super
(
ctx
);
}
link
()
{
return
redis
.
all
([
[
'get'
,
'friend:text:links'
],
[
'get'
,
'friend:img:links'
]
]).
then
(
redisData
=>
{
let
textLinks
=
[],
imgLinks
=
[];
try
{
textLinks
=
JSON
.
parse
(
redisData
[
0
]
||
'[]'
);
}
catch
(
e
)
{
logger
.
error
(
`
friend
text
links
parse
error
:
$
{
JSON
.
stringify
(
e
)}
`
);
}
try
{
imgLinks
=
JSON
.
parse
(
redisData
[
1
]
||
'[]'
);
}
catch
(
e
)
{
logger
.
error
(
`
friend
img
links
parse
error
:
$
{
JSON
.
stringify
(
e
)}
`
);
}
return
{
textLinks
:
_
.
sortBy
(
textLinks
,
o
=>
{
return
-
o
.
sort
}),
imgLinks
:
_
.
sortBy
(
imgLinks
,
o
=>
{
return
-
o
.
sort
})
};
});
}
};
...
...
Please
register
or
login
to post a comment