|
@@ -7,6 +7,7 @@ type Cost interface {
|
|
Deduction() //扣费(剩余量|账户余额)
|
|
Deduction() //扣费(剩余量|账户余额)
|
|
Before() bool
|
|
Before() bool
|
|
After()
|
|
After()
|
|
|
|
+ GetData() (interface{}, int, error)
|
|
}
|
|
}
|
|
|
|
|
|
type LeftNumCost struct {
|
|
type LeftNumCost struct {
|
|
@@ -15,6 +16,7 @@ type LeftNumCost struct {
|
|
LeftNum int
|
|
LeftNum int
|
|
ProductType int
|
|
ProductType int
|
|
DataNumLimitOneTimes int
|
|
DataNumLimitOneTimes int
|
|
|
|
+ GetData1 func() (interface{}, int, error)
|
|
}
|
|
}
|
|
type AccountBalanceCost struct {
|
|
type AccountBalanceCost struct {
|
|
AppID string
|
|
AppID string
|
|
@@ -23,6 +25,7 @@ type AccountBalanceCost struct {
|
|
}
|
|
}
|
|
|
|
|
|
func (l *LeftNumCost) Deduction() {
|
|
func (l *LeftNumCost) Deduction() {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
func (l *LeftNumCost) Before() bool {
|
|
func (l *LeftNumCost) Before() bool {
|
|
@@ -41,6 +44,10 @@ func (l *LeftNumCost) Before() bool {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (l *LeftNumCost) GetData() (interface{}, int, error) {
|
|
|
|
+ return l.GetData1()
|
|
|
|
+}
|
|
|
|
+
|
|
func (l *LeftNumCost) After() {
|
|
func (l *LeftNumCost) After() {
|
|
switch l.ProductType {
|
|
switch l.ProductType {
|
|
case 0:
|
|
case 0:
|
|
@@ -52,7 +59,7 @@ func (a *AccountBalanceCost) Deduction() {
|
|
|
|
|
|
}
|
|
}
|
|
func (a *AccountBalanceCost) Before() bool {
|
|
func (a *AccountBalanceCost) Before() bool {
|
|
-
|
|
|
|
|
|
+ return false
|
|
}
|
|
}
|
|
func (a *AccountBalanceCost) After() {
|
|
func (a *AccountBalanceCost) After() {
|
|
|
|
|