1
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const { Op } = Sequelize;
|
||||
const baseModel = require("../../middleware/baseModel");
|
||||
const { find_page } = require("../utils/query_helpers");
|
||||
const { build_search_where } = require("../utils/query_helpers");
|
||||
|
||||
function build_date_where(start_date, end_date) {
|
||||
const where = {};
|
||||
@@ -107,7 +107,20 @@ module.exports = {
|
||||
|
||||
"POST /biz_api_call_log/page": async (ctx) => {
|
||||
const body = ctx.getBody();
|
||||
const { count, rows } = await find_page(baseModel.biz_api_call_log, "biz_api_call_log", body);
|
||||
const param = body.param || body;
|
||||
const page_option = param.pageOption || {};
|
||||
const seach_option = param.seachOption || {};
|
||||
const page_num = parseInt(page_option.page, 10) || 1;
|
||||
const page_size = parseInt(page_option.pageSize, 10) || 20;
|
||||
const offset = (page_num - 1) * page_size;
|
||||
const biz_api_call_log = baseModel.biz_api_call_log;
|
||||
const where = build_search_where(biz_api_call_log, seach_option);
|
||||
const { count, rows } = await biz_api_call_log.findAndCountAll({
|
||||
where,
|
||||
offset,
|
||||
limit: page_size,
|
||||
order: [["id", "DESC"]],
|
||||
});
|
||||
ctx.success({ rows, count });
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user