refactor creating busi group

This commit is contained in:
Ulric Qin 2021-12-13 11:12:49 +08:00
parent d5050338f3
commit caa33c29e9
2 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,7 @@ var (
"The business group must retain at least one team": "业务组下要保留至少一个团队",
"At least one team have rw permission": "业务组下至少要有一个具备读写权限的团队",
"duplicate tagkey(%s)": "标签KEY(%s)重复了",
"Failed to create BusiGroup(%s)": "创建业务(%s)组失败",
}
langDict = map[string]map[string]string{
"zh": dict,

View File

@ -37,7 +37,18 @@ func busiGroupAdd(c *gin.Context) {
}
username := c.MustGet("username").(string)
ginx.NewRender(c).Message(models.BusiGroupAdd(f.Name, f.Members, username))
ginx.Dangerous(models.BusiGroupAdd(f.Name, f.Members, username))
// 如果创建成功拿着name去查应该可以查到
newbg, err := models.BusiGroupGet("name=?", f.Name)
ginx.Dangerous(err)
if newbg == nil {
ginx.NewRender(c).Message("Failed to create BusiGroup(%s)", f.Name)
return
}
ginx.NewRender(c).Data(newbg.Id, nil)
}
func busiGroupPut(c *gin.Context) {