feat: fix pay by balance
This commit is contained in:
@@ -280,10 +280,6 @@ func (ctl *posts) Buy(ctx fiber.Ctx, id int64, user *model.Users) (*wechat.JSAPI
|
||||
|
||||
payPrice := post.Price * int64(post.Discount) / 100
|
||||
if user.Balance >= payPrice {
|
||||
err = models.Users.SetBalance(ctx.Context(), user.ID, user.Balance-payPrice)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "余额支付失败")
|
||||
}
|
||||
|
||||
if err := ctl.job.Add(&jobs.BalancePayNotify{OrderNo: order.OrderNo}); err != nil {
|
||||
log.Errorf("add job error:%v", err)
|
||||
|
||||
Reference in New Issue
Block a user