info get profile
This commit is contained in:
parent
989b2daacc
commit
649e635d17
|
@ -109,12 +109,27 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *FsAddressModel) DeleteOne(ctx context.Context, addressId int64, userId int64) (err error) {
|
func (a *FsAddressModel) DeleteOne(ctx context.Context, addressId int64, userId int64) (err error) {
|
||||||
err = a.db.WithContext(ctx).Model(&FsAddress{}).
|
err = a.db.WithContext(ctx).Model(&FsAddress{}).
|
||||||
Where("`address_id` = ? and `user_id` = ? and `status` = ? ", addressId, userId, 1).
|
Where("`address_id` = ? and `user_id` = ? and `status` = 1 ", addressId, userId).
|
||||||
UpdateColumn("status", 0).Error
|
UpdateColumn("status", 0).Error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateUsedAddress 当每次订单成功后, 更新一次地址使用时间
|
||||||
|
func (a *FsAddressModel) UpdateUsedAddress(ctx context.Context, addressId int64, userId int64) (err error) {
|
||||||
|
err = a.db.WithContext(ctx).Model(&FsAddress{}).Transaction(func(tx *gorm.DB) error {
|
||||||
|
logx.Info("address_id:", addressId, " update used")
|
||||||
|
now := time.Now().UTC()
|
||||||
|
err = tx.Where("`user_id` = ? and `status` = 1 and `address_id` = ? and `ltime` < ?", userId, addressId, now).
|
||||||
|
UpdateColumn("ltime", now).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user