فهرست منبع

Merge branch 'yun-group-buy' of k.zhang/duoduo into yun-test

k.zhang 3 هفته پیش
والد
کامیت
fb4df01321
2فایلهای تغییر یافته به همراه30 افزوده شده و 1 حذف شده
  1. 29 0
      apis/shanghu/account.go
  2. 1 1
      apis/shanghu/base.go

+ 29 - 0
apis/shanghu/account.go

@@ -4,6 +4,7 @@ import (
 	"duoduo/apis/shanghu/models"
 	"duoduo/models/shanghu"
 	"duoduo/tools/app"
+	"errors"
 	"github.com/gin-gonic/gin"
 )
 
@@ -45,3 +46,31 @@ func GetAccountAmount(c *gin.Context) {
 	}
 
 }
+
+func GetActiveAmount(c *gin.Context) {
+	var inData models.GetAccountAmountRequest
+	var outData models.GetAccountAmountReply
+	var sqlClientData shanghu.ActiveClientAccount
+
+	err := c.ShouldBindJSON(&inData)
+	if err != nil {
+		app.Error(c, 400, err, err.Error())
+		return
+	}
+
+	if inData.Type == "client" {
+		sqlClientData.ClientOpenID = inData.OpenId
+		clientAccount, err := sqlClientData.GetActiveAccount()
+		if err != nil {
+			app.Error(c, 500, err, err.Error())
+			return
+		}
+		outData.Amount = clientAccount.Amount
+		app.OK(c, outData, app.Success)
+		return
+
+	} else {
+		app.Error(c, 500, errors.New("不支持此业务查询"), "不支持此业务查询")
+		return
+	}
+}

+ 1 - 1
apis/shanghu/base.go

@@ -100,6 +100,6 @@ func InitShangHuRouter(engine *gin.RouterGroup) {
 		activeV1.POST("/active/draw/count", ActiveDrawCount)                //邀请客户数量统计
 		activeV1.POST("/client/user/info", GetActiveUserInfo)               //client 用户信息
 		activeV1.POST("/active/cash/out", ActiveCashOut)                    //c端提现
-
+		activeV1.POST("/active/client/amount", GetActiveAmount)             //余额
 	}
 }