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