You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
package user
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"recook/internal/libs/bean"
|
|
"recook/internal/v2/lib/back"
|
|
"recook/internal/v2/lib/common"
|
|
"recook/internal/v2/logic/app/user"
|
|
"recook/tools"
|
|
"time"
|
|
)
|
|
|
|
type Balance struct {
|
|
}
|
|
|
|
type argsMonthHistory struct {
|
|
Date string `json:"date" form:"date"`
|
|
Status int `json:"status" form:"status"`
|
|
bean.Page
|
|
}
|
|
|
|
// @Style 余额信息
|
|
func (b *Balance) Info(c *gin.Context) {
|
|
userId, _ := common.GetAppUserId(c)
|
|
|
|
info := user.BalanceLogic.Info(userId)
|
|
|
|
back.Suc(c, "获取成功", info)
|
|
}
|
|
|
|
// @Style 月余额记录
|
|
func (b *Balance) MonthHistory(c *gin.Context) {
|
|
args := argsMonthHistory{}
|
|
if err := tools.ParseParams(&args, c); err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
if args.Date == "" {
|
|
back.Fail(c, "参数错误")
|
|
return
|
|
}
|
|
month, err := time.ParseInLocation("2006-01", args.Date, time.Local)
|
|
if err != nil {
|
|
back.Fail(c, "月份格式错误")
|
|
return
|
|
}
|
|
userId, _ := common.GetAppUserId(c)
|
|
|
|
lists, total := user.BalanceLogic.MonthHistroy(userId, month, args.Status, args.Page)
|
|
|
|
back.Suc(c, "获取成功", bean.ResultLists{
|
|
List: lists,
|
|
Total: total,
|
|
})
|
|
}
|