* 获取项目的环境变量值 * @interface /project/get_env * @method GET * @category project * @foldnumber 10 * @param {Number} id 项目id,不能为空 * @returns {Object} * @example
(ctx)
| 959 | * @example |
| 960 | */ |
| 961 | async getEnv(ctx) { |
| 962 | try { |
| 963 | // console.log(ctx.request.query.project_id) |
| 964 | let project_id = ctx.request.query.project_id; |
| 965 | // let params = ctx.request.body; |
| 966 | if (!project_id) { |
| 967 | return (ctx.body = yapi.commons.resReturn(null, 405, '项目id不能为空')); |
| 968 | } |
| 969 | |
| 970 | // 去掉权限判断 |
| 971 | // if ((await this.checkAuth(project_id, 'project', 'edit')) !== true) { |
| 972 | // return (ctx.body = yapi.commons.resReturn(null, 405, '没有权限')); |
| 973 | // } |
| 974 | |
| 975 | let env = await this.Model.getByEnv(project_id); |
| 976 | |
| 977 | ctx.body = yapi.commons.resReturn(env); |
| 978 | } catch (e) { |
| 979 | ctx.body = yapi.commons.resReturn(null, 402, e.message); |
| 980 | } |
| 981 | } |
| 982 | |
| 983 | arrRepeat(arr, key) { |
| 984 | const s = new Set(); |
no test coverage detected