Skip to content

Commit

Permalink
refactor creating busi group
Browse files Browse the repository at this point in the history
  • Loading branch information
UlricQin committed Dec 13, 2021
1 parent d505033 commit caa33c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/webapi/config/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 12 additions & 1 deletion src/webapi/router/router_busi_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit caa33c2

Please sign in to comment.