hi-server/apis/public/portal.api
shanshanzhong c582087c0f refactor: 更新项目引用路径从perfect-panel/ppanel-server到perfect-panel/server
feat: 添加版本和构建时间变量
fix: 修正短信队列类型注释错误
style: 清理未使用的代码和测试文件
docs: 更新安装文档中的下载链接
chore: 迁移数据库脚本添加日志和订阅配置
2025-10-13 01:33:03 -07:00

101 lines
3.0 KiB
Plaintext

syntax = "v1"
info (
title: "Portal API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
PortalPurchaseRequest {
AuthType string `json:"auth_type"`
Identifier string `json:"identifier"`
Password string `json:"password,omitempty"`
Payment int64 `json:"payment"`
SubscribeId int64 `json:"subscribe_id"`
Quantity int64 `json:"quantity"`
Coupon string `json:"coupon,omitempty"`
InviteCode string `json:"invite_code,omitempty"`
TurnstileToken string `json:"turnstile_token,omitempty"`
}
PortalPurchaseResponse {
OrderNo string `json:"order_no"`
}
GetSubscriptionRequest {
Language string `form:"language"`
}
GetSubscriptionResponse {
List []Subscribe `json:"list"`
}
PrePurchaseOrderRequest {
Payment int64 `json:"payment,omitempty"`
SubscribeId int64 `json:"subscribe_id"`
Quantity int64 `json:"quantity"`
Coupon string `json:"coupon,omitempty"`
}
PrePurchaseOrderResponse {
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
FeeAmount int64 `json:"fee_amount"`
}
QueryPurchaseOrderRequest {
AuthType string `form:"auth_type"`
Identifier string `form:"identifier"`
OrderNo string `form:"order_no"`
}
QueryPurchaseOrderResponse {
OrderNo string `json:"order_no"`
Subscribe Subscribe `json:"subscribe"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
FeeAmount int64 `json:"fee_amount"`
Payment PaymentMethod `json:"payment"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
Token string `json:"token,omitempty"`
}
)
@server (
prefix: v1/public/portal
group: public/portal
middleware: DeviceMiddleware
)
service ppanel {
@doc "Get available payment methods"
@handler GetAvailablePaymentMethods
get /payment-method returns (GetAvailablePaymentMethodsResponse)
@doc "Get Subscription"
@handler GetSubscription
get /subscribe (GetSubscriptionRequest) returns (GetSubscriptionResponse)
@doc "Pre Purchase Order"
@handler PrePurchaseOrder
post /pre (PrePurchaseOrderRequest) returns (PrePurchaseOrderResponse)
@doc "Purchase subscription"
@handler Purchase
post /purchase (PortalPurchaseRequest) returns (PortalPurchaseResponse)
@doc "Query Purchase Order"
@handler QueryPurchaseOrder
get /order/status (QueryPurchaseOrderRequest) returns (QueryPurchaseOrderResponse)
@doc "Purchase Checkout"
@handler PurchaseCheckout
post /order/checkout (CheckoutOrderRequest) returns (CheckoutOrderResponse)
}