小程序虚拟支付
This commit is contained in:
@@ -31,16 +31,18 @@ type MyInfoRes struct {
|
||||
// ===== 用户管理 =====
|
||||
|
||||
type AdminUserItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
Openid string `json:"openid"`
|
||||
LevelKey string `json:"level_key"`
|
||||
LevelName string `json:"level_name"`
|
||||
Status int `json:"status"`
|
||||
UsageCount int64 `json:"usage_count"`
|
||||
LastUsedAt string `json:"last_used_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
Id int64 `json:"id"`
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarUrl string `json:"avatar_url"`
|
||||
Openid string `json:"openid"`
|
||||
LevelKey string `json:"level_key"`
|
||||
LevelName string `json:"level_name"`
|
||||
LevelExpireAt string `json:"level_expire_at"`
|
||||
QuotaPeriodDays int `json:"quota_period_days"` // 0 = 跟随全局设置
|
||||
Status int `json:"status"`
|
||||
UsageCount int64 `json:"usage_count"`
|
||||
LastUsedAt string `json:"last_used_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type UserListReq struct {
|
||||
@@ -141,6 +143,9 @@ type AdminToolItem struct {
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Description string `json:"description"`
|
||||
FreeQuota int `json:"free_quota"` // 免费额度(每周期次数)
|
||||
MemberQuota int `json:"member_quota"` // 会员额度(每周期次数)
|
||||
PayCost int `json:"pay_cost"` // 付费额度每次消耗系数
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"is_enabled"`
|
||||
IsHot int `json:"is_hot"`
|
||||
@@ -161,13 +166,16 @@ type ToolsListRes struct {
|
||||
}
|
||||
|
||||
type ToolsSaveReq struct {
|
||||
g.Meta `path:"/tools/save" method:"post" tags:"admin" summary:"保存工具"`
|
||||
g.Meta `path:"/tools/save" method:"post" tags:"admin" summary:"保存工具(含额度配置)"`
|
||||
Id int64 `json:"id"`
|
||||
ToolKey string `v:"required-if:id,0#工具标识不能为空" json:"toolKey"`
|
||||
ModuleKey string `v:"required#所属模块不能为空" json:"moduleKey"`
|
||||
Name string `v:"required#工具名称不能为空" json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Description string `json:"description"`
|
||||
FreeQuota int `v:"min:0#免费额度不能为负" json:"freeQuota"`
|
||||
MemberQuota int `v:"min:0#会员额度不能为负" json:"memberQuota"`
|
||||
PayCost int `v:"min:1#付费消耗系数至少为 1" json:"payCost"`
|
||||
Sort int `json:"sort"`
|
||||
IsEnabled int `json:"isEnabled"`
|
||||
IsHot int `json:"isHot"`
|
||||
|
||||
125
api/admin/v1/quota.go
Normal file
125
api/admin/v1/quota.go
Normal file
@@ -0,0 +1,125 @@
|
||||
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{}
|
||||
Reference in New Issue
Block a user