* 判断分组名称是否重复 * @interface /project/check_project_name * @method get
(ctx)
| 152 | */ |
| 153 | |
| 154 | async checkProjectName(ctx) { |
| 155 | try { |
| 156 | let name = ctx.request.query.name; |
| 157 | let group_id = ctx.request.query.group_id; |
| 158 | |
| 159 | if (!name) { |
| 160 | return (ctx.body = yapi.commons.resReturn(null, 401, '项目名不能为空')); |
| 161 | } |
| 162 | let checkRepeat = await this.Model.checkNameRepeat(name, group_id); |
| 163 | |
| 164 | if (checkRepeat > 0) { |
| 165 | return (ctx.body = yapi.commons.resReturn(null, 401, '已存在的项目名')); |
| 166 | } |
| 167 | |
| 168 | ctx.body = yapi.commons.resReturn({}); |
| 169 | } catch (err) { |
| 170 | ctx.body = yapi.commons.resReturn(null, 402, err.message); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * 添加项目分组 |
no test coverage detected