change channel to receiver

This commit is contained in:
Mystikfluu 2022-08-10 23:45:57 +02:00
parent 781d6cf467
commit d37c883d89
3 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ CREATE TABLE `dms` (
`dms_text` varchar(4000) NOT NULL,
`dms_time` bigint NOT NULL,
`dms_special_text` varchar(100) DEFAULT NULL,
`dms_channel` varchar(100) DEFAULT NULL,
`dms_receiver` varchar(100) DEFAULT NULL,
`dms_is_private` tinyint DEFAULT '0',
`dms_from_bot` tinyint DEFAULT '0',
`dms_reply_id` bigint unsigned DEFAULT NULL,

View File

@ -16,8 +16,8 @@ module.exports = {
"dms_user_name","dms_text","dms_time","dms_special_text","dms_id","dms_from_bot","dms_reply_id"
]
let sql = `select ${columns.join(",")} from ipost.dms where (dms_channel = ?) order by dms_id desc;`
con.query(sql, [xor(encodeURIComponent(res.locals.username),otherperson)], function (err, result) {
let sql = `select ${columns.join(",")} from ipost.dms where (dms_receiver = ?) order by dms_id desc;`
con.query(sql, [otherperson], function (err, result) {
if (err) throw err;
res.json(result)
});

View File

@ -70,8 +70,8 @@ module.exports = {
return
}
let sql = `insert into ipost.dms (dms_user_name,dms_text,dms_time,dms_channel,dms_from_bot,dms_reply_id) values (?,?,?,?,?,?);`
let values = [encodeURIComponent(res.locals.username),req.body.message,Date.now(),xor(encodeURIComponent(res.locals.username),otherperson),res.locals.isbot,reply_id]
let sql = `insert into ipost.dms (dms_user_name,dms_text,dms_time,dms_receiver,dms_from_bot,dms_reply_id) values (?,?,?,?,?,?);`
let values = [encodeURIComponent(res.locals.username),req.body.message,Date.now(),otherperson,res.locals.isbot,reply_id]
con.query(sql, values, function (err, result) {
if (err) throw err;
// let post_obj = {