package manage import ( "github.com/gin-gonic/gin" "gold-shop/errors" request "gold-shop/request/manage" "gold-shop/service" "gold-shop/utils/excel" "gold-shop/utils/result" ) func GetPayments(c *gin.Context) (result.Data, error) { var req request.PaymentQueryRequest err := c.ShouldBindQuery(&req) if err != nil { return nil, errors.NewBusinessError("参数错误") } records, total := service.PaymentService.GetPayments(req) data := result.Data{ "records": records, "total": total, } return data, nil } func DownloadPayments(c *gin.Context) { var req request.PaymentQueryRequest _ = c.ShouldBindQuery(&req) f := service.PaymentService.GeneratePaymentsExcel(req) excel.Download(f, "支付列表.xlsx", c) }