1
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
const baseModel = require("../../middleware/baseModel");
|
||||
const { find_page, find_for_export } = require("../utils/query_helpers");
|
||||
const { build_search_where } = require("../utils/query_helpers");
|
||||
const logic = require("../service/biz_subscription_logic");
|
||||
const audit = require("../utils/biz_audit");
|
||||
|
||||
module.exports = {
|
||||
"POST /biz_subscription/page": async (ctx) => {
|
||||
const body = ctx.getBody();
|
||||
const { count, rows } = await find_page(baseModel.biz_subscription, "biz_subscription", 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_subscription = baseModel.biz_subscription;
|
||||
const where = build_search_where(biz_subscription, seach_option);
|
||||
const { count, rows } = await biz_subscription.findAndCountAll({
|
||||
where,
|
||||
offset,
|
||||
limit: page_size,
|
||||
order: [["id", "DESC"]],
|
||||
});
|
||||
ctx.success({ rows, count });
|
||||
},
|
||||
"GET /biz_subscription/detail": async (ctx) => {
|
||||
@@ -75,7 +88,14 @@ module.exports = {
|
||||
},
|
||||
"POST /biz_subscription/export": async (ctx) => {
|
||||
const body = ctx.getBody();
|
||||
const res = await find_for_export(baseModel.biz_subscription, "biz_subscription", body);
|
||||
ctx.success(res);
|
||||
const param = body.param || body;
|
||||
const biz_subscription = baseModel.biz_subscription;
|
||||
const where = build_search_where(biz_subscription, param.seachOption || {});
|
||||
const rows = await biz_subscription.findAll({
|
||||
where,
|
||||
limit: 10000,
|
||||
order: [["id", "DESC"]],
|
||||
});
|
||||
ctx.success({ rows });
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user