Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이하영
/
YTMT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이진아
2019-12-06 14:31:46 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aa54589ac1c1ab786c61a967ef3bde14efee6bdd
aa54589a
1 parent
28c55b9a
yourtoons2.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
routes/yourtoons2.js
routes/yourtoons2.js
0 → 100644
View file @
aa54589
var
express
=
require
(
'express'
);
var
async
=
require
(
'async'
);
var
router
=
express
.
Router
();
function
getYourToons2
(
id
,
cb
){
//현재 로그인한 유저가 아닌 다른 유저들의 내툰리스트 가져오기
var
sqlquery
=
"SELECT u.id, t.toon_index, t.name, t.thum_link, t.webtoon_link, t.week, t.site FROM user u, user_toon_relation ur, toon t WHERE u.id != '"
+
id
+
"' && u.id=ur.user_id && t.toon_index=ur.toon_index;"
;
var
yourlist2
=
new
Array
();
connection
.
query
(
sqlquery
,
id
,
function
(
err
,
rows
,
result
){
if
(
!
err
){
yourlist2
=
rows
;
cb
(
yourlist2
);
console
.
log
(
yourlist2
);
}
else
{
console
.
log
(
"니툰 리스트 가져오는데 실패했습니다!"
);
//throw err;
}
});
}
/* GET home page. */
router
.
get
(
'/'
,
function
(
req
,
res
,
next
)
{
if
(
!
req
.
isAuthenticated
()){
res
.
redirect
(
'/'
);
}
else
{
async
.
series
(
[
function
(
callback
){
getYourToons2
(
req
.
user
.
user_id
,
function
(
yourtoon_list2
)
{
callback
(
null
,
yourtoon_list2
);
});
}
],
function
(
err
,
results
){
res
.
render
(
'yourtoon2s'
,
{
yourtoons2
:
results
[
0
]
});
}
);
}
});
module
.
exports
=
router
;
\ No newline at end of file
Please
register
or
login
to post a comment