code refactor

This commit is contained in:
UlricQin 2020-11-03 12:17:17 +08:00
parent b448dad860
commit a4026e8c25
3 changed files with 12 additions and 2 deletions

View File

@ -29,7 +29,7 @@ const (
type User struct {
Id int64 `json:"id"`
UUID string `json:"-" xorm:"'uuid'"`
UUID string `json:"uuid" xorm:"'uuid'"`
Username string `json:"username"`
Password string `json:"-"`
Dispname string `json:"dispname"`

View File

@ -102,6 +102,10 @@ func roleGlobalUsersGet(c *gin.Context) {
list, err := models.UserSearchListInIds(ids, query, limit, offset(c, limit))
dangerous(err)
for i := 0; i < len(list); i++ {
list[i].UUID = ""
}
renderData(c, gin.H{
"list": list,
"total": total,

View File

@ -23,6 +23,10 @@ func userListGet(c *gin.Context) {
list, err := models.UserGets(ids, query, limit, offset(c, limit))
dangerous(err)
for i := 0; i < len(list); i++ {
list[i].UUID = ""
}
renderData(c, gin.H{
"list": list,
"total": total,
@ -75,7 +79,9 @@ func userAddPost(c *gin.Context) {
}
func userProfileGet(c *gin.Context) {
renderData(c, User(urlParamInt64(c, "id")), nil)
user := User(urlParamInt64(c, "id"))
user.UUID = ""
renderData(c, user,nil)
}
func userProfilePut(c *gin.Context) {