* 获取分类列表 * @interface /interface/getCatMenu * @method GET * @category interface * @foldnumber 10 * @param {Number} project_id 项目id,不能为空 * @returns {Object} * @example ./api/interface/getCatMenu
(ctx)
| 1022 | * @example ./api/interface/getCatMenu |
| 1023 | */ |
| 1024 | async getCatMenu(ctx) { |
| 1025 | let project_id = ctx.params.project_id; |
| 1026 | |
| 1027 | if (!project_id || isNaN(project_id)) { |
| 1028 | return (ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空')); |
| 1029 | } |
| 1030 | |
| 1031 | try { |
| 1032 | let project = await this.projectModel.getBaseInfo(project_id); |
| 1033 | if (project.project_type === 'private') { |
| 1034 | if ((await this.checkAuth(project._id, 'project', 'edit')) !== true) { |
| 1035 | return (ctx.body = yapi.commons.resReturn(null, 406, '没有权限')); |
| 1036 | } |
| 1037 | } |
| 1038 | let res = await this.catModel.list(project_id); |
| 1039 | return (ctx.body = yapi.commons.resReturn(res)); |
| 1040 | } catch (e) { |
| 1041 | yapi.commons.resReturn(null, 400, e.message); |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | /** |
| 1046 | * 获取自定义接口字段数据 |
nothing calls this directly
no test coverage detected