refactor(plan):移除套餐相关的所有修改
This commit is contained in:
1 parent
8480d06d21
commit
5d48dbcdc2
73 files changed
+958
-2306
No files matched your search
@@ -144,7 +144,6 @@ type IAdminV1 interface {
|
||||
OrderList(ctx context.Context, req *v1.OrderListReq) (res *v1.OrderListRes, err error)
|
||||
OrderDetail(ctx context.Context, req *v1.OrderDetailReq) (res *v1.OrderDetailRes, err error)
|
||||
OrderRefund(ctx context.Context, req *v1.OrderRefundReq) (res *v1.OrderRefundRes, err error)
|
||||
OrderRefundPreview(ctx context.Context, req *v1.OrderRefundPreviewReq) (res *v1.OrderRefundPreviewRes, err error)
|
||||
OrderComplete(ctx context.Context, req *v1.OrderCompleteReq) (res *v1.OrderCompleteRes, err error)
|
||||
OrderExport(ctx context.Context, req *v1.OrderExportReq) (res *v1.OrderExportRes, err error)
|
||||
AdminMemberCreate(ctx context.Context, req *v1.AdminMemberCreateReq) (res *v1.AdminMemberCreateRes, err error)
|
||||
|
||||
@@ -62,23 +62,7 @@ type OrderRefundReq struct {
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
type OrderRefundRes struct {
|
||||
RefundAmount float64 `json:"refund_amount"`
|
||||
}
|
||||
|
||||
// OrderRefundPreviewReq 退款预览(计算可退金额)
|
||||
type OrderRefundPreviewReq struct {
|
||||
g.Meta `path:"/orders/{id}/refund-preview" method:"get" mime:"json" tags:"管理后台-订单" summary:"退款预览"`
|
||||
Id int64 `json:"id" in:"path" v:"required|min:1"`
|
||||
}
|
||||
|
||||
type OrderRefundPreviewRes struct {
|
||||
CanRefund bool `json:"can_refund"`
|
||||
RefundAmount float64 `json:"refund_amount"`
|
||||
OrderType string `json:"order_type"`
|
||||
OrderStatus string `json:"order_status"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
type OrderRefundRes struct{}
|
||||
|
||||
type OrderCompleteReq struct {
|
||||
g.Meta `path:"/orders/{id}/complete" method:"post" mime:"json" tags:"管理后台-订单" summary:"手动完成订单"`
|
||||
|
||||
+23
-32
@@ -15,24 +15,19 @@ type PlanListReq struct {
|
||||
}
|
||||
|
||||
type PlanItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Identifier string `json:"identifier"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
CreditAmount float64 `json:"credit_amount"`
|
||||
BonusAmount float64 `json:"bonus_amount"`
|
||||
ValidityDays int `json:"validity_days"`
|
||||
AllowedModels []string `json:"allowed_models"`
|
||||
PurchaseLimit int `json:"purchase_limit"`
|
||||
PurchaseLimitPeriod string `json:"purchase_limit_period"`
|
||||
Stock int `json:"stock"`
|
||||
TotalPurchased int `json:"total_purchased"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
CreatedAt *gtime.Time `json:"created_at"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Identifier string `json:"identifier"`
|
||||
Description string `json:"description"`
|
||||
MonthlyPrice float64 `json:"monthly_price"`
|
||||
YearlyPrice float64 `json:"yearly_price"`
|
||||
Status string `json:"status"`
|
||||
MonthlyQuotaTokens int64 `json:"monthly_quota_tokens"`
|
||||
AllowedModels []string `json:"allowed_models"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
CreatedAt *gtime.Time `json:"created_at"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PlanListRes struct {
|
||||
@@ -43,20 +38,16 @@ type PlanListRes struct {
|
||||
}
|
||||
|
||||
type PlanCreateReq struct {
|
||||
g.Meta `path:"/plans" method:"post" mime:"json" tags:"管理后台-套餐" summary:"创建套餐"`
|
||||
Name string `json:"name" v:"required#请输入名称"`
|
||||
Identifier string `json:"identifier" v:"required#请输入标识符"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price" v:"min:0.01#价格必须大于0.01"`
|
||||
CreditAmount float64 `json:"credit_amount" v:"min:0.01#额度必须大于0.01"`
|
||||
BonusAmount float64 `json:"bonus_amount"`
|
||||
ValidityDays int `json:"validity_days" v:"min:1#有效天数至少为1"`
|
||||
AllowedModels []string `json:"allowed_models"`
|
||||
PurchaseLimit int `json:"purchase_limit"`
|
||||
PurchaseLimitPeriod string `json:"purchase_limit_period" v:"in:lifetime,monthly,yearly#限购周期无效"`
|
||||
Stock int `json:"stock"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
g.Meta `path:"/plans" method:"post" mime:"json" tags:"管理后台-套餐" summary:"创建套餐"`
|
||||
Name string `json:"name" v:"required#请输入名称"`
|
||||
Identifier string `json:"identifier" v:"required#请输入标识符"`
|
||||
Description string `json:"description"`
|
||||
MonthlyPrice float64 `json:"monthly_price"`
|
||||
YearlyPrice float64 `json:"yearly_price"`
|
||||
MonthlyQuotaTokens int64 `json:"monthly_quota_tokens"`
|
||||
AllowedModels []string `json:"allowed_models"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
}
|
||||
|
||||
type PlanCreateRes struct {
|
||||
|
||||
@@ -119,8 +119,8 @@ type ITenantV1 interface {
|
||||
PersonalModelDist(ctx context.Context, req *v1.PersonalModelDistReq) (res *v1.PersonalModelDistRes, err error)
|
||||
PersonalApiKeyUsage(ctx context.Context, req *v1.PersonalApiKeyUsageReq) (res *v1.PersonalApiKeyUsageRes, err error)
|
||||
TenantPlanList(ctx context.Context, req *v1.TenantPlanListReq) (res *v1.TenantPlanListRes, err error)
|
||||
TenantPlanMine(ctx context.Context, req *v1.TenantPlanMineReq) (res *v1.TenantPlanMineRes, err error)
|
||||
TenantPlanOrderCreate(ctx context.Context, req *v1.TenantPlanOrderCreateReq) (res *v1.TenantPlanOrderCreateRes, err error)
|
||||
TenantPlanCurrent(ctx context.Context, req *v1.TenantPlanCurrentReq) (res *v1.TenantPlanCurrentRes, err error)
|
||||
TenantPlanCancelAutoRenew(ctx context.Context, req *v1.TenantPlanCancelAutoRenewReq) (res *v1.TenantPlanCancelAutoRenewRes, err error)
|
||||
PlaygroundChat(ctx context.Context, req *v1.PlaygroundChatReq) (res *v1.PlaygroundChatRes, err error)
|
||||
PlaygroundImage(ctx context.Context, req *v1.PlaygroundImageReq) (res *v1.PlaygroundImageRes, err error)
|
||||
PlaygroundAudioTTS(ctx context.Context, req *v1.PlaygroundAudioTTSReq) (res *v1.PlaygroundAudioTTSRes, err error)
|
||||
|
||||
@@ -92,13 +92,7 @@ type TenantRechargeCreateReq struct {
|
||||
}
|
||||
|
||||
type TenantRechargeCreateRes struct {
|
||||
OrderId int64 `json:"order_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
PaymentUrl string `json:"payment_url"`
|
||||
PaymentNo string `json:"payment_no"`
|
||||
Params map[string]string `json:"params,omitempty"`
|
||||
IsRedirect bool `json:"is_redirect"`
|
||||
FinalAmount float64 `json:"final_amount"`
|
||||
Data map[string]any `json:"data"`
|
||||
}
|
||||
|
||||
type TenantPaymentInfoReq struct {
|
||||
@@ -109,7 +103,7 @@ type TenantPaymentInfoRes struct {
|
||||
Channels []map[string]any `json:"channels"`
|
||||
AmountOptions []int `json:"amount_options,omitempty"`
|
||||
AmountDiscount map[int]float64 `json:"amount_discount,omitempty"`
|
||||
MinTopUp float64 `json:"min_topup,omitempty"`
|
||||
MinTopUp int `json:"min_topup,omitempty"`
|
||||
Currency string `json:"currency,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -8,61 +8,50 @@ import (
|
||||
// === 租户套餐 ===
|
||||
|
||||
type TenantPlanItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Identifier string `json:"identifier"`
|
||||
Description string `json:"description"`
|
||||
Price float64 `json:"price"`
|
||||
CreditAmount float64 `json:"credit_amount"`
|
||||
BonusAmount float64 `json:"bonus_amount"`
|
||||
ValidityDays int `json:"validity_days"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Identifier string `json:"identifier"`
|
||||
Description string `json:"description"`
|
||||
MonthlyPrice float64 `json:"monthly_price"`
|
||||
YearlyPrice float64 `json:"yearly_price"`
|
||||
MonthlyQuotaTokens int64 `json:"monthly_quota_tokens"`
|
||||
AllowedModels []string `json:"allowed_models"`
|
||||
IsRecommended bool `json:"is_recommended"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
}
|
||||
|
||||
type TenantPlanListReq struct {
|
||||
g.Meta `path:"/plans" method:"get" mime:"json" tags:"租户控制台-套餐" summary:"可购买套餐列表"`
|
||||
g.Meta `path:"/plans" method:"get" mime:"json" tags:"租户控制台-套餐" summary:"套餐列表"`
|
||||
}
|
||||
|
||||
type TenantPlanListRes struct {
|
||||
List []*TenantPlanItem `json:"list"`
|
||||
}
|
||||
|
||||
// TenantPlanMineReq 我的套餐
|
||||
type TenantPlanMineReq struct {
|
||||
g.Meta `path:"/plans/mine" method:"get" mime:"json" tags:"租户控制台-套餐" summary:"我的套餐"`
|
||||
type TenantPlanCurrentReq struct {
|
||||
g.Meta `path:"/plan/current" method:"get" mime:"json" tags:"租户控制台-套餐" summary:"当前套餐"`
|
||||
}
|
||||
|
||||
type TenantPlanMineItem struct {
|
||||
Id int64 `json:"id"`
|
||||
PlanId int64 `json:"plan_id"`
|
||||
PlanName string `json:"plan_name"`
|
||||
Status string `json:"status"`
|
||||
TotalCredits float64 `json:"total_credits"`
|
||||
RemainingCredits float64 `json:"remaining_credits"`
|
||||
StartAt *gtime.Time `json:"start_at"`
|
||||
EndAt *gtime.Time `json:"end_at"`
|
||||
ActivatedAt *gtime.Time `json:"activated_at"`
|
||||
ExpiresAt *gtime.Time `json:"expires_at"`
|
||||
CreatedAt *gtime.Time `json:"created_at"`
|
||||
type TenantPlanCurrentRes struct {
|
||||
Id int64 `json:"id"`
|
||||
TenantId int64 `json:"tenant_id"`
|
||||
PlanId int64 `json:"plan_id"`
|
||||
Status string `json:"status"`
|
||||
StartAt *gtime.Time `json:"start_at"`
|
||||
EndAt *gtime.Time `json:"end_at"`
|
||||
AutoRenew bool `json:"auto_renew"`
|
||||
MonthlyQuotaTokens int64 `json:"monthly_quota_tokens"`
|
||||
UsedTokens int64 `json:"used_tokens"`
|
||||
LastResetAt *gtime.Time `json:"last_reset_at"`
|
||||
Name string `json:"name"`
|
||||
Identifier string `json:"identifier"`
|
||||
Description string `json:"description"`
|
||||
MonthlyPrice float64 `json:"monthly_price"`
|
||||
YearlyPrice float64 `json:"yearly_price"`
|
||||
}
|
||||
|
||||
type TenantPlanMineRes struct {
|
||||
List []*TenantPlanMineItem `json:"list"`
|
||||
TotalRemaining float64 `json:"total_remaining"`
|
||||
ActiveCount int `json:"active_count"`
|
||||
type TenantPlanCancelAutoRenewReq struct {
|
||||
g.Meta `path:"/plan/cancel-auto-renew" method:"put" mime:"json" tags:"租户控制台-套餐" summary:"取消自动续费"`
|
||||
}
|
||||
|
||||
// TenantPlanOrderCreateReq 购买套餐创建订单
|
||||
type TenantPlanOrderCreateReq struct {
|
||||
g.Meta `path:"/plans/orders" method:"post" mime:"json" tags:"租户控制台-套餐" summary:"购买套餐"`
|
||||
PlanId int64 `json:"plan_id" v:"required|min:1#请选择套餐"`
|
||||
PaymentChannel string `json:"payment_channel" v:"required#请选择支付渠道"`
|
||||
PaymentMethod string `json:"payment_method" v:"required#请选择支付方式"`
|
||||
}
|
||||
|
||||
type TenantPlanOrderCreateRes struct {
|
||||
OrderId int64 `json:"order_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
PaymentUrl string `json:"payment_url"`
|
||||
}
|
||||
type TenantPlanCancelAutoRenewRes struct{}
|
||||
Reference in new issue
Block a user