init
This commit is contained in:
35
api/controller_admin/biz_usage.js
Normal file
35
api/controller_admin/biz_usage.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const crud = require("../service/biz_admin_crud");
|
||||
const { getRequestBody } = crud;
|
||||
|
||||
module.exports = {
|
||||
"POST /biz_usage/page": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const data = await crud.page("biz_usage_monthly", body);
|
||||
ctx.success({ rows: data.rows, count: data.count });
|
||||
},
|
||||
"POST /biz_usage/add": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const row = await crud.add("biz_usage_monthly", body);
|
||||
ctx.success(row);
|
||||
},
|
||||
"POST /biz_usage/edit": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
await crud.edit("biz_usage_monthly", body);
|
||||
ctx.success({});
|
||||
},
|
||||
"POST /biz_usage/del": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
await crud.del("biz_usage_monthly", body);
|
||||
ctx.success({});
|
||||
},
|
||||
"GET /biz_usage/detail": async (ctx) => {
|
||||
const q = ctx.query || {};
|
||||
const row = await crud.detail("biz_usage_monthly", { id: q.id || q.ID });
|
||||
ctx.success(row);
|
||||
},
|
||||
"POST /biz_usage/export": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const res = await crud.exportCsv("biz_usage_monthly", body);
|
||||
ctx.success(res);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user