|
@@ -4,12 +4,9 @@ package lock
|
|
|
用户消费接口
|
|
|
*/
|
|
|
type Cost interface {
|
|
|
- deduction() //扣费(剩余量|账户余额)
|
|
|
- before() bool
|
|
|
- after()
|
|
|
-}
|
|
|
-
|
|
|
-type Deduction interface {
|
|
|
+ Deduction() //扣费(剩余量|账户余额)
|
|
|
+ Before() bool
|
|
|
+ After()
|
|
|
}
|
|
|
|
|
|
type LeftNumCost struct {
|
|
@@ -25,10 +22,10 @@ type AccountBalanceCost struct {
|
|
|
AccountBalance int
|
|
|
}
|
|
|
|
|
|
-func (l *LeftNumCost) deduction() {
|
|
|
+func (l *LeftNumCost) Deduction() {
|
|
|
}
|
|
|
|
|
|
-func (l *LeftNumCost) before() bool {
|
|
|
+func (l *LeftNumCost) Before() bool {
|
|
|
switch l.ProductType {
|
|
|
case 0:
|
|
|
//按次扣费的产品-判断left_num
|
|
@@ -44,13 +41,19 @@ func (l *LeftNumCost) before() bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-func (l *LeftNumCost) after() {
|
|
|
+func (l *LeftNumCost) After() {
|
|
|
switch l.ProductType {
|
|
|
case 0:
|
|
|
case 1:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (a *AccountBalanceCost) deduction() {
|
|
|
+func (a *AccountBalanceCost) Deduction() {
|
|
|
+
|
|
|
+}
|
|
|
+func (a *AccountBalanceCost) Before() bool {
|
|
|
+
|
|
|
+}
|
|
|
+func (a *AccountBalanceCost) After() {
|
|
|
|
|
|
}
|