* 更新一个接口集name或描述 * @interface /col/up_col * @method POST * @category col * @foldnumber 10 * @param {String} name * @param {String} desc * @returns {Object} * @example
(ctx)
| 667 | */ |
| 668 | |
| 669 | async upCol(ctx) { |
| 670 | try { |
| 671 | let params = ctx.request.body; |
| 672 | let id = params.col_id; |
| 673 | if (!id) { |
| 674 | return (ctx.body = yapi.commons.resReturn(null, 400, '缺少 col_id 参数')); |
| 675 | } |
| 676 | let colData = await this.colModel.get(id); |
| 677 | if (!colData) { |
| 678 | return (ctx.body = yapi.commons.resReturn(null, 400, '不存在')); |
| 679 | } |
| 680 | let auth = await this.checkAuth(colData.project_id, 'project', 'edit'); |
| 681 | if (!auth) { |
| 682 | return (ctx.body = yapi.commons.resReturn(null, 400, '没有权限')); |
| 683 | } |
| 684 | delete params.col_id; |
| 685 | let result = await this.colModel.up(id, params); |
| 686 | let username = this.getUsername(); |
| 687 | yapi.commons.saveLog({ |
| 688 | content: `<a href="/user/profile/${this.getUid()}">${username}</a> 更新了测试集合 <a href="/project/${ |
| 689 | colData.project_id |
| 690 | }/interface/col/${id}">${colData.name}</a> 的信息`, |
| 691 | type: 'project', |
| 692 | uid: this.getUid(), |
| 693 | username: username, |
| 694 | typeid: colData.project_id |
| 695 | }); |
| 696 | |
| 697 | ctx.body = yapi.commons.resReturn(result); |
| 698 | } catch (e) { |
| 699 | ctx.body = yapi.commons.resReturn(null, 400, e.message); |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | /** |
| 704 | * 更新多个接口case index |
nothing calls this directly
no test coverage detected