Move rebate processing into model transactions, keep frozen rebates out of transferable quota until release, and trigger top-up rebates idempotently.
32 lines
779 B
Go
32 lines
779 B
Go
package service
|
|
|
|
import "github.com/QuantumNous/new-api/model"
|
|
|
|
func IsRebateEnabled() bool {
|
|
return model.IsRebateEnabled()
|
|
}
|
|
|
|
func GetGlobalRebateRatePercent() int {
|
|
return model.GetGlobalRebateRatePercent()
|
|
}
|
|
|
|
func GetGlobalRebateFrozenDays() int {
|
|
return model.GetGlobalRebateFrozenDays()
|
|
}
|
|
|
|
func GetEffectiveRebateRate(inviter *model.User) int {
|
|
return model.GetEffectiveRebateRate(inviter)
|
|
}
|
|
|
|
func GetEffectiveFrozenDays(inviter *model.User) int {
|
|
return model.GetEffectiveFrozenDays(inviter)
|
|
}
|
|
|
|
func ProcessRebateAfterRecharge(invitee *model.User, orderId int, orderType string, orderAmount int) error {
|
|
return model.ProcessRebateAfterRecharge(invitee, orderId, orderType, orderAmount)
|
|
}
|
|
|
|
func ReleaseExpiredRebates() error {
|
|
return model.ReleaseExpiredRebates()
|
|
}
|