fix: 修改用户名邮箱bug

This commit is contained in:
zwjamnsss 2017-10-10 20:02:17 +08:00
parent 542612f138
commit 45e2d1695d
4 changed files with 16 additions and 6 deletions

View File

@ -293,7 +293,13 @@ class groupController extends baseController {
try {
let groupInst = yapi.getInst(groupModel);
let group = await groupInst.get(params.id);
ctx.body = yapi.commons.resReturn(group.members);
const members = [];
for(let i = 0, len = group.members.length; i < len; i++) {
let item = group.members[i];
let member = await this.getUserdata(item.uid, item.role)
members.push(member)
}
ctx.body = yapi.commons.resReturn(members);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}

View File

@ -306,7 +306,13 @@ class projectController extends baseController {
try {
let project = await this.Model.get(params.id);
ctx.body = yapi.commons.resReturn(project.members);
const members = [];
for(let i = 0, len = project.members.length; i < len; i++) {
let item = project.members[i];
let member = await this.getUserdata(item.uid, item.role)
members.push(member)
}
ctx.body = yapi.commons.resReturn(members);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}

View File

@ -17,9 +17,7 @@ class groupModel extends baseModel {
members: [
{
uid: Number,
role: {type: String, enum:['owner', 'dev']},
username: String,
email: String
role: {type: String, enum:['owner', 'dev']}
}
]
};

View File

@ -15,7 +15,7 @@ class projectModel extends baseModel {
group_id: { type: Number, required: true },
project_type: {type:String, required: true, enum: ['public', 'private']},
members: [
{uid: Number, role: {type: String, enum:['owner', 'dev']},username: String, email: String}
{uid: Number, role: {type: String, enum:['owner', 'dev']}}
],
env: [
{ name: String, domain: String }