1
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
const crud = require("../service/biz_admin_crud");
|
||||
const { getRequestBody } = crud;
|
||||
|
||||
const baseModel = require("../../middleware/baseModel");
|
||||
const audit = require("../service/biz_audit_service");
|
||||
|
||||
module.exports = {
|
||||
"POST /biz_plan/page": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
const data = await crud.page("biz_plan", body);
|
||||
ctx.success({ rows: data.rows, count: data.count });
|
||||
},
|
||||
"POST /biz_plan/add": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
const row = await crud.add("biz_plan", body);
|
||||
await audit.logAudit({
|
||||
admin_user_id: audit.pickAdminId(ctx),
|
||||
@@ -22,7 +22,7 @@ module.exports = {
|
||||
ctx.success(row);
|
||||
},
|
||||
"POST /biz_plan/edit": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
await crud.edit("biz_plan", body);
|
||||
await audit.logAudit({
|
||||
admin_user_id: audit.pickAdminId(ctx),
|
||||
@@ -33,7 +33,7 @@ module.exports = {
|
||||
ctx.success({});
|
||||
},
|
||||
"POST /biz_plan/del": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
await crud.del("biz_plan", body);
|
||||
await audit.logAudit({
|
||||
admin_user_id: audit.pickAdminId(ctx),
|
||||
@@ -53,7 +53,7 @@ module.exports = {
|
||||
ctx.success(rows);
|
||||
},
|
||||
"POST /biz_plan/toggle": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
const id = body.id;
|
||||
if (id == null) return ctx.fail("缺少 id");
|
||||
const row = await baseModel.biz_plan.findByPk(id);
|
||||
@@ -70,7 +70,7 @@ module.exports = {
|
||||
ctx.success({ status: next });
|
||||
},
|
||||
"POST /biz_plan/export": async (ctx) => {
|
||||
const body = getRequestBody(ctx);
|
||||
const body = ctx.getBody();
|
||||
const res = await crud.exportCsv("biz_plan", body);
|
||||
ctx.success(res);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user