* 获取特定cat_id下最新修改的动态信息 * @interface /log/list_by_update * @method post * @category log * @foldnumber 10 * @param {Number} typeid 动态类型id, 不能为空 * @returns {Object} * @example /log/list
(ctx)
| 105 | */ |
| 106 | |
| 107 | async listByUpdate(ctx) { |
| 108 | let params = ctx.params; |
| 109 | |
| 110 | try { |
| 111 | let { typeid, type, apis } = params; |
| 112 | let list = []; |
| 113 | let projectDatas = await this.projectModel.getBaseInfo(typeid, 'basepath'); |
| 114 | let basePath = projectDatas.toObject().basepath; |
| 115 | |
| 116 | for (let i = 0; i < apis.length; i++) { |
| 117 | let api = apis[i]; |
| 118 | if (basePath) { |
| 119 | api.path = api.path.indexOf(basePath) === 0 ? api.path.substr(basePath.length) : api.path; |
| 120 | } |
| 121 | let interfaceIdList = await this.interfaceModel.getByPath( |
| 122 | typeid, |
| 123 | api.path, |
| 124 | api.method, |
| 125 | '_id' |
| 126 | ); |
| 127 | |
| 128 | for (let j = 0; j < interfaceIdList.length; j++) { |
| 129 | let interfaceId = interfaceIdList[j]; |
| 130 | let id = interfaceId.id; |
| 131 | let result = await this.Model.listWithCatid(typeid, type, id); |
| 132 | |
| 133 | list = list.concat(result); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // let result = await this.Model.listWithCatid(typeid, type, catId); |
| 138 | ctx.body = yapi.commons.resReturn(list); |
| 139 | } catch (err) { |
| 140 | ctx.body = yapi.commons.resReturn(null, 402, err.message); |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | module.exports = logController; |
nothing calls this directly
no test coverage detected