fix:设置当前logo

This commit is contained in:
momo 2023-09-08 18:19:24 +08:00
parent 2ae8cde2ce
commit 7abcfadd93

View File

@ -150,8 +150,16 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
}
userInfo.Metadata = &metadataBUserInfo
userInfo.Utime = &nowTime
resUpdates := tx.Model(&userInfo).Select("metadata").Where("id = ?", userInfo.Id).Updates(&userInfo)
err = resUpdates.Error
if userInfo.Id == 0 {
// 新增
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 != gorm.ErrRecordNotFound {
logc.Errorf(l.ctx, "FsUserInfo Updates err%+v", err)