2026-09-17 17:38:45 +08:00
|
|
|
|
package v1
|
|
|
|
|
|
|
|
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
// 会员购买(微信小程序虚拟支付 · 道具直购)
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
// MemberPlanOut 可购买的会员套餐
|
|
|
|
|
|
type MemberPlanOut struct {
|
|
|
|
|
|
PlanKey string `json:"plan_key"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Subtitle string `json:"subtitle"`
|
|
|
|
|
|
LevelKey string `json:"level_key"`
|
|
|
|
|
|
DurationDays int `json:"duration_days"`
|
|
|
|
|
|
PriceCents int64 `json:"price_cents"` // 单位:分
|
|
|
|
|
|
ProductId string `json:"product_id"`
|
|
|
|
|
|
Badge string `json:"badge"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MemberLevelOut 等级权益(用于前端渲染权益对比)
|
|
|
|
|
|
type MemberLevelOut struct {
|
|
|
|
|
|
LevelKey string `json:"level_key"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Modules []string `json:"modules"`
|
|
|
|
|
|
ModuleNames []string `json:"module_names"`
|
|
|
|
|
|
IsCurrent bool `json:"is_current"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MemberStateOut 我的会员状态
|
|
|
|
|
|
type MemberStateOut struct {
|
|
|
|
|
|
IsMember bool `json:"is_member"`
|
|
|
|
|
|
LevelKey string `json:"level_key"`
|
|
|
|
|
|
LevelName string `json:"level_name"`
|
|
|
|
|
|
ExpireAt string `json:"expire_at"` // 空串表示永久或未开通
|
|
|
|
|
|
DaysLeft int `json:"days_left"`
|
|
|
|
|
|
Modules []string `json:"modules"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MemberCenterReq 会员中心
|
|
|
|
|
|
type MemberCenterReq struct {
|
|
|
|
|
|
g.Meta `path:"/member/center" method:"get" tags:"member" summary:"会员中心(套餐 + 会员状态 + 权益)"`
|
|
|
|
|
|
}
|
|
|
|
|
|
type MemberCenterRes struct {
|
|
|
|
|
|
Plans []MemberPlanOut `json:"plans"`
|
|
|
|
|
|
Levels []MemberLevelOut `json:"levels"`
|
|
|
|
|
|
State MemberStateOut `json:"state"`
|
|
|
|
|
|
Notices []string `json:"notices"`
|
|
|
|
|
|
XpayReady bool `json:"xpay_ready"` // 服务端虚拟支付参数是否已配置
|
|
|
|
|
|
Quotas []QuotaToolOut `json:"quotas"` // 各工具额度(会员权益页据此展示提升幅度)
|
|
|
|
|
|
Packs []QuotaPackOut `json:"packs"` // 次数包通用档位
|
|
|
|
|
|
PeriodDays int `json:"period_days"` // 当前生效的额度重置周期
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-29 10:57:01 +08:00
|
|
|
|
// MemberOrderCreateReq 创建会员订单(**只建单**,N1-1/2)。
|
2026-09-17 17:38:45 +08:00
|
|
|
|
//
|
2026-09-29 10:57:01 +08:00
|
|
|
|
// Code 保留以兼容旧客户端但**非必传**:建单不再校验「支付人 = 登录人」(该校验前移到
|
|
|
|
|
|
// POST /member/order/pay)。两步式的第一步只负责落一条待支付订单。
|
2026-09-17 17:38:45 +08:00
|
|
|
|
type MemberOrderCreateReq struct {
|
2026-09-29 10:57:01 +08:00
|
|
|
|
g.Meta `path:"/member/order" method:"post" tags:"member" summary:"创建会员订单(待支付,不返回支付参数)"`
|
2026-09-17 17:38:45 +08:00
|
|
|
|
PlanKey string `v:"required#请选择会员套餐" json:"plan_key"`
|
|
|
|
|
|
Code string `json:"code"`
|
2026-09-29 15:48:13 +08:00
|
|
|
|
// Platform 客户端平台(uni.getSystemInfoSync().platform:ios/android/devtools/h5)。
|
|
|
|
|
|
// 缺省时服务端按 User-Agent 兜底推断;ios → pay_channel=apple(iOS 走 App Store IAP,
|
|
|
|
|
|
// 开发者无法主动退款,后台据此禁用 API 退款)。
|
|
|
|
|
|
Platform string `json:"platform"`
|
2026-09-17 17:38:45 +08:00
|
|
|
|
}
|
2026-09-29 10:57:01 +08:00
|
|
|
|
|
|
|
|
|
|
// MemberOrderCreateRes 创建会员订单响应(只建单,**不返回支付参数**;N1-1/2)。
|
|
|
|
|
|
//
|
|
|
|
|
|
// 支付参数由独立端点 POST /member/order/pay 构建(见 order.go 的 MemberOrderPayRes)。
|
|
|
|
|
|
// Reused=true 表示命中「同用户 + 同套餐 + 待支付」的既有单(N1-10),保证待支付单恒为 1 条。
|
2026-09-17 17:38:45 +08:00
|
|
|
|
type MemberOrderCreateRes struct {
|
2026-09-29 10:57:01 +08:00
|
|
|
|
OutTradeNo string `json:"out_trade_no"`
|
|
|
|
|
|
Reused bool `json:"reused"`
|
|
|
|
|
|
OriginPriceCents int64 `json:"origin_price_cents"`
|
|
|
|
|
|
PaidPriceCents int64 `json:"paid_price_cents"`
|
|
|
|
|
|
Status int `json:"status"`
|
2026-09-17 17:38:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MemberOrderCheckReq 查询订单状态(前端支付成功回调后轮询;同时承担兜底发货)
|
|
|
|
|
|
type MemberOrderCheckReq struct {
|
|
|
|
|
|
g.Meta `path:"/member/order/check" method:"post" tags:"member" summary:"查询会员订单状态"`
|
|
|
|
|
|
OutTradeNo string `v:"required#订单号不能为空" json:"out_trade_no"`
|
|
|
|
|
|
}
|
|
|
|
|
|
type MemberOrderCheckRes struct {
|
|
|
|
|
|
Status int `json:"status"`
|
|
|
|
|
|
Delivered bool `json:"delivered"`
|
|
|
|
|
|
State MemberStateOut `json:"state"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MemberOrdersReq 我的会员订单
|
|
|
|
|
|
type MemberOrdersReq struct {
|
|
|
|
|
|
g.Meta `path:"/member/orders" method:"get" tags:"member" summary:"我的会员订单"`
|
|
|
|
|
|
Limit int `json:"limit"`
|
2026-09-30 17:01:18 +08:00
|
|
|
|
Tab int `json:"tab"` // 0全部 1待付款 2已生效 3退款
|
2026-09-17 17:38:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
type MemberOrderOut struct {
|
|
|
|
|
|
OutTradeNo string `json:"out_trade_no"`
|
|
|
|
|
|
OrderType int `json:"order_type"` // 1=会员套餐 2=次数包
|
|
|
|
|
|
PlanKey string `json:"plan_key"`
|
|
|
|
|
|
PlanName string `json:"plan_name"`
|
2026-09-29 10:57:01 +08:00
|
|
|
|
PackKey string `json:"pack_key"`
|
2026-09-17 17:38:45 +08:00
|
|
|
|
Title string `json:"title"` // 统一展示标题(套餐名 / 次数包名)
|
|
|
|
|
|
ToolKey string `json:"tool_key"`
|
|
|
|
|
|
ToolName string `json:"tool_name"`
|
|
|
|
|
|
Times int `json:"times"`
|
|
|
|
|
|
PriceCents int64 `json:"price_cents"`
|
|
|
|
|
|
Status int `json:"status"`
|
|
|
|
|
|
StatusText string `json:"status_text"`
|
|
|
|
|
|
PayChannel string `json:"pay_channel"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
DeliveredAt string `json:"delivered_at"`
|
2026-09-29 10:57:01 +08:00
|
|
|
|
// ===== T04.6 优惠凭证(响应 snake_case)=====
|
|
|
|
|
|
OriginPriceCents int64 `json:"origin_price_cents"`
|
|
|
|
|
|
PaidPriceCents int64 `json:"paid_price_cents"`
|
|
|
|
|
|
PromoCode string `json:"promo_code"`
|
|
|
|
|
|
DiscountCents int64 `json:"discount_cents"`
|
|
|
|
|
|
PromoKind int `json:"promo_kind"`
|
2026-09-17 17:38:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
type MemberOrdersRes struct {
|
|
|
|
|
|
List []MemberOrderOut `json:"list"`
|
|
|
|
|
|
}
|