| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 
							- package shanghu
 
- import (
 
- 	"duoduo/apis/shanghu/models"
 
- 	"duoduo/models/shanghu"
 
- 	"duoduo/tools/app"
 
- 	"fmt"
 
- 	"github.com/gin-gonic/gin"
 
- 	"time"
 
- )
 
- func CashOutList(c *gin.Context) {
 
- 	var inData models.CashOutListRequest
 
- 	var sqlData shanghu.CashOut
 
- 	var outData []models.CashOutListReply
 
- 	err := c.ShouldBindJSON(&inData)
 
- 	if err != nil {
 
- 		app.Error(c, 400, err, err.Error())
 
- 		return
 
- 	}
 
- 	var pageSize = 1000
 
- 	var pageIndex = 1
 
- 	//if inData.PageSize != 0 {
 
- 	//	pageSize = inData.PageSize
 
- 	//}
 
- 	//if inData.PageIndex != 0 {
 
- 	//	pageIndex = inData.PageIndex
 
- 	//}
 
- 	fmt.Println(inData.OpenId)
 
- 	sqlData.OpenID = inData.OpenId
 
- 	sqlData.AppID = inData.Appid
 
- 	cashOutList, count, err := sqlData.GetCashOutList(pageSize, pageIndex)
 
- 	if err != nil {
 
- 		app.Error(c, 500, err, err.Error())
 
- 		return
 
- 	}
 
- 	for i := 0; i < len(cashOutList); i++ {
 
- 		var cashOut models.CashOutListReply
 
- 		cashOut.Amount = cashOutList[i].Amount.Sub(cashOutList[i].Fee)
 
- 		cashOut.TotalAmount = cashOutList[i].Amount
 
- 		cashOut.CreateAt = cashOutList[i].CreatedAt.Format(time.DateTime)
 
- 		cashOut.Fee = cashOutList[i].Fee
 
- 		if cashOutList[i].Status == 1 {
 
- 			cashOut.Des = "提现中"
 
- 		} else if cashOutList[i].Status == 2 {
 
- 			cashOut.Des = "提现失败"
 
- 		} else if cashOutList[i].Status == 3 {
 
- 			cashOut.Des = "提现成功"
 
- 		} else if cashOutList[i].Status == 99 {
 
- 			cashOut.Des = "提现完成"
 
- 		}
 
- 		outData = append(outData, cashOut)
 
- 	}
 
- 	app.PageOK(c, outData, count, pageIndex, pageSize, app.Success)
 
- }
 
 
  |