291 lines
8.1 KiB
Plaintext
291 lines
8.1 KiB
Plaintext
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 []BalanceLog `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
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"`
|
|
}
|
|
BindEmailWithVerificationRequest {
|
|
Email string `json:"email" validate:"required"`
|
|
Code string `json:"code" validate:"required"`
|
|
}
|
|
BindEmailWithVerificationResponse {
|
|
Success bool `json:"success"`
|
|
Message string `json:"message,omitempty"`
|
|
Token string `json:"token,omitempty"` // 设备关联后的新Token
|
|
UserId int64 `json:"user_id,omitempty"` // 目标用户ID
|
|
}
|
|
GetDeviceListResponse {
|
|
List []UserDevice `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
UnbindDeviceRequest {
|
|
Id int64 `json:"id" validate:"required"`
|
|
}
|
|
GetSubscribeStatusResponse {
|
|
DeviceStatus bool `json:"device_status"`
|
|
EmailStatus bool `json:"email_status"`
|
|
}
|
|
// GetAgentRealtimeRequest - 获取代理链接实时数据
|
|
GetAgentRealtimeRequest {}
|
|
// GetAgentRealtimeResponse - 代理链接实时数据响应
|
|
GetAgentRealtimeResponse {
|
|
Total int64 `json:"total"` // 访问总人数
|
|
Clicks int64 `json:"clicks"` // 点击量
|
|
Views int64 `json:"views"` // 浏览量
|
|
PaidCount int64 `json:"paid_count"` // 付费数量
|
|
}
|
|
// GetUserInviteStatsRequest - 获取用户邀请统计
|
|
GetUserInviteStatsRequest {}
|
|
// GetUserInviteStatsResponse - 用户邀请统计响应
|
|
GetUserInviteStatsResponse {
|
|
FriendlyCount int64 `json:"friendly_count"` // 有效邀请数(有订单的用户)
|
|
HistoryCount int64 `json:"history_count"` // 历史邀请总数
|
|
}
|
|
// GetInviteSalesRequest - 获取最近销售数据
|
|
GetInviteSalesRequest {
|
|
Page int `form:"page" validate:"required"`
|
|
Size int `form:"size" validate:"required"`
|
|
}
|
|
// GetInviteSalesResponse - 最近销售数据响应
|
|
GetInviteSalesResponse {
|
|
Total int64 `json:"total"` // 销售记录总数
|
|
List []InvitedUserSale `json:"list"` // 销售数据列表(分页)
|
|
}
|
|
// InvitedUserSale - 被邀请用户的销售记录
|
|
InvitedUserSale {
|
|
Amount int64 `json:"amount"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UserEmail string `json:"user_email"`
|
|
UserId int64 `json:"user_id"`
|
|
}
|
|
// GetAgentDownloadsRequest - 获取各端下载量
|
|
GetAgentDownloadsRequest {}
|
|
// GetAgentDownloadsResponse - 各端下载量响应
|
|
GetAgentDownloadsResponse {
|
|
List []AgentDownloadStats `json:"list"`
|
|
}
|
|
// AgentDownloadStats - 各端下载量统计
|
|
AgentDownloadStats {
|
|
Platform string `json:"platform"`
|
|
Clicks int64 `json:"clicks"`
|
|
Visits int64 `json:"visits"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: v1/public/user
|
|
group: public/user
|
|
middleware: AuthMiddleware,DeviceMiddleware
|
|
)
|
|
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 "Get Subscribe Status (device/email)"
|
|
@handler GetSubscribeStatus
|
|
get /subscribe_status returns (GetSubscribeStatusResponse)
|
|
|
|
@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)
|
|
|
|
@doc "Get Device List"
|
|
@handler GetDeviceList
|
|
get /devices returns (GetDeviceListResponse)
|
|
|
|
@doc "Unbind Device"
|
|
@handler UnbindDevice
|
|
put /unbind_device (UnbindDeviceRequest)
|
|
|
|
@doc "Get agent realtime data"
|
|
@handler GetAgentRealtime
|
|
get /agent/realtime (GetAgentRealtimeRequest) returns (GetAgentRealtimeResponse)
|
|
|
|
@doc "Get user invite statistics"
|
|
@handler GetUserInviteStats
|
|
get /invite/stats (GetUserInviteStatsRequest) returns (GetUserInviteStatsResponse)
|
|
|
|
@doc "Get invite sales data"
|
|
@handler GetInviteSales
|
|
get /invite/sales (GetInviteSalesRequest) returns (GetInviteSalesResponse)
|
|
|
|
@doc "Get agent downloads data"
|
|
@handler GetAgentDownloads
|
|
get /agent/downloads (GetAgentDownloadsRequest) returns (GetAgentDownloadsResponse)
|
|
}
|
|
|