82 lines
3.1 KiB
Go
82 lines
3.1 KiB
Go
package dto
|
||
|
||
import (
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
// 后台管理端接口聚合(组前缀 /api/v1/admin,path 相对组)。
|
||
// service 按表归入各表文件(订单→order、授权→license),controller 聚合 admin。
|
||
|
||
// ---------- 订单管理 ----------
|
||
|
||
// AdminOrderListReq 订单列表查询
|
||
type AdminOrderListReq struct {
|
||
g.Meta `path:"/orders" method:"get" summary:"订单列表" tags:"管理端"`
|
||
PhoneNum string `json:"phoneNum" v:"length:0,20" dc:"手机号精确匹配"`
|
||
Status string `json:"status" v:"in:created,paid,closed" dc:"订单状态"`
|
||
StartAt *gtime.Time `json:"startAt" dc:"下单时间起(含)"`
|
||
EndAt *gtime.Time `json:"endAt" dc:"下单时间止(含)"`
|
||
Page int `json:"page" v:"integer|min:1" dc:"页码,默认 1"`
|
||
Size int `json:"size" v:"integer|min:1|max:100" dc:"每页条数,默认 20"`
|
||
}
|
||
|
||
// AdminOrderItem 订单条目(金额整数分,前端展示 ÷100)
|
||
type AdminOrderItem struct {
|
||
OrderId string `json:"orderId"`
|
||
PhoneNum string `json:"phoneNum"`
|
||
PlanId string `json:"planId"`
|
||
Channel string `json:"channel"`
|
||
AmountCents int64 `json:"amountCents"`
|
||
Status string `json:"status"`
|
||
CreatedAt *gtime.Time `json:"createdAt"`
|
||
PaidAt *gtime.Time `json:"paidAt"`
|
||
}
|
||
|
||
type AdminOrderListRes struct {
|
||
Total int64 `json:"total"`
|
||
List []*AdminOrderItem `json:"list"`
|
||
}
|
||
|
||
// ---------- 授权管理 ----------
|
||
|
||
// AdminLicenseListReq 账号/授权列表查询
|
||
type AdminLicenseListReq struct {
|
||
g.Meta `path:"/licenses" method:"get" summary:"账号列表" tags:"管理端"`
|
||
PhoneNum string `json:"phoneNum" v:"length:0,20" dc:"手机号模糊匹配"`
|
||
Page int `json:"page" v:"integer|min:1" dc:"页码,默认 1"`
|
||
Size int `json:"size" v:"integer|min:1|max:100" dc:"每页条数,默认 20"`
|
||
}
|
||
|
||
// AdminLicenseItem 账号条目(未充值时 expiresAt 为 null)
|
||
type AdminLicenseItem struct {
|
||
PhoneNum string `json:"phoneNum"`
|
||
ExpiresAt *gtime.Time `json:"expiresAt"`
|
||
CreatedAt *gtime.Time `json:"createdAt"`
|
||
UpdatedAt *gtime.Time `json:"updatedAt"`
|
||
}
|
||
|
||
type AdminLicenseListRes struct {
|
||
Total int64 `json:"total"`
|
||
List []*AdminLicenseItem `json:"list"`
|
||
}
|
||
|
||
// AdminGrantReq 手动授权(免费发卡,与支付回调同自然日叠加语义;未注册账号自动建占位行)
|
||
type AdminGrantReq struct {
|
||
g.Meta `path:"/licenses/grant" method:"post" summary:"手动授权" tags:"管理端"`
|
||
PhoneNum string `json:"phoneNum" v:"required|length:6,20" dc:"手机号"`
|
||
PlanId string `json:"planId" v:"required" dc:"套餐标识(需在 config.yml plans 存在)"`
|
||
}
|
||
|
||
type AdminGrantRes struct {
|
||
ExpiresAt *gtime.Time `json:"expiresAt"`
|
||
}
|
||
|
||
// AdminRevokeReq 撤销授权(清授权保留账号)
|
||
type AdminRevokeReq struct {
|
||
g.Meta `path:"/licenses/revoke" method:"post" summary:"撤销授权" tags:"管理端"`
|
||
PhoneNum string `json:"phoneNum" v:"required|length:6,20" dc:"手机号"`
|
||
}
|
||
|
||
type AdminRevokeRes struct{}
|