From 98851a41ea498ddba0cf5760a0008ef8a1872730 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Thu, 7 Sep 2023 13:10:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=8A=E4=BC=A0logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../upload/internal/logic/uploadlogologic.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/server/upload/internal/logic/uploadlogologic.go b/server/upload/internal/logic/uploadlogologic.go index 3983742e..2dc66024 100644 --- a/server/upload/internal/logic/uploadlogologic.go +++ b/server/upload/internal/logic/uploadlogologic.go @@ -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 })