Browse Source

Merge branch 'master' of http://192.168.3.207:10080/group3/SwordFish_Interface_Service

xuzhiheng 4 years ago
parent
commit
84e06fcd3f
2 changed files with 32 additions and 12 deletions
  1. 15 12
      lock/interface.go
  2. 17 0
      test/project/project_interface_test.go

+ 15 - 12
lock/interface.go

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

+ 17 - 0
test/project/project_interface_test.go

@@ -0,0 +1,17 @@
+package project
+
+import (
+	"sfis/lock"
+	"testing"
+)
+
+func Test_ProjectInterface(t *testing.T) {
+	leftNumCost := &lock.LeftNumCost{
+		AppID:                "sfPQRYRQMAAwcGBwYBCgcA",
+		ProductID:            1003,
+		LeftNum:              199999,
+		ProductType:          1,
+		DataNumLimitOneTimes: 100,
+	}
+	leftNumCost.Before()
+}