明树Git Lab

Commit ccd33ccf authored by zfp1's avatar zfp1

uodate

parent 82b5d93f
Pipeline #106967 passed with stage
in 3 seconds
...@@ -67,6 +67,10 @@ async function deleteMessage(req, res, next) { ...@@ -67,6 +67,10 @@ async function deleteMessage(req, res, next) {
*/ */
async function getUserMessages(req, res, next) { async function getUserMessages(req, res, next) {
try { try {
let page = req.body.page || 1;
let limit = req.body.pagesize || req.body.pageSize || 10;
let offset = (page - 1) * limit;
const messages = await DB.Message.findAll({ const messages = await DB.Message.findAll({
where: { where: {
[Op.and]: [sequelize.where( [Op.and]: [sequelize.where(
...@@ -87,6 +91,8 @@ async function getUserMessages(req, res, next) { ...@@ -87,6 +91,8 @@ async function getUserMessages(req, res, next) {
// attributes: ['id', 'name', 'avatar'] // attributes: ['id', 'name', 'avatar']
// } // }
// ], // ],
limit,
offset,
raw: true, raw: true,
order: [['createdAt', 'DESC']], order: [['createdAt', 'DESC']],
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment