fix(balance): add timestamp to balance logs for payment, refund, and recharge transactions

This commit is contained in:
Chang lue Tsen 2025-09-05 09:29:19 -04:00
parent 71d32d73bb
commit 3199dc5141
3 changed files with 15 additions and 12 deletions

View File

@ -415,6 +415,7 @@ func (l *PurchaseCheckoutLogic) balancePayment(u *user.User, o *order.Order) err
Type: log.BalanceTypePayment, // Type 3 represents payment deduction Type: log.BalanceTypePayment, // Type 3 represents payment deduction
OrderId: o.Id, OrderId: o.Id,
Balance: userInfo.Balance, Balance: userInfo.Balance,
Timestamp: time.Now().UnixMilli(),
} }
content, _ := balanceLog.Marshal() content, _ := balanceLog.Marshal()
err = db.Create(&log.SystemLog{ err = db.Create(&log.SystemLog{

View File

@ -98,6 +98,7 @@ func (l *UnsubscribeLogic) Unsubscribe(req *types.UnsubscribeRequest) error {
Amount: balanceRefundAmount, Amount: balanceRefundAmount,
Type: log.BalanceTypeRefund, // Type 4 represents refund transaction Type: log.BalanceTypeRefund, // Type 4 represents refund transaction
Balance: balance, Balance: balance,
Timestamp: time.Now().UnixMilli(),
} }
content, _ := balanceLog.Marshal() content, _ := balanceLog.Marshal()

View File

@ -626,6 +626,7 @@ func (l *ActivateOrderLogic) Recharge(ctx context.Context, orderInfo *order.Orde
Type: CommissionTypeRecharge, Type: CommissionTypeRecharge,
OrderId: orderInfo.Id, OrderId: orderInfo.Id,
Balance: userInfo.Balance, Balance: userInfo.Balance,
Timestamp: time.Now().UnixMilli(),
} }
content, _ := balanceLog.Marshal() content, _ := balanceLog.Marshal()