- Node group CRUD operations with traffic-based filtering - Three grouping modes: average distribution, subscription-based, and traffic-based - Automatic and manual group recalculation with history tracking - Group assignment preview before applying changes - User subscription group locking to prevent automatic reassignment - Subscribe-to-group mapping configuration - Group calculation history and detailed reports - System configuration for group management (enabled/mode/auto_create) Database: - Add node_group table for group definitions - Add group_history and group_history_detail tables for tracking - Add node_group_ids (JSON) to nodes and subscribe tables - Add node_group_id and group_locked fields to user_subscribe table - Add migration files for schema changes
73 lines
2.4 KiB
Plaintext
73 lines
2.4 KiB
Plaintext
syntax = "v1"
|
|
|
|
info (
|
|
title: "Subscribe API"
|
|
desc: "API for ppanel"
|
|
author: "Tension"
|
|
email: "tension@ppanel.com"
|
|
version: "0.0.1"
|
|
)
|
|
|
|
import "../types.api"
|
|
|
|
type (
|
|
QuerySubscribeListRequest {
|
|
Language string `form:"language"`
|
|
}
|
|
QueryUserSubscribeNodeListResponse {
|
|
List []UserSubscribeInfo `json:"list"`
|
|
}
|
|
UserSubscribeInfo {
|
|
Id int64 `json:"id"`
|
|
UserId int64 `json:"user_id"`
|
|
OrderId int64 `json:"order_id"`
|
|
SubscribeId int64 `json:"subscribe_id"`
|
|
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"`
|
|
IsTryOut bool `json:"is_try_out"`
|
|
Nodes []*UserSubscribeNodeInfo `json:"nodes"`
|
|
}
|
|
UserSubscribeNodeInfo {
|
|
Id int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Uuid string `json:"uuid"`
|
|
Protocol string `json:"protocol"`
|
|
Protocols string `json:"protocols"`
|
|
Port uint16 `json:"port"`
|
|
Address string `json:"address"`
|
|
Tags []string `json:"tags"`
|
|
Country string `json:"country"`
|
|
City string `json:"city"`
|
|
Longitude string `json:"longitude"`
|
|
Latitude string `json:"latitude"`
|
|
LatitudeCenter string `json:"latitude_center"`
|
|
LongitudeCenter string `json:"longitude_center"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: v1/public/subscribe
|
|
group: public/subscribe
|
|
middleware: AuthMiddleware,DeviceMiddleware
|
|
)
|
|
service ppanel {
|
|
@doc "Get subscribe list"
|
|
@handler QuerySubscribeList
|
|
get /list (QuerySubscribeListRequest) returns (QuerySubscribeListResponse)
|
|
|
|
@doc "Get user subscribe node info"
|
|
@handler QueryUserSubscribeNodeList
|
|
get /node/list returns (QueryUserSubscribeNodeListResponse)
|
|
}
|
|
|