262 lines
7.7 KiB
Plaintext
262 lines
7.7 KiB
Plaintext
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 uint8 `form:"type"`
|
|
Search string `form:"search,optional"`
|
|
}
|
|
GetMessageLogListResponse {
|
|
Total int64 `json:"total"`
|
|
List []MessageLog `json:"list"`
|
|
}
|
|
FilterLogParams {
|
|
Page int `form:"page"`
|
|
Size int `form:"size"`
|
|
Date string `form:"date,optional"`
|
|
Search string `form:"search,optional"`
|
|
}
|
|
FilterEmailLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []MessageLog `json:"list"`
|
|
}
|
|
FilterMobileLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []MessageLog `json:"list"`
|
|
}
|
|
SubscribeLog {
|
|
UserId int64 `json:"user_id"`
|
|
Token string `json:"token"`
|
|
UserAgent string `json:"user_agent"`
|
|
ClientIP string `json:"client_ip"`
|
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
}
|
|
FilterSubscribeLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
UserSubscribeId int64 `form:"user_subscribe_id,optional"`
|
|
}
|
|
FilterSubscribeLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []SubscribeLog `json:"list"`
|
|
}
|
|
LoginLog {
|
|
UserId int64 `json:"user_id"`
|
|
Method string `json:"method"`
|
|
LoginIP string `json:"login_ip"`
|
|
UserAgent string `json:"user_agent"`
|
|
Success bool `json:"success"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
}
|
|
FilterLoginLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterLoginLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []LoginLog `json:"list"`
|
|
}
|
|
RegisterLog {
|
|
UserId int64 `json:"user_id"`
|
|
AuthMethod string `json:"auth_method"`
|
|
Identifier string `json:"identifier"`
|
|
RegisterIP string `json:"register_ip"`
|
|
UserAgent string `json:"user_agent"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
}
|
|
FilterRegisterLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterRegisterLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []RegisterLog `json:"list"`
|
|
}
|
|
ResetSubscribeLog {
|
|
Type uint16 `json:"type"`
|
|
UserId int64 `json:"user_id"`
|
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
|
OrderNo string `json:"order_no,omitempty"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
}
|
|
FilterResetSubscribeLogRequest {
|
|
FilterLogParams
|
|
UserSubscribeId int64 `form:"user_subscribe_id,optional"`
|
|
}
|
|
FilterResetSubscribeLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []ResetSubscribeLog `json:"list"`
|
|
}
|
|
UserSubscribeTrafficLog {
|
|
SubscribeId int64 `json:"subscribe_id"` // Subscribe ID
|
|
UserId int64 `json:"user_id"` // User ID
|
|
Upload int64 `json:"upload"` // Upload traffic in bytes
|
|
Download int64 `json:"download"` // Download traffic in bytes
|
|
Total int64 `json:"total"` // Total traffic in bytes (Upload + Download)
|
|
Date string `json:"date"` // Date in YYYY-MM-DD format
|
|
Details bool `json:"details"` // Whether to show detailed traffic
|
|
}
|
|
FilterSubscribeTrafficRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
UserSubscribeId int64 `form:"user_subscribe_id,optional"`
|
|
}
|
|
FilterSubscribeTrafficResponse {
|
|
Total int64 `json:"total"`
|
|
List []UserSubscribeTrafficLog `json:"list"`
|
|
}
|
|
ServerTrafficLog {
|
|
ServerId int64 `json:"server_id"` // Server ID
|
|
Upload int64 `json:"upload"` // Upload traffic in bytes
|
|
Download int64 `json:"download"` // Download traffic in bytes
|
|
Total int64 `json:"total"` // Total traffic in bytes (Upload + Download)
|
|
Date string `json:"date"` // Date in YYYY-MM-DD format
|
|
Details bool `json:"details"` // Whether to show detailed traffic
|
|
}
|
|
FilterServerTrafficLogRequest {
|
|
FilterLogParams
|
|
ServerId int64 `form:"server_id,optional"`
|
|
}
|
|
FilterServerTrafficLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []ServerTrafficLog `json:"list"`
|
|
}
|
|
FilterBalanceLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterBalanceLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []BalanceLog `json:"list"`
|
|
}
|
|
FilterCommissionLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterCommissionLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []CommissionLog `json:"list"`
|
|
}
|
|
GiftLog {
|
|
Type uint16 `json:"type"`
|
|
userId int64 `json:"user_id"`
|
|
OrderNo string `json:"order_no"`
|
|
SubscribeId int64 `json:"subscribe_id"`
|
|
Amount int64 `json:"amount"`
|
|
Balance int64 `json:"balance"`
|
|
Remark string `json:"remark,omitempty"`
|
|
Timestamp int64 `json:"timestamp"`
|
|
}
|
|
FilterGiftLogRequest {
|
|
FilterLogParams
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterGiftLogResponse {
|
|
Total int64 `json:"total"`
|
|
List []GiftLog `json:"list"`
|
|
}
|
|
TrafficLogDetails {
|
|
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"`
|
|
}
|
|
FilterTrafficLogDetailsRequest {
|
|
FilterLogParams
|
|
ServerId int64 `form:"server_id,optional"`
|
|
SubscribeId int64 `form:"subscribe_id,optional"`
|
|
UserId int64 `form:"user_id,optional"`
|
|
}
|
|
FilterTrafficLogDetailsResponse {
|
|
Total int64 `json:"total"`
|
|
List []TrafficLogDetails `json:"list"`
|
|
}
|
|
LogSetting {
|
|
AutoClear *bool `json:"auto_clear"`
|
|
ClearDays int64 `json:"clear_days"`
|
|
}
|
|
)
|
|
|
|
@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)
|
|
|
|
@doc "Filter email log"
|
|
@handler FilterEmailLog
|
|
get /email/list (FilterLogParams) returns (FilterEmailLogResponse)
|
|
|
|
@doc "Filter mobile log"
|
|
@handler FilterMobileLog
|
|
get /mobile/list (FilterLogParams) returns (FilterMobileLogResponse)
|
|
|
|
@doc "Filter subscribe log"
|
|
@handler FilterSubscribeLog
|
|
get /subscribe/list (FilterSubscribeLogRequest) returns (FilterSubscribeLogResponse)
|
|
|
|
@doc "Filter login log"
|
|
@handler FilterLoginLog
|
|
get /login/list (FilterLoginLogRequest) returns (FilterLoginLogResponse)
|
|
|
|
@doc "Filter register log"
|
|
@handler FilterRegisterLog
|
|
get /register/list (FilterRegisterLogRequest) returns (FilterRegisterLogResponse)
|
|
|
|
@doc "Filter reset subscribe log"
|
|
@handler FilterResetSubscribeLog
|
|
get /subscribe/reset/list (FilterResetSubscribeLogRequest) returns (FilterResetSubscribeLogResponse)
|
|
|
|
@doc "Filter user subscribe traffic log"
|
|
@handler FilterUserSubscribeTrafficLog
|
|
get /subscribe/traffic/list (FilterSubscribeTrafficRequest) returns (FilterSubscribeTrafficResponse)
|
|
|
|
@doc "Filter server traffic log"
|
|
@handler FilterServerTrafficLog
|
|
get /server/traffic/list (FilterServerTrafficLogRequest) returns (FilterServerTrafficLogResponse)
|
|
|
|
@doc "Filter balance log"
|
|
@handler FilterBalanceLog
|
|
get /balance/list (FilterBalanceLogRequest) returns (FilterBalanceLogResponse)
|
|
|
|
@doc "Filter commission log"
|
|
@handler FilterCommissionLog
|
|
get /commission/list (FilterCommissionLogRequest) returns (FilterCommissionLogResponse)
|
|
|
|
@doc "Filter gift log"
|
|
@handler FilterGiftLog
|
|
get /gift/list (FilterGiftLogRequest) returns (FilterGiftLogResponse)
|
|
|
|
@doc "Filter traffic log details"
|
|
@handler FilterTrafficLogDetails
|
|
get /traffic/details (FilterTrafficLogDetailsRequest) returns (FilterTrafficLogDetailsResponse)
|
|
|
|
@doc "Get log setting"
|
|
@handler GetLogSetting
|
|
get /setting returns (LogSetting)
|
|
|
|
@doc "Update log setting"
|
|
@handler UpdateLogSetting
|
|
post /setting (LogSetting)
|
|
}
|
|
|