fix(user):更新用户名称在修改的时候,拼音缩写不跟随修改的问题。
This commit is contained in:
parent
7b8ee5ddbd
commit
710d285733
|
@ -8,6 +8,7 @@ import (
|
|||
"electricity_bill_calc/response"
|
||||
"electricity_bill_calc/security"
|
||||
"electricity_bill_calc/service"
|
||||
"electricity_bill_calc/tools"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -326,6 +327,10 @@ func modifyAccountDetail(c *gin.Context) {
|
|||
newUserInfo := new(model.UserDetail)
|
||||
newUserInfo.Id = targetUserId
|
||||
newUserInfo.Name = &modForm.Name
|
||||
if &modForm.Name != nil {
|
||||
abbr := tools.PinyinAbbr(*&modForm.Name)
|
||||
newUserInfo.Abbr = &abbr
|
||||
}
|
||||
newUserInfo.Region = modForm.Region
|
||||
newUserInfo.Address = modForm.Address
|
||||
newUserInfo.Contact = modForm.Contact
|
||||
|
@ -337,7 +342,7 @@ func modifyAccountDetail(c *gin.Context) {
|
|||
}
|
||||
_, err = global.DB.NewUpdate().Model(newUserInfo).
|
||||
WherePK().
|
||||
Column("name", "region", "address", "contact", "phone", "unit_service_fee").
|
||||
Column("name", "abbr", "region", "address", "contact", "phone", "unit_service_fee").
|
||||
Exec(c)
|
||||
if err != nil {
|
||||
result.Error(http.StatusInternalServerError, err.Error())
|
||||
|
|
Loading…
Reference in New Issue
Block a user