This commit is contained in:
2025-10-10 07:13:36 -07:00
commit 95c66c0a8a
1023 changed files with 78353 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
syntax = "v1"
info (
title: "Ads API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
type (
CreateAdsRequest {
Title string `json:"title"`
Type string `json:"type"`
Content string `json:"content"`
Description string `json:"description"`
TargetURL string `json:"target_url"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Status int `json:"status"`
}
UpdateAdsRequest {
Id int64 `json:"id"`
Title string `json:"title"`
Type string `json:"type"`
Content string `json:"content"`
Description string `json:"description"`
TargetURL string `json:"target_url"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Status int `json:"status"`
}
DeleteAdsRequest {
Id int64 `json:"id"`
}
GetAdsListRequest {
Page int `form:"page"`
Size int `form:"size"`
Status *int `form:"status,omitempty"`
Search string `form:"search,omitempty"`
}
GetAdsListResponse {
Total int64 `json:"total"`
List []Ads `json:"list"`
}
GetAdsDetailRequest {
Id int64 `form:"id"`
}
)
import "../types.api"
@server (
prefix: v1/admin/ads
group: admin/ads
middleware: AuthMiddleware
)
service ppanel {
@doc "Create Ads"
@handler CreateAds
post / (CreateAdsRequest)
@doc "Update Ads"
@handler UpdateAds
put / (UpdateAdsRequest)
@doc "Delete Ads"
@handler DeleteAds
delete / (DeleteAdsRequest)
@doc "Get Ads List"
@handler GetAdsList
get /list (GetAdsListRequest) returns (GetAdsListResponse)
@doc "Get Ads Detail"
@handler GetAdsDetail
get /detail (GetAdsDetailRequest) returns (Ads)
}
+76
View File
@@ -0,0 +1,76 @@
syntax = "v1"
info (
title: "Announcement API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
CreateAnnouncementRequest {
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
}
UpdateAnnouncementRequest {
Id int64 `json:"id" validate:"required"`
Title string `json:"title"`
Content string `json:"content"`
Show *bool `json:"show"`
Pinned *bool `json:"pinned"`
Popup *bool `json:"popup"`
}
UpdateAnnouncementEnableRequest {
Id int64 `json:"id" validate:"required"`
Enable *bool `json:"enable" validate:"required"`
}
DeleteAnnouncementRequest {
Id int64 `json:"id" validate:"required"`
}
GetAnnouncementListRequest {
Page int64 `form:"page"`
Size int64 `form:"size"`
Show *bool `form:"show,omitempty"`
Pinned *bool `form:"pinned,omitempty"`
Popup *bool `form:"popup,omitempty"`
Search string `form:"search,omitempty"`
}
GetAnnouncementListResponse {
Total int64 `json:"total"`
List []Announcement `json:"list"`
}
GetAnnouncementRequest {
Id int64 `form:"id" validate:"required"`
}
)
@server (
prefix: v1/admin/announcement
group: admin/announcement
middleware: AuthMiddleware
)
service ppanel {
@doc "Create announcement"
@handler CreateAnnouncement
post / (CreateAnnouncementRequest)
@doc "Update announcement"
@handler UpdateAnnouncement
put / (UpdateAnnouncementRequest)
@doc "Get announcement list"
@handler GetAnnouncementList
get /list (GetAnnouncementListRequest) returns (GetAnnouncementListResponse)
@doc "Delete announcement"
@handler DeleteAnnouncement
delete / (DeleteAnnouncementRequest)
@doc "Get announcement"
@handler GetAnnouncement
get /detail (GetAnnouncementRequest) returns (Announcement)
}
+76
View File
@@ -0,0 +1,76 @@
syntax = "v1"
info (
title: "Auth Method Management"
desc: "System auth method management"
author: "Tension"
email: "tension@ppanel.com"
version: "0.1.2"
)
import (
"../types.api"
)
type (
UpdateAuthMethodConfigRequest {
Id int64 `json:"id"`
Method string `json:"method"`
Config interface{} `json:"config"`
Enabled *bool `json:"enabled"`
}
GetAuthMethodConfigRequest {
Method string `form:"method"`
}
GetAuthMethodListResponse {
List []AuthMethodConfig `json:"list"`
}
TestSmsSendRequest {
AreaCode string `json:"area_code" validate:"required"`
Telephone string `json:"telephone" validate:"required"`
}
// Test email smtp request
TestEmailSendRequest {
Email string `json:"email" validate:"required"`
}
)
@server (
prefix: v1/admin/auth-method
group: admin/authMethod
middleware: AuthMiddleware
)
service ppanel {
@doc "Get auth method list"
@handler GetAuthMethodList
get /list returns (GetAuthMethodListResponse)
@doc "Get auth method config"
@handler GetAuthMethodConfig
get /config (GetAuthMethodConfigRequest) returns (AuthMethodConfig)
@doc "Update auth method config"
@handler UpdateAuthMethodConfig
put /config (UpdateAuthMethodConfigRequest) returns (AuthMethodConfig)
@doc "Test sms send"
@handler TestSmsSend
post /test_sms_send (TestSmsSendRequest)
@doc "Test email send"
@handler TestEmailSend
post /test_email_send (TestEmailSendRequest)
@doc "Get sms support platform"
@handler GetSmsPlatform
get /sms_platform returns (PlatformResponse)
@doc "Get email support platform"
@handler GetEmailPlatform
get /email_platform returns (PlatformResponse)
}
+88
View File
@@ -0,0 +1,88 @@
syntax = "v1"
info (
title: "Console API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
type (
ServerTrafficData {
ServerId int64 `json:"server_id"`
Name string `json:"name"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
}
UserTrafficData {
SID int64 `json:"sid"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
}
ServerTotalDataResponse {
OnlineUserIPs int64 `json:"online_user_ips"`
OnlineServers int64 `json:"online_servers"`
OfflineServers int64 `json:"offline_servers"`
TodayUpload int64 `json:"today_upload"`
TodayDownload int64 `json:"today_download"`
MonthlyUpload int64 `json:"monthly_upload"`
MonthlyDownload int64 `json:"monthly_download"`
UpdatedAt int64 `json:"updated_at"`
ServerTrafficRankingToday []ServerTrafficData `json:"server_traffic_ranking_today"`
ServerTrafficRankingYesterday []ServerTrafficData `json:"server_traffic_ranking_yesterday"`
UserTrafficRankingToday []UserTrafficData `json:"user_traffic_ranking_today"`
UserTrafficRankingYesterday []UserTrafficData `json:"user_traffic_ranking_yesterday"`
}
UserStatistics {
Date string `json:"date,omitempty"`
Register int64 `json:"register"`
NewOrderUsers int64 `json:"new_order_users"`
RenewalOrderUsers int64 `json:"renewal_order_users"`
List []UserStatistics `json:"list,omitempty"`
}
OrdersStatistics {
Date string `json:"date,omitempty"`
AmountTotal int64 `json:"amount_total"`
NewOrderAmount int64 `json:"new_order_amount"`
RenewalOrderAmount int64 `json:"renewal_order_amount"`
List []OrdersStatistics `json:"list,omitempty"`
}
RevenueStatisticsResponse {
Today OrdersStatistics `json:"today"`
Monthly OrdersStatistics `json:"monthly"`
All OrdersStatistics `json:"all"`
}
UserStatisticsResponse {
Today UserStatistics `json:"today"`
Monthly UserStatistics `json:"monthly"`
All UserStatistics `json:"all"`
}
TicketWaitRelpyResponse {
Count int64 `json:"count"`
}
)
@server (
prefix: v1/admin/console
group: admin/console
middleware: AuthMiddleware
)
service ppanel {
@doc "Query server total data"
@handler QueryServerTotalData
get /server returns (ServerTotalDataResponse)
@doc "Query revenue statistics"
@handler QueryRevenueStatistics
get /revenue returns (RevenueStatisticsResponse)
@doc "Query user statistics"
@handler QueryUserStatistics
get /user returns (UserStatisticsResponse)
@doc "Query ticket wait reply"
@handler QueryTicketWaitReply
get /ticket returns (TicketWaitRelpyResponse)
}
+85
View File
@@ -0,0 +1,85 @@
syntax = "v1"
info (
title: "coupon API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
CreateCouponRequest {
Name string `json:"name" validate:"required"`
Code string `json:"code,omitempty"`
Count int64 `json:"count,omitempty"`
Type uint8 `json:"type" validate:"required"`
Discount int64 `json:"discount" validate:"required"`
StartTime int64 `json:"start_time" validate:"required"`
ExpireTime int64 `json:"expire_time" validate:"required"`
UserLimit int64 `json:"user_limit,omitempty"`
Subscribe []int64 `json:"subscribe,omitempty"`
UsedCount int64 `json:"used_count,omitempty"`
Enable *bool `json:"enable,omitempty"`
}
UpdateCouponRequest {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Code string `json:"code,omitempty"`
Count int64 `json:"count,omitempty"`
Type uint8 `json:"type" validate:"required"`
Discount int64 `json:"discount" validate:"required"`
StartTime int64 `json:"start_time" validate:"required"`
ExpireTime int64 `json:"expire_time" validate:"required"`
UserLimit int64 `json:"user_limit,omitempty"`
Subscribe []int64 `json:"subscribe,omitempty"`
UsedCount int64 `json:"used_count,omitempty"`
Enable *bool `json:"enable,omitempty"`
}
DeleteCouponRequest {
Id int64 `json:"id" validate:"required"`
}
BatchDeleteCouponRequest {
Ids []int64 `json:"ids" validate:"required"`
}
GetCouponListRequest {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
Subscribe int64 `form:"subscribe,omitempty"`
Search string `form:"search,omitempty"`
}
GetCouponListResponse {
Total int64 `json:"total"`
List []Coupon `json:"list"`
}
)
@server (
prefix: v1/admin/coupon
group: admin/coupon
middleware: AuthMiddleware
)
service ppanel {
@doc "Create coupon"
@handler CreateCoupon
post / (CreateCouponRequest)
@doc "Update coupon"
@handler UpdateCoupon
put / (UpdateCouponRequest)
@doc "Delete coupon"
@handler DeleteCoupon
delete / (DeleteCouponRequest)
@doc "Batch delete coupon"
@handler BatchDeleteCoupon
delete /batch (BatchDeleteCouponRequest)
@doc "Get coupon list"
@handler GetCouponList
get /list (GetCouponListRequest) returns (GetCouponListResponse)
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "v1"
info(
title: "Device API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
type (
)
+78
View File
@@ -0,0 +1,78 @@
syntax = "v1"
info (
title: "Document API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
CreateDocumentRequest {
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
Tags []string `json:"tags,omitempty" `
Show *bool `json:"show"`
}
UpdateDocumentRequest {
Id int64 `json:"id" validate:"required"`
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
Tags []string `json:"tags,omitempty" `
Show *bool `json:"show"`
}
DeleteDocumentRequest {
Id int64 `json:"id" validate:"required"`
}
BatchDeleteDocumentRequest {
Ids []int64 `json:"ids" validate:"required"`
}
GetDocumentListRequest {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
Tag string `form:"tag,omitempty"`
Search string `form:"search,omitempty"`
}
GetDocumentListResponse {
Total int64 `json:"total"`
List []Document `json:"list"`
}
GetDocumentDetailRequest {
Id int64 `json:"id" validate:"required"`
}
)
@server (
prefix: v1/admin/document
group: admin/document
middleware: AuthMiddleware
)
service ppanel {
@doc "Create document"
@handler CreateDocument
post / (CreateDocumentRequest)
@doc "Update document"
@handler UpdateDocument
put / (UpdateDocumentRequest)
@doc "Delete document"
@handler DeleteDocument
delete / (DeleteDocumentRequest)
@doc "Batch delete document"
@handler BatchDeleteDocument
delete /batch (BatchDeleteDocumentRequest)
@doc "Get document list"
@handler GetDocumentList
get /list (GetDocumentListRequest) returns (GetDocumentListResponse)
@doc "Get document detail"
@handler GetDocumentDetail
get /detail (GetDocumentDetailRequest) returns (Document)
}
+40
View File
@@ -0,0 +1,40 @@
syntax = "v1"
info (
title: "Log API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
GetMessageLogListRequest {
Page int `form:"page"`
Size int `form:"size"`
Type string `form:"type"`
Platform string `form:"platform,omitempty"`
To string `form:"to,omitempty"`
Subject string `form:"subject,omitempty"`
Content string `form:"content,omitempty"`
Status int `form:"status,omitempty"`
}
GetMessageLogListResponse {
Total int64 `json:"total"`
List []MessageLog `json:"list"`
}
)
@server (
prefix: v1/admin/log
group: admin/log
middleware: AuthMiddleware
)
service ppanel {
@doc "Get message log list"
@handler GetMessageLogList
get /message/list (GetMessageLogListRequest) returns (GetMessageLogListResponse)
}
+68
View File
@@ -0,0 +1,68 @@
syntax = "v1"
info (
title: "order API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
CreateOrderRequest {
UserId int64 `json:"user_id" validate:"required"`
Type uint8 `json:"type" validate:"required"`
Quantity int64 `json:"quantity,omitempty"`
Price int64 `json:"price" validate:"required"`
Amount int64 `json:"amount" validate:"required"`
Discount int64 `json:"discount,omitempty"`
Coupon string `json:"coupon,omitempty"`
CouponDiscount int64 `json:"coupon_discount,omitempty"`
Commission int64 `json:"commission"`
FeeAmount int64 `json:"fee_amount" validate:"required"`
PaymentId int64 `json:"payment_id" validate:"required"`
TradeNo string `json:"trade_no,omitempty"`
Status uint8 `json:"status,omitempty"`
SubscribeId int64 `json:"subscribe_id,omitempty"`
}
UpdateOrderStatusRequest {
Id int64 `json:"id" validate:"required"`
Status uint8 `json:"status" validate:"required"`
PaymentId int64 `json:"payment_id,omitempty"`
TradeNo string `json:"trade_no,omitempty"`
}
GetOrderListRequest {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
UserId int64 `form:"user_id,omitempty"`
Status uint8 `form:"status,omitempty"`
SubscribeId int64 `form:"subscribe_id,omitempty"`
Search string `form:"search,omitempty"`
}
GetOrderListResponse {
Total int64 `json:"total"`
List []Order `json:"list"`
}
)
@server (
prefix: v1/admin/order
group: admin/order
middleware: AuthMiddleware
)
service ppanel {
@doc "Create order"
@handler CreateOrder
post / (CreateOrderRequest)
@doc "Get order list"
@handler GetOrderList
get /list (GetOrderListRequest) returns (GetOrderListResponse)
@doc "Update order status"
@handler UpdateOrderStatus
put /status (UpdateOrderStatusRequest)
}
+81
View File
@@ -0,0 +1,81 @@
syntax = "v1"
info (
title: "payment API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
CreatePaymentMethodRequest {
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config interface{} `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
UpdatePaymentMethodRequest {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config interface{} `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
DeletePaymentMethodRequest {
Id int64 `json:"id" validate:"required"`
}
GetPaymentMethodListRequest {
Page int `form:"page"`
Size int `form:"size"`
Platform string `form:"platform,omitempty"`
Search string `form:"search,omitempty"`
Enable *bool `form:"enable,omitempty"`
}
GetPaymentMethodListResponse {
Total int64 `json:"total"`
List []PaymentMethodDetail `json:"list"`
}
)
@server (
prefix: v1/admin/payment
group: admin/payment
middleware: AuthMiddleware
)
service ppanel {
@doc "Create Payment Method"
@handler CreatePaymentMethod
post / (CreatePaymentMethodRequest) returns (PaymentConfig)
@doc "Update Payment Method"
@handler UpdatePaymentMethod
put / (UpdatePaymentMethodRequest) returns (PaymentConfig)
@doc "Delete Payment Method"
@handler DeletePaymentMethod
delete / (DeletePaymentMethodRequest)
@doc "Get Payment Method List"
@handler GetPaymentMethodList
get /list (GetPaymentMethodListRequest) returns (GetPaymentMethodListResponse)
@doc "Get supported payment platform"
@handler GetPaymentPlatform
get /platform returns (PlatformResponse)
}
+190
View File
@@ -0,0 +1,190 @@
syntax = "v1"
info (
title: "Node API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
GetNodeServerListRequest {
Page int `form:"page" validate:"required"`
Size int `form:"size" validate:"required"`
Tag string `form:"tag,omitempty"`
GroupId int64 `form:"group_id,omitempty"`
Search string `form:"search,omitempty"`
}
GetNodeServerListResponse {
Total int64 `json:"total"`
List []Server `json:"list"`
}
UpdateNodeRequest {
Id int64 `json:"id" validate:"required"`
Tags []string `json:"tags"`
Country string `json:"country"`
City string `json:"city"`
Name string `json:"name" validate:"required"`
ServerAddr string `json:"server_addr" validate:"required"`
RelayMode string `json:"relay_mode"`
RelayNode []NodeRelay `json:"relay_node"`
SpeedLimit int `json:"speed_limit"`
TrafficRatio float32 `json:"traffic_ratio"`
GroupId int64 `json:"group_id"`
Protocol string `json:"protocol" validate:"required"`
Config interface{} `json:"config" validate:"required"`
Enable *bool `json:"enable"`
Sort int64 `json:"sort"`
}
CreateNodeRequest {
Name string `json:"name" validate:"required"`
Tags []string `json:"tags"`
Country string `json:"country"`
City string `json:"city"`
ServerAddr string `json:"server_addr" validate:"required"`
RelayMode string `json:"relay_mode"`
RelayNode []NodeRelay `json:"relay_node"`
SpeedLimit int `json:"speed_limit"`
TrafficRatio float32 `json:"traffic_ratio"`
GroupId int64 `json:"group_id"`
Protocol string `json:"protocol" validate:"required"`
Config interface{} `json:"config" validate:"required"`
Enable *bool `json:"enable"`
Sort int64 `json:"sort"`
}
DeleteNodeRequest {
Id int64 `json:"id" validate:"required"`
}
GetNodeGroupListResponse {
Total int64 `json:"total"`
List []ServerGroup `json:"list"`
}
CreateNodeGroupRequest {
Name string `json:"name" validate:"required"`
Description string `json:"description"`
}
UpdateNodeGroupRequest {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
}
DeleteNodeGroupRequest {
Id int64 `json:"id" validate:"required"`
}
BatchDeleteNodeRequest {
Ids []int64 `json:"ids" validate:"required"`
}
BatchDeleteNodeGroupRequest {
Ids []int64 `json:"ids" validate:"required"`
}
GetNodeDetailRequest {
Id int64 `form:"id" validate:"required"`
}
NodeSortRequest {
Sort []SortItem `json:"sort"`
}
CreateRuleGroupRequest {
Name string `json:"name" validate:"required"`
Icon string `json:"icon"`
Tags []string `json:"tags"`
Rules string `json:"rules"`
Enable bool `json:"enable"`
}
UpdateRuleGroupRequest {
Id int64 `json:"id" validate:"required"`
Icon string `json:"icon"`
Name string `json:"name" validate:"required"`
Tags []string `json:"tags"`
Rules string `json:"rules"`
Enable bool `json:"enable"`
}
DeleteRuleGroupRequest {
Id int64 `json:"id" validate:"required"`
}
GetRuleGroupResponse {
Total int64 `json:"total"`
List []ServerRuleGroup `json:"list"`
}
GetNodeTagListResponse {
Tags []string `json:"tags"`
}
)
@server (
prefix: v1/admin/server
group: admin/server
middleware: AuthMiddleware
)
service ppanel {
@doc "Get node tag list"
@handler GetNodeTagList
get /tag/list returns (GetNodeTagListResponse)
@doc "Get node list"
@handler GetNodeList
get /list (GetNodeServerListRequest) returns (GetNodeServerListResponse)
@doc "Get node detail"
@handler GetNodeDetail
get /detail (GetNodeDetailRequest) returns (Server)
@doc "Update node"
@handler UpdateNode
put / (UpdateNodeRequest)
@doc "Create node"
@handler CreateNode
post / (CreateNodeRequest)
@doc "Delete node"
@handler DeleteNode
delete / (DeleteNodeRequest)
@doc "Batch delete node"
@handler BatchDeleteNode
delete /batch (BatchDeleteNodeRequest)
@doc "Get node group list"
@handler GetNodeGroupList
get /group/list returns (GetNodeGroupListResponse)
@doc "Create node group"
@handler CreateNodeGroup
post /group (CreateNodeGroupRequest)
@doc "Update node group"
@handler UpdateNodeGroup
put /group (UpdateNodeGroupRequest)
@doc "Delete node group"
@handler DeleteNodeGroup
delete /group (DeleteNodeGroupRequest)
@doc "Batch delete node group"
@handler BatchDeleteNodeGroup
delete /group/batch (BatchDeleteNodeGroupRequest)
@doc "Node sort "
@handler NodeSort
post /sort (NodeSortRequest)
@doc "Create rule group"
@handler CreateRuleGroup
post /rule_group (CreateRuleGroupRequest)
@doc "Update rule group"
@handler UpdateRuleGroup
put /rule_group (UpdateRuleGroupRequest)
@doc "Delete rule group"
@handler DeleteRuleGroup
delete /rule_group (DeleteRuleGroupRequest)
@doc "Get rule group list"
@handler GetRuleGroupList
get /rule_group_list returns (GetRuleGroupResponse)
}
+164
View File
@@ -0,0 +1,164 @@
syntax = "v1"
info (
title: "Subscribe API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
GetSubscribeDetailsRequest {
Id int64 `form:"id" validate:"required"`
}
CreateSubscribeGroupRequest {
Name string `json:"name" validate:"required"`
Description string `json:"description"`
}
UpdateSubscribeGroupRequest {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
}
GetSubscribeGroupListResponse {
List []SubscribeGroup `json:"list"`
Total int64 `json:"total"`
}
DeleteSubscribeGroupRequest {
Id int64 `json:"id" validate:"required"`
}
BatchDeleteSubscribeGroupRequest {
Ids []int64 `json:"ids" validate:"required"`
}
CreateSubscribeRequest {
Name string `json:"name" validate:"required"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
GroupId int64 `json:"group_id"`
ServerGroup []int64 `json:"server_group"`
Server []int64 `json:"server"`
Show *bool `json:"show"`
Sell *bool `json:"sell"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction *bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset *bool `json:"renewal_reset"`
}
UpdateSubscribeRequest {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
GroupId int64 `json:"group_id"`
ServerGroup []int64 `json:"server_group"`
Server []int64 `json:"server"`
Show *bool `json:"show"`
Sell *bool `json:"sell"`
Sort int64 `json:"sort"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction *bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset *bool `json:"renewal_reset"`
}
SubscribeSortRequest {
Sort []SortItem `json:"sort"`
}
GetSubscribeListRequest {
Page int64 `form:"page" validate:"required"`
Size int64 `form:"size" validate:"required"`
GroupId int64 `form:"group_id,omitempty"`
Search string `form:"search,omitempty"`
}
SubscribeItem {
Subscribe
Sold int64 `json:"sold"`
}
GetSubscribeListResponse {
List []SubscribeItem `json:"list"`
Total int64 `json:"total"`
}
DeleteSubscribeRequest {
Id int64 `json:"id" validate:"required"`
}
BatchDeleteSubscribeRequest {
Ids []int64 `json:"ids" validate:"required"`
}
)
@server (
prefix: v1/admin/subscribe
group: admin/subscribe
middleware: AuthMiddleware
)
service ppanel {
@doc "Create subscribe group"
@handler CreateSubscribeGroup
post /group (CreateSubscribeGroupRequest)
@doc "Update subscribe group"
@handler UpdateSubscribeGroup
put /group (UpdateSubscribeGroupRequest)
@doc "Get subscribe group list"
@handler GetSubscribeGroupList
get /group/list returns (GetSubscribeGroupListResponse)
@doc "Delete subscribe group"
@handler DeleteSubscribeGroup
delete /group (DeleteSubscribeGroupRequest)
@doc "Batch delete subscribe group"
@handler BatchDeleteSubscribeGroup
delete /group/batch (BatchDeleteSubscribeGroupRequest)
@doc "Create subscribe"
@handler CreateSubscribe
post / (CreateSubscribeRequest)
@doc "Update subscribe"
@handler UpdateSubscribe
put / (UpdateSubscribeRequest)
@doc "Get subscribe list"
@handler GetSubscribeList
get /list (GetSubscribeListRequest) returns (GetSubscribeListResponse)
@doc "Delete subscribe"
@handler DeleteSubscribe
delete / (DeleteSubscribeRequest)
@doc "Batch delete subscribe"
@handler BatchDeleteSubscribe
delete /batch (BatchDeleteSubscribeRequest)
@doc "Get subscribe details"
@handler GetSubscribeDetails
get /details (GetSubscribeDetailsRequest) returns (Subscribe)
@doc "Subscribe sort"
@handler SubscribeSort
post /sort (SubscribeSortRequest)
}
+205
View File
@@ -0,0 +1,205 @@
syntax = "v1"
info (
title: "System API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
// Update application request
UpdateApplicationRequest {
Id int64 `json:"id" validate:"required"`
Icon string `json:"icon"`
Name string `json:"name"`
Description string `json:"description"`
SubscribeType string `json:"subscribe_type"`
Platform ApplicationPlatform `json:"platform"`
}
// Create application request
CreateApplicationRequest {
Icon string `json:"icon"`
Name string `json:"name"`
Description string `json:"description"`
SubscribeType string `json:"subscribe_type"`
Platform ApplicationPlatform `json:"platform"`
}
// Update application request
UpdateApplicationVersionRequest {
Id int64 `json:"id" validate:"required"`
Url string `json:"url"`
Version string `json:"version" validate:"required"`
Description string `json:"description"`
Platform string `json:"platform" validate:"required,oneof=windows mac linux android ios harmony"`
IsDefault bool `json:"is_default"`
ApplicationId int64 `json:"application_id" validate:"required"`
}
// Create application request
CreateApplicationVersionRequest {
Url string `json:"url"`
Version string `json:"version" validate:"required"`
Description string `json:"description"`
Platform string `json:"platform" validate:"required,oneof=windows mac linux android ios harmony"`
IsDefault bool `json:"is_default"`
ApplicationId int64 `json:"application_id" validate:"required"`
}
// Delete application request
DeleteApplicationRequest {
Id int64 `json:"id" validate:"required"`
}
// Delete application request
DeleteApplicationVersionRequest {
Id int64 `json:"id" validate:"required"`
}
GetNodeMultiplierResponse {
Periods []TimePeriod `json:"periods"`
}
// SetNodeMultiplierRequest
SetNodeMultiplierRequest {
Periods []TimePeriod `json:"periods"`
}
)
@server (
prefix: v1/admin/system
group: admin/system
middleware: AuthMiddleware
)
service ppanel {
@doc "Get site config"
@handler GetSiteConfig
get /site_config returns (SiteConfig)
@doc "Update site config"
@handler UpdateSiteConfig
put /site_config (SiteConfig)
@doc "Get subscribe config"
@handler GetSubscribeConfig
get /subscribe_config returns (SubscribeConfig)
@doc "Update subscribe config"
@handler UpdateSubscribeConfig
put /subscribe_config (SubscribeConfig)
@doc "Get subscribe type"
@handler GetSubscribeType
get /subscribe_type returns (SubscribeType)
@doc "update application config"
@handler UpdateApplicationConfig
put /application_config (ApplicationConfig)
@doc "get application config"
@handler GetApplicationConfig
get /application_config returns (ApplicationConfig)
@doc "Get application"
@handler GetApplication
get /application returns (ApplicationResponse)
@doc "Update application"
@handler UpdateApplication
put /application (UpdateApplicationRequest)
@doc "Create application"
@handler CreateApplication
post /application (CreateApplicationRequest)
@doc "Delete application"
@handler DeleteApplication
delete /application (DeleteApplicationRequest)
@doc "Update application version"
@handler UpdateApplicationVersion
put /application_version (UpdateApplicationVersionRequest)
@doc "Create application version"
@handler CreateApplicationVersion
post /application_version (CreateApplicationVersionRequest)
@doc "Delete application"
@handler DeleteApplicationVersion
delete /application_version (DeleteApplicationVersionRequest)
@doc "Get register config"
@handler GetRegisterConfig
get /register_config returns (RegisterConfig)
@doc "Update register config"
@handler UpdateRegisterConfig
put /register_config (RegisterConfig)
@doc "Get verify config"
@handler GetVerifyConfig
get /verify_config returns (VerifyConfig)
@doc "Update verify config"
@handler UpdateVerifyConfig
put /verify_config (VerifyConfig)
@doc "Get node config"
@handler GetNodeConfig
get /node_config returns (NodeConfig)
@doc "Update node config"
@handler UpdateNodeConfig
put /node_config (NodeConfig)
@doc "Get invite config"
@handler GetInviteConfig
get /invite_config returns (InviteConfig)
@doc "Update invite config"
@handler UpdateInviteConfig
put /invite_config (InviteConfig)
@doc "Get Team of Service Config"
@handler GetTosConfig
get /tos_config returns (TosConfig)
@doc "Update Team of Service Config"
@handler UpdateTosConfig
put /tos_config (TosConfig)
@doc "get Privacy Policy Config"
@handler GetPrivacyPolicyConfig
get /privacy returns (PrivacyPolicyConfig)
@doc "Update Privacy Policy Config"
@handler UpdatePrivacyPolicyConfig
put /privacy (PrivacyPolicyConfig)
@doc "Get Currency Config"
@handler GetCurrencyConfig
get /currency_config returns (CurrencyConfig)
@doc "Update Currency Config"
@handler UpdateCurrencyConfig
put /currency_config (CurrencyConfig)
@doc "setting telegram bot"
@handler SettingTelegramBot
post /setting_telegram_bot
@doc "Get Node Multiplier"
@handler GetNodeMultiplier
get /get_node_multiplier returns (GetNodeMultiplierResponse)
@doc "Set Node Multiplier"
@handler SetNodeMultiplier
post /set_node_multiplier (SetNodeMultiplierRequest)
@doc "Get Verify Code Config"
@handler GetVerifyCodeConfig
get /verify_code_config returns (VerifyCodeConfig)
@doc "Update Verify Code Config"
@handler UpdateVerifyCodeConfig
put /verify_code_config (VerifyCodeConfig)
}
+62
View File
@@ -0,0 +1,62 @@
syntax = "v1"
info (
title: "Ticket API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
UpdateTicketStatusRequest {
Id int64 `json:"id" validate:"required"`
Status *uint8 `json:"status" validate:"required"`
}
GetTicketListRequest {
Page int64 `form:"page"`
Size int64 `form:"size"`
UserId int64 `form:"user_id,omitempty"`
Status *uint8 `form:"status,omitempty"`
Search string `form:"search,omitempty"`
}
GetTicketListResponse {
Total int64 `json:"total"`
List []Ticket `json:"list"`
}
GetTicketRequest {
Id int64 `form:"id" validate:"required"`
}
CreateTicketFollowRequest {
TicketId int64 `json:"ticket_id" validate:"required"`
From string `json:"from" validate:"required"`
Type uint8 `json:"type" validate:"required"`
Content string `json:"content" validate:"required"`
}
)
@server (
prefix: v1/admin/ticket
group: admin/ticket
middleware: AuthMiddleware
)
service ppanel {
@doc "Get ticket list"
@handler GetTicketList
get /list (GetTicketListRequest) returns (GetTicketListResponse)
@doc "Get ticket detail"
@handler GetTicket
get /detail (GetTicketRequest) returns (Ticket)
@doc "Update ticket status"
@handler UpdateTicketStatus
put / (UpdateTicketStatusRequest)
@doc "Create ticket follow"
@handler CreateTicketFollow
post /follow (CreateTicketFollowRequest)
}
+33
View File
@@ -0,0 +1,33 @@
syntax = "v1"
info(
title: "Tools Api"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
LogResponse {
List interface{} `json:"list"`
}
)
@server (
prefix: v1/admin/tool
group: admin/tool
middleware: AuthMiddleware
)
service ppanel {
@doc "Get System Log"
@handler GetSystemLog
get /log returns (LogResponse)
@doc "Restart System"
@handler RestartSystem
get /restart
}
+278
View File
@@ -0,0 +1,278 @@
syntax = "v1"
info (
title: "User API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"../types.api"
)
type (
// GetUserListRequest
GetUserListRequest {
Page int `form:"page"`
Size int `form:"size"`
Search string `form:"search,omitempty"`
UserId *int64 `form:"user_id,omitempty"`
SubscribeId *int64 `form:"subscribe_id,omitempty"`
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
}
// GetUserListResponse
GetUserListResponse {
Total int64 `json:"total"`
List []User `json:"list"`
}
// GetUserDetail
GetDetailRequest {
Id int64 `form:"id" validate:"required"`
}
UpdateUserBasiceInfoRequest {
UserId int64 `json:"user_id" validate:"required"`
Password string `json:"password"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
GiftAmount int64 `json:"gift_amount"`
Telegram int64 `json:"telegram"`
ReferCode string `json:"refer_code"`
RefererId int64 `json:"referer_id"`
Enable bool `json:"enable"`
IsAdmin bool `json:"is_admin"`
}
UpdateUserNotifySettingRequest {
UserId int64 `json:"user_id" validate:"required"`
EnableBalanceNotify bool `json:"enable_balance_notify"`
EnableLoginNotify bool `json:"enable_login_notify"`
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
EnableTradeNotify bool `json:"enable_trade_notify"`
}
CreateUserRequest {
Email string `json:"email"`
Telephone string `json:"telephone"`
TelephoneAreaCode string `json:"telephone_area_code"`
Password string `json:"password"`
ProductId int64 `json:"product_id"`
Duration int64 `json:"duration"`
RefererUser string `json:"referer_user"`
ReferCode string `json:"refer_code"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
GiftAmount int64 `json:"gift_amount"`
IsAdmin bool `json:"is_admin"`
}
UserSubscribeDetail {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
User User `json:"user"`
OrderId int64 `json:"order_id"`
SubscribeId int64 `json:"subscribe_id"`
Subscribe Subscribe `json:"subscribe"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
ResetTime int64 `json:"reset_time"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Token string `json:"token"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
BatchDeleteUserRequest {
Ids []int64 `json:"ids" validate:"required"`
}
DeleteUserDeivceRequest {
Id int64 `json:"id"`
}
KickOfflineRequest {
Id int64 `json:"id"`
}
CreateUserAuthMethodRequest {
UserId int64 `json:"user_id"`
AuthType string `json:"auth_type"`
AuthIdentifier string `json:"auth_identifier"`
}
DeleteUserAuthMethodRequest {
UserId int64 `json:"user_id"`
AuthType string `json:"auth_type"`
}
UpdateUserAuthMethodRequest {
UserId int64 `json:"user_id"`
AuthType string `json:"auth_type"`
AuthIdentifier string `json:"auth_identifier"`
}
GetUserAuthMethodRequest {
UserId int64 `json:"user_id"`
}
GetUserAuthMethodResponse {
AuthMethods []UserAuthMethod `json:"auth_methods"`
}
GetUserSubscribeListRequest {
Page int `form:"page"`
Size int `form:"size"`
UserId int64 `form:"user_id"`
}
GetUserSubscribeListResponse {
List []UserSubscribe `json:"list"`
Total int64 `json:"total"`
}
GetUserSubscribeLogsRequest {
Page int `form:"page"`
Size int `form:"size"`
UserId int64 `form:"user_id"`
SubscribeId int64 `form:"subscribe_id,omitempty"`
}
GetUserSubscribeLogsResponse {
List []UserSubscribeLog `json:"list"`
Total int64 `json:"total"`
}
GetUserSubscribeDevicesRequest {
Page int `form:"page"`
Size int `form:"size"`
UserId int64 `form:"user_id"`
SubscribeId int64 `form:"subscribe_id"`
}
GetUserSubscribeDevicesResponse {
List []UserDevice `json:"list"`
Total int64 `json:"total"`
}
CreateUserSubscribeRequest {
UserId int64 `json:"user_id"`
ExpiredAt int64 `json:"expired_at"`
Traffic int64 `json:"traffic"`
SubscribeId int64 `json:"subscribe_id"`
}
UpdateUserSubscribeRequest {
UserSubscribeId int64 `json:"user_subscribe_id"`
SubscribeId int64 `json:"subscribe_id"`
Traffic int64 `json:"traffic"`
ExpiredAt int64 `json:"expired_at"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
}
GetUserLoginLogsRequest {
Page int `form:"page"`
Size int `form:"size"`
UserId int64 `form:"user_id"`
}
GetUserLoginLogsResponse {
List []UserLoginLog `json:"list"`
Total int64 `json:"total"`
}
DeleteUserSubscribeRequest {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
GetUserSubscribeByIdRequest {
Id int64 `form:"id" validate:"required"`
}
)
@server (
prefix: v1/admin/user
group: admin/user
jwt: JwtAuth
middleware: AuthMiddleware
)
service ppanel {
@doc "Get user list"
@handler GetUserList
get /list (GetUserListRequest) returns (GetUserListResponse)
@doc "Get user detail"
@handler GetUserDetail
get /detail (GetDetailRequest) returns (User)
@doc "Update user basic info"
@handler UpdateUserBasicInfo
put /basic (UpdateUserBasiceInfoRequest)
@doc "Update user notify setting"
@handler UpdateUserNotifySetting
put /notify (UpdateUserNotifySettingRequest)
@doc "Delete user"
@handler DeleteUser
delete / (GetDetailRequest)
@doc "Current user"
@handler CurrentUser
get /current returns (User)
@doc "Batch delete user"
@handler BatchDeleteUser
delete /batch (BatchDeleteUserRequest)
@doc "Create user"
@handler CreateUser
post / (CreateUserRequest)
@doc "User device"
@handler UpdateUserDevice
put /device (UserDevice)
@doc "Delete user device"
@handler DeleteUserDevice
delete /device (DeleteUserDeivceRequest)
@doc "kick offline user device"
@handler KickOfflineByUserDevice
put /device/kick_offline (KickOfflineRequest)
@doc "Create user auth method"
@handler CreateUserAuthMethod
post /auth_method (CreateUserAuthMethodRequest)
@doc "Delete user auth method"
@handler DeleteUserAuthMethod
delete /auth_method (DeleteUserAuthMethodRequest)
@doc "Update user auth method"
@handler UpdateUserAuthMethod
put /auth_method (UpdateUserAuthMethodRequest)
@doc "Get user auth method"
@handler GetUserAuthMethod
get /auth_method (GetUserAuthMethodRequest) returns (GetUserAuthMethodResponse)
@doc "Get user subcribe"
@handler GetUserSubscribe
get /subscribe (GetUserSubscribeListRequest) returns (GetUserSubscribeListResponse)
@doc "Get user subcribe by id"
@handler GetUserSubscribeById
get /subscribe/detail (GetUserSubscribeByIdRequest) returns (UserSubscribeDetail)
@doc "Get user subcribe logs"
@handler GetUserSubscribeLogs
get /subscribe/logs (GetUserSubscribeLogsRequest) returns (GetUserSubscribeLogsResponse)
@doc "Get user subcribe traffic logs"
@handler GetUserSubscribeTrafficLogs
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
@doc "Get user subcribe devices"
@handler GetUserSubscribeDevices
get /subscribe/device (GetUserSubscribeDevicesRequest) returns (GetUserSubscribeDevicesResponse)
@doc "Create user subcribe"
@handler CreateUserSubscribe
post /subscribe (CreateUserSubscribeRequest)
@doc "Update user subcribe"
@handler UpdateUserSubscribe
put /subscribe (UpdateUserSubscribeRequest)
@doc "Delete user subcribe"
@handler DeleteUserSubscribe
delete /subscribe (DeleteUserSubscribeRequest)
@doc "Get user login logs"
@handler GetUserLoginLogs
get /login/logs (GetUserLoginLogsRequest) returns (GetUserLoginLogsResponse)
}
+24
View File
@@ -0,0 +1,24 @@
syntax = "v1"
info (
title: "Announcement API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/app/announcement
group: app/announcement
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Query announcement"
@handler QueryAnnouncement
get /list (QueryAnnouncementRequest) returns (QueryAnnouncementResponse)
}
+105
View File
@@ -0,0 +1,105 @@
syntax = "v1"
info(
title: "App Auth Api"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"../types.api"
)
type (
AppAuthCheckRequest {
Method string `json:"method" validate:"required" validate:"required,oneof=device email mobile"`
Account string `json:"account"`
Identifier string `json:"identifier" validate:"required"`
UserAgent string `json:"user_agent" validate:"required,oneof=windows mac linux android ios harmony"`
AreaCode string `json:"area_code"`
}
AppAuthCheckResponse {
Status bool
}
AppAuthRequest {
Method string `json:"method" validate:"required" validate:"required,oneof=device email mobile"`
Account string `json:"account"`
Password string `json:"password"`
Identifier string `json:"identifier" validate:"required"`
UserAgent string `json:"user_agent" validate:"required,oneof=windows mac linux android ios harmony"`
Code string `json:"code"`
Invite string `json:"invite"`
AreaCode string `json:"area_code"`
CfToken string `json:"cf_token,optional"`
}
AppAuthRespone {
Token string `json:"token"`
}
AppSendCodeRequest {
Method string `json:"method" validate:"required" validate:"required,oneof=email mobile"`
Account string `json:"account"`
AreaCode string `json:"area_code"`
CfToken string `json:"cf_token,optional"`
}
AppSendCodeRespone {
Status bool `json:"status"`
Code string `json:"code,omitempty"`
}
AppConfigRequest {
UserAgent string `json:"user_agent" validate:"required,oneof=windows mac linux android ios harmony"`
}
AppConfigResponse {
EncryptionKey string `json:"encryption_key"`
EncryptionMethod string `json:"encryption_method"`
Domains []string `json:"domains"`
StartupPicture string `json:"startup_picture"`
StartupPictureSkipTime int64 `json:"startup_picture_skip_time"`
Application AppInfo `json:"applications"`
OfficialEmail string `json:"official_email"`
OfficialWebsite string `json:"official_website"`
OfficialTelegram string `json:"official_telegram"`
OfficialTelephone string `json:"official_telephone"`
InvitationLink string `json:"invitation_link"`
KrWebsiteId string `json:"kr_website_id"`
}
AppInfo {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Url string `json:"url"`
Version string `json:"version"`
VersionReview string `json:"version_review"`
VersionDescription string `json:"version_description"`
IsDefault bool `json:"is_default"`
}
)
@server(
prefix: v1/app/auth
group: app/auth
middleware: AppMiddleware
)
service ppanel {
@doc "Check Account"
@handler Check
post /check (AppAuthCheckRequest) returns (AppAuthCheckResponse)
@doc "Login"
@handler Login
post /login (AppAuthRequest) returns (AppAuthRespone)
@doc "Register"
@handler Register
post /register (AppAuthRequest) returns (AppAuthRespone)
@doc "Reset Password"
@handler ResetPassword
post /reset_password (AppAuthRequest) returns (AppAuthRespone)
@doc "GetAppConfig"
@handler GetAppConfig
post /config (AppConfigRequest) returns (AppConfigResponse)
}
+27
View File
@@ -0,0 +1,27 @@
syntax = "v1"
info(
title: "Document API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/app/document
group: app/document
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Get document list"
@handler QueryDocumentList
get /list returns (QueryDocumentListResponse)
@doc "Get document detail"
@handler QueryDocumentDetail
get /detail (QueryDocumentDetailRequest) returns (Document)
}
+49
View File
@@ -0,0 +1,49 @@
syntax = "v1"
info(
title: "App Node Api"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type(
AppRuleGroupListResponse {
Total int64 `json:"total"`
List []ServerRuleGroup `json:"list"`
}
AppUserSubscbribeNodeRequest {
Id int64 `form:"id" validate:"required"`
}
AppUserSubscbribeNodeResponse{
List []AppUserSubscbribeNode `json:"list"`
}
)
@server (
prefix: v1/app/node
group: app/node
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Get Node list"
@handler GetNodeList
get /list (AppUserSubscbribeNodeRequest) returns(AppUserSubscbribeNodeResponse)
@doc "Get rule group list"
@handler GetRuleGroupList
get /rule_group_list returns (AppRuleGroupListResponse)
}
+58
View File
@@ -0,0 +1,58 @@
syntax = "v1"
info (
title: "Order API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"../types.api"
)
@server (
prefix: v1/app/order
group: app/order
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Pre create order"
@handler PreCreateOrder
post /pre (PurchaseOrderRequest) returns (PreOrderResponse)
@doc "purchase Subscription"
@handler Purchase
post /purchase (PurchaseOrderRequest) returns (PurchaseOrderResponse)
@doc "Renewal Subscription"
@handler Renewal
post /renewal (RenewalOrderRequest) returns (RenewalOrderResponse)
@doc "Reset traffic"
@handler ResetTraffic
post /reset (ResetTrafficOrderRequest) returns (ResetTrafficOrderResponse)
@doc "Recharge"
@handler Recharge
post /recharge (RechargeOrderRequest) returns (RechargeOrderResponse)
@doc "Checkout order"
@handler CheckoutOrder
post /checkout (CheckoutOrderRequest) returns (CheckoutOrderResponse)
@doc "Close order"
@handler CloseOrder
post /close (CloseOrderRequest)
@doc "Get order"
@handler QueryOrderDetail
get /detail (QueryOrderDetailRequest) returns (OrderDetail)
@doc "Get order list"
@handler QueryOrderList
get /list (QueryOrderListRequest) returns (QueryOrderListResponse)
}
+23
View File
@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: "payment API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/app/payment
group: app/payment
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Get available payment methods"
@handler GetAvailablePaymentMethods
get /methods returns (GetAvailablePaymentMethodsResponse)
}
+75
View File
@@ -0,0 +1,75 @@
syntax = "v1"
info(
title: "Subscribe API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
QueryUserSubscribeResp {
Data []UserSubscribeData `json:"data"`
}
UserSubscribeData {
SubscribeId int64 `json:"subscribe_id"`
UserSubscribeId int64 `json:"user_subscribe_id"`
}
UserSubscribeResetPeriodRequest {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
UserSubscribeResetPeriodResponse {
Status bool `json:"status"`
}
AppUserSubscribeRequest {
ContainsNodes *bool `form:"contains_nodes"`
}
AppUserSubscbribeResponse {
List []AppUserSubcbribe `json:"list"`
}
)
@server(
prefix: v1/app/subscribe
group: app/subscribe
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "Get subscribe list"
@handler QuerySubscribeList
get /list returns (QuerySubscribeListResponse)
@doc "Get subscribe group list"
@handler QuerySubscribeGroupList
get /group/list returns (QuerySubscribeGroupListResponse)
@doc "Get application config"
@handler QueryApplicationConfig
get /application/config returns (ApplicationResponse)
@doc "Get Already subscribed to package"
@handler QueryUserAlreadySubscribe
get /user/already_subscribe returns (QueryUserSubscribeResp)
@doc "Get Available subscriptions for users"
@handler QueryUserAvailableUserSubscribe
get /user/available_subscribe (AppUserSubscribeRequest) returns (AppUserSubscbribeResponse)
@doc "Reset user subscription period"
@handler ResetUserSubscribePeriod
post /reset/period (UserSubscribeResetPeriodRequest) returns (UserSubscribeResetPeriodResponse)
}
+90
View File
@@ -0,0 +1,90 @@
syntax = "v1"
info (
title: "App User Api"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"../types.api"
)
type (
UserInfoResponse {
Id int64 `json:"id"`
Balance int64 `json:"balance"`
Email string `json:"email"`
RefererId int64 `json:"referer_id"`
ReferCode string `json:"refer_code"`
Avatar string `json:"avatar"`
AreaCode string `json:"area_code"`
Telephone string `json:"telephone"`
Devices []UserDevice `json:"devices"`
AuthMethods []UserAuthMethod `json:"auth_methods"`
}
UpdatePasswordRequeset {
Password string `json:"password"`
NewPassword string `json:"new_password"`
}
DeleteAccountRequest {
Method string `json:"method" validate:"required" validate:"required,oneof=email telephone device"`
Code string `json:"code"`
}
GetUserOnlineTimeStatisticsResponse{
WeeklyStats []WeeklyStat`json:"weekly_stats"`
ConnectionRecords ConnectionRecords`json:"connection_records"`
}
WeeklyStat{
Day int `json:"day"`
DayName string `json:"day_name"`
Hours float64 `json:"hours"`
}
ConnectionRecords{
CurrentContinuousDays int64 `json:"current_continuous_days"`
HistoryContinuousDays int64 `json:"history_continuous_days"`
LongestSingleConnection int64 `json:"longest_single_connection"`
}
)
@server (
prefix: v1/app/user
group: app/user
middleware: AppMiddleware,AuthMiddleware
)
service ppanel {
@doc "query user info"
@handler QueryUserInfo
get /info returns (UserInfoResponse)
@doc "Update Password "
@handler UpdatePassword
put /password (UpdatePasswordRequeset)
@doc "Delete Account"
@handler DeleteAccount
delete /account (DeleteAccountRequest)
@doc "Get user subcribe traffic logs"
@handler GetUserSubscribeTrafficLogs
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
@doc "Get user online time total"
@handler GetUserOnlineTimeStatistics
get /online_time/statistics returns (GetUserOnlineTimeStatisticsResponse)
@doc "Query User Affiliate List"
@handler QueryUserAffiliateList
get /affiliate/list (QueryUserAffiliateListRequest) returns (QueryUserAffiliateListResponse)
@doc "Query User Affiliate Count"
@handler QueryUserAffiliate
get /affiliate/count returns (QueryUserAffiliateCountResponse)
}
+23
View File
@@ -0,0 +1,23 @@
syntax = "v1"
info(
title: "App Heartbeat Api"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
@server(
prefix: v1/app/ws
group: app/ws
middleware: AuthMiddleware
)
service ppanel {
@doc "App heartbeat"
@handler AppWs
get /:userid/:identifier
}
+166
View File
@@ -0,0 +1,166 @@
syntax = "v1"
info (
title: "User auth API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
type (
// User login request
UserLoginRequest {
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
IP string `header:"X-Original-Forwarded-For"`
UserAgent string `header:"User-Agent"`
CfToken string `json:"cf_token,optional"`
}
// Check user is exist request
CheckUserRequest {
Email string `form:"email" validate:"required"`
}
// User login response
CheckUserResponse {
exist bool `json:"exist"`
}
// User login response
UserRegisterRequest {
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
Invite string `json:"invite,optional"`
Code string `json:"code,optional"`
IP string `header:"X-Original-Forwarded-For"`
UserAgent string `header:"User-Agent"`
CfToken string `json:"cf_token,optional"`
}
// User login response
ResetPasswordRequest {
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
Code string `json:"code,optional"`
IP string `header:"X-Original-Forwarded-For"`
UserAgent string `header:"User-Agent"`
CfToken string `json:"cf_token,optional"`
}
LoginResponse {
Token string `json:"token"`
}
OAthLoginRequest {
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
Redirect string `json:"redirect"`
}
OAuthLoginResponse {
Redirect string `json:"redirect"`
}
OAuthLoginGetTokenRequest {
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
Callback interface{} `json:"callback" validate:"required"`
}
// login request
TelephoneLoginRequest {
Telephone string `json:"telephone" validate:"required"`
TelephoneCode string `json:"telephone_code"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password"`
IP string `header:"X-Original-Forwarded-For"`
CfToken string `json:"cf_token,optional"`
}
// Check user is exist request
TelephoneCheckUserRequest {
Telephone string `form:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
}
// User login response
TelephoneCheckUserResponse {
exist bool `json:"exist"`
}
// User login response
TelephoneRegisterRequest {
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password" validate:"required"`
Invite string `json:"invite,optional"`
Code string `json:"code,optional"`
IP string `header:"X-Original-Forwarded-For"`
CfToken string `json:"cf_token,optional"`
}
// User login response
TelephoneResetPasswordRequest {
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password" validate:"required"`
Code string `json:"code,optional"`
IP string `header:"X-Original-Forwarded-For"`
CfToken string `json:"cf_token,optional"`
}
AppleLoginCallbackRequest {
Code string `form:"code"`
IDToken string `form:"id_token"`
State string `form:"state"`
}
GoogleLoginCallbackRequest {
Code string `form:"code"`
State string `form:"state"`
}
)
@server (
prefix: v1/auth
group: auth
)
service ppanel {
@doc "User login"
@handler UserLogin
post /login (UserLoginRequest) returns (LoginResponse)
@doc "Check user is exist"
@handler CheckUser
get /check (CheckUserRequest) returns (CheckUserResponse)
@doc "User register"
@handler UserRegister
post /register (UserRegisterRequest) returns (LoginResponse)
@doc "Reset password"
@handler ResetPassword
post /reset (ResetPasswordRequest) returns (LoginResponse)
@doc "User Telephone login"
@handler TelephoneLogin
post /login/telephone (TelephoneLoginRequest) returns (LoginResponse)
@doc "Check user telephone is exist"
@handler CheckUserTelephone
get /check/telephone (TelephoneCheckUserRequest) returns (TelephoneCheckUserResponse)
@doc "User Telephone register"
@handler TelephoneUserRegister
post /register/telephone (TelephoneRegisterRequest) returns (LoginResponse)
@doc "Reset password"
@handler TelephoneResetPassword
post /reset/telephone (TelephoneResetPasswordRequest) returns (LoginResponse)
}
@server (
prefix: v1/auth/oauth
group: auth/oauth
)
service ppanel {
@doc "OAuth login"
@handler OAuthLogin
post /login (OAthLoginRequest) returns (OAuthLoginResponse)
@doc "OAuth login get token"
@handler OAuthLoginGetToken
post /login/token (OAuthLoginGetTokenRequest) returns (LoginResponse)
@doc "Apple Login Callback"
@handler AppleLoginCallback
post /callback/apple (AppleLoginCallbackRequest)
}
+125
View File
@@ -0,0 +1,125 @@
syntax = "v1"
info (
title: "Common API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "./types.api"
type (
VeifyConfig {
TurnstileSiteKey string `json:"turnstile_site_key"`
EnableLoginVerify bool `json:"enable_login_verify"`
EnableRegisterVerify bool `json:"enable_register_verify"`
EnableResetPasswordVerify bool `json:"enable_reset_password_verify"`
}
GetGlobalConfigResponse {
Site SiteConfig `json:"site"`
Verify VeifyConfig `json:"verify"`
Auth AuthConfig `json:"auth"`
Invite InviteConfig `json:"invite"`
Currency Currency `json:"currency"`
Subscribe SubscribeConfig `json:"subscribe"`
VerifyCode PubilcVerifyCodeConfig `json:"verify_code"`
OAuthMethods []string `json:"oauth_methods"`
WebAd bool `json:"web_ad"`
}
Currency {
CurrencyUnit string `json:"currency_unit"`
CurrencySymbol string `json:"currency_symbol"`
}
GetTosResponse {
TosContent string `json:"tos_content"`
}
GetAppcationResponse {
Config ApplicationConfig `json:"config"`
Applications []ApplicationResponseInfo `json:"applications"`
}
// GetCodeRequest Get code request
SendCodeRequest {
Email string `json:"email" validate:"required"`
Type uint8 `json:"type" validate:"required"`
}
SendSmsCodeRequest {
Type uint8 `json:"type" validate:"required"`
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
}
// GetCodeResponse Get code response
SendCodeResponse {
Code string `json:"code,omitempty"`
Status bool `json:"status"`
}
// GetStatResponse Get stat response
GetStatResponse {
User int64 `json:"user"`
Node int64 `json:"node"`
Country int64 `json:"country"`
Protocol []string `json:"protocol"`
}
// Get ads
GetAdsRequest {
Device string `form:"device"`
Position string `form:"position"`
}
GetAdsResponse {
List []Ads `json:"list"`
}
CheckVerificationCodeRequest {
Method string `json:"method" validate:"required,oneof=email mobile"`
Account string `json:"account" validate:"required"`
Code string `json:"code" validate:"required"`
Type uint8 `json:"type" validate:"required"`
}
CheckVerificationCodeRespone{
Status bool `json:"status"`
}
)
@server (
prefix: v1/common
group: common
)
service ppanel {
@doc "Get global config"
@handler GetGlobalConfig
get /site/config returns (GetGlobalConfigResponse)
@doc "Get Tos Content"
@handler GetApplication
get /application returns (GetAppcationResponse)
@doc "Get Tos Content"
@handler GetTos
get /site/tos returns (GetTosResponse)
@doc "Get Privacy Policy"
@handler GetPrivacyPolicy
get /site/privacy returns (PrivacyPolicyConfig)
@doc "Get stat"
@handler GetStat
get /site/stat returns (GetStatResponse)
@doc "Get verification code"
@handler SendEmailCode
post /send_code (SendCodeRequest) returns (SendCodeResponse)
@doc "Get sms verification code"
@handler SendSmsCode
post /send_sms_code (SendSmsCodeRequest) returns (SendCodeResponse)
@doc "Get Ads"
@handler GetAds
get /ads (GetAdsRequest) returns (GetAdsResponse)
@doc "Check verification code"
@handler CheckVerificationCode
post /check_verification_code (CheckVerificationCodeRequest) returns (CheckVerificationCodeRespone)
}
+121
View File
@@ -0,0 +1,121 @@
syntax = "v1"
info (
title: "Node API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
ShadowsocksProtocol {
Port int `json:"port"`
Method string `json:"method"`
}
VmessProtocol {
Host string `json:"host"`
Port int `json:"port"`
EnableTLS *bool `json:"enable_tls"`
TLSConfig string `json:"tls_config"`
Network string `json:"network"`
Transport string `json:"transport"`
}
VlessProtocol {
Host string `json:"host"`
Port int `json:"port"`
Network string `json:"network"`
Transport string `json:"transport"`
Security string `json:"security"`
SecurityConfig string `json:"security_config"`
XTLS string `json:"xtls"`
}
TrojanProtocol {
Host string `json:"host"`
Port int `json:"port"`
EnableTLS *bool `json:"enable_tls"`
TLSConfig string `json:"tls_config"`
Network string `json:"network"`
Transport string `json:"transport"`
}
GetServerConfigRequest {
ServerCommon
}
GetServerConfigResponse {
Basic ServerBasic `json:"basic"`
Protocol string `json:"protocol"`
Config interface{} `json:"config"`
}
ServerBasic {
PushInterval int64 `json:"push_interval"`
PullInterval int64 `json:"pull_interval"`
}
ServerCommon {
Protocol string `form:"protocol"`
ServerId int64 `form:"server_id"`
SecretKey string `form:"secret_key"`
}
ServerUser {
Id int64 `json:"id"`
UUID string `json:"uuid"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
}
GetServerUserListRequest {
ServerCommon
}
GetServerUserListResponse {
Users []ServerUser `json:"users"`
}
UserTraffic {
SID int64 `json:"uid"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
}
ServerPushUserTrafficRequest {
ServerCommon
Traffic []UserTraffic `json:"traffic"`
}
ServerPushStatusRequest {
ServerCommon
Cpu float64 `json:"cpu"`
Mem float64 `json:"mem"`
Disk float64 `json:"disk"`
UpdatedAt int64 `json:"updated_at"`
}
OnlineUsersRequest {
ServerCommon
Users []OnlineUser `json:"users"`
}
)
@server (
prefix: v1/server
group: server
middleware: ServerMiddleware
)
service ppanel {
@doc "Get user list"
@handler GetServerUserList
get /user (GetServerUserListRequest) returns (GetServerUserListResponse)
@doc "Push user Traffic"
@handler ServerPushUserTraffic
post /push (ServerPushUserTrafficRequest)
@doc "Push server status"
@handler ServerPushStatus
post /status (ServerPushStatusRequest)
@doc "Get server config"
@handler GetServerConfig
get /config (GetServerConfigRequest) returns (GetServerConfigResponse)
@doc "Push online users"
@handler PushOnlineUsers
post /online (OnlineUsersRequest)
}
+24
View File
@@ -0,0 +1,24 @@
syntax = "v1"
info (
title: "Announcement API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/public/announcement
group: public/announcement
middleware: AuthMiddleware
)
service ppanel {
@doc "Query announcement"
@handler QueryAnnouncement
get /list (QueryAnnouncementRequest) returns (QueryAnnouncementResponse)
}
+28
View File
@@ -0,0 +1,28 @@
syntax = "v1"
info(
title: "Document API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/public/document
group: public/document
middleware: AuthMiddleware
)
service ppanel {
@doc "Get document list"
@handler QueryDocumentList
get /list returns (QueryDocumentListResponse)
@doc "Get document detail"
@handler QueryDocumentDetail
get /detail (QueryDocumentDetailRequest) returns (Document)
}
+51
View File
@@ -0,0 +1,51 @@
syntax = "v1"
info (
title: "Order API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/public/order
group: public/order
middleware: AuthMiddleware
)
service ppanel {
@doc "Pre create order"
@handler PreCreateOrder
post /pre (PurchaseOrderRequest) returns (PreOrderResponse)
@doc "purchase Subscription"
@handler Purchase
post /purchase (PurchaseOrderRequest) returns (PurchaseOrderResponse)
@doc "Renewal Subscription"
@handler Renewal
post /renewal (RenewalOrderRequest) returns (RenewalOrderResponse)
@doc "Reset traffic"
@handler ResetTraffic
post /reset (ResetTrafficOrderRequest) returns (ResetTrafficOrderResponse)
@doc "Recharge"
@handler Recharge
post /recharge (RechargeOrderRequest) returns (RechargeOrderResponse)
@doc "Close order"
@handler CloseOrder
post /close (CloseOrderRequest)
@doc "Get order"
@handler QueryOrderDetail
get /detail (QueryOrderDetailRequest) returns (OrderDetail)
@doc "Get order list"
@handler QueryOrderList
get /list (QueryOrderListRequest) returns (QueryOrderListResponse)
}
+24
View File
@@ -0,0 +1,24 @@
syntax = "v1"
info (
title: "payment API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/public/payment
group: public/payment
middleware: AuthMiddleware
)
service ppanel {
@doc "Get available payment methods"
@handler GetAvailablePaymentMethods
get /methods returns (GetAvailablePaymentMethodsResponse)
}
+95
View File
@@ -0,0 +1,95 @@
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"`
TurnstileToken string `json:"turnstile_token,omitempty"`
}
PortalPurchaseResponse {
OrderNo string `json:"order_no"`
}
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
)
service ppanel {
@doc "Get available payment methods"
@handler GetAvailablePaymentMethods
get /payment-method returns (GetAvailablePaymentMethodsResponse)
@doc "Get Subscription"
@handler GetSubscription
get /subscribe 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)
}
+31
View File
@@ -0,0 +1,31 @@
syntax = "v1"
info (
title: "Subscribe API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
@server (
prefix: v1/public/subscribe
group: public/subscribe
middleware: AuthMiddleware
)
service ppanel {
@doc "Get subscribe list"
@handler QuerySubscribeList
get /list returns (QuerySubscribeListResponse)
@doc "Get subscribe group list"
@handler QuerySubscribeGroupList
get /group/list returns (QuerySubscribeGroupListResponse)
@doc "Get application config"
@handler QueryApplicationConfig
get /application/config returns (ApplicationResponse)
}
+70
View File
@@ -0,0 +1,70 @@
syntax = "v1"
info (
title: "Ticket API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
GetUserTicketListResponse {
Total int64 `json:"total"`
List []Ticket `json:"list"`
}
CreateUserTicketRequest {
Title string `json:"title"`
Description string `json:"description"`
}
GetUserTicketListRequest {
Page int `form:"page"`
Size int `form:"size"`
Status *uint8 `form:"status,omitempty"`
Search string `form:"search,omitempty"`
}
GetUserTicketDetailRequest {
Id int64 `form:"id" validate:"required"`
}
UpdateUserTicketStatusRequest {
Id int64 `json:"id" validate:"required"`
Status *uint8 `json:"status" validate:"required"`
}
CreateUserTicketFollowRequest {
TicketId int64 `json:"ticket_id"`
From string `json:"from"`
Type uint8 `json:"type"`
Content string `json:"content"`
}
)
@server (
prefix: v1/public/ticket
group: public/ticket
middleware: AuthMiddleware
)
service ppanel {
@doc "Get ticket list"
@handler GetUserTicketList
get /list (GetUserTicketListRequest) returns (GetUserTicketListResponse)
@doc "Get ticket detail"
@handler GetUserTicketDetails
get /detail (GetUserTicketDetailRequest) returns (Ticket)
@doc "Update ticket status"
@handler UpdateUserTicketStatus
put / (UpdateUserTicketStatusRequest)
@doc "Create ticket follow"
@handler CreateUserTicketFollow
post /follow (CreateUserTicketFollowRequest)
@doc "Create ticket"
@handler CreateUserTicket
post / (CreateUserTicketRequest)
}
+211
View File
@@ -0,0 +1,211 @@
syntax = "v1"
info (
title: "User API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "../types.api"
type (
UpdateUserNotifyRequest {
EnableBalanceNotify *bool `json:"enable_balance_notify"`
EnableLoginNotify *bool `json:"enable_login_notify"`
EnableSubscribeNotify *bool `json:"enable_subscribe_notify"`
EnableTradeNotify *bool `json:"enable_trade_notify"`
}
UpdateUserPasswordRequest {
Password string `json:"password" validate:"required"`
}
QueryUserSubscribeListResponse {
List []UserSubscribe `json:"list"`
Total int64 `json:"total"`
}
QueryUserBalanceLogListResponse {
List []UserBalanceLog `json:"list"`
Total int64 `json:"total"`
}
CommissionLog {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderNo string `json:"order_no"`
Amount int64 `json:"amount"`
CreatedAt int64 `json:"created_at"`
}
QueryUserCommissionLogListRequest {
Page int `form:"page"`
Size int `form:"size"`
}
QueryUserCommissionLogListResponse {
List []CommissionLog `json:"list"`
Total int64 `json:"total"`
}
BindTelegramResponse {
Url string `json:"url"`
ExpiredAt int64 `json:"expired_at"`
}
PreUnsubscribeRequest {
Id int64 `json:"id"`
}
PreUnsubscribeResponse {
DeductionAmount int64 `json:"deduction_amount"`
}
UnsubscribeRequest {
Id int64 `json:"id"`
}
BindOAuthRequest {
Method string `json:"method"`
Redirect string `json:"redirect"`
}
BindOAuthResponse {
Redirect string `json:"redirect"`
}
BindOAuthCallbackRequest {
Method string `json:"method"`
Callback interface{} `json:"callback"`
}
GetOAuthMethodsResponse {
Methods []UserAuthMethod `json:"methods"`
}
UnbindOAuthRequest {
Method string `json:"method"`
}
ResetUserSubscribeTokenRequest {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
GetLoginLogRequest {
Page int `form:"page"`
Size int `form:"size"`
}
GetLoginLogResponse {
List []UserLoginLog `json:"list"`
Total int64 `json:"total"`
}
GetSubscribeLogRequest {
Page int `form:"page"`
Size int `form:"size"`
}
GetSubscribeLogResponse {
List []UserSubscribeLog `json:"list"`
Total int64 `json:"total"`
}
UpdateBindMobileRequest{
AreaCode string `json:"area_code" validate:"required"`
Mobile string `json:"mobile" validate:"required"`
Code string `json:"code" validate:"required"`
}
UpdateBindEmailRequest{
Email string `json:"email" validate:"required"`
}
VerifyEmailRequest {
Email string `json:"email" validate:"required"`
Code string `json:"code" validate:"required"`
}
)
@server (
prefix: v1/public/user
group: public/user
middleware: AuthMiddleware
)
service ppanel {
@doc "Query User Info"
@handler QueryUserInfo
get /info returns (User)
@doc "Update User Notify"
@handler UpdateUserNotify
put /notify (UpdateUserNotifyRequest)
@doc "Update User Password"
@handler UpdateUserPassword
put /password (UpdateUserPasswordRequest)
@doc "Query User Subscribe"
@handler QueryUserSubscribe
get /subscribe returns (QueryUserSubscribeListResponse)
@doc "Pre Unsubscribe"
@handler PreUnsubscribe
post /unsubscribe/pre (PreUnsubscribeRequest) returns (PreUnsubscribeResponse)
@doc "Unsubscribe"
@handler Unsubscribe
post /unsubscribe (UnsubscribeRequest)
@doc "Query User Balance Log"
@handler QueryUserBalanceLog
get /balance_log returns (QueryUserBalanceLogListResponse)
@doc "Query User Affiliate Count"
@handler QueryUserAffiliate
get /affiliate/count returns (QueryUserAffiliateCountResponse)
@doc "Query User Affiliate List"
@handler QueryUserAffiliateList
get /affiliate/list (QueryUserAffiliateListRequest) returns (QueryUserAffiliateListResponse)
@doc "Bind Telegram"
@handler BindTelegram
get /bind_telegram returns (BindTelegramResponse)
@doc "Unbind Telegram"
@handler UnbindTelegram
post /unbind_telegram
@doc "Query User Commission Log"
@handler QueryUserCommissionLog
get /commission_log (QueryUserCommissionLogListRequest) returns (QueryUserCommissionLogListResponse)
@doc "Bind OAuth"
@handler BindOAuth
post /bind_oauth (BindOAuthRequest) returns (BindOAuthResponse)
@doc "Bind OAuth Callback"
@handler BindOAuthCallback
post /bind_oauth/callback (BindOAuthCallbackRequest)
@doc "Get OAuth Methods"
@handler GetOAuthMethods
get /oauth_methods returns (GetOAuthMethodsResponse)
@doc "Unbind OAuth"
@handler UnbindOAuth
post /unbind_oauth (UnbindOAuthRequest)
@doc "Reset User Subscribe Token"
@handler ResetUserSubscribeToken
put /subscribe_token (ResetUserSubscribeTokenRequest)
@doc "Get Login Log"
@handler GetLoginLog
get /login_log (GetLoginLogRequest) returns (GetLoginLogResponse)
@doc "Get Subscribe Log"
@handler GetSubscribeLog
get /subscribe_log (GetSubscribeLogRequest) returns (GetSubscribeLogResponse)
@doc "Verify Email"
@handler VerifyEmail
post /verify_email (VerifyEmailRequest)
@doc "Update Bind Mobile"
@handler UpdateBindMobile
put /bind_mobile (UpdateBindMobileRequest)
@doc "Update Bind Email"
@handler UpdateBindEmail
put /bind_email (UpdateBindEmailRequest)
}
+26
View File
@@ -0,0 +1,26 @@
syntax = "v1"
info(
title: "admin API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"./admin/system.api"
"./admin/user.api"
"./admin/server.api"
"./admin/subscribe.api"
"./admin/payment.api"
"./admin/coupon.api"
"./admin/order.api"
"./admin/ticket.api"
"./admin/announcement.api"
"./admin/document.api"
"./admin/tool.api"
"./admin/console.api"
"./admin/auth.api"
"./admin/log.api"
"./admin/ads.api"
)
+21
View File
@@ -0,0 +1,21 @@
syntax = "v1"
info(
title: "App API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"./app/auth.api"
"./app/user.api"
"./app/node.api"
"./app/ws.api"
"./app/order.api"
"./app/announcement.api"
"./app/payment.api"
"./app/document.api"
"./app/subscribe.api"
)
+14
View File
@@ -0,0 +1,14 @@
syntax = "v1"
info(
title: "common API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"./common.api"
"./auth/auth.api"
)
+11
View File
@@ -0,0 +1,11 @@
syntax = "v1"
info(
title: "Node API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import "./node/node.api"
+19
View File
@@ -0,0 +1,19 @@
syntax = "v1"
info(
title: "User API"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
import (
"./public/user.api"
"./public/subscribe.api"
"./public/order.api"
"./public/announcement.api"
"./public/ticket.api"
"./public/payment.api"
"./public/document.api"
"./public/portal.api"
)
+752
View File
@@ -0,0 +1,752 @@
syntax = "v1"
info (
title: "Interface Model"
desc: "API for ppanel"
author: "Tension"
email: "tension@ppanel.com"
version: "0.0.1"
)
type (
User {
Id int64 `json:"id"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
GiftAmount int64 `json:"gift_amount"`
Telegram int64 `json:"telegram"`
ReferCode string `json:"refer_code"`
RefererId int64 `json:"referer_id"`
Enable bool `json:"enable"`
IsAdmin bool `json:"is_admin,omitempty"`
EnableBalanceNotify bool `json:"enable_balance_notify"`
EnableLoginNotify bool `json:"enable_login_notify"`
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
EnableTradeNotify bool `json:"enable_trade_notify"`
AuthMethods []UserAuthMethod `json:"auth_methods"`
UserDevices []UserDevice `json:"user_devices"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
DeletedAt int64 `json:"deleted_at,omitempty"`
IsDel bool `json:"is_del,omitempty"`
}
Follow {
Id int64 `json:"id"`
TicketId int64 `json:"ticket_id"`
From string `json:"from"`
Type uint8 `json:"type"`
Content string `json:"content"`
CreatedAt int64 `json:"created_at"`
}
Ticket {
Id int64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
UserId int64 `json:"user_id"`
Follows []Follow `json:"follow,omitempty"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
SiteConfig {
Host string `json:"host"`
SiteName string `json:"site_name"`
SiteDesc string `json:"site_desc"`
SiteLogo string `json:"site_logo"`
Keywords string `json:"keywords"`
CustomHTML string `json:"custom_html"`
CustomData string `json:"custom_data"`
}
SubscribeConfig {
SingleModel bool `json:"single_model"`
SubscribePath string `json:"subscribe_path"`
SubscribeDomain string `json:"subscribe_domain"`
PanDomain bool `json:"pan_domain"`
}
VerifyCodeConfig {
VerifyCodeExpireTime int64 `json:"verify_code_expire_time"`
VerifyCodeLimit int64 `json:"verify_code_limit"`
VerifyCodeInterval int64 `json:"verify_code_interval"`
}
PubilcVerifyCodeConfig {
VerifyCodeInterval int64 `json:"verify_code_interval"`
}
SubscribeType {
SubscribeTypes []string `json:"subscribe_types"`
}
Application {
Id int64 `json:"id"`
Icon string `json:"icon"`
Name string `json:"name"`
Description string `json:"description"`
SubscribeType string `json:"subscribe_type"`
}
ApplicationVersion {
Id int64 `json:"id"`
Url string `json:"url"`
Version string `json:"version" validate:"required"`
Description string `json:"description"`
IsDefault bool `json:"is_default"`
}
ApplicationResponse {
Applications []ApplicationResponseInfo `json:"applications"`
}
ApplicationResponseInfo {
Id int64 `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"`
Description string `json:"description"`
SubscribeType string `json:"subscribe_type"`
Platform ApplicationPlatform `json:"platform"`
}
ApplicationPlatform {
IOS []*ApplicationVersion `json:"ios,omitempty"`
MacOS []*ApplicationVersion `json:"macos,omitempty"`
Linux []*ApplicationVersion `json:"linux,omitempty"`
Android []*ApplicationVersion `json:"android,omitempty"`
Windows []*ApplicationVersion `json:"windows,omitempty"`
Harmony []*ApplicationVersion `json:"harmony,omitempty"`
}
AuthConfig {
Mobile MobileAuthenticateConfig `json:"mobile"`
Email EmailAuthticateConfig `json:"email"`
Register PubilcRegisterConfig `json:"register"`
}
PubilcRegisterConfig {
StopRegister bool `json:"stop_register"`
EnableIpRegisterLimit bool `json:"enable_ip_register_limit"`
IpRegisterLimit int64 `json:"ip_register_limit"`
IpRegisterLimitDuration int64 `json:"ip_register_limit_duration"`
}
MobileAuthenticateConfig {
Enable bool `json:"enable"`
EnableWhitelist bool `json:"enable_whitelist"`
Whitelist []string `json:"whitelist"`
}
EmailAuthticateConfig {
Enable bool `json:"enable"`
EnableVerify bool `json:"enable_verify"`
EnableDomainSuffix bool `json:"enable_domain_suffix"`
DomainSuffixList string `json:"domain_suffix_list"`
}
RegisterConfig {
StopRegister bool `json:"stop_register"`
EnableTrial bool `json:"enable_trial"`
TrialSubscribe int64 `json:"trial_subscribe"`
TrialTime int64 `json:"trial_time"`
TrialTimeUnit string `json:"trial_time_unit"`
EnableIpRegisterLimit bool `json:"enable_ip_register_limit"`
IpRegisterLimit int64 `json:"ip_register_limit"`
IpRegisterLimitDuration int64 `json:"ip_register_limit_duration"`
}
VerifyConfig {
TurnstileSiteKey string `json:"turnstile_site_key"`
TurnstileSecret string `json:"turnstile_secret"`
EnableLoginVerify bool `json:"enable_login_verify"`
EnableRegisterVerify bool `json:"enable_register_verify"`
EnableResetPasswordVerify bool `json:"enable_reset_password_verify"`
}
NodeConfig {
NodeSecret string `json:"node_secret"`
NodePullInterval int64 `json:"node_pull_interval"`
NodePushInterval int64 `json:"node_push_interval"`
}
InviteConfig {
ForcedInvite bool `json:"forced_invite"`
ReferralPercentage int64 `json:"referral_percentage"`
OnlyFirstPurchase bool `json:"only_first_purchase"`
}
TelegramConfig {
TelegramBotToken string `json:"telegram_bot_token"`
TelegramGroupUrl string `json:"telegram_group_url"`
TelegramNotify bool `json:"telegram_notify"`
TelegramWebHookDomain string `json:"telegram_web_hook_domain"`
}
TosConfig {
TosContent string `json:"tos_content"`
}
PrivacyPolicyConfig {
PrivacyPolicy string `json:"privacy_policy"`
}
CurrencyConfig {
AccessKey string `json:"access_key"`
CurrencyUnit string `json:"currency_unit"`
CurrencySymbol string `json:"currency_symbol"`
}
SubscribeDiscount {
Quantity int64 `json:"quantity"`
Discount int64 `json:"discount"`
}
Subscribe {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
GroupId int64 `json:"group_id"`
ServerGroup []int64 `json:"server_group"`
Server []int64 `json:"server"`
Show bool `json:"show"`
Sell bool `json:"sell"`
Sort int64 `json:"sort"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset bool `json:"renewal_reset"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
SubscribeGroup {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Shadowsocks {
Method string `json:"method" validate:"required"`
Port int `json:"port" validate:"required"`
ServerKey string `json:"server_key"`
}
Vmess {
Port int `json:"port" validate:"required"`
Transport string `json:"transport" validate:"required"`
TransportConfig TransportConfig `json:"transport_config"`
Security string `json:"security" validate:"required"`
SecurityConfig SecurityConfig `json:"security_config"`
}
Vless {
Port int `json:"port" validate:"required"`
Flow string `json:"flow" validate:"required"`
Transport string `json:"transport" validate:"required"`
TransportConfig TransportConfig `json:"transport_config"`
Security string `json:"security" validate:"required"`
SecurityConfig SecurityConfig `json:"security_config"`
}
Trojan {
Port int `json:"port" validate:"required"`
Transport string `json:"transport" validate:"required"`
TransportConfig TransportConfig `json:"transport_config"`
Security string `json:"security" validate:"required"`
SecurityConfig SecurityConfig `json:"security_config"`
}
Hysteria2 {
Port int `json:"port" validate:"required"`
HopPorts string `json:"hop_ports" validate:"required"`
HopInterval int `json:"hop_interval" validate:"required"`
ObfsPassword string `json:"obfs_password" validate:"required"`
SecurityConfig SecurityConfig `json:"security_config"`
}
Tuic {
Port int `json:"port" validate:"required"`
SecurityConfig SecurityConfig `json:"security_config"`
}
SecurityConfig {
SNI string `json:"sni"`
AllowInsecure *bool `json:"allow_insecure"`
Fingerprint string `json:"fingerprint"`
RealityServerAddr string `json:"reality_server_addr"`
RealityServerPort int `json:"reality_server_port"`
RealityPrivateKey string `json:"reality_private_key"`
RealityPublicKey string `json:"reality_public_key"`
RealityShortId string `json:"reality_short_id"`
}
TransportConfig {
Path string `json:"path"`
Host string `json:"host"`
ServiceName string `json:"service_name"`
}
Server {
Id int64 `json:"id"`
Tags []string `json:"tags"`
Country string `json:"country"`
City string `json:"city"`
Name string `json:"name"`
ServerAddr string `json:"server_addr"`
RelayMode string `json:"relay_mode"`
RelayNode []NodeRelay `json:"relay_node"`
SpeedLimit int `json:"speed_limit"`
TrafficRatio float32 `json:"traffic_ratio"`
GroupId int64 `json:"group_id"`
Protocol string `json:"protocol"`
Config interface{} `json:"config"`
Enable *bool `json:"enable"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Status *NodeStatus `json:"status"`
Sort int64 `json:"sort"`
}
OnlineUser {
SID int64 `json:"uid"`
IP string `json:"ip"`
}
NodeStatus {
Online interface{} `json:"online"`
Cpu float64 `json:"cpu"`
Mem float64 `json:"mem"`
Disk float64 `json:"disk"`
UpdatedAt int64 `json:"updated_at"`
}
ServerGroup {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
PaymentMethod {
Id int64 `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"`
Description string `json:"description"`
Icon string `json:"icon"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent"`
FeeAmount int64 `json:"fee_amount"`
}
PaymentConfig {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config interface{} `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
PaymentMethodDetail {
Id int64 `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"`
Description string `json:"description"`
Icon string `json:"icon"`
Domain string `json:"domain"`
Config interface{} `json:"config"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent"`
FeeAmount int64 `json:"fee_amount"`
Enable bool `json:"enable"`
NotifyURL string `json:"notify_url"`
}
Order {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderNo string `json:"order_no"`
Type uint8 `json:"type"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
GiftAmount int64 `json:"gift_amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`
SubscribeId int64 `json:"subscribe_id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
OrderDetail {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderNo string `json:"order_no"`
Type uint8 `json:"type"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
GiftAmount int64 `json:"gift_amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
Method string `json:"method"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`
SubscribeId int64 `json:"subscribe_id"`
Subscribe Subscribe `json:"subscribe"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Document {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Tags []string `json:"tags"`
Show bool `json:"show"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Coupon {
Id int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Count int64 `json:"count"`
Type uint8 `json:"type"`
Discount int64 `json:"discount"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
UserLimit int64 `json:"user_limit"`
Subscribe []int64 `json:"subscribe"`
UsedCount int64 `json:"used_count"`
Enable bool `json:"enable"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Announcement {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Show *bool `json:"show"`
Pinned *bool `json:"pinned"`
Popup *bool `json:"popup"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
UserSubscribe {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderId int64 `json:"order_id"`
SubscribeId int64 `json:"subscribe_id"`
Subscribe Subscribe `json:"subscribe"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
FinishedAt int64 `json:"finished_at"`
ResetTime int64 `json:"reset_time"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Token string `json:"token"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
UserBalanceLog {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
Amount int64 `json:"amount"`
Type uint8 `json:"type"`
OrderId int64 `json:"order_id"`
Balance int64 `json:"balance"`
CreatedAt int64 `json:"created_at"`
}
UserAffiliate {
Avatar string `json:"avatar"`
Identifier string `json:"identifier"`
RegisteredAt int64 `json:"registered_at"`
Enable bool `json:"enable"`
}
SortItem {
Id int64 `json:"id" validate:"required"`
Sort int64 `json:"sort" validate:"required"`
}
TimePeriod {
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Multiplier float32 `json:"multiplier"`
}
NodeRelay {
Host string `json:"host"`
Port int `json:"port"`
Prefix string `json:"prefix"`
}
ApplicationConfig {
AppId int64 `json:"app_id"`
EncryptionKey string `json:"encryption_key"`
EncryptionMethod string `json:"encryption_method"`
Domains []string `json:"domains" validate:"required"`
StartupPicture string `json:"startup_picture"`
StartupPictureSkipTime int64 `json:"startup_picture_skip_time"`
}
UserDevice {
Id int64 `json:"id"`
Ip string `json:"ip"`
Identifier string `json:"identifier"`
UserAgent string `json:"user_agent"`
Online bool `json:"online"`
Enabled bool `json:"enabled"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
UserAuthMethod {
AuthType string `json:"auth_type"`
AuthIdentifier string `json:"auth_identifier"`
Verified bool `json:"verified"`
}
AuthMethodConfig {
Id int64 `json:"id"`
Method string `json:"method"`
Config interface{} `json:"config"`
Enabled bool `json:"enabled"`
}
TrafficLog {
Id int64 `json:"id"`
ServerId int64 `json:"server_id"`
UserId int64 `json:"user_id"`
SubscribeId int64 `json:"subscribe_id"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Timestamp int64 `json:"timestamp"`
}
ServerRuleGroup {
Id int64 `json:"id"`
Icon string `json:"icon"`
Name string `json:"name" validate:"required"`
Tags []string `json:"tags"`
Rules string `json:"rules"`
Enable bool `json:"enable"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
UserSubscribeLog {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
UserSubscribeId int64 `json:"user_subscribe_id"`
Token string `json:"token"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
CreatedAt int64 `json:"created_at"`
}
UserLoginLog {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
LoginIP string `json:"login_ip"`
UserAgent string `json:"user_agent"`
Success bool `json:"success"`
CreatedAt int64 `json:"created_at"`
}
MessageLog {
Id int64 `json:"id"`
Type string `json:"type"`
Platform string `json:"platform"`
To string `json:"to"`
Subject string `json:"subject"`
Content string `json:"content"`
Status int `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Ads {
Id int `json:"id"`
Title string `json:"title"`
Type string `json:"type"`
Content string `json:"content"`
Description string `json:"description"`
TargetURL string `json:"target_url"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Status int `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
//public order
PurchaseOrderRequest {
SubscribeId int64 `json:"subscribe_id"`
Quantity int64 `json:"quantity"`
Payment int64 `json:"payment,omitempty"`
Coupon string `json:"coupon,omitempty"`
}
PreOrderResponse {
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
GiftAmount int64 `json:"gift_amount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
FeeAmount int64 `json:"fee_amount"`
}
PurchaseOrderResponse {
OrderNo string `json:"order_no"`
}
RenewalOrderRequest {
UserSubscribeID int64 `json:"user_subscribe_id"`
Quantity int64 `json:"quantity"`
Payment int64 `json:"payment"`
Coupon string `json:"coupon,omitempty"`
}
RenewalOrderResponse {
OrderNo string `json:"order_no"`
}
ResetTrafficOrderRequest {
UserSubscribeID int64 `json:"user_subscribe_id"`
Payment int64 `json:"payment"`
}
ResetTrafficOrderResponse {
OrderNo string `json:"order_no"`
}
RechargeOrderRequest {
Amount int64 `json:"amount"`
Payment int64 `json:"payment"`
}
RechargeOrderResponse {
OrderNo string `json:"order_no"`
}
PreRenewalOrderResponse {
OrderNo string `json:"orderNo"`
}
CloseOrderRequest {
OrderNo string `json:"orderNo" validate:"required"`
}
QueryOrderDetailRequest {
OrderNo string `form:"order_no" validate:"required"`
}
StripePayment {
Method string `json:"method"`
ClientSecret string `json:"client_secret"`
PublishableKey string `json:"publishable_key"`
}
QueryOrderListRequest {
Page int `form:"page" validate:"required"`
Size int `form:"size" validate:"required"`
}
QueryOrderListResponse {
Total int64 `json:"total"`
List []OrderDetail `json:"list"`
}
//public document
QueryDocumentListResponse {
Total int64 `json:"total"`
List []Document `json:"list"`
}
QueryDocumentDetailRequest {
Id int64 `form:"id" validate:"required"`
}
// public payment
GetAvailablePaymentMethodsResponse {
List []PaymentMethod `json:"list"`
}
// public announcement
QueryAnnouncementRequest {
Page int `form:"page"`
Size int `form:"size"`
Pinned *bool `form:"pinned"`
Popup *bool `form:"popup"`
}
QueryAnnouncementResponse {
Total int64 `json:"total"`
List []Announcement `json:"announcements"`
}
//subscribe
QuerySubscribeListResponse {
List []Subscribe `json:"list"`
Total int64 `json:"total"`
}
QuerySubscribeGroupListResponse {
List []SubscribeGroup `json:"list"`
Total int64 `json:"total"`
}
GetUserSubscribeTrafficLogsRequest {
Page int `form:"page"`
Size int `form:"size"`
UserId int64 `form:"user_id"`
SubscribeId int64 `form:"subscribe_id"`
StartTime int64 `form:"start_time"`
EndTime int64 `form:"end_time"`
}
GetUserSubscribeTrafficLogsResponse {
List []TrafficLog `json:"list"`
Total int64 `json:"total"`
}
QueryUserAffiliateListResponse {
List []UserAffiliate `json:"list"`
Total int64 `json:"total"`
}
PlatformResponse {
List []PlatformInfo `json:"list"`
}
PlatformInfo {
Platform string `json:"platform"`
PlatformUrl string `json:"platform_url"`
PlatformFieldDescription map[string]string `json:"platform_field_description"`
}
AlipayNotifyResponse {
ReturnCode string `json:"return_code"`
}
EPayNotifyRequest {
Pid int64 `json:"pid" form:"pid"`
TradeNo string `json:"trade_no" form:"trade_no"`
OutTradeNo string `json:"out_trade_no" form:"out_trade_no"`
Type string `json:"type" form:"type"`
Name string `json:"name" form:"name"`
Money string `json:"money" form:"money"`
TradeStatus string `json:"trade_status" form:"trade_status"`
Param string `json:"param" form:"param"`
Sign string `json:"sign" form:"sign"`
SignType string `json:"sign_type" form:"sign_type"`
}
QueryUserAffiliateListRequest {
Page int `form:"page"`
Size int `form:"size"`
}
CheckoutOrderRequest {
OrderNo string `json:"orderNo"`
ReturnUrl string `json:"returnUrl,omitempty"`
}
CheckoutOrderResponse {
Type string `json:"type"`
CheckoutUrl string `json:"checkout_url,omitempty"`
Stripe *StripePayment `json:"stripe,omitempty"`
}
SiteCustomDataContacts {
Email string `json:"email"`
Telephone string `json:"telephone"`
Address string `json:"address"`
}
QueryUserAffiliateCountResponse {
Registers int64 `json:"registers"`
TotalCommission int64 `json:"total_commission"`
}
AppUserSubcbribe{
Id int64 `json:"id"`
Name string `json:"name"`
Upload int64 `json:"upload"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
DeviceLimit int64 `json:"device_limit"`
StartTime string `json:"start_time"`
ExpireTime string `json:"expire_time"`
List []AppUserSubscbribeNode `json:"list"`
}
AppUserSubscbribeNode{
Id int64 `json:"id"`
Name string `json:"name"`
Uuid string `json:"uuid"`
Protocol string `json:"protocol"`
RelayMode string `json:"relay_mode"`
RelayNode string `json:"relay_node"`
ServerAddr string `json:"server_addr"`
SpeedLimit int `json:"speed_limit"`
Tags []string `json:"tags"`
Traffic int64 `json:"traffic"`
TrafficRatio float64 `json:"traffic_ratio"`
Upload int64 `json:"upload"`
Config string `json:"config"`
Country string `json:"country"`
City string `json:"city"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
LatitudeCountry string `json:"latitudeCountry"`
LongitudeCountry string `json:"longitudeCountry"`
CreatedAt int64 `json:"created_at"`
Download int64 `json:"download"`
}
)