|
@@ -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
|
|
|
+ }
|
|
|
+}
|