shenjiachi před 2 dny
rodič
revize
60a6b0fe23
1 změnil soubory, kde provedl 45 přidání a 46 odebrání
  1. +45
    -46
      app/hdl/member_center/hdl_user_management.go

+ 45
- 46
app/hdl/member_center/hdl_user_management.go Zobrazit soubor

@@ -6,7 +6,6 @@ import (
md "applet/app/md/institutional_management/member_center"
svc "applet/app/svc/member_center"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"github.com/gin-gonic/gin"
)

@@ -123,53 +122,53 @@ func UserManagementUpdateUserInfo(c *gin.Context) {
return
}

userDb := implement.NewUserDb(db.Db)
_ = implement.NewUserDb(db.Db)

var affected int64
var err1 error
forceColumns := make([]string, 0)
user := model.User{
Id: req.UID,
}
if req.Memo != "" {
user.Memo = req.Memo
forceColumns = append(forceColumns, "memo")
}
if req.Disable != false {
user.State = 2
forceColumns = append(forceColumns, "state")
}
if req.LastLoginIp != "" {
user.LastLoginIp = req.LastLoginIp
forceColumns = append(forceColumns, "last_login_ip")
}
if req.Avatar != "" {
user.Avatar = req.Avatar
forceColumns = append(forceColumns, "avatar")
}
if len(forceColumns) > 0 {
affected, err1 = userDb.UserUpdate(req.UID, &user)
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
}
var err2 error
if req.Tag != 0 {
record := model.UserTagRecords{
TagId: req.Tag,
}
recordsDb := implement.NewUserTagRecordsDb(db.Db)
affected, err2 = recordsDb.UserTagRecordsUpdate(req.UID, &record, "tag_id")
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}
}
//var affected int64
//var err1 error
//forceColumns := make([]string, 0)
//user := model.User{
// Id: req.UID,
//}
//if req.Memo != "" {
// user.Memo = req.Memo
// forceColumns = append(forceColumns, "memo")
//}
//if req.Disable != false {
// user.State = 2
// forceColumns = append(forceColumns, "state")
//}
//if req.LastLoginIp != "" {
// user.LastLoginIp = req.LastLoginIp
// forceColumns = append(forceColumns, "last_login_ip")
//}
//if req.Avatar != "" {
// user.Avatar = req.Avatar
// forceColumns = append(forceColumns, "avatar")
//}
//if len(forceColumns) > 0 {
// affected, err1 = userDb.UserUpdate(req.UID, &user)
// if err1 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err1.Error())
// return
// }
//}
//
//var err2 error
//if req.Tag != 0 {
// record := model.UserTagRecords{
// TagId: req.Tag,
// }
// recordsDb := implement.NewUserTagRecordsDb(db.Db)
// affected, err2 = recordsDb.UserTagRecordsUpdate(req.UID, &record, "tag_id")
// if err2 != nil {
// e.OutErr(c, e.ERR_DB_ORM, err2.Error())
// return
// }
//
//}

e.OutSuc(c, affected, nil)
e.OutSuc(c, 0, nil)
}

// UserManagementGetOneBasic


Načítá se…
Zrušit
Uložit