126 lines
4.7 KiB
Go
126 lines
4.7 KiB
Go
package v1
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// ============================================================================
|
|
// 管理端:额度配置 / 次数包 / 会员套餐 / 额度设置
|
|
// ============================================================================
|
|
|
|
// ===== 次数包档位 =====
|
|
|
|
type QuotaPackItem struct {
|
|
Id int64 `json:"id"`
|
|
PackKey string `json:"pack_key"`
|
|
Name string `json:"name"`
|
|
Times int `json:"times"`
|
|
PriceCents int64 `json:"price_cents"`
|
|
ProductId string `json:"product_id"`
|
|
ValidDays int `json:"valid_days"`
|
|
ToolKey string `json:"tool_key"`
|
|
ToolName string `json:"tool_name"`
|
|
Badge string `json:"badge"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"is_enabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type QuotaPackListReq struct {
|
|
g.Meta `path:"/quota/pack/list" method:"get" tags:"admin" summary:"次数包档位列表"`
|
|
}
|
|
type QuotaPackListRes struct {
|
|
List []QuotaPackItem `json:"list"`
|
|
}
|
|
|
|
type QuotaPackSaveReq struct {
|
|
g.Meta `path:"/quota/pack/save" method:"post" tags:"admin" summary:"保存次数包档位"`
|
|
Id int64 `json:"id"`
|
|
PackKey string `v:"required-if:id,0#档位标识不能为空" json:"packKey"`
|
|
Name string `v:"required#展示名不能为空" json:"name"`
|
|
Times int `v:"min:1#次数必须大于 0" json:"times"`
|
|
PriceCents int64 `v:"min:1#价格必须大于 0" json:"priceCents"`
|
|
ProductId string `v:"required#微信道具 ID 不能为空" json:"productId"`
|
|
ValidDays int `json:"validDays"`
|
|
ToolKey string `json:"toolKey"`
|
|
Badge string `json:"badge"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"isEnabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
type QuotaPackSaveRes struct{}
|
|
|
|
type QuotaPackToggleReq struct {
|
|
g.Meta `path:"/quota/pack/toggle" method:"post" tags:"admin" summary:"次数包启停"`
|
|
Id int64 `v:"required" json:"id"`
|
|
Value int `json:"value"`
|
|
}
|
|
type QuotaPackToggleRes struct{}
|
|
|
|
// ===== 额度设置 =====
|
|
|
|
type QuotaSettingGetReq struct {
|
|
g.Meta `path:"/quota/setting/get" method:"get" tags:"admin" summary:"额度设置"`
|
|
}
|
|
type QuotaSettingGetRes struct {
|
|
PeriodDays int `json:"period_days"` // 全局默认额度重置周期(天)
|
|
DefaultPeriodDays int `json:"default_period_days"` // 代码兜底值,界面上作为占位提示
|
|
}
|
|
|
|
type QuotaSettingSaveReq struct {
|
|
g.Meta `path:"/quota/setting/save" method:"post" tags:"admin" summary:"保存额度设置"`
|
|
PeriodDays int `v:"min:1|max:3650#周期至少 1 天|周期最多 3650 天" json:"periodDays"`
|
|
}
|
|
type QuotaSettingSaveRes struct{}
|
|
|
|
// ===== 会员套餐 =====
|
|
|
|
type PlanItem struct {
|
|
Id int64 `json:"id"`
|
|
PlanKey string `json:"plan_key"`
|
|
Name string `json:"name"`
|
|
Subtitle string `json:"subtitle"`
|
|
LevelKey string `json:"level_key"`
|
|
LevelName string `json:"level_name"`
|
|
DurationDays int `json:"duration_days"`
|
|
PriceCents int64 `json:"price_cents"`
|
|
ProductId string `json:"product_id"`
|
|
Badge string `json:"badge"`
|
|
QuotaPeriodDays int `json:"quota_period_days"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"is_enabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type PlanListReq struct {
|
|
g.Meta `path:"/plan/list" method:"get" tags:"admin" summary:"会员套餐列表"`
|
|
}
|
|
type PlanListRes struct {
|
|
List []PlanItem `json:"list"`
|
|
}
|
|
|
|
// PlanSaveReq 只开放运营真正需要改的字段:价格、道具 ID、额度周期、上下架。
|
|
// plan_key / level_key / duration_days 属跨端契约,仍由 seedMemberPlans 定义,
|
|
// 避免后台改出「前端不认识的等级」。
|
|
type PlanSaveReq struct {
|
|
g.Meta `path:"/plan/save" method:"post" tags:"admin" summary:"保存会员套餐(仅价格/道具/额度周期/上下架)"`
|
|
Id int64 `v:"required#套餐 ID 不能为空" json:"id"`
|
|
Name string `v:"required#套餐名不能为空" json:"name"`
|
|
Subtitle string `json:"subtitle"`
|
|
PriceCents int64 `v:"min:1#价格必须大于 0" json:"priceCents"`
|
|
ProductId string `v:"required#微信道具 ID 不能为空" json:"productId"`
|
|
Badge string `json:"badge"`
|
|
QuotaPeriodDays int `json:"quotaPeriodDays"`
|
|
Sort int `json:"sort"`
|
|
IsEnabled int `json:"isEnabled"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
type PlanSaveRes struct{}
|
|
|
|
// ===== 用户额度周期 =====
|
|
|
|
type UserQuotaPeriodReq struct {
|
|
g.Meta `path:"/user/quota-period" method:"post" tags:"admin" summary:"单独调整用户额度周期"`
|
|
UserId int64 `v:"required#用户 ID 不能为空" json:"userId"`
|
|
PeriodDays int `v:"min:0|max:3650#周期不能为负|周期最多 3650 天" json:"periodDays"`
|
|
}
|
|
type UserQuotaPeriodRes struct{}
|