添加文件生成功能,支持自定义文件模板

This commit is contained in:
2024-07-13 12:29:57 +08:00
parent 34a98ab47e
commit eb50ad480e
3 changed files with 178 additions and 52 deletions

View File

@@ -90,16 +90,15 @@ class exportController extends baseController {
if ((await this.checkAuth(projectId, 'project', 'edit')) !== true) {
return (ctx.body = yapi.commons.resReturn(null, 405, '没有权限'));
}
let existData = await this.genCodeModel.listByProjectId(projectId);
if (existData.find(templ => templ.tag === requestBody.tag)){
return (ctx.body = yapi.commons.resReturn(null, 502, 'tag已存在'));
}
let result;
if (requestBody.id) {
result = await this.genCodeModel.up(requestBody);
} else {
let existData = await this.genCodeModel.listByProjectId(projectId);
if (existData.find(templ => templ.tag === requestBody.tag)){
return (ctx.body = yapi.commons.resReturn(null, 502, 'tag已存在'));
}
result = await this.genCodeModel.save(requestBody);
}