hi-server/apis/public/portal.api
shanshanzhong b0a03401b8
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m31s
feat(用户): 添加通过密码绑定邮箱和邀请码功能
新增绑定邮箱和密码的接口,用于设备用户绑定已有邮箱账户
新增绑定邀请码接口,绑定成功后会为双方赠送订阅天数
修复API定义中的格式问题,统一缩进和对齐
移除不再使用的WebSocket路由
2025-10-22 03:45:07 -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)
}