info get profile

This commit is contained in:
eson 2023-09-28 16:54:10 +08:00
parent 989b2daacc
commit 649e635d17

View File

@ -109,12 +109,27 @@ func (a *FsAddressModel) SettingUserDefaultAddress(ctx context.Context, userId i
return nil
})
return
return err
}
func (a *FsAddressModel) DeleteOne(ctx context.Context, addressId int64, userId int64) (err error) {
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
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
}