2022-11-29 23:02:06 +08:00
|
|
|
import { Context } from "koa";
|
2022-12-02 11:04:17 +08:00
|
|
|
import service from "../service/GlobalConfigService";
|
2022-11-29 23:02:06 +08:00
|
|
|
|
|
|
|
const router = {};
|
|
|
|
|
|
|
|
/**
|
2022-12-02 11:04:17 +08:00
|
|
|
* 获取单个配置
|
2022-11-29 23:02:06 +08:00
|
|
|
*/
|
|
|
|
router["GET /config/code"] = async function (ctx: Context) {
|
|
|
|
ctx.body = await service.getVal(ctx.request.query.code as string);
|
|
|
|
};
|
|
|
|
|
2022-12-02 11:04:17 +08:00
|
|
|
/**
|
|
|
|
* 获取多个配置项
|
|
|
|
*/
|
|
|
|
router["POST /config/multCode"] = async function (ctx: Context) {
|
|
|
|
ctx.body = await service.getMultVal(ctx.request.body);
|
|
|
|
};
|
|
|
|
|
2022-11-29 23:02:06 +08:00
|
|
|
/**
|
|
|
|
* 提交修改
|
|
|
|
*/
|
|
|
|
router["POST /config/update"] = async function (ctx: Context) {
|
|
|
|
ctx.body = await service.updateVal(ctx.request.body.code, ctx.request.body.val);
|
|
|
|
};
|
|
|
|
|
2023-01-10 23:15:39 +08:00
|
|
|
/**
|
|
|
|
* 提交修改
|
|
|
|
*/
|
|
|
|
router["POST /config/insertOrUpdate"] = async function (ctx: Context) {
|
|
|
|
ctx.body = await service.insertOrReplace(ctx.request.body);
|
|
|
|
};
|
|
|
|
|
2022-11-29 23:02:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
export default router;
|