Skip to content

Commit

Permalink
是否关注了此用户
Browse files Browse the repository at this point in the history
  • Loading branch information
Silin7 committed Sep 5, 2021
1 parent 04b79c7 commit 5765440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controller/mineModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ const is_follow_collection = async (req, res, next) => {
}
let parameter = req.query
let author_id = req.headers.author_id
await mineDao.is_follow_collection(parameter.watched_id, author_id).then(result => {
await mineDao.is_follow_collection(parameter.user_id, author_id).then(result => {
let flag = result[0]["COUNT(*)"] === 0 ? false : true
res.json({
code: 0,
Expand Down
5 changes: 3 additions & 2 deletions model/dao/mineDao.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ module.exports = {
},

// 是否关注了此用户
is_follow_collection: async (watched_id, author_id) => {
let sql = `SELECT COUNT(*) FROM \`relations_user\` WHERE \`followers_id\` = '${author_id}' AND \`watched_id\` = '${watched_id}'`
is_follow_collection: async (user_id, author_id) => {
let sql = `SELECT COUNT(*) FROM \`relations_user\` WHERE \`followers_id\` = '${author_id}' AND \`user_id\` = '${user_id}'`
console.log(sql)
return await db.query(sql)
},

Expand Down

0 comments on commit 5765440

Please sign in to comment.