소스 검색

update

master
shenjiachi 5 일 전
부모
커밋
60a6b0fe23
1개의 변경된 파일45개의 추가작업 그리고 46개의 파일을 삭제
  1. +45
    -46
      app/hdl/member_center/hdl_user_management.go

+ 45
- 46
app/hdl/member_center/hdl_user_management.go 파일 보기

@@ -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


불러오는 중...
취소
저장