//根据页码查询
router.post("/findbypage", async ctx => {
let config = ctx.request.body;
let where = config.where ? config.where : null;
let page = parseInt(config.page);
let rowsPerPage = parseInt(config.rowsPerPage);
try {
let mainSeq = main.mainSequelize;
let Model = mainSeq.models.FileInfo;
let ret = await Model.findAndCountAll({
where: where,
offset: page * rowsPerPage,
limit: rowsPerPage,
logging:true
});
ctx.body = {
data: ret
};
} catch (e) {
throw e;
}
});
经过logging发现
LIMIT NaN OFFSET NaN
缺少参数 ,加上这两个相应的参数就ok了