-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathhandler.js
More file actions
27 lines (23 loc) · 747 Bytes
/
handler.js
File metadata and controls
27 lines (23 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
exports = module.exports = {};
let mongo = require('./mongo');
let config = require('./config');
exports.acceptGroupInvite = async function (req, res) {
let groupList = await mongo.WhiteList.find({ type: 'group', id: req.body.group_id }).toArray();
if (groupList.length) {
res.send({ approve: true });
} else {
res.send({
approve: false,
reason: `如需添加我请先和 ${config.adminIdList.join(' 或者 ')} 联系。`
});
}
}
exports.acceptFriendInvite = async function (req, res) {
let friendList = await mongo.WhiteList.find({ type: 'friend', id: req.body.user_id }).toArray();
if (friendList.length) {
res.send({ approve: true });
} else {
res.send({ approve: false });
}
}