修复(#105): 消除 goctl 重新生成漂移
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "invite admin API"
|
||||
desc: "API for ppanel"
|
||||
author: "Tension"
|
||||
email: "tension@ppanel.com"
|
||||
version: "0.0.1"
|
||||
)
|
||||
|
||||
type (
|
||||
GetInviteManageListRequest {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Search string `form:"search"`
|
||||
InviterId int64 `form:"inviter_id"`
|
||||
InviteeId int64 `form:"invitee_id"`
|
||||
}
|
||||
InviteManageRecord {
|
||||
InviterId int64 `json:"inviter_id"`
|
||||
InviterIdentifier string `json:"inviter_identifier"`
|
||||
InviteeId int64 `json:"invitee_id"`
|
||||
InviteeIdentifier string `json:"invitee_identifier"`
|
||||
InviteeAvatar string `json:"invitee_avatar"`
|
||||
InviteeEnable bool `json:"invitee_enable"`
|
||||
InvitedAt int64 `json:"invited_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
GetInviteManageListResponse {
|
||||
Total int64 `json:"total"`
|
||||
List []InviteManageRecord `json:"list"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: v1/admin/invite
|
||||
group: admin/invite
|
||||
middleware: AuthMiddleware
|
||||
)
|
||||
service ppanel {
|
||||
@doc "Get invite manage list"
|
||||
@handler GetInviteManageList
|
||||
get /list (GetInviteManageListRequest) returns (GetInviteManageListResponse)
|
||||
}
|
||||
@@ -46,6 +46,7 @@ type (
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly *bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
NodeGroupIds []int64 `json:"node_group_ids,omitempty"`
|
||||
@@ -74,6 +75,7 @@ type (
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly *bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
NodeGroupIds []int64 `json:"node_group_ids,omitempty"`
|
||||
@@ -175,4 +177,3 @@ service ppanel {
|
||||
@handler ResetAllSubscribeToken
|
||||
post /reset_all_token returns (ResetAllSubscribeTokenResponse)
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,12 @@ type (
|
||||
SubscribeId *int64 `form:"subscribe_id,omitempty"`
|
||||
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
|
||||
ShortCode string `form:"short_code,omitempty"`
|
||||
DeviceId *int64 `form:"device_id,omitempty"`
|
||||
FamilyJoined *bool `form:"family_joined,omitempty"`
|
||||
FamilyStatus string `form:"family_status,omitempty"`
|
||||
FamilyOwnerUserId *int64 `form:"family_owner_user_id,omitempty"`
|
||||
FamilyId *int64 `form:"family_id,omitempty"`
|
||||
SortOrder string `form:"sort_order,omitempty"`
|
||||
}
|
||||
// GetUserListResponse
|
||||
GetUserListResponse {
|
||||
@@ -134,6 +136,40 @@ type (
|
||||
List []UserDevice `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
GetAdminUserInviteStatsRequest {
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
}
|
||||
GetAdminUserInviteStatsResponse {
|
||||
InviteCount int64 `json:"invite_count"`
|
||||
TotalCommission int64 `json:"total_commission"`
|
||||
CurrentCommission int64 `json:"current_commission"`
|
||||
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||
}
|
||||
GetAdminUserInviteListRequest {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
Search string `form:"search,omitempty"`
|
||||
Enable *bool `form:"enable,omitempty"`
|
||||
UserIdSearch int64 `form:"user_id_search,omitempty"`
|
||||
}
|
||||
AdminInvitedUser {
|
||||
Id int64 `json:"id"`
|
||||
Avatar string `json:"avatar"`
|
||||
Identifier string `json:"identifier"`
|
||||
Enable bool `json:"enable"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
GetAdminUserInviteListResponse {
|
||||
Total int64 `json:"total"`
|
||||
List []AdminInvitedUser `json:"list"`
|
||||
}
|
||||
CreateUserSubscribeRequest {
|
||||
UserId int64 `json:"user_id"`
|
||||
ExpiredAt int64 `json:"expired_at"`
|
||||
@@ -318,6 +354,14 @@ service ppanel {
|
||||
@handler GetUserSubscribeTrafficLogs
|
||||
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
|
||||
|
||||
@doc "Get admin user invite stats"
|
||||
@handler GetAdminUserInviteStats
|
||||
get /invite/stats (GetAdminUserInviteStatsRequest) returns (GetAdminUserInviteStatsResponse)
|
||||
|
||||
@doc "Get admin user invite list"
|
||||
@handler GetAdminUserInviteList
|
||||
get /invite/list (GetAdminUserInviteListRequest) returns (GetAdminUserInviteListResponse)
|
||||
|
||||
@doc "Get user subcribe devices"
|
||||
@handler GetUserSubscribeDevices
|
||||
get /subscribe/device (GetUserSubscribeDevicesRequest) returns (GetUserSubscribeDevicesResponse)
|
||||
|
||||
+2
-3
@@ -111,7 +111,7 @@ type (
|
||||
|
||||
@server (
|
||||
prefix: v1/server
|
||||
group: server
|
||||
group: node/server
|
||||
middleware: ServerMiddleware
|
||||
)
|
||||
service ppanel {
|
||||
@@ -138,11 +138,10 @@ service ppanel {
|
||||
|
||||
@server (
|
||||
prefix: v2/server
|
||||
group: server
|
||||
group: node/server
|
||||
)
|
||||
service ppanel {
|
||||
@doc "Get Server Protocol Config"
|
||||
@handler QueryServerProtocolConfig
|
||||
get /:server_id (QueryServerConfigRequest) returns (QueryServerConfigResponse)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -30,8 +30,9 @@ import (
|
||||
"admin/ads.api"
|
||||
"admin/marketing.api"
|
||||
"admin/application.api"
|
||||
"admin/group.api"
|
||||
"admin/promo.api"
|
||||
"admin/invite.api"
|
||||
"admin/group.api"
|
||||
"public/user.api"
|
||||
"public/subscribe.api"
|
||||
"public/redemption.api"
|
||||
|
||||
@@ -162,9 +162,11 @@ type (
|
||||
RegisterConfig {
|
||||
StopRegister bool `json:"stop_register"`
|
||||
EnableTrial bool `json:"enable_trial"`
|
||||
EnableTrialEmailWhitelist bool `json:"enable_trial_email_whitelist"`
|
||||
TrialSubscribe int64 `json:"trial_subscribe"`
|
||||
TrialTime int64 `json:"trial_time"`
|
||||
TrialTimeUnit string `json:"trial_time_unit"`
|
||||
TrialEmailDomainWhitelist string `json:"trial_email_domain_whitelist"`
|
||||
EnableIpRegisterLimit bool `json:"enable_ip_register_limit"`
|
||||
IpRegisterLimit int64 `json:"ip_register_limit"`
|
||||
IpRegisterLimitDuration int64 `json:"ip_register_limit_duration"`
|
||||
@@ -228,6 +230,7 @@ type (
|
||||
SubscribeDiscount {
|
||||
Quantity int64 `json:"quantity"`
|
||||
Discount float64 `json:"discount"`
|
||||
NewUserOnly bool `json:"new_user_only"`
|
||||
MapApple string `json:"map_apple"`
|
||||
Promo *SubscribePromo `json:"promo"`
|
||||
}
|
||||
@@ -293,6 +296,7 @@ type (
|
||||
SpeedLimit int64 `json:"speed_limit"`
|
||||
DeviceLimit int64 `json:"device_limit"`
|
||||
Quota int64 `json:"quota"`
|
||||
NewUserOnly bool `json:"new_user_only"`
|
||||
Nodes []int64 `json:"nodes"`
|
||||
NodeTags []string `json:"node_tags"`
|
||||
NodeGroupIds []int64 `json:"node_group_ids,omitempty"`
|
||||
@@ -462,6 +466,8 @@ type (
|
||||
Amount int64 `json:"amount"`
|
||||
GiftAmount int64 `json:"gift_amount"`
|
||||
Discount int64 `json:"discount"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
PromoDiscount int64 `json:"promo_discount"`
|
||||
Coupon string `json:"coupon"`
|
||||
CouponDiscount int64 `json:"coupon_discount"`
|
||||
Commission int64 `json:"commission,omitempty"`
|
||||
@@ -484,6 +490,8 @@ type (
|
||||
Amount int64 `json:"amount"`
|
||||
GiftAmount int64 `json:"gift_amount"`
|
||||
Discount int64 `json:"discount"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
PromoDiscount int64 `json:"promo_discount"`
|
||||
Coupon string `json:"coupon"`
|
||||
CouponDiscount int64 `json:"coupon_discount"`
|
||||
Commission int64 `json:"commission,omitempty"`
|
||||
@@ -557,10 +565,13 @@ type (
|
||||
}
|
||||
UserSubscribe {
|
||||
Id int64 `json:"id"`
|
||||
IdStr string `json:"id_str"`
|
||||
UserId int64 `json:"user_id"`
|
||||
OrderId int64 `json:"order_id"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
Subscribe Subscribe `json:"subscribe"`
|
||||
NodeGroupId int64 `json:"node_group_id"`
|
||||
NodeGroupName string `json:"node_group_name"`
|
||||
StartTime int64 `json:"start_time"`
|
||||
ExpireTime int64 `json:"expire_time"`
|
||||
FinishedAt int64 `json:"finished_at"`
|
||||
@@ -908,6 +919,7 @@ type (
|
||||
AttachAppleTransactionResponse {
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
Tier string `json:"tier"`
|
||||
ExistingOrderNo string `json:"existing_order_no,omitempty"`
|
||||
}
|
||||
RestoreAppleTransactionsRequest {
|
||||
Transactions []string `json:"transactions" validate:"required"`
|
||||
|
||||
@@ -2,6 +2,8 @@ module github.com/perfect-panel/server
|
||||
|
||||
go 1.24
|
||||
|
||||
replace github.com/zeromicro/go-zero => ./internal/gozero
|
||||
|
||||
require (
|
||||
github.com/GUAIK-ORG/go-snowflake v0.0.0-20200116064823-220c4260e85f
|
||||
github.com/alibabacloud-go/darabonba-openapi v0.1.18
|
||||
@@ -33,6 +35,7 @@ require (
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/stripe/stripe-go/v81 v81.1.0
|
||||
github.com/twilio/twilio-go v1.23.11
|
||||
github.com/zeromicro/go-zero v0.0.0
|
||||
go.opentelemetry.io/otel v1.29.0
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package logx
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Logger interface {
|
||||
Error(...any)
|
||||
Errorf(string, ...any)
|
||||
Info(...any)
|
||||
Infof(string, ...any)
|
||||
}
|
||||
|
||||
type logger struct{}
|
||||
|
||||
func WithContext(context.Context) Logger {
|
||||
return logger{}
|
||||
}
|
||||
|
||||
func (logger) Error(v ...any) {
|
||||
log.Print(v...)
|
||||
}
|
||||
|
||||
func (logger) Errorf(format string, v ...any) {
|
||||
log.Printf(format, v...)
|
||||
}
|
||||
|
||||
func (logger) Info(v ...any) {
|
||||
log.Print(v...)
|
||||
}
|
||||
|
||||
func (logger) Infof(format string, v ...any) {
|
||||
log.Printf(format, v...)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
module github.com/zeromicro/go-zero
|
||||
|
||||
go 1.24
|
||||
|
||||
require github.com/gin-gonic/gin v1.10.0
|
||||
@@ -0,0 +1,27 @@
|
||||
package httpx
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Parse(r *http.Request, v any) error {
|
||||
if r.Body == nil {
|
||||
return nil
|
||||
}
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
if err := decoder.Decode(v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ErrorCtx(_ context.Context, w http.ResponseWriter, err error) {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
|
||||
func OkJsonCtx(_ context.Context, w http.ResponseWriter, v any) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
_ = json.NewEncoder(w).Encode(v)
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package rest
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Middleware = gin.HandlerFunc
|
||||
|
||||
type Route struct {
|
||||
Method string
|
||||
Path string
|
||||
Handler gin.HandlerFunc
|
||||
Middlewares []Middleware
|
||||
}
|
||||
|
||||
type RouteOption func(*routeOptions)
|
||||
|
||||
type routeOptions struct {
|
||||
prefix string
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
router *gin.Engine
|
||||
optionalAuth Middleware
|
||||
}
|
||||
|
||||
type ServerOption func(*Server)
|
||||
|
||||
func NewServer(router *gin.Engine, opts ...ServerOption) *Server {
|
||||
server := &Server{router: router}
|
||||
for _, opt := range opts {
|
||||
opt(server)
|
||||
}
|
||||
return server
|
||||
}
|
||||
|
||||
func WithOptionalAuth(middleware Middleware) ServerOption {
|
||||
return func(server *Server) {
|
||||
server.optionalAuth = middleware
|
||||
}
|
||||
}
|
||||
|
||||
func WithMiddlewares(middlewares []Middleware, routes ...Route) []Route {
|
||||
for i := range routes {
|
||||
routes[i].Middlewares = append(routes[i].Middlewares, middlewares...)
|
||||
}
|
||||
return routes
|
||||
}
|
||||
|
||||
func WithPrefix(prefix string) RouteOption {
|
||||
return func(opts *routeOptions) {
|
||||
opts.prefix = prefix
|
||||
}
|
||||
}
|
||||
|
||||
func WithJwt(_ string) RouteOption {
|
||||
return func(_ *routeOptions) {}
|
||||
}
|
||||
|
||||
func (server *Server) AddRoutes(routes []Route, opts ...RouteOption) {
|
||||
options := routeOptions{}
|
||||
for _, opt := range opts {
|
||||
opt(&options)
|
||||
}
|
||||
|
||||
for _, route := range routes {
|
||||
handlers := append([]gin.HandlerFunc{}, route.Middlewares...)
|
||||
if server.optionalAuth != nil && options.prefix == "/v1/public/subscribe" && route.Path == "/list" && len(handlers) > 0 {
|
||||
handlers[0] = server.optionalAuth
|
||||
}
|
||||
handlers = append(handlers, route.Handler)
|
||||
server.router.Handle(route.Method, options.prefix+route.Path, handlers...)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
authHandler "github.com/perfect-panel/server/internal/handler/auth"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func CheckCodeLegacyHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return authHandler.CheckCodeLegacyV1Handler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
authHandler "github.com/perfect-panel/server/internal/handler/auth"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func CheckCodeLegacyV2Handler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return authHandler.CheckCodeLegacyV2Handler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func GetServerConfigHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.GetServerConfigHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func GetServerUserListHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.GetServerUserListHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func PushOnlineUsersHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.PushOnlineUsersHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func QueryServerProtocolConfigHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.QueryServerProtocolConfigHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func ServerPushStatusHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.ServerPushStatusHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
serverhandler "github.com/perfect-panel/server/internal/handler/server"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
)
|
||||
|
||||
func ServerPushUserTrafficHandler(svcCtx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return serverhandler.ServerPushUserTrafficHandler(svcCtx)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
+2065
-940
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1 @@
|
||||
package common
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package server
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
@@ -0,0 +1 @@
|
||||
package apple
|
||||
+6
-1
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/perfect-panel/server/internal/handler"
|
||||
"github.com/perfect-panel/server/internal/middleware"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
@@ -64,7 +65,11 @@ func initServer(svc *svc.ServiceContext) *gin.Engine {
|
||||
)
|
||||
|
||||
// register handlers
|
||||
handler.RegisterHandlers(r, svc)
|
||||
svc.AuthMiddleware = middleware.AuthMiddleware(svc)
|
||||
svc.OptionalAuthMiddleware = middleware.OptionalAuthMiddleware(svc)
|
||||
svc.DeviceMiddleware = middleware.DeviceMiddleware(svc)
|
||||
svc.ServerMiddleware = middleware.ServerMiddleware(svc)
|
||||
handler.RegisterHandlers(rest.NewServer(r, rest.WithOptionalAuth(svc.OptionalAuthMiddleware)), svc)
|
||||
r.StaticFile("/order-recovery.html", "./public/order-recovery.html")
|
||||
// register subscribe handler
|
||||
handler.RegisterSubscribeHandlers(r, svc)
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/perfect-panel/server/internal/model/client"
|
||||
"github.com/perfect-panel/server/internal/model/node"
|
||||
"github.com/perfect-panel/server/internal/model/redemption"
|
||||
@@ -76,6 +77,10 @@ type ServiceContext struct {
|
||||
NodeMultiplierManager *nodeMultiplier.Manager
|
||||
AuthLimiter *limit.PeriodLimit
|
||||
DeviceManager *device.DeviceManager
|
||||
AuthMiddleware gin.HandlerFunc
|
||||
OptionalAuthMiddleware gin.HandlerFunc
|
||||
DeviceMiddleware gin.HandlerFunc
|
||||
ServerMiddleware gin.HandlerFunc
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
||||
+264
-266
@@ -3,15 +3,21 @@
|
||||
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ActivateOrderRequest struct {
|
||||
OrderNo string `json:"order_no" validate:"required"`
|
||||
}
|
||||
|
||||
type RefundOrderRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
Reason string `json:"reason,omitempty" validate:"omitempty,max=500"`
|
||||
type AdminInvitedUser struct {
|
||||
Id int64 `json:"id"`
|
||||
Avatar string `json:"avatar"`
|
||||
Identifier string `json:"identifier"`
|
||||
Enable bool `json:"enable"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
|
||||
type Ads struct {
|
||||
@@ -126,6 +132,10 @@ type ApplicationVersion struct {
|
||||
IsDefault bool `json:"is_default"`
|
||||
}
|
||||
|
||||
type ApproveWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type AttachAppleTransactionByIdRequest struct {
|
||||
OrderNo string `json:"order_no" validate:"required"`
|
||||
TransactionId string `json:"transaction_id" validate:"required"`
|
||||
@@ -251,6 +261,10 @@ type BindTelegramResponse struct {
|
||||
ExpiredAt int64 `json:"expired_at"`
|
||||
}
|
||||
|
||||
type CancelWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type CheckUserRequest struct {
|
||||
Email string `form:"email" validate:"required"`
|
||||
}
|
||||
@@ -316,45 +330,6 @@ type ContactRequest struct {
|
||||
Notes string `json:"notes" validate:"max=2000"`
|
||||
}
|
||||
|
||||
type PromoPrice struct {
|
||||
Id int64 `json:"id"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
Quantity int64 `json:"quantity"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PromoPriceItem struct {
|
||||
SubscribeId int64 `json:"subscribe_id" validate:"required,gt=0"`
|
||||
Quantity int64 `json:"quantity" validate:"required,gt=0,lte=1000"`
|
||||
PromoPrice int64 `json:"promo_price" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type PromoRule struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority"`
|
||||
Enabled bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PromoUsage struct {
|
||||
Id int64 `json:"id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type Coupon struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -414,16 +389,6 @@ type CreateCouponRequest struct {
|
||||
Enable *bool `json:"enable,omitempty"`
|
||||
}
|
||||
|
||||
type CreatePromoRuleRequest struct {
|
||||
Name string `json:"name" validate:"required,max=100"`
|
||||
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority" validate:"gte=0"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
}
|
||||
|
||||
type CreateDocumentRequest struct {
|
||||
Title string `json:"title" validate:"required"`
|
||||
Content string `json:"content" validate:"required"`
|
||||
@@ -485,6 +450,16 @@ type CreatePaymentMethodRequest struct {
|
||||
Enable *bool `json:"enable" validate:"required"`
|
||||
}
|
||||
|
||||
type CreatePromoRuleRequest struct {
|
||||
Name string `json:"name" validate:"required,max=100"`
|
||||
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority" validate:"gte=0"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
}
|
||||
|
||||
type CreateQuotaTaskRequest struct {
|
||||
Subscribers []int64 `json:"subscribers"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
@@ -668,6 +643,14 @@ type DeletePaymentMethodRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
}
|
||||
|
||||
type DeletePromoPriceRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type DeletePromoRuleRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type DeleteRedemptionCodeRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
}
|
||||
@@ -823,14 +806,6 @@ type FamilySummary struct {
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type FileUploadRequest struct {
|
||||
BizType string `form:"biz_type" validate:"required"`
|
||||
}
|
||||
|
||||
type FileUploadResponse struct {
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type FileUploadCompleteRequest struct {
|
||||
FileId string `json:"file_id" validate:"required"`
|
||||
}
|
||||
@@ -856,6 +831,14 @@ type FileUploadInitResponse struct {
|
||||
ExpiredAt int64 `json:"expired_at"`
|
||||
}
|
||||
|
||||
type FileUploadRequest struct {
|
||||
BizType string `form:"biz_type" validate:"required"`
|
||||
}
|
||||
|
||||
type FileUploadResponse struct {
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type FilterBalanceLogRequest struct {
|
||||
FilterLogParams
|
||||
UserId int64 `form:"user_id,optional"`
|
||||
@@ -876,17 +859,6 @@ type FilterCommissionLogResponse struct {
|
||||
List []CommissionLog `json:"list"`
|
||||
}
|
||||
|
||||
type FilterOrderRefundLogRequest struct {
|
||||
FilterLogParams
|
||||
OrderId int64 `form:"order_id,optional"`
|
||||
UserId int64 `form:"user_id,optional"`
|
||||
}
|
||||
|
||||
type FilterOrderRefundLogResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []OrderRefundLog `json:"list"`
|
||||
}
|
||||
|
||||
type FilterEmailLogResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []MessageLog `json:"list"`
|
||||
@@ -936,6 +908,17 @@ type FilterNodeListResponse struct {
|
||||
List []Node `json:"list"`
|
||||
}
|
||||
|
||||
type FilterOrderRefundLogRequest struct {
|
||||
FilterLogParams
|
||||
OrderId int64 `form:"order_id,optional"`
|
||||
UserId int64 `form:"user_id,optional"`
|
||||
}
|
||||
|
||||
type FilterOrderRefundLogResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []OrderRefundLog `json:"list"`
|
||||
}
|
||||
|
||||
type FilterRegisterLogRequest struct {
|
||||
FilterLogParams
|
||||
UserId int64 `form:"user_id,optional"`
|
||||
@@ -1027,6 +1010,32 @@ type GenerateCaptchaResponse struct {
|
||||
BlockImage string `json:"block_image,omitempty"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
Search string `form:"search,omitempty"`
|
||||
Enable *bool `form:"enable,omitempty"`
|
||||
UserIdSearch int64 `form:"user_id_search,omitempty"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AdminInvitedUser `json:"list"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteStatsRequest struct {
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteStatsResponse struct {
|
||||
InviteCount int64 `json:"invite_count"`
|
||||
TotalCommission int64 `json:"total_commission"`
|
||||
CurrentCommission int64 `json:"current_commission"`
|
||||
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||
}
|
||||
|
||||
type GetAdsDetailRequest struct {
|
||||
Id int64 `form:"id"`
|
||||
}
|
||||
@@ -1145,48 +1154,6 @@ type GetCouponListResponse struct {
|
||||
List []Coupon `json:"list"`
|
||||
}
|
||||
|
||||
type GetPromoPriceListRequest struct {
|
||||
PromoRuleId int64 `form:"promo_rule_id" validate:"required,gt=0"`
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
}
|
||||
|
||||
type GetPromoPriceListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoPrice `json:"list"`
|
||||
}
|
||||
|
||||
type GetPromoRuleDetailRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type GetPromoRuleListRequest struct {
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
Type string `form:"type" validate:"omitempty,oneof=new_user inactive_user campaign"`
|
||||
Enabled *bool `form:"enabled"`
|
||||
Search string `form:"search,omitempty"`
|
||||
}
|
||||
|
||||
type GetPromoRuleListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoRule `json:"list"`
|
||||
}
|
||||
|
||||
type GetPromoUsageListRequest struct {
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
RuleId int64 `form:"rule_id,omitempty"`
|
||||
UserId int64 `form:"user_id,omitempty"`
|
||||
SubscribeId int64 `form:"subscribe_id,omitempty"`
|
||||
OrderNo string `form:"order_no,omitempty"`
|
||||
}
|
||||
|
||||
type GetPromoUsageListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoUsage `json:"list"`
|
||||
}
|
||||
|
||||
type GetDetailRequest struct {
|
||||
Id int64 `form:"id" validate:"required"`
|
||||
}
|
||||
@@ -1327,6 +1294,19 @@ type GetGroupHistoryResponse struct {
|
||||
List []GroupHistory `json:"list"`
|
||||
}
|
||||
|
||||
type GetInviteManageListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Search string `form:"search"`
|
||||
InviterId int64 `form:"inviter_id"`
|
||||
InviteeId int64 `form:"invitee_id"`
|
||||
}
|
||||
|
||||
type GetInviteManageListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []InviteManageRecord `json:"list"`
|
||||
}
|
||||
|
||||
type GetInviteRecordsRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
@@ -1339,6 +1319,32 @@ type GetInviteRecordsResponse struct {
|
||||
List []InviteRecord `json:"list"`
|
||||
}
|
||||
|
||||
type GetLogMessageRawRequest struct {
|
||||
Id int64 `form:"id" validate:"required"`
|
||||
}
|
||||
|
||||
type GetLogMessageRawResponse struct {
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId *int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
Stack string `json:"stack"`
|
||||
Context interface{} `json:"context"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Locale string `json:"locale"`
|
||||
Digest string `json:"digest"`
|
||||
OccurredAt int64 `json:"occurred_at"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type GetLoginLogRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
@@ -1417,6 +1423,48 @@ type GetPreSendEmailCountResponse struct {
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
type GetPromoPriceListRequest struct {
|
||||
PromoRuleId int64 `form:"promo_rule_id" validate:"required,gt=0"`
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
}
|
||||
|
||||
type GetPromoPriceListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoPrice `json:"list"`
|
||||
}
|
||||
|
||||
type GetPromoRuleDetailRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type GetPromoRuleListRequest struct {
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
Type string `form:"type" validate:"omitempty,oneof=new_user inactive_user campaign"`
|
||||
Enabled *bool `form:"enabled"`
|
||||
Search string `form:"search,omitempty"`
|
||||
}
|
||||
|
||||
type GetPromoRuleListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoRule `json:"list"`
|
||||
}
|
||||
|
||||
type GetPromoUsageListRequest struct {
|
||||
Page int64 `form:"page" validate:"required,gt=0"`
|
||||
Size int64 `form:"size" validate:"required,gt=0,lte=200"`
|
||||
RuleId int64 `form:"rule_id,omitempty"`
|
||||
UserId int64 `form:"user_id,omitempty"`
|
||||
SubscribeId int64 `form:"subscribe_id,omitempty"`
|
||||
OrderNo string `form:"order_no,omitempty"`
|
||||
}
|
||||
|
||||
type GetPromoUsageListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []PromoUsage `json:"list"`
|
||||
}
|
||||
|
||||
type GetRedemptionCodeListRequest struct {
|
||||
Page int64 `form:"page" validate:"required"`
|
||||
Size int64 `form:"size" validate:"required"`
|
||||
@@ -1708,6 +1756,19 @@ type GetUserTrafficStatsResponse struct {
|
||||
TotalTraffic int64 `json:"total_traffic"`
|
||||
}
|
||||
|
||||
type GetWithdrawalListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
UserId *int64 `form:"user_id,omitempty"`
|
||||
Status *uint8 `form:"status,omitempty"`
|
||||
Method *uint8 `form:"method,omitempty"`
|
||||
}
|
||||
|
||||
type GetWithdrawalListResponse struct {
|
||||
List []WithdrawalLog `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type GiftLog struct {
|
||||
Type uint16 `json:"type"`
|
||||
UserId int64 `json:"user_id"`
|
||||
@@ -1768,6 +1829,21 @@ type InviteConfig struct {
|
||||
GiftDays int64 `json:"gift_days"`
|
||||
}
|
||||
|
||||
type InviteManageRecord struct {
|
||||
InviterId int64 `json:"inviter_id"`
|
||||
InviterIdentifier string `json:"inviter_identifier"`
|
||||
InviteeId int64 `json:"invitee_id"`
|
||||
InviteeIdentifier string `json:"invitee_identifier"`
|
||||
InviteeAvatar string `json:"invitee_avatar"`
|
||||
InviteeEnable bool `json:"invitee_enable"`
|
||||
InvitedAt int64 `json:"invited_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
|
||||
type InviteRecord struct {
|
||||
Role string `json:"role"`
|
||||
PeerHash string `json:"peer_hash"`
|
||||
@@ -2158,6 +2234,45 @@ type PrivacyPolicyConfig struct {
|
||||
PrivacyPolicy string `json:"privacy_policy"`
|
||||
}
|
||||
|
||||
type PromoPrice struct {
|
||||
Id int64 `json:"id"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
Quantity int64 `json:"quantity"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PromoPriceItem struct {
|
||||
SubscribeId int64 `json:"subscribe_id" validate:"required,gt=0"`
|
||||
Quantity int64 `json:"quantity" validate:"required,gt=0,lte=1000"`
|
||||
PromoPrice int64 `json:"promo_price" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type PromoRule struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority"`
|
||||
Enabled bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type PromoUsage struct {
|
||||
Id int64 `json:"id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
PromoRuleId int64 `json:"promo_rule_id"`
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
OrderNo string `json:"order_no"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type Protocol struct {
|
||||
Type string `json:"type"`
|
||||
Port uint16 `json:"port"`
|
||||
@@ -2406,10 +2521,6 @@ type QueryUserSubscribeNodeListResponse struct {
|
||||
List []UserSubscribeInfo `json:"list"`
|
||||
}
|
||||
|
||||
type CancelWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type QueryWithdrawalLogListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
@@ -2420,28 +2531,6 @@ type QueryWithdrawalLogListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type GetWithdrawalListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
UserId *int64 `form:"user_id,omitempty"`
|
||||
Status *uint8 `form:"status,omitempty"`
|
||||
Method *uint8 `form:"method,omitempty"`
|
||||
}
|
||||
|
||||
type GetWithdrawalListResponse struct {
|
||||
List []WithdrawalLog `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
type ApproveWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type RejectWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
Reason string `json:"reason" validate:"required,max=500"`
|
||||
}
|
||||
|
||||
type QuotaTask struct {
|
||||
Id int64 `json:"id"`
|
||||
Subscribers []int64 `json:"subscribers"`
|
||||
@@ -2528,6 +2617,11 @@ type RedemptionRecord struct {
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type RefundOrderRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
Reason string `json:"reason,omitempty" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
type RegisterConfig struct {
|
||||
StopRegister bool `json:"stop_register"`
|
||||
EnableTrial bool `json:"enable_trial"`
|
||||
@@ -2551,6 +2645,11 @@ type RegisterLog struct {
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type RejectWithdrawalRequest struct {
|
||||
WithdrawalId int64 `json:"withdrawal_id" validate:"required,gt=0"`
|
||||
Reason string `json:"reason" validate:"required,max=500"`
|
||||
}
|
||||
|
||||
type RemoveFamilyMemberRequest struct {
|
||||
FamilyId int64 `json:"family_id" validate:"required,gt=0"`
|
||||
UserId int64 `json:"user_id" validate:"required,gt=0"`
|
||||
@@ -2809,6 +2908,11 @@ type SetNodeMultiplierRequest struct {
|
||||
Periods []TimePeriod `json:"periods"`
|
||||
}
|
||||
|
||||
type SetPromoPriceRequest struct {
|
||||
PromoRuleId int64 `json:"promo_rule_id" validate:"required,gt=0"`
|
||||
Items []PromoPriceItem `json:"items" validate:"required,min=1,dive"`
|
||||
}
|
||||
|
||||
type Shadowsocks struct {
|
||||
Method string `json:"method" validate:"required"`
|
||||
Port int `json:"port" validate:"required"`
|
||||
@@ -2866,13 +2970,6 @@ type StripePayment struct {
|
||||
PublishableKey string `json:"publishable_key"`
|
||||
}
|
||||
|
||||
type SubscribePromo struct {
|
||||
RuleName string `json:"rule_name"`
|
||||
RuleType string `json:"rule_type"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
}
|
||||
|
||||
type Subscribe struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -2975,6 +3072,13 @@ type SubscribeLog struct {
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type SubscribePromo struct {
|
||||
RuleName string `json:"rule_name"`
|
||||
RuleType string `json:"rule_type"`
|
||||
PromoPrice int64 `json:"promo_price"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
}
|
||||
|
||||
type SubscribeSortRequest struct {
|
||||
Sort []SortItem `json:"sort"`
|
||||
}
|
||||
@@ -3222,30 +3326,6 @@ type UpdateCouponRequest struct {
|
||||
Enable *bool `json:"enable,omitempty"`
|
||||
}
|
||||
|
||||
type SetPromoPriceRequest struct {
|
||||
PromoRuleId int64 `json:"promo_rule_id" validate:"required,gt=0"`
|
||||
Items []PromoPriceItem `json:"items" validate:"required,min=1,dive"`
|
||||
}
|
||||
|
||||
type DeletePromoPriceRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type DeletePromoRuleRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
type UpdatePromoRuleRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
Name string `json:"name" validate:"required,max=100"`
|
||||
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority" validate:"gte=0"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
}
|
||||
|
||||
type UpdateDocumentRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
Title string `json:"title" validate:"required"`
|
||||
@@ -3312,6 +3392,17 @@ type UpdatePaymentMethodRequest struct {
|
||||
Enable *bool `json:"enable" validate:"required"`
|
||||
}
|
||||
|
||||
type UpdatePromoRuleRequest struct {
|
||||
Id int64 `uri:"id" validate:"required,gt=0"`
|
||||
Name string `json:"name" validate:"required,max=100"`
|
||||
Type string `json:"type" validate:"required,oneof=new_user inactive_user campaign"`
|
||||
Params map[string]interface{} `json:"params"`
|
||||
Priority int64 `json:"priority" validate:"gte=0"`
|
||||
Enabled *bool `json:"enabled"`
|
||||
StartTime *int64 `json:"start_time"`
|
||||
EndTime *int64 `json:"end_time"`
|
||||
}
|
||||
|
||||
type UpdateRedemptionCodeRequest struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
TotalCount int64 `json:"total_count,omitempty"`
|
||||
@@ -3470,7 +3561,7 @@ type User struct {
|
||||
EnableLoginNotify bool `json:"enable_login_notify"`
|
||||
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
|
||||
EnableTradeNotify bool `json:"enable_trade_notify"`
|
||||
UseStatus bool `json:"use_status"`
|
||||
UseStatus bool `json:"use_status"` // Whether to show the "bind email to get free trial" prompt
|
||||
AuthMethods []UserAuthMethod `json:"auth_methods"`
|
||||
UserDevices []UserDevice `json:"user_devices"`
|
||||
Rules []string `json:"rules"`
|
||||
@@ -3787,96 +3878,3 @@ type WithdrawalLog struct {
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteStatsRequest struct {
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteStatsResponse struct {
|
||||
InviteCount int64 `json:"invite_count"`
|
||||
TotalCommission int64 `json:"total_commission"`
|
||||
CurrentCommission int64 `json:"current_commission"`
|
||||
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteListRequest struct {
|
||||
UserId int64 `form:"user_id" validate:"required"`
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Search string `form:"search"`
|
||||
Enable *int `form:"enable"`
|
||||
UserIdSearch int64 `form:"user_id_search"`
|
||||
}
|
||||
|
||||
type AdminInvitedUser struct {
|
||||
Id int64 `json:"id"`
|
||||
Avatar string `json:"avatar"`
|
||||
Identifier string `json:"identifier"`
|
||||
Enable bool `json:"enable"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
|
||||
type GetAdminUserInviteListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []AdminInvitedUser `json:"list"`
|
||||
}
|
||||
|
||||
type GetInviteManageListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Search string `form:"search"`
|
||||
InviterId int64 `form:"inviter_id"`
|
||||
InviteeId int64 `form:"invitee_id"`
|
||||
}
|
||||
|
||||
type InviteManageRecord struct {
|
||||
InviterId int64 `json:"inviter_id"`
|
||||
InviterIdentifier string `json:"inviter_identifier"`
|
||||
InviteeId int64 `json:"invitee_id"`
|
||||
InviteeIdentifier string `json:"invitee_identifier"`
|
||||
InviteeAvatar string `json:"invitee_avatar"`
|
||||
InviteeEnable bool `json:"invitee_enable"`
|
||||
InvitedAt int64 `json:"invited_at"`
|
||||
OrderCount int64 `json:"order_count"`
|
||||
HasPurchased bool `json:"has_purchased"`
|
||||
InviterCommission int64 `json:"inviter_commission"`
|
||||
InviterGiftDays int64 `json:"inviter_gift_days"`
|
||||
InviteeGiftDays int64 `json:"invitee_gift_days"`
|
||||
}
|
||||
|
||||
type GetInviteManageListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []InviteManageRecord `json:"list"`
|
||||
}
|
||||
|
||||
type GetLogMessageRawRequest struct {
|
||||
Id int64 `form:"id" validate:"required"`
|
||||
}
|
||||
|
||||
type GetLogMessageRawResponse struct {
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId *int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
Stack string `json:"stack"`
|
||||
Context json.RawMessage `json:"context"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Locale string `json:"locale"`
|
||||
Digest string `json:"digest"`
|
||||
OccurredAt int64 `json:"occurred_at"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user