Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
@@ -84,6 +84,8 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i
|
||||
|
||||
err = a.db.WithContext(ctx).Model(&FsAddress{}).Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
logx.Info("address_id:", addressId, " set default ")
|
||||
|
||||
now := time.Now().UTC()
|
||||
|
||||
err = tx.Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId).Take(nil).Error
|
||||
@@ -91,14 +93,14 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Where("`user_id` = ? and `status` = 1 and `address_id` = ? ", userId, addressId).
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Where(" `user_id` = ? and `status` = 1 and `address_id` != ? and `ltime` > ? ", userId, addressId, now.AddDate(10, 0, 0)).
|
||||
err = tx.Model(&FsAddress{}).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)
|
||||
|
||||
Reference in New Issue
Block a user