From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 19:20:21 +0800 Subject: [PATCH] 公海member_id使用0 --- model/user.go | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/user.go b/model/user.go index b931f71..44f7fdc 100644 --- a/model/user.go +++ b/model/user.go @@ -292,7 +292,7 @@ return records, nil } -func (slf *UserSearch) Upsert(record User) error { +func (slf *UserSearch) Upsert(record User, SubUserQueried bool) error { var db = slf.SetId(record.UUID).build() old, err := slf.First() @@ -303,12 +303,12 @@ } else if old.Username != record.Username || old.UserType != record.UserType || old.NickName != record.NickName || - record.SubUserIds != "" && old.SubUserIds != record.SubUserIds { + SubUserQueried && old.SubUserIds != record.SubUserIds { old.Username = record.Username old.UserType = record.UserType old.NickName = record.NickName old.SubUserIds = record.SubUserIds - if err := db.Updates(&record).Error; err != nil { + if err := db.Save(&old).Error; err != nil { return fmt.Errorf("update user err: %v, old record: %+v", err, old) } } -- Gitblit v1.8.0