优化乐刷通知与钱包充值流程

This commit is contained in:
yml
2026-06-03 18:51:56 +08:00
parent a1942c8453
commit 783999f396
9 changed files with 1938 additions and 73 deletions
+3 -1
View File
@@ -8,6 +8,8 @@ var (
ErrInsufficientBalance = errors.New("insufficient balance")
)
const MinRechargeAmount = 0.01
type Service struct {
repo *Repository
}
@@ -34,7 +36,7 @@ func (s *Service) Recharge(userID uint64, req RechargeRequest) (*AccountDTO, err
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
if req.Amount <= 0 {
if req.Amount < MinRechargeAmount {
return nil, ErrInvalidAmount
}
return s.repo.Recharge(userID, req.Amount)