fix:上传logo

This commit is contained in:
momo 2023-09-07 13:10:02 +08:00
parent b8cf209d24
commit 98851a41ea

View File

@ -247,11 +247,24 @@ func (l *UploadLogoLogic) UploadLogo(req *types.UploadLogoReq, userinfo *auth.Us
return err
}
userInfo.Metadata = &metadataB
logc.Infof(l.ctx, "userInfo %+v", userInfo)
if userInfo.Id > 0 {
tx.Select("metadata").Where("id = ?", userInfo.Id).Updates(userInfo)
resUpdates := tx.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)
return err
}
}
} else {
tx.Create(userInfo)
resCreate := tx.Create(&userInfo)
err = resCreate.Error
if err != nil {
if err != gorm.ErrRecordNotFound {
logc.Errorf(l.ctx, "FsUserInfo Create err%+v", err)
return err
}
}
}
return nil
})