From 5fcd76e32eabbbe74003ded1ef52f4047601e985 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 11:51:24 +0800 Subject: [PATCH 1/2] info get profile --- model/gmodel/fs_address_logic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/gmodel/fs_address_logic.go b/model/gmodel/fs_address_logic.go index 6909304d..86848aa4 100755 --- a/model/gmodel/fs_address_logic.go +++ b/model/gmodel/fs_address_logic.go @@ -86,14 +86,14 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i now := time.Now().UTC() - err = tx.Model(&FsAddress{}).Where(" `user_id` = ? and `status` = ? and `address_id` = ? ", userId, 1, addressId). + err = tx.Model(&FsAddress{}).Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId). UpdateColumn("ltime", now.AddDate(250, 0, 0)). UpdateColumn("utime", now).Error if err != nil { return err } - err = tx.Where(" `user_id` = ? and `status` = ? and `address_id` != ? and `ltime` > ? ", userId, 1, addressId, now.AddDate(10, 0, 0)). + err = tx.Where(" `user_id` = ? and `status` = 1 and `address_id` != ? and `ltime` > ? ", userId, addressId, now.AddDate(10, 0, 0)). UpdateColumn("ltime", now).Error if err != nil { logx.Error(err) From 53446bb606df18d5dfe3d097342b392a9159f6ed Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 11:55:21 +0800 Subject: [PATCH 2/2] info get profile --- model/gmodel/fs_address_logic.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/model/gmodel/fs_address_logic.go b/model/gmodel/fs_address_logic.go index 86848aa4..2dfcc55b 100755 --- a/model/gmodel/fs_address_logic.go +++ b/model/gmodel/fs_address_logic.go @@ -86,7 +86,12 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i now := time.Now().UTC() - err = tx.Model(&FsAddress{}).Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId). + err = tx.Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId).Take(nil).Error + if err != nil { + return err + } + + err = tx.Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId). UpdateColumn("ltime", now.AddDate(250, 0, 0)). UpdateColumn("utime", now).Error if err != nil {