fix:设置当前logo
This commit is contained in:
parent
2ae8cde2ce
commit
7abcfadd93
|
@ -150,8 +150,16 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
|
||||||
}
|
}
|
||||||
userInfo.Metadata = &metadataBUserInfo
|
userInfo.Metadata = &metadataBUserInfo
|
||||||
userInfo.Utime = &nowTime
|
userInfo.Utime = &nowTime
|
||||||
resUpdates := tx.Model(&userInfo).Select("metadata").Where("id = ?", userInfo.Id).Updates(&userInfo)
|
if userInfo.Id == 0 {
|
||||||
err = resUpdates.Error
|
// 新增
|
||||||
|
resCreate := tx.Model(&userInfo).Create(&userInfo)
|
||||||
|
err = resCreate.Error
|
||||||
|
} else {
|
||||||
|
// 更新
|
||||||
|
resUpdates := tx.Model(&userInfo).Select("metadata").Where("id = ?", userInfo.Id).Updates(&userInfo)
|
||||||
|
err = resUpdates.Error
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != gorm.ErrRecordNotFound {
|
if err != gorm.ErrRecordNotFound {
|
||||||
logc.Errorf(l.ctx, "FsUserInfo Updates err:%+v", err)
|
logc.Errorf(l.ctx, "FsUserInfo Updates err:%+v", err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user