mirror of
https://github.com/YMFE/yapi.git
synced 2024-11-27 04:40:08 +08:00
fix: 命令行导入成员信息为 undefined
This commit is contained in:
parent
f1a30fa071
commit
c6172ef0fe
@ -3,6 +3,10 @@
|
||||
* json schema number和integer支持枚举
|
||||
* 服务端测试增加下载功能
|
||||
|
||||
### Bug Fixed
|
||||
|
||||
* 命令行导入成员信息为 undefined
|
||||
|
||||
### v1.3.21
|
||||
|
||||
* 请求配置增加 context.utils.CryptoJS
|
||||
|
@ -192,7 +192,7 @@ class baseController {
|
||||
return 'owner';
|
||||
}
|
||||
let memberData = _.find(projectData.members, m => {
|
||||
if (m.uid === this.getUid()) {
|
||||
if (m && m.uid === this.getUid()) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -216,12 +216,14 @@ class interfaceController extends baseController {
|
||||
}
|
||||
|
||||
// 新建接口的人成为项目dev 如果不存在的话
|
||||
// 命令行导入时无法获知导入接口人的信息,其uid 为 999999
|
||||
let uid = this.getUid();
|
||||
if (this.getRole() !== 'admin') {
|
||||
|
||||
if (this.getRole() !== 'admin' && uid !== 999999) {
|
||||
let userdata = await yapi.commons.getUserdata(uid, 'dev');
|
||||
// 检查一下是否有这个人
|
||||
let check = await this.projectModel.checkMemberRepeat(params.project_id, uid);
|
||||
if (check === 0) {
|
||||
if (check === 0 && userdata) {
|
||||
await this.projectModel.addMember(params.project_id, [userdata]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user