初始化v1
This commit is contained in:
230
api/v1/payment_order.go
Normal file
230
api/v1/payment_order.go
Normal file
@@ -0,0 +1,230 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// PaymentOrderCreateReq 创建支付订单请求
|
||||
type PaymentOrderCreateReq struct {
|
||||
g.Meta `path:"/payment/create" method:"post" summary:"创建支付订单" tags:"支付订单管理"`
|
||||
VipLevelId uint `json:"vip_level_id" v:"required|min:1#VIP等级ID不能为空|VIP等级ID必须大于0" dc:"VIP等级ID"`
|
||||
PaymentType int `json:"payment_type" v:"required|in:1,2,3#支付方式不能为空|支付方式错误" dc:"支付方式(1:支付宝,2:微信,3:余额)"`
|
||||
CouponId uint `json:"coupon_id" v:"min:0#优惠券ID必须大于等于0" dc:"优惠券ID" default:"0"`
|
||||
Remark string `json:"remark" v:"length:0,200#备注长度不能超过200字符" dc:"备注"`
|
||||
}
|
||||
|
||||
// PaymentOrderCreateRes 创建支付订单响应
|
||||
type PaymentOrderCreateRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
OrderNo string `json:"order_no" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" dc:"支付单号"`
|
||||
PayUrl string `json:"pay_url" dc:"支付链接"`
|
||||
Amount string `json:"amount" dc:"支付金额"`
|
||||
}
|
||||
|
||||
// PaymentOrderListReq 支付订单列表请求
|
||||
type PaymentOrderListReq struct {
|
||||
g.Meta `path:"/payment/list" method:"get" summary:"支付订单列表" tags:"支付订单管理"`
|
||||
Status int `json:"status" v:"in:-1,0,1,2,3#状态值错误" dc:"状态(-1:全部,0:待支付,1:已支付,2:已取消,3:已退款)" default:"-1"`
|
||||
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
|
||||
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
|
||||
}
|
||||
|
||||
// PaymentOrderListRes 支付订单列表响应
|
||||
type PaymentOrderListRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
List []PaymentOrderItem `json:"list" dc:"订单列表"`
|
||||
Total int `json:"total" dc:"总数"`
|
||||
Page int `json:"page" dc:"当前页"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
}
|
||||
|
||||
// PaymentOrderItem 支付订单项目
|
||||
type PaymentOrderItem struct {
|
||||
Id uint `json:"id" dc:"订单ID"`
|
||||
OrderNo string `json:"order_no" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" dc:"支付单号"`
|
||||
VipLevelName string `json:"vip_level_name" dc:"VIP等级名称"`
|
||||
OriginalPrice string `json:"original_price" dc:"原价"`
|
||||
CouponAmount string `json:"coupon_amount" dc:"优惠金额"`
|
||||
ActualAmount string `json:"actual_amount" dc:"实付金额"`
|
||||
PaymentType int `json:"payment_type" dc:"支付方式"`
|
||||
Status int `json:"status" dc:"订单状态"`
|
||||
PaidAt string `json:"paid_at" dc:"支付时间"`
|
||||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
}
|
||||
|
||||
// PaymentOrderDetailReq 支付订单详情请求
|
||||
type PaymentOrderDetailReq struct {
|
||||
g.Meta `path:"/payment/detail" method:"get" summary:"支付订单详情" tags:"支付订单管理"`
|
||||
OrderNo string `json:"order_no" v:"required#订单号不能为空" dc:"订单号"`
|
||||
}
|
||||
|
||||
// PaymentOrderDetailRes 支付订单详情响应
|
||||
type PaymentOrderDetailRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
Order PaymentOrderDetail `json:"order" dc:"订单详情"`
|
||||
}
|
||||
|
||||
// PaymentOrderDetail 支付订单详情
|
||||
type PaymentOrderDetail struct {
|
||||
Id uint `json:"id" dc:"订单ID"`
|
||||
OrderNo string `json:"order_no" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" dc:"支付单号"`
|
||||
VipLevelId uint `json:"vip_level_id" dc:"VIP等级ID"`
|
||||
VipLevelName string `json:"vip_level_name" dc:"VIP等级名称"`
|
||||
Duration int `json:"duration" dc:"时长(天)"`
|
||||
OriginalPrice string `json:"original_price" dc:"原价"`
|
||||
CouponId uint `json:"coupon_id" dc:"优惠券ID"`
|
||||
CouponAmount string `json:"coupon_amount" dc:"优惠金额"`
|
||||
ActualAmount string `json:"actual_amount" dc:"实付金额"`
|
||||
PaymentType int `json:"payment_type" dc:"支付方式"`
|
||||
Status int `json:"status" dc:"订单状态"`
|
||||
PaidAt string `json:"paid_at" dc:"支付时间"`
|
||||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
}
|
||||
|
||||
// PaymentOrderCancelReq 取消支付订单请求
|
||||
type PaymentOrderCancelReq struct {
|
||||
g.Meta `path:"/payment/cancel" method:"post" summary:"取消支付订单" tags:"支付订单管理"`
|
||||
OrderNo string `json:"order_no" v:"required#订单号不能为空" dc:"订单号"`
|
||||
}
|
||||
|
||||
// PaymentOrderCancelRes 取消支付订单响应
|
||||
type PaymentOrderCancelRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
}
|
||||
|
||||
// PaymentCallbackReq 支付回调请求
|
||||
type PaymentCallbackReq struct {
|
||||
g.Meta `path:"/payment/callback" method:"post" summary:"支付回调" tags:"支付订单管理"`
|
||||
OrderNo string `json:"order_no" v:"required#订单号不能为空" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" v:"required#支付单号不能为空" dc:"支付单号"`
|
||||
Amount string `json:"amount" v:"required#支付金额不能为空" dc:"支付金额"`
|
||||
Status int `json:"status" v:"required|in:1,2#支付状态不能为空|支付状态错误" dc:"支付状态(1:成功,2:失败)"`
|
||||
TradeNo string `json:"trade_no" dc:"第三方交易号"`
|
||||
}
|
||||
|
||||
// PaymentCallbackRes 支付回调响应
|
||||
type PaymentCallbackRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderListReq 管理员支付订单列表请求
|
||||
type AdminPaymentOrderListReq struct {
|
||||
g.Meta `path:"/admin/payment/list" method:"get" summary:"管理员支付订单列表" tags:"支付订单管理"`
|
||||
UserId uint `json:"user_id" v:"min:0#用户ID必须大于等于0" dc:"用户ID" default:"0"`
|
||||
Status int `json:"status" v:"in:-1,0,1,2,3#状态值错误" dc:"状态(-1:全部,0:待支付,1:已支付,2:已取消,3:已退款)" default:"-1"`
|
||||
PaymentType int `json:"payment_type" v:"in:-1,1,2,3#支付方式错误" dc:"支付方式(-1:全部,1:支付宝,2:微信,3:余额)" default:"-1"`
|
||||
StartDate string `json:"start_date" v:"date#开始日期格式错误" dc:"开始日期"`
|
||||
EndDate string `json:"end_date" v:"date#结束日期格式错误" dc:"结束日期"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索(订单号/用户名)"`
|
||||
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
|
||||
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderListRes 管理员支付订单列表响应
|
||||
type AdminPaymentOrderListRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
List []AdminPaymentOrderItem `json:"list" dc:"订单列表"`
|
||||
Total int `json:"total" dc:"总数"`
|
||||
Page int `json:"page" dc:"当前页"`
|
||||
Size int `json:"size" dc:"每页数量"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderItem 管理员支付订单项目
|
||||
type AdminPaymentOrderItem struct {
|
||||
Id uint `json:"id" dc:"订单ID"`
|
||||
OrderNo string `json:"order_no" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" dc:"支付单号"`
|
||||
UserId uint `json:"user_id" dc:"用户ID"`
|
||||
Username string `json:"username" dc:"用户名"`
|
||||
VipLevelName string `json:"vip_level_name" dc:"VIP等级名称"`
|
||||
OriginalPrice string `json:"original_price" dc:"原价"`
|
||||
CouponAmount string `json:"coupon_amount" dc:"优惠金额"`
|
||||
ActualAmount string `json:"actual_amount" dc:"实付金额"`
|
||||
PaymentType int `json:"payment_type" dc:"支付方式"`
|
||||
Status int `json:"status" dc:"订单状态"`
|
||||
PaidAt string `json:"paid_at" dc:"支付时间"`
|
||||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderDetailReq 管理员支付订单详情请求
|
||||
type AdminPaymentOrderDetailReq struct {
|
||||
g.Meta `path:"/admin/payment/detail" method:"get" summary:"管理员支付订单详情" tags:"支付订单管理"`
|
||||
Id uint `json:"id" v:"required|min:1#订单ID不能为空|订单ID必须大于0" dc:"订单ID"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderDetailRes 管理员支付订单详情响应
|
||||
type AdminPaymentOrderDetailRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
Order AdminPaymentOrderDetail `json:"order" dc:"订单详情"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderDetail 管理员支付订单详情
|
||||
type AdminPaymentOrderDetail struct {
|
||||
Id uint `json:"id" dc:"订单ID"`
|
||||
OrderNo string `json:"order_no" dc:"订单号"`
|
||||
PaymentNo string `json:"payment_no" dc:"支付单号"`
|
||||
UserId uint `json:"user_id" dc:"用户ID"`
|
||||
Username string `json:"username" dc:"用户名"`
|
||||
VipLevelId uint `json:"vip_level_id" dc:"VIP等级ID"`
|
||||
VipLevelName string `json:"vip_level_name" dc:"VIP等级名称"`
|
||||
Duration int `json:"duration" dc:"时长(天)"`
|
||||
OriginalPrice string `json:"original_price" dc:"原价"`
|
||||
CouponId uint `json:"coupon_id" dc:"优惠券ID"`
|
||||
CouponAmount string `json:"coupon_amount" dc:"优惠金额"`
|
||||
ActualAmount string `json:"actual_amount" dc:"实付金额"`
|
||||
PaymentType int `json:"payment_type" dc:"支付方式"`
|
||||
Status int `json:"status" dc:"订单状态"`
|
||||
TradeNo string `json:"trade_no" dc:"第三方交易号"`
|
||||
PaidAt string `json:"paid_at" dc:"支付时间"`
|
||||
CreatedAt string `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt string `json:"updated_at" dc:"更新时间"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderRefundReq 管理员订单退款请求
|
||||
type AdminPaymentOrderRefundReq struct {
|
||||
g.Meta `path:"/admin/payment/refund" method:"post" summary:"订单退款" tags:"支付订单管理"`
|
||||
Id uint `json:"id" v:"required|min:1#订单ID不能为空|订单ID必须大于0" dc:"订单ID"`
|
||||
RefundType int `json:"refund_type" v:"required|in:1,2#退款类型不能为空|退款类型错误" dc:"退款类型(1:全额退款,2:部分退款)"`
|
||||
Amount string `json:"amount" v:"required-if:refund_type,2#部分退款时金额不能为空" dc:"退款金额"`
|
||||
Reason string `json:"reason" v:"required|length:1,200#退款原因不能为空|退款原因长度为1-200字符" dc:"退款原因"`
|
||||
}
|
||||
|
||||
// AdminPaymentOrderRefundRes 管理员订单退款响应
|
||||
type AdminPaymentOrderRefundRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
}
|
||||
|
||||
// PaymentStatisticsReq 支付统计请求
|
||||
type PaymentStatisticsReq struct {
|
||||
g.Meta `path:"/admin/payment/statistics" method:"get" summary:"支付统计" tags:"支付订单管理"`
|
||||
StartDate string `json:"start_date" v:"date#开始日期格式错误" dc:"开始日期"`
|
||||
EndDate string `json:"end_date" v:"date#结束日期格式错误" dc:"结束日期"`
|
||||
Type string `json:"type" v:"in:day,week,month#统计类型错误" dc:"统计类型(day:按天,week:按周,month:按月)" default:"day"`
|
||||
}
|
||||
|
||||
// PaymentStatisticsRes 支付统计响应
|
||||
type PaymentStatisticsRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
TotalCount int `json:"total_count" dc:"总订单数"`
|
||||
TotalAmount string `json:"total_amount" dc:"总金额"`
|
||||
PaidCount int `json:"paid_count" dc:"已支付订单数"`
|
||||
PaidAmount string `json:"paid_amount" dc:"已支付金额"`
|
||||
RefundCount int `json:"refund_count" dc:"退款订单数"`
|
||||
RefundAmount string `json:"refund_amount" dc:"退款金额"`
|
||||
ChartData []PaymentStatisticsItem `json:"chart_data" dc:"图表数据"`
|
||||
}
|
||||
|
||||
// PaymentStatisticsItem 支付统计项目
|
||||
type PaymentStatisticsItem struct {
|
||||
Date string `json:"date" dc:"日期"`
|
||||
Count int `json:"count" dc:"订单数"`
|
||||
Amount string `json:"amount" dc:"金额"`
|
||||
}
|
||||
Reference in New Issue
Block a user