refactor: 更新项目引用路径从perfect-panel/ppanel-server到perfect-panel/server
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 6m27s
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 6m27s
feat: 添加版本和构建时间变量 fix: 修正短信队列类型注释错误 style: 清理未使用的代码和测试文件 docs: 更新安装文档中的下载链接 chore: 迁移数据库脚本添加日志和订阅配置
This commit is contained in:
parent
393b42f35a
commit
c582087c0f
67
1.conf
Normal file
67
1.conf
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name api.hifast.biz 4d3vsw8.88xgaen.hifast.biz;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name api.hifast.biz;
|
||||||
|
client_max_body_size 150M;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/api.hifast.biz/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/api.hifast.biz/privkey.pem;
|
||||||
|
# 安全头
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
add_header X-Frame-Options DENY;
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# de99e242子域名指向3001 (管理界面)
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name 4d3vsw8.88xgaen.hifast.biz;
|
||||||
|
client_max_body_size 150M;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/4d3vsw8.88xgaen.hifast.biz/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/4d3vsw8.88xgaen.hifast.biz/privkey.pem;
|
||||||
|
|
||||||
|
# 安全头
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
add_header X-Frame-Options DENY;
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
|
||||||
|
# Gzip压缩
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json image/svg+xml;
|
||||||
|
|
||||||
|
location ^~ / {
|
||||||
|
proxy_pass http://127.0.0.1:3001;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $http_connection;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
add_header X-Cache $upstream_cache_status;
|
||||||
|
add_header Cache-Control no-cache;
|
||||||
|
proxy_ssl_server_name off;
|
||||||
|
proxy_ssl_name $proxy_host;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ FROM golang:alpine AS builder
|
|||||||
LABEL stage=gobuilder
|
LABEL stage=gobuilder
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG VERSION
|
||||||
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}
|
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}
|
||||||
|
|
||||||
# Combine apk commands into one to reduce layer size
|
# Combine apk commands into one to reduce layer size
|
||||||
@ -18,8 +19,9 @@ RUN go mod download
|
|||||||
# Copy the rest of the application code
|
# Copy the rest of the application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the binary with optimization flags to reduce binary size
|
# Build the binary with version and build time
|
||||||
RUN go build -ldflags="-s -w" -o /app/ppanel ppanel.go
|
RUN BUILD_TIME=$(date -u +"%Y-%m-%d %H:%M:%S") && \
|
||||||
|
go build -ldflags="-s -w -X 'github.com/perfect-panel/server/pkg/constant.Version=${VERSION}' -X 'github.com/perfect-panel/server/pkg/constant.BuildTime=${BUILD_TIME}'" -o /app/ppanel ppanel.go
|
||||||
|
|
||||||
# Final minimal image
|
# Final minimal image
|
||||||
FROM scratch
|
FROM scratch
|
||||||
@ -34,7 +36,7 @@ ENV TZ=Asia/Shanghai
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/ppanel /app/ppanel
|
COPY --from=builder /app/ppanel /app/ppanel
|
||||||
COPY --from=builder /etc /app/etc
|
COPY --from=builder /build/etc /app/etc
|
||||||
|
|
||||||
# Expose the port (optional)
|
# Expose the port (optional)
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
84
Makefile
Normal file
84
Makefile
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
NAME="ppanel-server"
|
||||||
|
BINDIR=bin
|
||||||
|
VERSION=$(shell git describe --tags || echo "unknown version")
|
||||||
|
BUILDTIME=$(shell date -u)
|
||||||
|
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/perfect-panel/server/pkg/constant.Version=$(VERSION)" \
|
||||||
|
-X "github.com/perfect-panel/server/pkg/constant.BuildTime=$(BUILDTIME)" \
|
||||||
|
-w -s -buildid='
|
||||||
|
|
||||||
|
PLATFORM_LIST = \
|
||||||
|
darwin-amd64 \
|
||||||
|
darwin-amd64-v3 \
|
||||||
|
darwin-arm64 \
|
||||||
|
linux-386 \
|
||||||
|
linux-amd64 \
|
||||||
|
linux-amd64-v3 \
|
||||||
|
linux-armv5 \
|
||||||
|
linux-armv6 \
|
||||||
|
linux-armv7 \
|
||||||
|
linux-arm64 \
|
||||||
|
|
||||||
|
WINDOWS_ARCH_LIST = \
|
||||||
|
windows-386 \
|
||||||
|
windows-amd64 \
|
||||||
|
windows-amd64-v3 \
|
||||||
|
windows-arm64 \
|
||||||
|
windows-armv7
|
||||||
|
|
||||||
|
all: linux-amd64 darwin-amd64 windows-amd64 # Most used
|
||||||
|
|
||||||
|
darwin-amd64:
|
||||||
|
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
darwin-amd64-v3:
|
||||||
|
GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
darwin-arm64:
|
||||||
|
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-386:
|
||||||
|
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-amd64:
|
||||||
|
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-amd64-v3:
|
||||||
|
GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-armv5:
|
||||||
|
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-armv6:
|
||||||
|
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-armv7:
|
||||||
|
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
linux-arm64:
|
||||||
|
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
||||||
|
|
||||||
|
windows-386:
|
||||||
|
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
||||||
|
|
||||||
|
windows-amd64:
|
||||||
|
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
||||||
|
|
||||||
|
windows-amd64-v3:
|
||||||
|
GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
||||||
|
|
||||||
|
windows-arm64:
|
||||||
|
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
||||||
|
|
||||||
|
windows-armv7:
|
||||||
|
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
||||||
|
|
||||||
|
|
||||||
|
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
|
||||||
|
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
|
||||||
|
|
||||||
|
$(gz_releases): %.gz : %
|
||||||
|
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
|
||||||
|
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
|
||||||
|
|
||||||
|
$(zip_releases): %.zip : %
|
||||||
|
zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
|
||||||
140
adapter/adapter.go
Normal file
140
adapter/adapter.go
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/internal/model/node"
|
||||||
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Adapter struct {
|
||||||
|
SiteName string // 站点名称
|
||||||
|
Servers []*node.Node // 服务器列表
|
||||||
|
UserInfo User // 用户信息
|
||||||
|
ClientTemplate string // 客户端配置模板
|
||||||
|
OutputFormat string // 输出格式,默认是 base64
|
||||||
|
SubscribeName string // 订阅名称
|
||||||
|
}
|
||||||
|
|
||||||
|
type Option func(*Adapter)
|
||||||
|
|
||||||
|
// WithServers 设置服务器列表
|
||||||
|
func WithServers(servers []*node.Node) Option {
|
||||||
|
return func(opts *Adapter) {
|
||||||
|
opts.Servers = servers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUserInfo 设置用户信息
|
||||||
|
func WithUserInfo(user User) Option {
|
||||||
|
return func(opts *Adapter) {
|
||||||
|
opts.UserInfo = user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOutputFormat 设置输出格式
|
||||||
|
func WithOutputFormat(format string) Option {
|
||||||
|
return func(opts *Adapter) {
|
||||||
|
opts.OutputFormat = format
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSiteName 设置站点名称
|
||||||
|
func WithSiteName(name string) Option {
|
||||||
|
return func(opts *Adapter) {
|
||||||
|
opts.SiteName = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSubscribeName 设置订阅名称
|
||||||
|
func WithSubscribeName(name string) Option {
|
||||||
|
return func(opts *Adapter) {
|
||||||
|
opts.SubscribeName = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAdapter(tpl string, opts ...Option) *Adapter {
|
||||||
|
adapter := &Adapter{
|
||||||
|
Servers: []*node.Node{},
|
||||||
|
UserInfo: User{},
|
||||||
|
ClientTemplate: tpl,
|
||||||
|
OutputFormat: "base64", // 默认输出格式
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(adapter)
|
||||||
|
}
|
||||||
|
|
||||||
|
return adapter
|
||||||
|
}
|
||||||
|
|
||||||
|
func (adapter *Adapter) Client() (*Client, error) {
|
||||||
|
client := &Client{
|
||||||
|
SiteName: adapter.SiteName,
|
||||||
|
SubscribeName: adapter.SubscribeName,
|
||||||
|
ClientTemplate: adapter.ClientTemplate,
|
||||||
|
OutputFormat: adapter.OutputFormat,
|
||||||
|
Proxies: []Proxy{},
|
||||||
|
UserInfo: adapter.UserInfo,
|
||||||
|
}
|
||||||
|
|
||||||
|
proxies, err := adapter.Proxies(adapter.Servers)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client.Proxies = proxies
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (adapter *Adapter) Proxies(servers []*node.Node) ([]Proxy, error) {
|
||||||
|
var proxies []Proxy
|
||||||
|
|
||||||
|
for _, item := range servers {
|
||||||
|
if item.Server == nil {
|
||||||
|
logger.Errorf("[Adapter] Server is nil for node ID: %d", item.Id)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
protocols, err := item.Server.UnmarshalProtocols()
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("[Adapter] Unmarshal Protocols error: %s; server id : %d", err.Error(), item.ServerId)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, protocol := range protocols {
|
||||||
|
if protocol.Type == item.Protocol {
|
||||||
|
proxies = append(proxies, Proxy{
|
||||||
|
Sort: item.Sort,
|
||||||
|
Name: item.Name,
|
||||||
|
Server: item.Address,
|
||||||
|
Port: item.Port,
|
||||||
|
Type: item.Protocol,
|
||||||
|
Tags: strings.Split(item.Tags, ","),
|
||||||
|
Security: protocol.Security,
|
||||||
|
SNI: protocol.SNI,
|
||||||
|
AllowInsecure: protocol.AllowInsecure,
|
||||||
|
Fingerprint: protocol.Fingerprint,
|
||||||
|
RealityServerAddr: protocol.RealityServerAddr,
|
||||||
|
RealityServerPort: protocol.RealityServerPort,
|
||||||
|
RealityPrivateKey: protocol.RealityPrivateKey,
|
||||||
|
RealityPublicKey: protocol.RealityPublicKey,
|
||||||
|
RealityShortId: protocol.RealityShortId,
|
||||||
|
Transport: protocol.Transport,
|
||||||
|
Host: protocol.Host,
|
||||||
|
Path: protocol.Path,
|
||||||
|
ServiceName: protocol.ServiceName,
|
||||||
|
Method: protocol.Cipher,
|
||||||
|
ServerKey: protocol.ServerKey,
|
||||||
|
Flow: protocol.Flow,
|
||||||
|
HopPorts: protocol.HopPorts,
|
||||||
|
HopInterval: protocol.HopInterval,
|
||||||
|
ObfsPassword: protocol.ObfsPassword,
|
||||||
|
DisableSNI: protocol.DisableSNI,
|
||||||
|
ReduceRtt: protocol.ReduceRtt,
|
||||||
|
UDPRelayMode: protocol.UDPRelayMode,
|
||||||
|
CongestionController: protocol.CongestionController,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return proxies, nil
|
||||||
|
}
|
||||||
34
adapter/adapter_test.go
Normal file
34
adapter/adapter_test.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAdapter_Client(t *testing.T) {
|
||||||
|
servers := getServers()
|
||||||
|
if len(servers) == 0 {
|
||||||
|
t.Errorf("[Test] No servers found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a := NewAdapter(tpl, WithServers(servers), WithUserInfo(User{
|
||||||
|
Password: "test-password",
|
||||||
|
ExpiredAt: time.Now().AddDate(1, 0, 0),
|
||||||
|
Download: 0,
|
||||||
|
Upload: 0,
|
||||||
|
Traffic: 1000,
|
||||||
|
SubscribeURL: "https://example.com/subscribe",
|
||||||
|
}))
|
||||||
|
client, err := a.Client()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("[Test] Failed to get client: %v", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bytes, err := client.Build()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("[Test] Failed to build client config: %v", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Logf("[Test] Client config built successfully: %s", string(bytes))
|
||||||
|
|
||||||
|
}
|
||||||
146
adapter/client.go
Normal file
146
adapter/client.go
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
|
"reflect"
|
||||||
|
"text/template"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/Masterminds/sprig/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Proxy struct {
|
||||||
|
Sort int
|
||||||
|
Name string
|
||||||
|
Server string
|
||||||
|
Port uint16
|
||||||
|
Type string
|
||||||
|
Tags []string
|
||||||
|
|
||||||
|
// Security Options
|
||||||
|
Security string
|
||||||
|
SNI string // Server Name Indication for TLS
|
||||||
|
AllowInsecure bool // Allow insecure connections (skip certificate verification)
|
||||||
|
Fingerprint string // Client fingerprint for TLS connections
|
||||||
|
RealityServerAddr string // Reality server address
|
||||||
|
RealityServerPort int // Reality server port
|
||||||
|
RealityPrivateKey string // Reality private key for authentication
|
||||||
|
RealityPublicKey string // Reality public key for authentication
|
||||||
|
RealityShortId string // Reality short ID for authentication
|
||||||
|
// Transport Options
|
||||||
|
Transport string // Transport protocol (e.g., ws, http, grpc)
|
||||||
|
Host string // For WebSocket/HTTP/HTTPS
|
||||||
|
Path string // For HTTP/HTTPS
|
||||||
|
ServiceName string // For gRPC
|
||||||
|
// Shadowsocks Options
|
||||||
|
Method string
|
||||||
|
ServerKey string // For Shadowsocks 2022
|
||||||
|
|
||||||
|
// Vmess/Vless/Trojan Options
|
||||||
|
Flow string // Flow for Vmess/Vless/Trojan
|
||||||
|
// Hysteria2 Options
|
||||||
|
HopPorts string // Comma-separated list of hop ports
|
||||||
|
HopInterval int // Interval for hop ports in seconds
|
||||||
|
ObfsPassword string // Obfuscation password for Hysteria2
|
||||||
|
UpMbps int // Upload speed in Mbps
|
||||||
|
DownMbps int // Download speed in Mbps
|
||||||
|
|
||||||
|
// Tuic Options
|
||||||
|
DisableSNI bool // Disable SNI
|
||||||
|
ReduceRtt bool // Reduce RTT
|
||||||
|
UDPRelayMode string // UDP relay mode (e.g., "full", "partial")
|
||||||
|
CongestionController string // Congestion controller (e.g., "cubic", "bbr")
|
||||||
|
|
||||||
|
// AnyTLS
|
||||||
|
PaddingScheme string
|
||||||
|
|
||||||
|
// Mieru
|
||||||
|
Multiplex string
|
||||||
|
|
||||||
|
// Obfs
|
||||||
|
//Obfs string // obfs, 'none', 'http', 'tls'
|
||||||
|
//ObfsHost string // obfs host
|
||||||
|
//ObfsPath string // obfs path
|
||||||
|
|
||||||
|
// Vless
|
||||||
|
XhttpMode string // xhttp mode
|
||||||
|
XhttpExtra string // xhttp path
|
||||||
|
|
||||||
|
// encryption
|
||||||
|
Encryption string // encryption,'none', 'mlkem768x25519plus'
|
||||||
|
EncryptionMode string // encryption mode,'native', 'xorpub', 'random'
|
||||||
|
EncryptionRtt string // encryption rtt,'0rtt', '1rtt'
|
||||||
|
EncryptionTicket string // encryption ticket
|
||||||
|
EncryptionServerPadding string // encryption server padding
|
||||||
|
EncryptionPrivateKey string // encryption private key
|
||||||
|
EncryptionClientPadding string // encryption client padding
|
||||||
|
EncryptionPassword string // encryption password
|
||||||
|
|
||||||
|
Ratio float64 // Traffic ratio, default is 1
|
||||||
|
CertMode string // Certificate mode, `none`|`http`|`dns`|`self`
|
||||||
|
CertDNSProvider string // DNS provider for certificate
|
||||||
|
CertDNSEnv string // Environment for DNS provider
|
||||||
|
}
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
Password string
|
||||||
|
ExpiredAt time.Time
|
||||||
|
Download int64
|
||||||
|
Upload int64
|
||||||
|
Traffic int64
|
||||||
|
SubscribeURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
SiteName string // Name of the site
|
||||||
|
SubscribeName string // Name of the subscription
|
||||||
|
ClientTemplate string // Template for the entire client configuration
|
||||||
|
OutputFormat string // json, yaml, etc.
|
||||||
|
Proxies []Proxy // List of proxy configurations
|
||||||
|
UserInfo User // User information
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Build() ([]byte, error) {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
tmpl, err := template.New("client").Funcs(sprig.TxtFuncMap()).Parse(c.ClientTemplate)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
proxies := make([]map[string]interface{}, len(c.Proxies))
|
||||||
|
for i, p := range c.Proxies {
|
||||||
|
proxies[i] = StructToMap(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tmpl.Execute(&buf, map[string]interface{}{
|
||||||
|
"SiteName": c.SiteName,
|
||||||
|
"SubscribeName": c.SubscribeName,
|
||||||
|
"OutputFormat": c.OutputFormat,
|
||||||
|
"Proxies": proxies,
|
||||||
|
"UserInfo": c.UserInfo,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result := buf.String()
|
||||||
|
if c.OutputFormat == "base64" {
|
||||||
|
encoded := base64.StdEncoding.EncodeToString([]byte(result))
|
||||||
|
return []byte(encoded), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func StructToMap(obj interface{}) map[string]interface{} {
|
||||||
|
m := make(map[string]interface{})
|
||||||
|
v := reflect.ValueOf(obj)
|
||||||
|
t := reflect.TypeOf(obj)
|
||||||
|
|
||||||
|
for i := 0; i < v.NumField(); i++ {
|
||||||
|
field := t.Field(i)
|
||||||
|
m[field.Name] = v.Field(i).Interface()
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
153
adapter/client_test.go
Normal file
153
adapter/client_test.go
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var tpl = `
|
||||||
|
{{- range $n := .Proxies }}
|
||||||
|
{{- $dn := urlquery (default "node" $n.Name) -}}
|
||||||
|
{{- $sni := default $n.Host $n.SNI -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "shadowsocks" -}}
|
||||||
|
{{- $userinfo := b64enc (print $n.Method ":" $.UserInfo.Password) -}}
|
||||||
|
{{- printf "ss://%s@%s:%v#%s" $userinfo $n.Host $n.Port $dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "trojan" -}}
|
||||||
|
{{- $qs := "security=tls" -}}
|
||||||
|
{{- if $sni }}{{ $qs = printf "%s&sni=%s" $qs (urlquery $sni) }}{{ end -}}
|
||||||
|
{{- if $n.AllowInsecure }}{{ $qs = printf "%s&allowInsecure=%v" $qs $n.AllowInsecure }}{{ end -}}
|
||||||
|
{{- if $n.Fingerprint }}{{ $qs = printf "%s&fp=%s" $qs (urlquery $n.Fingerprint) }}{{ end -}}
|
||||||
|
{{- printf "trojan://%s@%s:%v?%s#%s" $.UserInfo.Password $n.Host $n.Port $qs $dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "vless" -}}
|
||||||
|
{{- $qs := "encryption=none" -}}
|
||||||
|
{{- if $n.RealityPublicKey -}}
|
||||||
|
{{- $qs = printf "%s&security=reality" $qs -}}
|
||||||
|
{{- $qs = printf "%s&pbk=%s" $qs (urlquery $n.RealityPublicKey) -}}
|
||||||
|
{{- if $n.RealityShortId }}{{ $qs = printf "%s&sid=%s" $qs (urlquery $n.RealityShortId) }}{{ end -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- if or $n.SNI $n.Fingerprint $n.AllowInsecure }}
|
||||||
|
{{- $qs = printf "%s&security=tls" $qs -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if $n.SNI }}{{ $qs = printf "%s&sni=%s" $qs (urlquery $n.SNI) }}{{ end -}}
|
||||||
|
{{- if $n.AllowInsecure }}{{ $qs = printf "%s&allowInsecure=%v" $qs $n.AllowInsecure }}{{ end -}}
|
||||||
|
{{- if $n.Fingerprint }}{{ $qs = printf "%s&fp=%s" $qs (urlquery $n.Fingerprint) }}{{ end -}}
|
||||||
|
{{- if $n.Network }}{{ $qs = printf "%s&type=%s" $qs $n.Network }}{{ end -}}
|
||||||
|
{{- if $n.Path }}{{ $qs = printf "%s&path=%s" $qs (urlquery $n.Path) }}{{ end -}}
|
||||||
|
{{- if $n.ServiceName }}{{ $qs = printf "%s&serviceName=%s" $qs (urlquery $n.ServiceName) }}{{ end -}}
|
||||||
|
{{- if $n.Flow }}{{ $qs = printf "%s&flow=%s" $qs (urlquery $n.Flow) }}{{ end -}}
|
||||||
|
{{- printf "vless://%s@%s:%v?%s#%s" $n.ServerKey $n.Host $n.Port $qs $dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "vmess" -}}
|
||||||
|
{{- $obj := dict
|
||||||
|
"v" "2"
|
||||||
|
"ps" $n.Name
|
||||||
|
"add" $n.Host
|
||||||
|
"port" $n.Port
|
||||||
|
"id" $n.ServerKey
|
||||||
|
"aid" 0
|
||||||
|
"net" (or $n.Network "tcp")
|
||||||
|
"type" "none"
|
||||||
|
"path" (or $n.Path "")
|
||||||
|
"host" $n.Host
|
||||||
|
-}}
|
||||||
|
{{- if or $n.SNI $n.Fingerprint $n.AllowInsecure }}{{ set $obj "tls" "tls" }}{{ end -}}
|
||||||
|
{{- if $n.SNI }}{{ set $obj "sni" $n.SNI }}{{ end -}}
|
||||||
|
{{- if $n.Fingerprint }}{{ set $obj "fp" $n.Fingerprint }}{{ end -}}
|
||||||
|
{{- printf "vmess://%s" (b64enc (toJson $obj)) -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if or (eq $n.Type "hysteria2") (eq $n.Type "hy2") -}}
|
||||||
|
{{- $qs := "" -}}
|
||||||
|
{{- if $n.SNI }}{{ $qs = printf "sni=%s" (urlquery $n.SNI) }}{{ end -}}
|
||||||
|
{{- if $n.AllowInsecure }}{{ $qs = printf "%s&insecure=%v" $qs $n.AllowInsecure }}{{ end -}}
|
||||||
|
{{- if $n.ObfsPassword }}{{ $qs = printf "%s&obfs-password=%s" $qs (urlquery $n.ObfsPassword) }}{{ end -}}
|
||||||
|
{{- printf "hy2://%s@%s:%v%s#%s"
|
||||||
|
$.UserInfo.Password
|
||||||
|
$n.Host
|
||||||
|
$n.Port
|
||||||
|
(ternary (gt (len $qs) 0) (print "?" $qs) "")
|
||||||
|
$dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "tuic" -}}
|
||||||
|
{{- $qs := "" -}}
|
||||||
|
{{- if $n.SNI }}{{ $qs = printf "sni=%s" (urlquery $n.SNI) }}{{ end -}}
|
||||||
|
{{- if $n.AllowInsecure }}{{ $qs = printf "%s&insecure=%v" $qs $n.AllowInsecure }}{{ end -}}
|
||||||
|
{{- printf "tuic://%s:%s@%s:%v%s#%s"
|
||||||
|
$n.ServerKey
|
||||||
|
$.UserInfo.Password
|
||||||
|
$n.Host
|
||||||
|
$n.Port
|
||||||
|
(ternary (gt (len $qs) 0) (print "?" $qs) "")
|
||||||
|
$dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if eq $n.Type "anytls" -}}
|
||||||
|
{{- $qs := "" -}}
|
||||||
|
{{- if $n.SNI }}{{ $qs = printf "sni=%s" (urlquery $n.SNI) }}{{ end -}}
|
||||||
|
{{- printf "anytls://%s@%s:%v%s#%s"
|
||||||
|
$.UserInfo.Password
|
||||||
|
$n.Host
|
||||||
|
$n.Port
|
||||||
|
(ternary (gt (len $qs) 0) (print "?" $qs) "")
|
||||||
|
$dn -}}
|
||||||
|
{{- "\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
`
|
||||||
|
|
||||||
|
func TestClient_Build(t *testing.T) {
|
||||||
|
client := &Client{
|
||||||
|
SiteName: "TestSite",
|
||||||
|
SubscribeName: "TestSubscribe",
|
||||||
|
ClientTemplate: tpl,
|
||||||
|
Proxies: []Proxy{
|
||||||
|
{
|
||||||
|
Name: "TestShadowSocks",
|
||||||
|
Type: "shadowsocks",
|
||||||
|
Host: "127.0.0.1",
|
||||||
|
Port: 1234,
|
||||||
|
Method: "aes-256-gcm",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "TestTrojan",
|
||||||
|
Type: "trojan",
|
||||||
|
Host: "example.com",
|
||||||
|
Port: 443,
|
||||||
|
AllowInsecure: true,
|
||||||
|
Security: "tls",
|
||||||
|
Transport: "tcp",
|
||||||
|
SNI: "v1-dy.ixigua.com",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
UserInfo: User{
|
||||||
|
Password: "testpassword",
|
||||||
|
ExpiredAt: time.Now().Add(24 * time.Hour),
|
||||||
|
Download: 1000000,
|
||||||
|
Upload: 500000,
|
||||||
|
Traffic: 1500000,
|
||||||
|
SubscribeURL: "https://example.com/subscribe",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
buf, err := client.Build()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed to build client: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Logf("[测试] 输出: %s", buf)
|
||||||
|
|
||||||
|
}
|
||||||
1
adapter/utils.go
Normal file
1
adapter/utils.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package adapter
|
||||||
46
adapter/utils_test.go
Normal file
46
adapter/utils_test.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package adapter
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/internal/model/server"
|
||||||
|
"gorm.io/driver/mysql"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAdapterProxy(t *testing.T) {
|
||||||
|
|
||||||
|
servers := getServers()
|
||||||
|
if len(servers) == 0 {
|
||||||
|
t.Fatal("no servers found")
|
||||||
|
}
|
||||||
|
for _, srv := range servers {
|
||||||
|
proxy, err := adapterProxy(*srv, "example.com", 0)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to adapt server %s: %v", srv.Name, err)
|
||||||
|
}
|
||||||
|
t.Logf("[测试] 适配服务器 %s 成功: %+v", srv.Name, proxy)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func getServers() []*server.Server {
|
||||||
|
db, err := connectMySQL("root:mylove520@tcp(localhost:3306)/perfectlink?charset=utf8mb4&parseTime=True&loc=Local")
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var servers []*server.Server
|
||||||
|
if err = db.Model(&server.Server{}).Find(&servers).Error; err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return servers
|
||||||
|
}
|
||||||
|
func connectMySQL(dsn string) (*gorm.DB, error) {
|
||||||
|
db, err := gorm.Open(mysql.New(mysql.Config{
|
||||||
|
DSN: dsn,
|
||||||
|
}), &gorm.Config{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return db, nil
|
||||||
|
}
|
||||||
96
apis/admin/application.api
Normal file
96
apis/admin/application.api
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "Application API"
|
||||||
|
desc: "API for ppanel"
|
||||||
|
author: "Tension"
|
||||||
|
email: "tension@ppanel.com"
|
||||||
|
version: "0.0.1"
|
||||||
|
)
|
||||||
|
|
||||||
|
import "../types.api"
|
||||||
|
|
||||||
|
type (
|
||||||
|
SubscribeApplication {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Icon string `json:"icon,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
UserAgent string `json:"user_agent"`
|
||||||
|
IsDefault bool `json:"is_default"`
|
||||||
|
SubscribeTemplate string `json:"template"`
|
||||||
|
OutputFormat string `json:"output_format"`
|
||||||
|
DownloadLink DownloadLink `json:"download_link,omitempty"`
|
||||||
|
CreatedAt int64 `json:"created_at"`
|
||||||
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
|
}
|
||||||
|
GetSubscribeApplicationListResponse {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []SubscribeApplication `json:"list"`
|
||||||
|
}
|
||||||
|
CreateSubscribeApplicationRequest {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Icon string `json:"icon,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
UserAgent string `json:"user_agent"`
|
||||||
|
IsDefault bool `json:"is_default"`
|
||||||
|
SubscribeTemplate string `json:"template"`
|
||||||
|
OutputFormat string `json:"output_format"`
|
||||||
|
DownloadLink DownloadLink `json:"download_link"`
|
||||||
|
}
|
||||||
|
UpdateSubscribeApplicationRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Icon string `json:"icon,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
UserAgent string `json:"user_agent"`
|
||||||
|
IsDefault bool `json:"is_default"`
|
||||||
|
SubscribeTemplate string `json:"template"`
|
||||||
|
OutputFormat string `json:"output_format"`
|
||||||
|
DownloadLink DownloadLink `json:"download_link,omitempty"`
|
||||||
|
}
|
||||||
|
DeleteSubscribeApplicationRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}
|
||||||
|
GetSubscribeApplicationListRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
|
}
|
||||||
|
PreviewSubscribeTemplateRequest {
|
||||||
|
Id int64 `form:"id"`
|
||||||
|
}
|
||||||
|
PreviewSubscribeTemplateResponse {
|
||||||
|
Template string `json:"template"` // 预览的模板内容
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: v1/admin/application
|
||||||
|
group: admin/application
|
||||||
|
middleware: AuthMiddleware
|
||||||
|
)
|
||||||
|
service ppanel {
|
||||||
|
@doc "Create subscribe application"
|
||||||
|
@handler CreateSubscribeApplication
|
||||||
|
post / (CreateSubscribeApplicationRequest) returns (SubscribeApplication)
|
||||||
|
|
||||||
|
@doc "Update subscribe application"
|
||||||
|
@handler UpdateSubscribeApplication
|
||||||
|
put /subscribe_application (UpdateSubscribeApplicationRequest) returns (SubscribeApplication)
|
||||||
|
|
||||||
|
@doc "Get subscribe application list"
|
||||||
|
@handler GetSubscribeApplicationList
|
||||||
|
get /subscribe_application_list (GetSubscribeApplicationListRequest) returns (GetSubscribeApplicationListResponse)
|
||||||
|
|
||||||
|
@doc "Delete subscribe application"
|
||||||
|
@handler DeleteSubscribeApplication
|
||||||
|
delete /subscribe_application (DeleteSubscribeApplicationRequest)
|
||||||
|
|
||||||
|
@doc "Preview Template"
|
||||||
|
@handler PreviewSubscribeTemplate
|
||||||
|
get /preview (PreviewSubscribeTemplateRequest) returns (PreviewSubscribeTemplateResponse)
|
||||||
|
}
|
||||||
|
|
||||||
@ -25,8 +25,6 @@ type (
|
|||||||
GetAuthMethodListResponse {
|
GetAuthMethodListResponse {
|
||||||
List []AuthMethodConfig `json:"list"`
|
List []AuthMethodConfig `json:"list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TestSmsSendRequest {
|
TestSmsSendRequest {
|
||||||
AreaCode string `json:"area_code" validate:"required"`
|
AreaCode string `json:"area_code" validate:"required"`
|
||||||
Telephone string `json:"telephone" validate:"required"`
|
Telephone string `json:"telephone" validate:"required"`
|
||||||
@ -35,7 +33,6 @@ type (
|
|||||||
TestEmailSendRequest {
|
TestEmailSendRequest {
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
@ -56,7 +53,6 @@ service ppanel {
|
|||||||
@handler UpdateAuthMethodConfig
|
@handler UpdateAuthMethodConfig
|
||||||
put /config (UpdateAuthMethodConfigRequest) returns (AuthMethodConfig)
|
put /config (UpdateAuthMethodConfigRequest) returns (AuthMethodConfig)
|
||||||
|
|
||||||
|
|
||||||
@doc "Test sms send"
|
@doc "Test sms send"
|
||||||
@handler TestSmsSend
|
@handler TestSmsSend
|
||||||
post /test_sms_send (TestSmsSendRequest)
|
post /test_sms_send (TestSmsSendRequest)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ type (
|
|||||||
Download int64 `json:"download"`
|
Download int64 `json:"download"`
|
||||||
}
|
}
|
||||||
ServerTotalDataResponse {
|
ServerTotalDataResponse {
|
||||||
OnlineUserIPs int64 `json:"online_user_ips"`
|
OnlineUsers int64 `json:"online_users"`
|
||||||
OnlineServers int64 `json:"online_servers"`
|
OnlineServers int64 `json:"online_servers"`
|
||||||
OfflineServers int64 `json:"offline_servers"`
|
OfflineServers int64 `json:"offline_servers"`
|
||||||
TodayUpload int64 `json:"today_upload"`
|
TodayUpload int64 `json:"today_upload"`
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "Device API"
|
title: "Device API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
@ -8,6 +8,3 @@ info(
|
|||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
|
||||||
|
|
||||||
)
|
|
||||||
@ -14,17 +14,182 @@ type (
|
|||||||
GetMessageLogListRequest {
|
GetMessageLogListRequest {
|
||||||
Page int `form:"page"`
|
Page int `form:"page"`
|
||||||
Size int `form:"size"`
|
Size int `form:"size"`
|
||||||
Type string `form:"type"`
|
Type uint8 `form:"type"`
|
||||||
Platform string `form:"platform,omitempty"`
|
Search string `form:"search,optional"`
|
||||||
To string `form:"to,omitempty"`
|
|
||||||
Subject string `form:"subject,omitempty"`
|
|
||||||
Content string `form:"content,omitempty"`
|
|
||||||
Status int `form:"status,omitempty"`
|
|
||||||
}
|
}
|
||||||
GetMessageLogListResponse {
|
GetMessageLogListResponse {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
List []MessageLog `json:"list"`
|
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 (
|
@server (
|
||||||
@ -36,5 +201,61 @@ service ppanel {
|
|||||||
@doc "Get message log list"
|
@doc "Get message log list"
|
||||||
@handler GetMessageLogList
|
@handler GetMessageLogList
|
||||||
get /message/list (GetMessageLogListRequest) returns (GetMessageLogListResponse)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
167
apis/admin/marketing.api
Normal file
167
apis/admin/marketing.api
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "Marketing API"
|
||||||
|
desc: "API for ppanel"
|
||||||
|
author: "Tension"
|
||||||
|
email: "tension@ppanel.com"
|
||||||
|
version: "0.0.1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
CreateBatchSendEmailTaskRequest {
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
Scope int8 `json:"scope"`
|
||||||
|
RegisterStartTime int64 `json:"register_start_time,omitempty"`
|
||||||
|
RegisterEndTime int64 `json:"register_end_time,omitempty"`
|
||||||
|
Additional string `json:"additional,omitempty"`
|
||||||
|
Scheduled int64 `json:"scheduled,omitempty"`
|
||||||
|
Interval uint8 `json:"interval,omitempty"`
|
||||||
|
Limit uint64 `json:"limit,omitempty"`
|
||||||
|
}
|
||||||
|
BatchSendEmailTask {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Subject string `json:"subject"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
Recipients string `json:"recipients"`
|
||||||
|
Scope int8 `json:"scope"`
|
||||||
|
RegisterStartTime int64 `json:"register_start_time"`
|
||||||
|
RegisterEndTime int64 `json:"register_end_time"`
|
||||||
|
Additional string `json:"additional"`
|
||||||
|
Scheduled int64 `json:"scheduled"`
|
||||||
|
Interval uint8 `json:"interval"`
|
||||||
|
Limit uint64 `json:"limit"`
|
||||||
|
Status uint8 `json:"status"`
|
||||||
|
Errors string `json:"errors"`
|
||||||
|
Total uint64 `json:"total"`
|
||||||
|
Current uint64 `json:"current"`
|
||||||
|
CreatedAt int64 `json:"created_at"`
|
||||||
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
|
}
|
||||||
|
GetBatchSendEmailTaskListRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
|
Scope *int8 `form:"scope,omitempty"`
|
||||||
|
Status *uint8 `form:"status,omitempty"`
|
||||||
|
}
|
||||||
|
GetBatchSendEmailTaskListResponse {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []BatchSendEmailTask `json:"list"`
|
||||||
|
}
|
||||||
|
StopBatchSendEmailTaskRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}
|
||||||
|
GetPreSendEmailCountRequest {
|
||||||
|
Scope int8 `json:"scope"`
|
||||||
|
RegisterStartTime int64 `json:"register_start_time,omitempty"`
|
||||||
|
RegisterEndTime int64 `json:"register_end_time,omitempty"`
|
||||||
|
}
|
||||||
|
GetPreSendEmailCountResponse {
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
}
|
||||||
|
GetBatchSendEmailTaskStatusRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}
|
||||||
|
GetBatchSendEmailTaskStatusResponse {
|
||||||
|
Status uint8 `json:"status"`
|
||||||
|
Current int64 `json:"current"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Errors string `json:"errors"`
|
||||||
|
}
|
||||||
|
CreateQuotaTaskRequest {
|
||||||
|
Subscribers []int64 `json:"subscribers"`
|
||||||
|
IsActive *bool `json:"is_active"`
|
||||||
|
StartTime int64 `json:"start_time"`
|
||||||
|
EndTime int64 `json:"end_time"`
|
||||||
|
ResetTraffic bool `json:"reset_traffic"`
|
||||||
|
Days uint64 `json:"days"`
|
||||||
|
GiftType uint8 `json:"gift_type"`
|
||||||
|
GiftValue uint64 `json:"gift_value"`
|
||||||
|
}
|
||||||
|
QuotaTask {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Subscribers []int64 `json:"subscribers"`
|
||||||
|
IsActive *bool `json:"is_active"`
|
||||||
|
StartTime int64 `json:"start_time"`
|
||||||
|
EndTime int64 `json:"end_time"`
|
||||||
|
ResetTraffic bool `json:"reset_traffic"`
|
||||||
|
Days uint64 `json:"days"`
|
||||||
|
GiftType uint8 `json:"gift_type"`
|
||||||
|
GiftValue uint64 `json:"gift_value"`
|
||||||
|
Objects []int64 `json:"objects"` // UserSubscribe IDs
|
||||||
|
Status uint8 `json:"status"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Current int64 `json:"current"`
|
||||||
|
Errors string `json:"errors"`
|
||||||
|
CreatedAt int64 `json:"created_at"`
|
||||||
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskPreCountRequest {
|
||||||
|
Subscribers []int64 `json:"subscribers"`
|
||||||
|
IsActive *bool `json:"is_active"`
|
||||||
|
StartTime int64 `json:"start_time"`
|
||||||
|
EndTime int64 `json:"end_time"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskPreCountResponse {
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskListRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
|
Status *uint8 `form:"status,omitempty"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskListResponse {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []QuotaTask `json:"list"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskStatusRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}
|
||||||
|
QueryQuotaTaskStatusResponse {
|
||||||
|
Status uint8 `json:"status"`
|
||||||
|
Current int64 `json:"current"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Errors string `json:"errors"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: v1/admin/marketing
|
||||||
|
group: admin/marketing
|
||||||
|
middleware: AuthMiddleware
|
||||||
|
)
|
||||||
|
service ppanel {
|
||||||
|
@doc "Create a batch send email task"
|
||||||
|
@handler CreateBatchSendEmailTask
|
||||||
|
post /email/batch/send (CreateBatchSendEmailTaskRequest)
|
||||||
|
|
||||||
|
@doc "Get batch send email task list"
|
||||||
|
@handler GetBatchSendEmailTaskList
|
||||||
|
get /email/batch/list (GetBatchSendEmailTaskListRequest) returns (GetBatchSendEmailTaskListResponse)
|
||||||
|
|
||||||
|
@doc "Stop a batch send email task"
|
||||||
|
@handler StopBatchSendEmailTask
|
||||||
|
post /email/batch/stop (StopBatchSendEmailTaskRequest)
|
||||||
|
|
||||||
|
@doc "Get pre-send email count"
|
||||||
|
@handler GetPreSendEmailCount
|
||||||
|
post /email/batch/pre-send-count (GetPreSendEmailCountRequest) returns (GetPreSendEmailCountResponse)
|
||||||
|
|
||||||
|
@doc "Get batch send email task status"
|
||||||
|
@handler GetBatchSendEmailTaskStatus
|
||||||
|
post /email/batch/status (GetBatchSendEmailTaskStatusRequest) returns (GetBatchSendEmailTaskStatusResponse)
|
||||||
|
|
||||||
|
@doc "Create a quota task"
|
||||||
|
@handler CreateQuotaTask
|
||||||
|
post /quota/create (CreateQuotaTaskRequest)
|
||||||
|
|
||||||
|
@doc "Query quota task pre-count"
|
||||||
|
@handler QueryQuotaTaskPreCount
|
||||||
|
post /quota/pre-count (QueryQuotaTaskPreCountRequest) returns (QueryQuotaTaskPreCountResponse)
|
||||||
|
|
||||||
|
@doc "Query quota task list"
|
||||||
|
@handler QueryQuotaTaskList
|
||||||
|
get /quota/list (QueryQuotaTaskListRequest) returns (QueryQuotaTaskListResponse)
|
||||||
|
}
|
||||||
|
|
||||||
@ -11,104 +11,134 @@ info (
|
|||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
GetNodeServerListRequest {
|
ServerOnlineIP {
|
||||||
Page int `form:"page" validate:"required"`
|
IP string `json:"ip"`
|
||||||
Size int `form:"size" validate:"required"`
|
Protocol string `json:"protocol"`
|
||||||
Tag string `form:"tag,omitempty"`
|
}
|
||||||
GroupId int64 `form:"group_id,omitempty"`
|
ServerOnlineUser {
|
||||||
|
IP []ServerOnlineIP `json:"ip"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Subscribe string `json:"subscribe"`
|
||||||
|
SubscribeId int64 `json:"subscribe_id"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
ExpiredAt int64 `json:"expired_at"`
|
||||||
|
}
|
||||||
|
ServerStatus {
|
||||||
|
Cpu float64 `json:"cpu"`
|
||||||
|
Mem float64 `json:"mem"`
|
||||||
|
Disk float64 `json:"disk"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Online []ServerOnlineUser `json:"online"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
Server {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Country string `json:"country"`
|
||||||
|
City string `json:"city"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Sort int `json:"sort"`
|
||||||
|
Protocols []Protocol `json:"protocols"`
|
||||||
|
LastReportedAt int64 `json:"last_reported_at"`
|
||||||
|
Status ServerStatus `json:"status"`
|
||||||
|
CreatedAt int64 `json:"created_at"`
|
||||||
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
|
}
|
||||||
|
CreateServerRequest {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Country string `json:"country,omitempty"`
|
||||||
|
City string `json:"city,omitempty"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Sort int `json:"sort,omitempty"`
|
||||||
|
Protocols []Protocol `json:"protocols"`
|
||||||
|
}
|
||||||
|
UpdateServerRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Country string `json:"country,omitempty"`
|
||||||
|
City string `json:"city,omitempty"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Sort int `json:"sort,omitempty"`
|
||||||
|
Protocols []Protocol `json:"protocols"`
|
||||||
|
}
|
||||||
|
DeleteServerRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
}
|
||||||
|
FilterServerListRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
Search string `form:"search,omitempty"`
|
Search string `form:"search,omitempty"`
|
||||||
}
|
}
|
||||||
GetNodeServerListResponse {
|
FilterServerListResponse {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
List []Server `json:"list"`
|
List []Server `json:"list"`
|
||||||
}
|
}
|
||||||
UpdateNodeRequest {
|
GetServerProtocolsRequest {
|
||||||
Id int64 `json:"id" validate:"required"`
|
Id int64 `form:"id"`
|
||||||
|
}
|
||||||
|
GetServerProtocolsResponse {
|
||||||
|
Protocols []Protocol `json:"protocols"`
|
||||||
|
}
|
||||||
|
Node {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
Country string `json:"country"`
|
Port uint16 `json:"port"`
|
||||||
City string `json:"city"`
|
Address string `json:"address"`
|
||||||
Name string `json:"name" validate:"required"`
|
ServerId int64 `json:"server_id"`
|
||||||
ServerAddr string `json:"server_addr" validate:"required"`
|
Protocol string `json:"protocol"`
|
||||||
RelayMode string `json:"relay_mode"`
|
Enabled *bool `json:"enabled"`
|
||||||
RelayNode []NodeRelay `json:"relay_node"`
|
Sort int `json:"sort,omitempty"`
|
||||||
SpeedLimit int `json:"speed_limit"`
|
CreatedAt int64 `json:"created_at"`
|
||||||
TrafficRatio float32 `json:"traffic_ratio"`
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
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 {
|
CreateNodeRequest {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags,omitempty"`
|
||||||
Country string `json:"country"`
|
Port uint16 `json:"port"`
|
||||||
City string `json:"city"`
|
Address string `json:"address"`
|
||||||
ServerAddr string `json:"server_addr" validate:"required"`
|
ServerId int64 `json:"server_id"`
|
||||||
RelayMode string `json:"relay_mode"`
|
Protocol string `json:"protocol"`
|
||||||
RelayNode []NodeRelay `json:"relay_node"`
|
Enabled *bool `json:"enabled"`
|
||||||
SpeedLimit int `json:"speed_limit"`
|
}
|
||||||
TrafficRatio float32 `json:"traffic_ratio"`
|
UpdateNodeRequest {
|
||||||
GroupId int64 `json:"group_id"`
|
Id int64 `json:"id"`
|
||||||
Protocol string `json:"protocol" validate:"required"`
|
Name string `json:"name"`
|
||||||
Config interface{} `json:"config" validate:"required"`
|
Tags []string `json:"tags,omitempty"`
|
||||||
|
Port uint16 `json:"port"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
ServerId int64 `json:"server_id"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Enabled *bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
ToggleNodeStatusRequest {
|
||||||
|
Id int64 `json:"id"`
|
||||||
Enable *bool `json:"enable"`
|
Enable *bool `json:"enable"`
|
||||||
Sort int64 `json:"sort"`
|
|
||||||
}
|
}
|
||||||
DeleteNodeRequest {
|
DeleteNodeRequest {
|
||||||
Id int64 `json:"id" validate:"required"`
|
Id int64 `json:"id"`
|
||||||
}
|
}
|
||||||
GetNodeGroupListResponse {
|
FilterNodeListRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
|
Search string `form:"search,omitempty"`
|
||||||
|
}
|
||||||
|
FilterNodeListResponse {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
List []ServerGroup `json:"list"`
|
List []Node `json:"list"`
|
||||||
}
|
}
|
||||||
CreateNodeGroupRequest {
|
HasMigrateSeverNodeResponse {
|
||||||
Name string `json:"name" validate:"required"`
|
HasMigrate bool `json:"has_migrate"`
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
}
|
||||||
UpdateNodeGroupRequest {
|
MigrateServerNodeResponse {
|
||||||
Id int64 `json:"id" validate:"required"`
|
Succee uint64 `json:"succee"`
|
||||||
Name string `json:"name" validate:"required"`
|
Fail uint64 `json:"fail"`
|
||||||
Description string `json:"description"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
DeleteNodeGroupRequest {
|
ResetSortRequest {
|
||||||
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"`
|
Sort []SortItem `json:"sort"`
|
||||||
}
|
}
|
||||||
CreateRuleGroupRequest {
|
QueryNodeTagResponse {
|
||||||
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"`
|
Tags []string `json:"tags"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -119,72 +149,64 @@ type (
|
|||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get node tag list"
|
@doc "Create Server"
|
||||||
@handler GetNodeTagList
|
@handler CreateServer
|
||||||
get /tag/list returns (GetNodeTagListResponse)
|
post /create (CreateServerRequest)
|
||||||
|
|
||||||
@doc "Get node list"
|
@doc "Update Server"
|
||||||
@handler GetNodeList
|
@handler UpdateServer
|
||||||
get /list (GetNodeServerListRequest) returns (GetNodeServerListResponse)
|
post /update (UpdateServerRequest)
|
||||||
|
|
||||||
@doc "Get node detail"
|
@doc "Delete Server"
|
||||||
@handler GetNodeDetail
|
@handler DeleteServer
|
||||||
get /detail (GetNodeDetailRequest) returns (Server)
|
post /delete (DeleteServerRequest)
|
||||||
|
|
||||||
@doc "Update node"
|
@doc "Filter Server List"
|
||||||
@handler UpdateNode
|
@handler FilterServerList
|
||||||
put / (UpdateNodeRequest)
|
get /list (FilterServerListRequest) returns (FilterServerListResponse)
|
||||||
|
|
||||||
@doc "Create node"
|
@doc "Get Server Protocols"
|
||||||
|
@handler GetServerProtocols
|
||||||
|
get /protocols (GetServerProtocolsRequest) returns (GetServerProtocolsResponse)
|
||||||
|
|
||||||
|
@doc "Create Node"
|
||||||
@handler CreateNode
|
@handler CreateNode
|
||||||
post / (CreateNodeRequest)
|
post /node/create (CreateNodeRequest)
|
||||||
|
|
||||||
@doc "Delete node"
|
@doc "Update Node"
|
||||||
|
@handler UpdateNode
|
||||||
|
post /node/update (UpdateNodeRequest)
|
||||||
|
|
||||||
|
@doc "Delete Node"
|
||||||
@handler DeleteNode
|
@handler DeleteNode
|
||||||
delete / (DeleteNodeRequest)
|
post /node/delete (DeleteNodeRequest)
|
||||||
|
|
||||||
@doc "Batch delete node"
|
@doc "Filter Node List"
|
||||||
@handler BatchDeleteNode
|
@handler FilterNodeList
|
||||||
delete /batch (BatchDeleteNodeRequest)
|
get /node/list (FilterNodeListRequest) returns (FilterNodeListResponse)
|
||||||
|
|
||||||
@doc "Get node group list"
|
@doc "Toggle Node Status"
|
||||||
@handler GetNodeGroupList
|
@handler ToggleNodeStatus
|
||||||
get /group/list returns (GetNodeGroupListResponse)
|
post /node/status/toggle (ToggleNodeStatusRequest)
|
||||||
|
|
||||||
@doc "Create node group"
|
@doc "Check if there is any server or node to migrate"
|
||||||
@handler CreateNodeGroup
|
@handler HasMigrateSeverNode
|
||||||
post /group (CreateNodeGroupRequest)
|
get /migrate/has returns (HasMigrateSeverNodeResponse)
|
||||||
|
|
||||||
@doc "Update node group"
|
@doc "Migrate server and node data to new database"
|
||||||
@handler UpdateNodeGroup
|
@handler MigrateServerNode
|
||||||
put /group (UpdateNodeGroupRequest)
|
post /migrate/run returns (MigrateServerNodeResponse)
|
||||||
|
|
||||||
@doc "Delete node group"
|
@doc "Reset server sort"
|
||||||
@handler DeleteNodeGroup
|
@handler ResetSortWithServer
|
||||||
delete /group (DeleteNodeGroupRequest)
|
post /server/sort (ResetSortRequest)
|
||||||
|
|
||||||
@doc "Batch delete node group"
|
@doc "Reset node sort"
|
||||||
@handler BatchDeleteNodeGroup
|
@handler ResetSortWithNode
|
||||||
delete /group/batch (BatchDeleteNodeGroupRequest)
|
post /node/sort (ResetSortRequest)
|
||||||
|
|
||||||
@doc "Node sort "
|
@doc "Query all node tags"
|
||||||
@handler NodeSort
|
@handler QueryNodeTag
|
||||||
post /sort (NodeSortRequest)
|
get /node/tags returns (QueryNodeTagResponse)
|
||||||
|
|
||||||
@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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ type (
|
|||||||
}
|
}
|
||||||
CreateSubscribeRequest {
|
CreateSubscribeRequest {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
|
Language string `json:"language"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
UnitPrice int64 `json:"unit_price"`
|
UnitPrice int64 `json:"unit_price"`
|
||||||
UnitTime string `json:"unit_time"`
|
UnitTime string `json:"unit_time"`
|
||||||
@ -45,9 +46,8 @@ type (
|
|||||||
SpeedLimit int64 `json:"speed_limit"`
|
SpeedLimit int64 `json:"speed_limit"`
|
||||||
DeviceLimit int64 `json:"device_limit"`
|
DeviceLimit int64 `json:"device_limit"`
|
||||||
Quota int64 `json:"quota"`
|
Quota int64 `json:"quota"`
|
||||||
GroupId int64 `json:"group_id"`
|
Nodes []int64 `json:"nodes"`
|
||||||
ServerGroup []int64 `json:"server_group"`
|
NodeTags []string `json:"node_tags"`
|
||||||
Server []int64 `json:"server"`
|
|
||||||
Show *bool `json:"show"`
|
Show *bool `json:"show"`
|
||||||
Sell *bool `json:"sell"`
|
Sell *bool `json:"sell"`
|
||||||
DeductionRatio int64 `json:"deduction_ratio"`
|
DeductionRatio int64 `json:"deduction_ratio"`
|
||||||
@ -58,6 +58,7 @@ type (
|
|||||||
UpdateSubscribeRequest {
|
UpdateSubscribeRequest {
|
||||||
Id int64 `json:"id" validate:"required"`
|
Id int64 `json:"id" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
|
Language string `json:"language"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
UnitPrice int64 `json:"unit_price"`
|
UnitPrice int64 `json:"unit_price"`
|
||||||
UnitTime string `json:"unit_time"`
|
UnitTime string `json:"unit_time"`
|
||||||
@ -68,9 +69,8 @@ type (
|
|||||||
SpeedLimit int64 `json:"speed_limit"`
|
SpeedLimit int64 `json:"speed_limit"`
|
||||||
DeviceLimit int64 `json:"device_limit"`
|
DeviceLimit int64 `json:"device_limit"`
|
||||||
Quota int64 `json:"quota"`
|
Quota int64 `json:"quota"`
|
||||||
GroupId int64 `json:"group_id"`
|
Nodes []int64 `json:"nodes"`
|
||||||
ServerGroup []int64 `json:"server_group"`
|
NodeTags []string `json:"node_tags"`
|
||||||
Server []int64 `json:"server"`
|
|
||||||
Show *bool `json:"show"`
|
Show *bool `json:"show"`
|
||||||
Sell *bool `json:"sell"`
|
Sell *bool `json:"sell"`
|
||||||
Sort int64 `json:"sort"`
|
Sort int64 `json:"sort"`
|
||||||
@ -85,16 +85,13 @@ type (
|
|||||||
GetSubscribeListRequest {
|
GetSubscribeListRequest {
|
||||||
Page int64 `form:"page" validate:"required"`
|
Page int64 `form:"page" validate:"required"`
|
||||||
Size int64 `form:"size" validate:"required"`
|
Size int64 `form:"size" validate:"required"`
|
||||||
GroupId int64 `form:"group_id,omitempty"`
|
Language string `form:"language,omitempty"`
|
||||||
Search string `form:"search,omitempty"`
|
Search string `form:"search,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
SubscribeItem {
|
SubscribeItem {
|
||||||
Subscribe
|
Subscribe
|
||||||
|
|
||||||
Sold int64 `json:"sold"`
|
Sold int64 `json:"sold"`
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSubscribeListResponse {
|
GetSubscribeListResponse {
|
||||||
List []SubscribeItem `json:"list"`
|
List []SubscribeItem `json:"list"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
|
|||||||
@ -11,50 +11,6 @@ info (
|
|||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
type (
|
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 {
|
GetNodeMultiplierResponse {
|
||||||
Periods []TimePeriod `json:"periods"`
|
Periods []TimePeriod `json:"periods"`
|
||||||
}
|
}
|
||||||
@ -62,6 +18,10 @@ type (
|
|||||||
SetNodeMultiplierRequest {
|
SetNodeMultiplierRequest {
|
||||||
Periods []TimePeriod `json:"periods"`
|
Periods []TimePeriod `json:"periods"`
|
||||||
}
|
}
|
||||||
|
PreViewNodeMultiplierResponse {
|
||||||
|
CurrentTime string `json:"current_time"`
|
||||||
|
Ratio float32 `json:"ratio"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
@ -86,46 +46,6 @@ service ppanel {
|
|||||||
@handler UpdateSubscribeConfig
|
@handler UpdateSubscribeConfig
|
||||||
put /subscribe_config (SubscribeConfig)
|
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"
|
@doc "Get register config"
|
||||||
@handler GetRegisterConfig
|
@handler GetRegisterConfig
|
||||||
get /register_config returns (RegisterConfig)
|
get /register_config returns (RegisterConfig)
|
||||||
@ -201,5 +121,9 @@ service ppanel {
|
|||||||
@doc "Update Verify Code Config"
|
@doc "Update Verify Code Config"
|
||||||
@handler UpdateVerifyCodeConfig
|
@handler UpdateVerifyCodeConfig
|
||||||
put /verify_code_config (VerifyCodeConfig)
|
put /verify_code_config (VerifyCodeConfig)
|
||||||
|
|
||||||
|
@doc "PreView Node Multiplier"
|
||||||
|
@handler PreViewNodeMultiplier
|
||||||
|
get /node_multiplier/preview returns (PreViewNodeMultiplierResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "Tools Api"
|
title: "Tools Api"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
@ -14,6 +14,9 @@ type (
|
|||||||
LogResponse {
|
LogResponse {
|
||||||
List interface{} `json:"list"`
|
List interface{} `json:"list"`
|
||||||
}
|
}
|
||||||
|
VersionResponse {
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
@ -21,7 +24,6 @@ type (
|
|||||||
group: admin/tool
|
group: admin/tool
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware
|
||||||
)
|
)
|
||||||
|
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get System Log"
|
@doc "Get System Log"
|
||||||
@handler GetSystemLog
|
@handler GetSystemLog
|
||||||
@ -30,4 +32,9 @@ service ppanel {
|
|||||||
@doc "Restart System"
|
@doc "Restart System"
|
||||||
@handler RestartSystem
|
@handler RestartSystem
|
||||||
get /restart
|
get /restart
|
||||||
|
|
||||||
|
@doc "Get Version"
|
||||||
|
@handler GetVersion
|
||||||
|
get /version returns (VersionResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,8 @@ type (
|
|||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
Balance int64 `json:"balance"`
|
Balance int64 `json:"balance"`
|
||||||
Commission int64 `json:"commission"`
|
Commission int64 `json:"commission"`
|
||||||
|
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||||
|
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||||
GiftAmount int64 `json:"gift_amount"`
|
GiftAmount int64 `json:"gift_amount"`
|
||||||
Telegram int64 `json:"telegram"`
|
Telegram int64 `json:"telegram"`
|
||||||
ReferCode string `json:"refer_code"`
|
ReferCode string `json:"refer_code"`
|
||||||
@ -58,6 +60,8 @@ type (
|
|||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
ProductId int64 `json:"product_id"`
|
ProductId int64 `json:"product_id"`
|
||||||
Duration int64 `json:"duration"`
|
Duration int64 `json:"duration"`
|
||||||
|
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||||
|
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||||
RefererUser string `json:"referer_user"`
|
RefererUser string `json:"referer_user"`
|
||||||
ReferCode string `json:"refer_code"`
|
ReferCode string `json:"refer_code"`
|
||||||
Balance int64 `json:"balance"`
|
Balance int64 `json:"balance"`
|
||||||
@ -164,6 +168,15 @@ type (
|
|||||||
List []UserLoginLog `json:"list"`
|
List []UserLoginLog `json:"list"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
GetUserSubscribeResetTrafficLogsRequest {
|
||||||
|
Page int `form:"page"`
|
||||||
|
Size int `form:"size"`
|
||||||
|
UserSubscribeId int64 `form:"user_subscribe_id"`
|
||||||
|
}
|
||||||
|
GetUserSubscribeResetTrafficLogsResponse {
|
||||||
|
List []ResetSubscribeTrafficLog `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
DeleteUserSubscribeRequest {
|
DeleteUserSubscribeRequest {
|
||||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||||
}
|
}
|
||||||
@ -251,6 +264,10 @@ service ppanel {
|
|||||||
@handler GetUserSubscribeLogs
|
@handler GetUserSubscribeLogs
|
||||||
get /subscribe/logs (GetUserSubscribeLogsRequest) returns (GetUserSubscribeLogsResponse)
|
get /subscribe/logs (GetUserSubscribeLogsRequest) returns (GetUserSubscribeLogsResponse)
|
||||||
|
|
||||||
|
@doc "Get user subcribe reset traffic logs"
|
||||||
|
@handler GetUserSubscribeResetTrafficLogs
|
||||||
|
get /subscribe/reset/logs (GetUserSubscribeResetTrafficLogsRequest) returns (GetUserSubscribeResetTrafficLogsResponse)
|
||||||
|
|
||||||
@doc "Get user subcribe traffic logs"
|
@doc "Get user subcribe traffic logs"
|
||||||
@handler GetUserSubscribeTrafficLogs
|
@handler GetUserSubscribeTrafficLogs
|
||||||
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
|
get /subscribe/traffic_logs (GetUserSubscribeTrafficLogsRequest) returns (GetUserSubscribeTrafficLogsResponse)
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
@ -11,10 +11,12 @@ info (
|
|||||||
type (
|
type (
|
||||||
// User login request
|
// User login request
|
||||||
UserLoginRequest {
|
UserLoginRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
UserAgent string `header:"User-Agent"`
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
// Check user is exist request
|
// Check user is exist request
|
||||||
@ -23,25 +25,29 @@ type (
|
|||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
CheckUserResponse {
|
CheckUserResponse {
|
||||||
exist bool `json:"exist"`
|
Exist bool `json:"exist"`
|
||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
UserRegisterRequest {
|
UserRegisterRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Invite string `json:"invite,optional"`
|
Invite string `json:"invite,optional"`
|
||||||
Code string `json:"code,optional"`
|
Code string `json:"code,optional"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
UserAgent string `header:"User-Agent"`
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
ResetPasswordRequest {
|
ResetPasswordRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Code string `json:"code,optional"`
|
Code string `json:"code,optional"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
UserAgent string `header:"User-Agent"`
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
LoginResponse {
|
LoginResponse {
|
||||||
@ -54,19 +60,20 @@ type (
|
|||||||
OAuthLoginResponse {
|
OAuthLoginResponse {
|
||||||
Redirect string `json:"redirect"`
|
Redirect string `json:"redirect"`
|
||||||
}
|
}
|
||||||
|
|
||||||
OAuthLoginGetTokenRequest {
|
OAuthLoginGetTokenRequest {
|
||||||
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
|
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
|
||||||
Callback interface{} `json:"callback" validate:"required"`
|
Callback interface{} `json:"callback" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// login request
|
// login request
|
||||||
TelephoneLoginRequest {
|
TelephoneLoginRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Telephone string `json:"telephone" validate:"required"`
|
Telephone string `json:"telephone" validate:"required"`
|
||||||
TelephoneCode string `json:"telephone_code"`
|
TelephoneCode string `json:"telephone_code"`
|
||||||
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
// Check user is exist request
|
// Check user is exist request
|
||||||
@ -76,25 +83,31 @@ type (
|
|||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
TelephoneCheckUserResponse {
|
TelephoneCheckUserResponse {
|
||||||
exist bool `json:"exist"`
|
Exist bool `json:"exist"`
|
||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
TelephoneRegisterRequest {
|
TelephoneRegisterRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Telephone string `json:"telephone" validate:"required"`
|
Telephone string `json:"telephone" validate:"required"`
|
||||||
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Invite string `json:"invite,optional"`
|
Invite string `json:"invite,optional"`
|
||||||
Code string `json:"code,optional"`
|
Code string `json:"code,optional"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type,optional"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
// User login response
|
// User login response
|
||||||
TelephoneResetPasswordRequest {
|
TelephoneResetPasswordRequest {
|
||||||
|
Identifier string `json:"identifier"`
|
||||||
Telephone string `json:"telephone" validate:"required"`
|
Telephone string `json:"telephone" validate:"required"`
|
||||||
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Code string `json:"code,optional"`
|
Code string `json:"code,optional"`
|
||||||
IP string `header:"X-Original-Forwarded-For"`
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
|
UserAgent string `header:"User-Agent"`
|
||||||
|
LoginType string `header:"Login-Type,optional"`
|
||||||
CfToken string `json:"cf_token,optional"`
|
CfToken string `json:"cf_token,optional"`
|
||||||
}
|
}
|
||||||
AppleLoginCallbackRequest {
|
AppleLoginCallbackRequest {
|
||||||
@ -106,11 +119,18 @@ type (
|
|||||||
Code string `form:"code"`
|
Code string `form:"code"`
|
||||||
State string `form:"state"`
|
State string `form:"state"`
|
||||||
}
|
}
|
||||||
|
DeviceLoginRequest {
|
||||||
|
Identifier string `json:"identifier" validate:"required"`
|
||||||
|
IP string `header:"X-Original-Forwarded-For"`
|
||||||
|
UserAgent string `json:"user_agent" validate:"required"`
|
||||||
|
CfToken string `json:"cf_token,optional"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/auth
|
prefix: v1/auth
|
||||||
group: auth
|
group: auth
|
||||||
|
middleware: DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "User login"
|
@doc "User login"
|
||||||
@ -144,6 +164,10 @@ service ppanel {
|
|||||||
@doc "Reset password"
|
@doc "Reset password"
|
||||||
@handler TelephoneResetPassword
|
@handler TelephoneResetPassword
|
||||||
post /reset/telephone (TelephoneResetPasswordRequest) returns (LoginResponse)
|
post /reset/telephone (TelephoneResetPasswordRequest) returns (LoginResponse)
|
||||||
|
|
||||||
|
@doc "Device Login"
|
||||||
|
@handler DeviceLogin
|
||||||
|
post /login/device (DeviceLoginRequest) returns (LoginResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
|
|||||||
@ -35,10 +35,6 @@ type (
|
|||||||
GetTosResponse {
|
GetTosResponse {
|
||||||
TosContent string `json:"tos_content"`
|
TosContent string `json:"tos_content"`
|
||||||
}
|
}
|
||||||
GetAppcationResponse {
|
|
||||||
Config ApplicationConfig `json:"config"`
|
|
||||||
Applications []ApplicationResponseInfo `json:"applications"`
|
|
||||||
}
|
|
||||||
// GetCodeRequest Get code request
|
// GetCodeRequest Get code request
|
||||||
SendCodeRequest {
|
SendCodeRequest {
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
@ -75,25 +71,34 @@ type (
|
|||||||
Code string `json:"code" validate:"required"`
|
Code string `json:"code" validate:"required"`
|
||||||
Type uint8 `json:"type" validate:"required"`
|
Type uint8 `json:"type" validate:"required"`
|
||||||
}
|
}
|
||||||
|
CheckVerificationCodeRespone {
|
||||||
CheckVerificationCodeRespone{
|
|
||||||
Status bool `json:"status"`
|
Status bool `json:"status"`
|
||||||
}
|
}
|
||||||
|
SubscribeClient {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Icon string `json:"icon,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
IsDefault bool `json:"is_default"`
|
||||||
|
DownloadLink DownloadLink `json:"download_link,omitempty"`
|
||||||
|
}
|
||||||
|
GetSubscribeClientResponse {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []SubscribeClient `json:"list"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/common
|
prefix: v1/common
|
||||||
group: common
|
group: common
|
||||||
|
middleware: DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get global config"
|
@doc "Get global config"
|
||||||
@handler GetGlobalConfig
|
@handler GetGlobalConfig
|
||||||
get /site/config returns (GetGlobalConfigResponse)
|
get /site/config returns (GetGlobalConfigResponse)
|
||||||
|
|
||||||
@doc "Get Tos Content"
|
|
||||||
@handler GetApplication
|
|
||||||
get /application returns (GetAppcationResponse)
|
|
||||||
|
|
||||||
@doc "Get Tos Content"
|
@doc "Get Tos Content"
|
||||||
@handler GetTos
|
@handler GetTos
|
||||||
get /site/tos returns (GetTosResponse)
|
get /site/tos returns (GetTosResponse)
|
||||||
@ -121,5 +126,9 @@ service ppanel {
|
|||||||
@doc "Check verification code"
|
@doc "Check verification code"
|
||||||
@handler CheckVerificationCode
|
@handler CheckVerificationCode
|
||||||
post /check_verification_code (CheckVerificationCodeRequest) returns (CheckVerificationCodeRespone)
|
post /check_verification_code (CheckVerificationCodeRequest) returns (CheckVerificationCodeRespone)
|
||||||
|
|
||||||
|
@doc "Get Client"
|
||||||
|
@handler GetClient
|
||||||
|
get /client returns (GetSubscribeClientResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,10 @@ info (
|
|||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
OnlineUser {
|
||||||
|
SID int64 `json:"uid"`
|
||||||
|
IP string `json:"ip"`
|
||||||
|
}
|
||||||
ShadowsocksProtocol {
|
ShadowsocksProtocol {
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
Method string `json:"method"`
|
Method string `json:"method"`
|
||||||
@ -78,7 +82,6 @@ type (
|
|||||||
ServerCommon
|
ServerCommon
|
||||||
Traffic []UserTraffic `json:"traffic"`
|
Traffic []UserTraffic `json:"traffic"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPushStatusRequest {
|
ServerPushStatusRequest {
|
||||||
ServerCommon
|
ServerCommon
|
||||||
Cpu float64 `json:"cpu"`
|
Cpu float64 `json:"cpu"`
|
||||||
@ -90,6 +93,20 @@ type (
|
|||||||
ServerCommon
|
ServerCommon
|
||||||
Users []OnlineUser `json:"users"`
|
Users []OnlineUser `json:"users"`
|
||||||
}
|
}
|
||||||
|
QueryServerConfigRequest {
|
||||||
|
ServerID int64 `path:"server_id"`
|
||||||
|
SecretKey string `form:"secret_key"`
|
||||||
|
Protocols []string `form:"protocols,omitempty"`
|
||||||
|
}
|
||||||
|
QueryServerConfigResponse {
|
||||||
|
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||||
|
IPStrategy string `json:"ip_strategy"`
|
||||||
|
DNS []NodeDNS `json:"dns"`
|
||||||
|
Block []string `json:"block"`
|
||||||
|
Outbound []NodeOutbound `json:"outbound"`
|
||||||
|
Protocols []Protocol `json:"protocols"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
@ -119,3 +136,13 @@ service ppanel {
|
|||||||
post /online (OnlineUsersRequest)
|
post /online (OnlineUsersRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: v2/server
|
||||||
|
group: server
|
||||||
|
)
|
||||||
|
service ppanel {
|
||||||
|
@doc "Get Server Protocol Config"
|
||||||
|
@handler QueryServerProtocolConfig
|
||||||
|
get /:server_id (QueryServerConfigRequest) returns (QueryServerConfigResponse)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,10 @@ info (
|
|||||||
|
|
||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/public/announcement
|
prefix: v1/public/announcement
|
||||||
group: public/announcement
|
group: public/announcement
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Query announcement"
|
@doc "Query announcement"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "Document API"
|
title: "Document API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
@ -10,13 +10,11 @@ info(
|
|||||||
|
|
||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/public/document
|
prefix: v1/public/document
|
||||||
group: public/document
|
group: public/document
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
|
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get document list"
|
@doc "Get document list"
|
||||||
@handler QueryDocumentList
|
@handler QueryDocumentList
|
||||||
@ -26,3 +24,4 @@ service ppanel {
|
|||||||
@handler QueryDocumentDetail
|
@handler QueryDocumentDetail
|
||||||
get /detail (QueryDocumentDetailRequest) returns (Document)
|
get /detail (QueryDocumentDetailRequest) returns (Document)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import "../types.api"
|
|||||||
@server (
|
@server (
|
||||||
prefix: v1/public/order
|
prefix: v1/public/order
|
||||||
group: public/order
|
group: public/order
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Pre create order"
|
@doc "Pre create order"
|
||||||
|
|||||||
@ -10,11 +10,10 @@ info (
|
|||||||
|
|
||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/public/payment
|
prefix: v1/public/payment
|
||||||
group: public/payment
|
group: public/payment
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get available payment methods"
|
@doc "Get available payment methods"
|
||||||
|
|||||||
@ -19,11 +19,15 @@ type (
|
|||||||
SubscribeId int64 `json:"subscribe_id"`
|
SubscribeId int64 `json:"subscribe_id"`
|
||||||
Quantity int64 `json:"quantity"`
|
Quantity int64 `json:"quantity"`
|
||||||
Coupon string `json:"coupon,omitempty"`
|
Coupon string `json:"coupon,omitempty"`
|
||||||
|
InviteCode string `json:"invite_code,omitempty"`
|
||||||
TurnstileToken string `json:"turnstile_token,omitempty"`
|
TurnstileToken string `json:"turnstile_token,omitempty"`
|
||||||
}
|
}
|
||||||
PortalPurchaseResponse {
|
PortalPurchaseResponse {
|
||||||
OrderNo string `json:"order_no"`
|
OrderNo string `json:"order_no"`
|
||||||
}
|
}
|
||||||
|
GetSubscriptionRequest {
|
||||||
|
Language string `form:"language"`
|
||||||
|
}
|
||||||
GetSubscriptionResponse {
|
GetSubscriptionResponse {
|
||||||
List []Subscribe `json:"list"`
|
List []Subscribe `json:"list"`
|
||||||
}
|
}
|
||||||
@ -66,6 +70,7 @@ type (
|
|||||||
@server (
|
@server (
|
||||||
prefix: v1/public/portal
|
prefix: v1/public/portal
|
||||||
group: public/portal
|
group: public/portal
|
||||||
|
middleware: DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get available payment methods"
|
@doc "Get available payment methods"
|
||||||
@ -74,7 +79,7 @@ service ppanel {
|
|||||||
|
|
||||||
@doc "Get Subscription"
|
@doc "Get Subscription"
|
||||||
@handler GetSubscription
|
@handler GetSubscription
|
||||||
get /subscribe returns (GetSubscriptionResponse)
|
get /subscribe (GetSubscriptionRequest) returns (GetSubscriptionResponse)
|
||||||
|
|
||||||
@doc "Pre Purchase Order"
|
@doc "Pre Purchase Order"
|
||||||
@handler PrePurchaseOrder
|
@handler PrePurchaseOrder
|
||||||
|
|||||||
@ -10,22 +10,20 @@ info (
|
|||||||
|
|
||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
|
type (
|
||||||
|
QuerySubscribeListRequest {
|
||||||
|
Language string `form:"language"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/public/subscribe
|
prefix: v1/public/subscribe
|
||||||
group: public/subscribe
|
group: public/subscribe
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get subscribe list"
|
@doc "Get subscribe list"
|
||||||
@handler QuerySubscribeList
|
@handler QuerySubscribeList
|
||||||
get /list returns (QuerySubscribeListResponse)
|
get /list (QuerySubscribeListRequest) 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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@ info (
|
|||||||
import "../types.api"
|
import "../types.api"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
||||||
GetUserTicketListResponse {
|
GetUserTicketListResponse {
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
List []Ticket `json:"list"`
|
List []Ticket `json:"list"`
|
||||||
@ -44,7 +43,7 @@ type (
|
|||||||
@server (
|
@server (
|
||||||
prefix: v1/public/ticket
|
prefix: v1/public/ticket
|
||||||
group: public/ticket
|
group: public/ticket
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Get ticket list"
|
@doc "Get ticket list"
|
||||||
|
|||||||
@ -25,17 +25,9 @@ type (
|
|||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
QueryUserBalanceLogListResponse {
|
QueryUserBalanceLogListResponse {
|
||||||
List []UserBalanceLog `json:"list"`
|
List []BalanceLog `json:"list"`
|
||||||
Total int64 `json:"total"`
|
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 {
|
QueryUserCommissionLogListRequest {
|
||||||
Page int `form:"page"`
|
Page int `form:"page"`
|
||||||
Size int `form:"size"`
|
Size int `form:"size"`
|
||||||
@ -77,47 +69,49 @@ type (
|
|||||||
ResetUserSubscribeTokenRequest {
|
ResetUserSubscribeTokenRequest {
|
||||||
UserSubscribeId int64 `json:"user_subscribe_id"`
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLoginLogRequest {
|
GetLoginLogRequest {
|
||||||
Page int `form:"page"`
|
Page int `form:"page"`
|
||||||
Size int `form:"size"`
|
Size int `form:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
GetLoginLogResponse {
|
GetLoginLogResponse {
|
||||||
List []UserLoginLog `json:"list"`
|
List []UserLoginLog `json:"list"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSubscribeLogRequest {
|
GetSubscribeLogRequest {
|
||||||
Page int `form:"page"`
|
Page int `form:"page"`
|
||||||
Size int `form:"size"`
|
Size int `form:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSubscribeLogResponse {
|
GetSubscribeLogResponse {
|
||||||
List []UserSubscribeLog `json:"list"`
|
List []UserSubscribeLog `json:"list"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
UpdateBindMobileRequest {
|
||||||
UpdateBindMobileRequest{
|
|
||||||
AreaCode string `json:"area_code" validate:"required"`
|
AreaCode string `json:"area_code" validate:"required"`
|
||||||
Mobile string `json:"mobile" validate:"required"`
|
Mobile string `json:"mobile" validate:"required"`
|
||||||
Code string `json:"code" validate:"required"`
|
Code string `json:"code" validate:"required"`
|
||||||
}
|
}
|
||||||
|
UpdateBindEmailRequest {
|
||||||
UpdateBindEmailRequest{
|
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
VerifyEmailRequest {
|
VerifyEmailRequest {
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
Code string `json:"code" validate:"required"`
|
Code string `json:"code" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetDeviceListResponse {
|
||||||
|
List []UserDevice `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UnbindDeviceRequest {
|
||||||
|
Id int64 `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
prefix: v1/public/user
|
prefix: v1/public/user
|
||||||
group: public/user
|
group: public/user
|
||||||
middleware: AuthMiddleware
|
middleware: AuthMiddleware,DeviceMiddleware
|
||||||
)
|
)
|
||||||
service ppanel {
|
service ppanel {
|
||||||
@doc "Query User Info"
|
@doc "Query User Info"
|
||||||
@ -207,5 +201,13 @@ service ppanel {
|
|||||||
@doc "Update Bind Email"
|
@doc "Update Bind Email"
|
||||||
@handler UpdateBindEmail
|
@handler UpdateBindEmail
|
||||||
put /bind_email (UpdateBindEmailRequest)
|
put /bind_email (UpdateBindEmailRequest)
|
||||||
|
|
||||||
|
@doc "Get Device List"
|
||||||
|
@handler GetDeviceList
|
||||||
|
get /devices returns (GetDeviceListResponse)
|
||||||
|
|
||||||
|
@doc "Unbind Device"
|
||||||
|
@handler UnbindDevice
|
||||||
|
put /unbind_device (UnbindDeviceRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "admin API"
|
title: "admin API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
email: "tension@ppanel.com"
|
email: "tension@ppanel.com"
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./admin/system.api"
|
"./admin/system.api"
|
||||||
"./admin/user.api"
|
"./admin/user.api"
|
||||||
@ -23,4 +24,7 @@ import (
|
|||||||
"./admin/auth.api"
|
"./admin/auth.api"
|
||||||
"./admin/log.api"
|
"./admin/log.api"
|
||||||
"./admin/ads.api"
|
"./admin/ads.api"
|
||||||
|
"./admin/marketing.api"
|
||||||
|
"./admin/application.api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
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"
|
|
||||||
)
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "common API"
|
title: "common API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
@ -12,3 +12,4 @@ import (
|
|||||||
"./common.api"
|
"./common.api"
|
||||||
"./auth/auth.api"
|
"./auth/auth.api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "Node API"
|
title: "Node API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
syntax = "v1"
|
syntax = "v1"
|
||||||
|
|
||||||
info(
|
info (
|
||||||
title: "User API"
|
title: "User API"
|
||||||
desc: "API for ppanel"
|
desc: "API for ppanel"
|
||||||
author: "Tension"
|
author: "Tension"
|
||||||
email: "tension@ppanel.com"
|
email: "tension@ppanel.com"
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./public/user.api"
|
"./public/user.api"
|
||||||
"./public/subscribe.api"
|
"./public/subscribe.api"
|
||||||
@ -17,3 +18,4 @@ import (
|
|||||||
"./public/document.api"
|
"./public/document.api"
|
||||||
"./public/portal.api"
|
"./public/portal.api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
227
apis/types.api
227
apis/types.api
@ -14,6 +14,8 @@ type (
|
|||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
Balance int64 `json:"balance"`
|
Balance int64 `json:"balance"`
|
||||||
Commission int64 `json:"commission"`
|
Commission int64 `json:"commission"`
|
||||||
|
ReferralPercentage uint8 `json:"referral_percentage"`
|
||||||
|
OnlyFirstPurchase bool `json:"only_first_purchase"`
|
||||||
GiftAmount int64 `json:"gift_amount"`
|
GiftAmount int64 `json:"gift_amount"`
|
||||||
Telegram int64 `json:"telegram"`
|
Telegram int64 `json:"telegram"`
|
||||||
ReferCode string `json:"refer_code"`
|
ReferCode string `json:"refer_code"`
|
||||||
@ -63,6 +65,8 @@ type (
|
|||||||
SubscribePath string `json:"subscribe_path"`
|
SubscribePath string `json:"subscribe_path"`
|
||||||
SubscribeDomain string `json:"subscribe_domain"`
|
SubscribeDomain string `json:"subscribe_domain"`
|
||||||
PanDomain bool `json:"pan_domain"`
|
PanDomain bool `json:"pan_domain"`
|
||||||
|
UserAgentLimit bool `json:"user_agent_limit"`
|
||||||
|
UserAgentList string `json:"user_agent_list"`
|
||||||
}
|
}
|
||||||
VerifyCodeConfig {
|
VerifyCodeConfig {
|
||||||
VerifyCodeExpireTime int64 `json:"verify_code_expire_time"`
|
VerifyCodeExpireTime int64 `json:"verify_code_expire_time"`
|
||||||
@ -111,6 +115,7 @@ type (
|
|||||||
AuthConfig {
|
AuthConfig {
|
||||||
Mobile MobileAuthenticateConfig `json:"mobile"`
|
Mobile MobileAuthenticateConfig `json:"mobile"`
|
||||||
Email EmailAuthticateConfig `json:"email"`
|
Email EmailAuthticateConfig `json:"email"`
|
||||||
|
Device DeviceAuthticateConfig `json:"device"`
|
||||||
Register PubilcRegisterConfig `json:"register"`
|
Register PubilcRegisterConfig `json:"register"`
|
||||||
}
|
}
|
||||||
PubilcRegisterConfig {
|
PubilcRegisterConfig {
|
||||||
@ -130,6 +135,14 @@ type (
|
|||||||
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
||||||
DomainSuffixList string `json:"domain_suffix_list"`
|
DomainSuffixList string `json:"domain_suffix_list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceAuthticateConfig {
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
ShowAds bool `json:"show_ads"`
|
||||||
|
EnableSecurity bool `json:"enable_security"`
|
||||||
|
OnlyRealDevice bool `json:"only_real_device"`
|
||||||
|
}
|
||||||
|
|
||||||
RegisterConfig {
|
RegisterConfig {
|
||||||
StopRegister bool `json:"stop_register"`
|
StopRegister bool `json:"stop_register"`
|
||||||
EnableTrial bool `json:"enable_trial"`
|
EnableTrial bool `json:"enable_trial"`
|
||||||
@ -151,6 +164,24 @@ type (
|
|||||||
NodeSecret string `json:"node_secret"`
|
NodeSecret string `json:"node_secret"`
|
||||||
NodePullInterval int64 `json:"node_pull_interval"`
|
NodePullInterval int64 `json:"node_pull_interval"`
|
||||||
NodePushInterval int64 `json:"node_push_interval"`
|
NodePushInterval int64 `json:"node_push_interval"`
|
||||||
|
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||||
|
IPStrategy string `json:"ip_strategy"`
|
||||||
|
DNS []NodeDNS `json:"dns"`
|
||||||
|
Block []string `json:"block"`
|
||||||
|
Outbound []NodeOutbound `json:"outbound"`
|
||||||
|
}
|
||||||
|
NodeDNS {
|
||||||
|
Proto string `json:"proto"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Domains []string `json:"domains"`
|
||||||
|
}
|
||||||
|
NodeOutbound {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int64 `json:"port"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Rules []string `json:"rules"`
|
||||||
}
|
}
|
||||||
InviteConfig {
|
InviteConfig {
|
||||||
ForcedInvite bool `json:"forced_invite"`
|
ForcedInvite bool `json:"forced_invite"`
|
||||||
@ -181,6 +212,7 @@ type (
|
|||||||
Subscribe {
|
Subscribe {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Language string `json:"language"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
UnitPrice int64 `json:"unit_price"`
|
UnitPrice int64 `json:"unit_price"`
|
||||||
UnitTime string `json:"unit_time"`
|
UnitTime string `json:"unit_time"`
|
||||||
@ -191,9 +223,8 @@ type (
|
|||||||
SpeedLimit int64 `json:"speed_limit"`
|
SpeedLimit int64 `json:"speed_limit"`
|
||||||
DeviceLimit int64 `json:"device_limit"`
|
DeviceLimit int64 `json:"device_limit"`
|
||||||
Quota int64 `json:"quota"`
|
Quota int64 `json:"quota"`
|
||||||
GroupId int64 `json:"group_id"`
|
Nodes []int64 `json:"nodes"`
|
||||||
ServerGroup []int64 `json:"server_group"`
|
NodeTags []string `json:"node_tags"`
|
||||||
Server []int64 `json:"server"`
|
|
||||||
Show bool `json:"show"`
|
Show bool `json:"show"`
|
||||||
Sell bool `json:"sell"`
|
Sell bool `json:"sell"`
|
||||||
Sort int64 `json:"sort"`
|
Sort int64 `json:"sort"`
|
||||||
@ -246,6 +277,14 @@ type (
|
|||||||
SecurityConfig SecurityConfig `json:"security_config"`
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
}
|
}
|
||||||
Tuic {
|
Tuic {
|
||||||
|
Port int `json:"port" validate:"required"`
|
||||||
|
DisableSNI bool `json:"disable_sni"`
|
||||||
|
ReduceRtt bool `json:"reduce_rtt"`
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode"`
|
||||||
|
CongestionController string `json:"congestion_controller"`
|
||||||
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
|
}
|
||||||
|
AnyTLS {
|
||||||
Port int `json:"port" validate:"required"`
|
Port int `json:"port" validate:"required"`
|
||||||
SecurityConfig SecurityConfig `json:"security_config"`
|
SecurityConfig SecurityConfig `json:"security_config"`
|
||||||
}
|
}
|
||||||
@ -264,37 +303,37 @@ type (
|
|||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
ServiceName string `json:"service_name"`
|
ServiceName string `json:"service_name"`
|
||||||
}
|
}
|
||||||
Server {
|
// Server {
|
||||||
Id int64 `json:"id"`
|
// Id int64 `json:"id"`
|
||||||
Tags []string `json:"tags"`
|
// Tags []string `json:"tags"`
|
||||||
Country string `json:"country"`
|
// Country string `json:"country"`
|
||||||
City string `json:"city"`
|
// City string `json:"city"`
|
||||||
Name string `json:"name"`
|
// Name string `json:"name"`
|
||||||
ServerAddr string `json:"server_addr"`
|
// ServerAddr string `json:"server_addr"`
|
||||||
RelayMode string `json:"relay_mode"`
|
// RelayMode string `json:"relay_mode"`
|
||||||
RelayNode []NodeRelay `json:"relay_node"`
|
// RelayNode []NodeRelay `json:"relay_node"`
|
||||||
SpeedLimit int `json:"speed_limit"`
|
// SpeedLimit int `json:"speed_limit"`
|
||||||
TrafficRatio float32 `json:"traffic_ratio"`
|
// TrafficRatio float32 `json:"traffic_ratio"`
|
||||||
GroupId int64 `json:"group_id"`
|
// GroupId int64 `json:"group_id"`
|
||||||
Protocol string `json:"protocol"`
|
// Protocol string `json:"protocol"`
|
||||||
Config interface{} `json:"config"`
|
// Config interface{} `json:"config"`
|
||||||
Enable *bool `json:"enable"`
|
// Enable *bool `json:"enable"`
|
||||||
CreatedAt int64 `json:"created_at"`
|
// CreatedAt int64 `json:"created_at"`
|
||||||
UpdatedAt int64 `json:"updated_at"`
|
// UpdatedAt int64 `json:"updated_at"`
|
||||||
Status *NodeStatus `json:"status"`
|
// Status *NodeStatus `json:"status"`
|
||||||
Sort int64 `json:"sort"`
|
// Sort int64 `json:"sort"`
|
||||||
}
|
// }
|
||||||
OnlineUser {
|
// OnlineUser {
|
||||||
SID int64 `json:"uid"`
|
// SID int64 `json:"uid"`
|
||||||
IP string `json:"ip"`
|
// IP string `json:"ip"`
|
||||||
}
|
// }
|
||||||
NodeStatus {
|
// NodeStatus {
|
||||||
Online interface{} `json:"online"`
|
// Online interface{} `json:"online"`
|
||||||
Cpu float64 `json:"cpu"`
|
// Cpu float64 `json:"cpu"`
|
||||||
Mem float64 `json:"mem"`
|
// Mem float64 `json:"mem"`
|
||||||
Disk float64 `json:"disk"`
|
// Disk float64 `json:"disk"`
|
||||||
UpdatedAt int64 `json:"updated_at"`
|
// UpdatedAt int64 `json:"updated_at"`
|
||||||
}
|
// }
|
||||||
ServerGroup {
|
ServerGroup {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -436,15 +475,6 @@ type (
|
|||||||
CreatedAt int64 `json:"created_at"`
|
CreatedAt int64 `json:"created_at"`
|
||||||
UpdatedAt int64 `json:"updated_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 {
|
UserAffiliate {
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
Identifier string `json:"identifier"`
|
Identifier string `json:"identifier"`
|
||||||
@ -465,14 +495,6 @@ type (
|
|||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
Prefix string `json:"prefix"`
|
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 {
|
UserDevice {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Ip string `json:"ip"`
|
Ip string `json:"ip"`
|
||||||
@ -507,9 +529,11 @@ type (
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Icon string `json:"icon"`
|
Icon string `json:"icon"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
|
Type string `json:"type"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
Rules string `json:"rules"`
|
Rules string `json:"rules"`
|
||||||
Enable bool `json:"enable"`
|
Enable bool `json:"enable"`
|
||||||
|
Default bool `json:"default"`
|
||||||
CreatedAt int64 `json:"created_at"`
|
CreatedAt int64 `json:"created_at"`
|
||||||
UpdatedAt int64 `json:"updated_at"`
|
UpdatedAt int64 `json:"updated_at"`
|
||||||
}
|
}
|
||||||
@ -520,7 +544,7 @@ type (
|
|||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
IP string `json:"ip"`
|
IP string `json:"ip"`
|
||||||
UserAgent string `json:"user_agent"`
|
UserAgent string `json:"user_agent"`
|
||||||
CreatedAt int64 `json:"created_at"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
}
|
}
|
||||||
UserLoginLog {
|
UserLoginLog {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
@ -528,18 +552,17 @@ type (
|
|||||||
LoginIP string `json:"login_ip"`
|
LoginIP string `json:"login_ip"`
|
||||||
UserAgent string `json:"user_agent"`
|
UserAgent string `json:"user_agent"`
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
CreatedAt int64 `json:"created_at"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
}
|
}
|
||||||
MessageLog {
|
MessageLog {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Type string `json:"type"`
|
Type uint8 `json:"type"`
|
||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
To string `json:"to"`
|
To string `json:"to"`
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
Content string `json:"content"`
|
Content interface{} `json:"content"`
|
||||||
Status int `json:"status"`
|
Status uint8 `json:"status"`
|
||||||
CreatedAt int64 `json:"created_at"`
|
CreatedAt int64 `json:"created_at"`
|
||||||
UpdatedAt int64 `json:"updated_at"`
|
|
||||||
}
|
}
|
||||||
Ads {
|
Ads {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
@ -557,7 +580,7 @@ type (
|
|||||||
//public order
|
//public order
|
||||||
PurchaseOrderRequest {
|
PurchaseOrderRequest {
|
||||||
SubscribeId int64 `json:"subscribe_id"`
|
SubscribeId int64 `json:"subscribe_id"`
|
||||||
Quantity int64 `json:"quantity"`
|
Quantity int64 `json:"quantity" validate:"required,gt=0"`
|
||||||
Payment int64 `json:"payment,omitempty"`
|
Payment int64 `json:"payment,omitempty"`
|
||||||
Coupon string `json:"coupon,omitempty"`
|
Coupon string `json:"coupon,omitempty"`
|
||||||
}
|
}
|
||||||
@ -707,13 +730,11 @@ type (
|
|||||||
Telephone string `json:"telephone"`
|
Telephone string `json:"telephone"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryUserAffiliateCountResponse {
|
QueryUserAffiliateCountResponse {
|
||||||
Registers int64 `json:"registers"`
|
Registers int64 `json:"registers"`
|
||||||
TotalCommission int64 `json:"total_commission"`
|
TotalCommission int64 `json:"total_commission"`
|
||||||
}
|
}
|
||||||
|
AppUserSubcbribe {
|
||||||
AppUserSubcbribe{
|
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Upload int64 `json:"upload"`
|
Upload int64 `json:"upload"`
|
||||||
@ -724,8 +745,7 @@ type (
|
|||||||
ExpireTime string `json:"expire_time"`
|
ExpireTime string `json:"expire_time"`
|
||||||
List []AppUserSubscbribeNode `json:"list"`
|
List []AppUserSubscbribeNode `json:"list"`
|
||||||
}
|
}
|
||||||
|
AppUserSubscbribeNode {
|
||||||
AppUserSubscbribeNode{
|
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Uuid string `json:"uuid"`
|
Uuid string `json:"uuid"`
|
||||||
@ -743,10 +763,87 @@ type (
|
|||||||
City string `json:"city"`
|
City string `json:"city"`
|
||||||
Latitude string `json:"latitude"`
|
Latitude string `json:"latitude"`
|
||||||
Longitude string `json:"longitude"`
|
Longitude string `json:"longitude"`
|
||||||
LatitudeCountry string `json:"latitudeCountry"`
|
|
||||||
LongitudeCountry string `json:"longitudeCountry"`
|
|
||||||
CreatedAt int64 `json:"created_at"`
|
CreatedAt int64 `json:"created_at"`
|
||||||
Download int64 `json:"download"`
|
Download int64 `json:"download"`
|
||||||
}
|
}
|
||||||
|
DownloadLink {
|
||||||
|
IOS string `json:"ios,omitempty"`
|
||||||
|
Android string `json:"android,omitempty"`
|
||||||
|
Windows string `json:"windows,omitempty"`
|
||||||
|
Mac string `json:"mac,omitempty"`
|
||||||
|
Linux string `json:"linux,omitempty"`
|
||||||
|
Harmony string `json:"harmony,omitempty"`
|
||||||
|
}
|
||||||
|
ResetSubscribeTrafficLog {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Type uint16 `json:"type"`
|
||||||
|
UserSubscribeId int64 `json:"user_subscribe_id"`
|
||||||
|
OrderNo string `json:"order_no,omitempty"`
|
||||||
|
Timestamp int64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
BalanceLog {
|
||||||
|
Type uint16 `json:"type"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Amount int64 `json:"amount"`
|
||||||
|
OrderNo string `json:"order_no,omitempty"`
|
||||||
|
Balance int64 `json:"balance"`
|
||||||
|
Timestamp int64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
CommissionLog {
|
||||||
|
Type uint16 `json:"type"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Amount int64 `json:"amount"`
|
||||||
|
OrderNo string `json:"order_no"`
|
||||||
|
Timestamp int64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
Protocol {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Port uint16 `json:"port"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
Security string `json:"security,omitempty"`
|
||||||
|
SNI string `json:"sni,omitempty"`
|
||||||
|
AllowInsecure bool `json:"allow_insecure,omitempty"`
|
||||||
|
Fingerprint string `json:"fingerprint,omitempty"`
|
||||||
|
RealityServerAddr string `json:"reality_server_addr,omitempty"`
|
||||||
|
RealityServerPort int `json:"reality_server_port,omitempty"`
|
||||||
|
RealityPrivateKey string `json:"reality_private_key,omitempty"`
|
||||||
|
RealityPublicKey string `json:"reality_public_key,omitempty"`
|
||||||
|
RealityShortId string `json:"reality_short_id,omitempty"`
|
||||||
|
Transport string `json:"transport,omitempty"`
|
||||||
|
Host string `json:"host,omitempty"`
|
||||||
|
Path string `json:"path,omitempty"`
|
||||||
|
ServiceName string `json:"service_name,omitempty"`
|
||||||
|
Cipher string `json:"cipher,omitempty"`
|
||||||
|
ServerKey string `json:"server_key,omitempty"`
|
||||||
|
Flow string `json:"flow,omitempty"`
|
||||||
|
HopPorts string `json:"hop_ports,omitempty"`
|
||||||
|
HopInterval int `json:"hop_interval,omitempty"`
|
||||||
|
ObfsPassword string `json:"obfs_password,omitempty"`
|
||||||
|
DisableSNI bool `json:"disable_sni,omitempty"`
|
||||||
|
ReduceRtt bool `json:"reduce_rtt,omitempty"`
|
||||||
|
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
|
||||||
|
CongestionController string `json:"congestion_controller,omitempty"`
|
||||||
|
Multiplex string `json:"multiplex,omitempty"` // mux, eg: off/low/medium/high
|
||||||
|
PaddingScheme string `json:"padding_scheme,omitempty"` // padding scheme
|
||||||
|
UpMbps int `json:"up_mbps,omitempty"` // upload speed limit
|
||||||
|
DownMbps int `json:"down_mbps,omitempty"` // download speed limit
|
||||||
|
Obfs string `json:"obfs,omitempty"` // obfs, 'none', 'http', 'tls'
|
||||||
|
ObfsHost string `json:"obfs_host,omitempty"` // obfs host
|
||||||
|
ObfsPath string `json:"obfs_path,omitempty"` // obfs path
|
||||||
|
XhttpMode string `json:"xhttp_mode,omitempty"` // xhttp mode
|
||||||
|
XhttpExtra string `json:"xhttp_extra,omitempty"` // xhttp extra path
|
||||||
|
Encryption string `json:"encryption,omitempty"` // encryption,'none', 'mlkem768x25519plus'
|
||||||
|
EncryptionMode string `json:"encryption_mode,omitempty"` // encryption mode,'native', 'xorpub', 'random'
|
||||||
|
EncryptionRtt string `json:"encryption_rtt,omitempty"` // encryption rtt,'0rtt', '1rtt'
|
||||||
|
EncryptionTicket string `json:"encryption_ticket,omitempty"` // encryption ticket
|
||||||
|
EncryptionServerPadding string `json:"encryption_server_padding,omitempty"` // encryption server padding
|
||||||
|
EncryptionPrivateKey string `json:"encryption_private_key,omitempty"` // encryption private key
|
||||||
|
EncryptionClientPadding string `json:"encryption_client_padding,omitempty"` // encryption client padding
|
||||||
|
EncryptionPassword string `json:"encryption_password,omitempty"` // encryption password
|
||||||
|
Ratio float64 `json:"ratio,omitempty"` // Traffic ratio, default is 1
|
||||||
|
CertMode string `json:"cert_mode,omitempty"` // Certificate mode, `none`|`http`|`dns`|`self`
|
||||||
|
CertDNSProvider string `json:"cert_dns_provider,omitempty"` // DNS provider for certificate
|
||||||
|
CertDNSEnv string `json:"cert_dns_env,omitempty"` // Environment for DNS provider
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
27
cmd/run.go
27
cmd/run.go
@ -4,6 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/pkg/constant"
|
||||||
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -12,18 +14,17 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/perfect-panel/ppanel-server/initialize"
|
"github.com/perfect-panel/server/initialize"
|
||||||
"github.com/perfect-panel/ppanel-server/internal"
|
"github.com/perfect-panel/server/internal"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/config"
|
"github.com/perfect-panel/server/internal/config"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/svc"
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/conf"
|
"github.com/perfect-panel/server/pkg/conf"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/constant"
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/logger"
|
"github.com/perfect-panel/server/pkg/orm"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/orm"
|
"github.com/perfect-panel/server/pkg/service"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/service"
|
"github.com/perfect-panel/server/pkg/tool"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/tool"
|
"github.com/perfect-panel/server/queue"
|
||||||
"github.com/perfect-panel/ppanel-server/queue"
|
"github.com/perfect-panel/server/scheduler"
|
||||||
"github.com/perfect-panel/ppanel-server/scheduler"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
@ -40,7 +41,7 @@ var startCmd = &cobra.Command{
|
|||||||
Use: "run",
|
Use: "run",
|
||||||
Short: "start PPanel",
|
Short: "start PPanel",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("[PPanel version] v" + constant.Version)
|
fmt.Println("[PPanel version] v" + fmt.Sprintf("%s(%s)", constant.Version, constant.BuildTime))
|
||||||
run()
|
run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,8 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/perfect-panel/ppanel-server/internal/config"
|
"github.com/perfect-panel/server/pkg/constant"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +12,6 @@ var versionCmd = &cobra.Command{
|
|||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "PPanel version",
|
Short: "PPanel version",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("[PPanel version] " + config.Version)
|
fmt.Println("[PPanel version] " + constant.Version + " (" + constant.BuildTime + ")")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
225
doc/config-zh.md
225
doc/config-zh.md
@ -1,88 +1,161 @@
|
|||||||
### 配置文件说明
|
# PPanel 配置指南
|
||||||
|
|
||||||
#### 1. 配置文件路径
|
本文件为 PPanel 应用程序的配置文件提供全面指南。配置文件采用 YAML 格式,定义了服务器、日志、数据库、Redis 和管理员访问的相关设置。
|
||||||
|
|
||||||
配置文件默认路径为:`./etc/ppanel.yaml`,可通过启动参数 `--config` 指定配置文件路径。
|
## 1. 配置文件概述
|
||||||
|
|
||||||
#### 2. 配置文件格式
|
- **默认路径**:`./etc/ppanel.yaml`
|
||||||
- 配置文件为yaml格式,支持注释,命名为xxx.yaml。
|
- **自定义路径**:通过启动参数 `--config` 指定配置文件路径。
|
||||||
|
- **格式**:YAML 格式,支持注释,文件名需以 `.yaml` 结尾。
|
||||||
|
|
||||||
|
## 2. 配置文件结构
|
||||||
|
|
||||||
|
以下是配置文件示例,包含默认值和说明:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 配置文件示例
|
# PPanel 配置文件
|
||||||
Host: # 服务监听地址,默认: 0.0.0.0
|
Host: "0.0.0.0" # 服务监听地址
|
||||||
Port: # 服务监听端口,默认: 8080
|
Port: 8080 # 服务监听端口
|
||||||
Debug: # 是否开启调试模式,开启后无法使用后台日志功能, 默认: false
|
Debug: false # 是否开启调试模式(禁用后台日志)
|
||||||
JwtAuth: # JWT认证配置
|
JwtAuth: # JWT 认证配置
|
||||||
AccessSecret: # 访问令牌密钥, 默认: 随机生成
|
AccessSecret: "" # 访问令牌密钥(为空时随机生成)
|
||||||
AccessExpire: # 访问令牌过期时间,单位秒, 默认: 604800
|
AccessExpire: 604800 # 访问令牌过期时间(秒)
|
||||||
Logger: # 日志配置
|
Logger: # 日志配置
|
||||||
FilePath: # 日志文件路径, 默认: ./ppanel.log
|
ServiceName: "" # 日志服务标识名称
|
||||||
MaxSize: # 日志文件最大大小,单位MB, 默认: 50
|
Mode: "console" # 日志输出模式(console、file、volume)
|
||||||
MaxBackup: # 日志文件最大备份数, 默认: 3
|
Encoding: "json" # 日志格式(json、plain)
|
||||||
MaxAge: # 日志文件最大保存时间,单位天, 默认: 30
|
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # 自定义时间格式
|
||||||
Compress: # 是否压缩日志文件, 默认: true
|
Path: "logs" # 日志文件目录
|
||||||
Level: # 日志级别, 默认: info, 可选: debug, info, warn, error, panic, panic, fatal
|
Level: "info" # 日志级别(info、error、severe)
|
||||||
MySQL:
|
Compress: false # 是否压缩日志文件
|
||||||
Addr: # MySQL地址, 必填
|
KeepDays: 7 # 日志保留天数
|
||||||
Username: # MySQL用户名, 必填
|
StackCooldownMillis: 100 # 堆栈日志冷却时间(毫秒)
|
||||||
Password: # MySQL密码, 必填
|
MaxBackups: 3 # 最大日志备份数
|
||||||
Dbname: # MySQL数据库名, 必填
|
MaxSize: 50 # 最大日志文件大小(MB)
|
||||||
Config: # Mysql配置默认值 charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
|
Rotation: "daily" # 日志轮转策略(daily、size)
|
||||||
MaxIdleConns: # 最大空闲连接数, 默认: 10
|
MySQL: # MySQL 数据库配置
|
||||||
MaxOpenConns: # 最大打开连接数, 默认: 100
|
Addr: "" # MySQL 地址(必填)
|
||||||
LogMode: # 日志级别, 默认: info, 可选: debug, error, warn, info
|
Username: "" # MySQL 用户名(必填)
|
||||||
LogZap: # 是否使用zap日志记录sql, 默认: true
|
Password: "" # MySQL 密码(必填)
|
||||||
SlowThreshold: # 慢查询阈值,单位毫秒, 默认: 1000
|
Dbname: "" # MySQL 数据库名(必填)
|
||||||
Redis:
|
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL 连接参数
|
||||||
Host: # Redis地址, 默认:localhost:6379
|
MaxIdleConns: 10 # 最大空闲连接数
|
||||||
Pass: # Redis密码, 默认: ""
|
MaxOpenConns: 100 # 最大打开连接数
|
||||||
DB: # Redis数据库, 默认: 0
|
LogMode: "info" # 日志级别(debug、error、warn、info)
|
||||||
|
LogZap: true # 是否使用 Zap 记录 SQL 日志
|
||||||
Administer:
|
SlowThreshold: 1000 # 慢查询阈值(毫秒)
|
||||||
Email: # 后台登录邮箱, 默认: admin@ppanel.dev
|
Redis: # Redis 配置
|
||||||
Password: # 后台登录密码, 默认: password
|
Host: "localhost:6379" # Redis 地址
|
||||||
|
Pass: "" # Redis 密码
|
||||||
|
DB: 0 # Redis 数据库索引
|
||||||
|
Administer: # 管理员登录配置
|
||||||
|
Email: "admin@ppanel.dev" # 管理员登录邮箱
|
||||||
|
Password: "password" # 管理员登录密码
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3. 配置文件说明
|
## 3. 配置项说明
|
||||||
|
|
||||||
- `Host`: 服务监听地址,默认: **0.0.0.0**
|
### 3.1 服务器设置
|
||||||
- `Port`: 服务监听端口,默认: **8080**
|
|
||||||
- `Debug`: 是否开启调试模式,开启后无法使用后台日志功能, 默认: **false**
|
|
||||||
- `JwtAuth`: JWT认证配置
|
|
||||||
- `AccessSecret`: 访问令牌密钥, 默认: **随机生成**
|
|
||||||
- `AccessExpire`: 访问令牌过期时间,单位秒, 默认: **604800**
|
|
||||||
- `Logger`: 日志配置
|
|
||||||
- `FilePath`: 日志文件路径, 默认: **./ppanel.log**
|
|
||||||
- `MaxSize`: 日志文件最大大小,单位MB, 默认: **50**
|
|
||||||
- `MaxBackup`: 日志文件最大备份数, 默认: **3**
|
|
||||||
- `MaxAge`: 日志文件最大保存时间,单位天, 默认: **30**
|
|
||||||
- `Compress`: 是否压缩日志文件, 默认: **true**
|
|
||||||
- `Level`: 日志级别, 默认: **info**, 可选: **debug, info, warn, error, panic, panic, fatal**
|
|
||||||
- `MySQL`: MySQL配置
|
|
||||||
- `Addr`: MySQL地址, 必填
|
|
||||||
- `Username`: MySQL用户名, 必填
|
|
||||||
- `Password`: MySQL密码, 必填
|
|
||||||
- `Dbname`: MySQL数据库名, 必填
|
|
||||||
- `Config`: Mysql配置默认值 charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
|
|
||||||
- `MaxIdleConns`: 最大空闲连接数, 默认: **10**
|
|
||||||
- `MaxOpenConns`: 最大打开连接数, 默认: **100**
|
|
||||||
- `LogMode`: 日志级别, 默认: **info**, 可选: **debug, error, warn, info**
|
|
||||||
- `LogZap`: 是否使用zap日志记录sql, 默认: **true**
|
|
||||||
- `SlowThreshold`: 慢查询阈值,单位毫秒, 默认: **1000**
|
|
||||||
- `Redis`: Redis配置
|
|
||||||
- `Host`: Redis地址, 默认: **localhost:6379**
|
|
||||||
- `Pass`: Redis密码, 默认: **""**
|
|
||||||
- `DB`: Redis数据库, 默认: **0**
|
|
||||||
- `Administer`: 后台登录配置
|
|
||||||
- `Email`: 后台登录邮箱, 默认: **admin@ppanel.dev**
|
|
||||||
- `Password`: 后台登录密码, 默认: **password**
|
|
||||||
|
|
||||||
#### 4. 环境变量
|
- **`Host`**:服务监听的地址。
|
||||||
|
- 默认:`0.0.0.0`(监听所有网络接口)。
|
||||||
|
- **`Port`**:服务监听的端口。
|
||||||
|
- 默认:`8080`。
|
||||||
|
- **`Debug`**:是否开启调试模式,开启后禁用后台日志功能。
|
||||||
|
- 默认:`false`。
|
||||||
|
|
||||||
支持的环境变量如下:
|
### 3.2 JWT 认证 (`JwtAuth`)
|
||||||
|
|
||||||
| 环境变量 | 配置项 | 示例 |
|
- **`AccessSecret`**:访问令牌的密钥。
|
||||||
|--------------|---------|:-------------------------------------------|
|
- 默认:为空时随机生成。
|
||||||
| PPANEL_DB | MySQL配置 | root:password@tcp(localhost:3306)/vpnboard |
|
- **`AccessExpire`**:令牌过期时间(秒)。
|
||||||
| PPANEL_REDIS | Redis配置 | redis://localhost:6379" |
|
- 默认:`604800`(7天)。
|
||||||
|
|
||||||
|
### 3.3 日志配置 (`Logger`)
|
||||||
|
|
||||||
|
- **`ServiceName`**:日志的服务标识名称,在 `volume` 模式下用作日志文件名。
|
||||||
|
- 默认:`""`。
|
||||||
|
- **`Mode`**:日志输出方式。
|
||||||
|
- 选项:`console`(标准输出/错误输出)、`file`(写入指定目录)、`volume`(Docker 卷)。
|
||||||
|
- 默认:`console`。
|
||||||
|
- **`Encoding`**:日志格式。
|
||||||
|
- 选项:`json`(结构化 JSON)、`plain`(纯文本,带颜色)。
|
||||||
|
- 默认:`json`。
|
||||||
|
- **`TimeFormat`**:日志时间格式。
|
||||||
|
- 默认:`2006-01-02T15:04:05.000Z07:00`。
|
||||||
|
- **`Path`**:日志文件存储目录。
|
||||||
|
- 默认:`logs`。
|
||||||
|
- **`Level`**:日志过滤级别。
|
||||||
|
- 选项:`info`(记录所有日志)、`error`(仅错误和严重日志)、`severe`(仅严重日志)。
|
||||||
|
- 默认:`info`。
|
||||||
|
- **`Compress`**:是否压缩日志文件(仅在 `file` 模式下生效)。
|
||||||
|
- 默认:`false`。
|
||||||
|
- **`KeepDays`**:日志文件保留天数。
|
||||||
|
- 默认:`7`。
|
||||||
|
- **`StackCooldownMillis`**:堆栈日志冷却时间(毫秒),防止日志过多。
|
||||||
|
- 默认:`100`。
|
||||||
|
- **`MaxBackups`**:最大日志备份数量(仅在 `size` 轮转时生效)。
|
||||||
|
- 默认:`3`。
|
||||||
|
- **`MaxSize`**:日志文件最大大小(MB,仅在 `size` 轮转时生效)。
|
||||||
|
- 默认:`50`。
|
||||||
|
- **`Rotation`**:日志轮转策略。
|
||||||
|
- 选项:`daily`(按天轮转)、`size`(按大小轮转)。
|
||||||
|
- 默认:`daily`。
|
||||||
|
|
||||||
|
### 3.4 MySQL 数据库 (`MySQL`)
|
||||||
|
|
||||||
|
- **`Addr`**:MySQL 服务器地址。
|
||||||
|
- 必填。
|
||||||
|
- **`Username`**:MySQL 用户名。
|
||||||
|
- 必填。
|
||||||
|
- **`Password`**:MySQL 密码。
|
||||||
|
- 必填。
|
||||||
|
- **`Dbname`**:MySQL 数据库名。
|
||||||
|
- 必填。
|
||||||
|
- **`Config`**:MySQL 连接参数。
|
||||||
|
- 默认:`charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`。
|
||||||
|
- **`MaxIdleConns`**:最大空闲连接数。
|
||||||
|
- 默认:`10`。
|
||||||
|
- **`MaxOpenConns`**:最大打开连接数。
|
||||||
|
- 默认:`100`。
|
||||||
|
- **`LogMode`**:SQL 日志级别。
|
||||||
|
- 选项:`debug`、`error`、`warn`、`info`。
|
||||||
|
- 默认:`info`。
|
||||||
|
- **`LogZap`**:是否使用 Zap 记录 SQL 日志。
|
||||||
|
- 默认:`true`。
|
||||||
|
- **`SlowThreshold`**:慢查询阈值(毫秒)。
|
||||||
|
- 默认:`1000`。
|
||||||
|
|
||||||
|
### 3.5 Redis 配置 (`Redis`)
|
||||||
|
|
||||||
|
- **`Host`**:Redis 服务器地址。
|
||||||
|
- 默认:`localhost:6379`。
|
||||||
|
- **`Pass`**:Redis 密码。
|
||||||
|
- 默认:`""`(无密码)。
|
||||||
|
- **`DB`**:Redis 数据库索引。
|
||||||
|
- 默认:`0`。
|
||||||
|
|
||||||
|
### 3.6 管理员登录 (`Administer`)
|
||||||
|
|
||||||
|
- **`Email`**:管理员登录邮箱。
|
||||||
|
- 默认:`admin@ppanel.dev`。
|
||||||
|
- **`Password`**:管理员登录密码。
|
||||||
|
- 默认:`password`。
|
||||||
|
|
||||||
|
## 4. 环境变量
|
||||||
|
|
||||||
|
以下环境变量可用于覆盖配置文件中的设置:
|
||||||
|
|
||||||
|
| 环境变量 | 配置项 | 示例值 |
|
||||||
|
|----------------|----------|----------------------------------------------|
|
||||||
|
| `PPANEL_DB` | MySQL 配置 | `root:password@tcp(localhost:3306)/vpnboard` |
|
||||||
|
| `PPANEL_REDIS` | Redis 配置 | `redis://localhost:6379` |
|
||||||
|
|
||||||
|
## 5. 最佳实践
|
||||||
|
|
||||||
|
- **安全性**:生产环境中避免使用默认的 `Administer` 凭据,更新 `Email` 和 `Password` 为安全值。
|
||||||
|
- **日志**:生产环境中建议使用 `file` 或 `volume` 模式持久化日志,将 `Level` 设置为 `error` 或 `severe` 以减少日志量。
|
||||||
|
- **数据库**:确保 `MySQL` 和 `Redis` 凭据安全,避免在版本控制中暴露。
|
||||||
|
- **JWT**:为 `JwtAuth` 的 `AccessSecret` 设置强密钥以增强安全性。
|
||||||
|
|
||||||
|
如需进一步帮助,请参考 PPanel 官方文档或联系支持团队。
|
||||||
226
doc/config.md
226
doc/config.md
@ -1,116 +1,164 @@
|
|||||||
### Configuration File Instructions
|
# PPanel Configuration Guide
|
||||||
#### Configuration File Path
|
|
||||||
|
|
||||||
The default configuration file path is ./etc/ppanel.yaml. You can specify a custom path using the --config startup parameter.
|
This document provides a comprehensive guide to the configuration file for the PPanel application. The configuration
|
||||||
|
file is in YAML format and defines settings for the server, logging, database, Redis, and admin access.
|
||||||
|
|
||||||
#### Configuration File Format
|
## 1. Configuration File Overview
|
||||||
|
|
||||||
The configuration file uses the YAML format, supports comments, and should be named xxx.yaml.
|
- **Default Path**: `./etc/ppanel.yaml`
|
||||||
|
- **Custom Path**: Specify a custom path using the `--config` startup parameter.
|
||||||
|
- **Format**: YAML, supports comments, and must be named with a `.yaml` extension.
|
||||||
|
|
||||||
|
## 2. Configuration File Structure
|
||||||
|
|
||||||
|
Below is an example of the configuration file with default values and explanations:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Sample Configuration File
|
# PPanel Configuration
|
||||||
Host: # Service listening address, default: 0.0.0.0
|
Host: "0.0.0.0" # Server listening address
|
||||||
Port: # Service listening port, default: 8080
|
Port: 8080 # Server listening port
|
||||||
Debug: # Enable debug mode; disables backend logging when enabled, default: false
|
Debug: false # Enable debug mode (disables background logging)
|
||||||
JwtAuth: # JWT authentication settings
|
JwtAuth: # JWT authentication settings
|
||||||
AccessSecret: # Access token secret, default: randomly generated
|
AccessSecret: "" # Access token secret (randomly generated if empty)
|
||||||
AccessExpire: # Access token expiration time in seconds, default: 604800
|
AccessExpire: 604800 # Access token expiration (seconds)
|
||||||
Logger: # Logging configuration
|
Logger: # Logging configuration
|
||||||
FilePath: # Log file path, default: ./ppanel.log
|
ServiceName: "" # Service name for log identification
|
||||||
MaxSize: # Maximum log file size in MB, default: 50
|
Mode: "console" # Log output mode (console, file, volume)
|
||||||
MaxBackup: # Maximum number of log file backups, default: 3
|
Encoding: "json" # Log format (json, plain)
|
||||||
MaxAge: # Maximum log file retention time in days, default: 30
|
TimeFormat: "2006-01-02T15:04:05.000Z07:00" # Custom time format
|
||||||
Compress: # Whether to compress log files, default: true
|
Path: "logs" # Log file directory
|
||||||
Level: # Logging level, default: info; options: debug, info, warn, error, panic, fatal
|
Level: "info" # Log level (info, error, severe)
|
||||||
MySQL:
|
Compress: false # Enable log compression
|
||||||
Addr: # MySQL address, required
|
KeepDays: 7 # Log retention period (days)
|
||||||
Username: # MySQL username, required
|
StackCooldownMillis: 100 # Stack trace cooldown (milliseconds)
|
||||||
Password: # MySQL password, required
|
MaxBackups: 3 # Maximum number of log backups
|
||||||
Dbname: # MySQL database name, required
|
MaxSize: 50 # Maximum log file size (MB)
|
||||||
Config: # MySQL configuration, default: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
|
Rotation: "daily" # Log rotation strategy (daily, size)
|
||||||
MaxIdleConns: # Maximum idle connections, default: 10
|
MySQL: # MySQL database configuration
|
||||||
MaxOpenConns: # Maximum open connections, default: 100
|
Addr: "" # MySQL address (required)
|
||||||
LogMode: # Log level, default: info; options: debug, error, warn, info
|
Username: "" # MySQL username (required)
|
||||||
LogZap: # Whether to use zap for SQL logging, default: true
|
Password: "" # MySQL password (required)
|
||||||
SlowThreshold: # Slow query threshold in milliseconds, default: 1000
|
Dbname: "" # MySQL database name (required)
|
||||||
Redis:
|
Config: "charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai" # MySQL connection parameters
|
||||||
Host: # Redis address, default: localhost:6379
|
MaxIdleConns: 10 # Maximum idle connections
|
||||||
Pass: # Redis password, default: ""
|
MaxOpenConns: 100 # Maximum open connections
|
||||||
DB: # Redis database, default: 0
|
LogMode: "info" # Log level (debug, error, warn, info)
|
||||||
|
LogZap: true # Enable Zap logging for SQL
|
||||||
Administer:
|
SlowThreshold: 1000 # Slow query threshold (milliseconds)
|
||||||
Email: # Admin login email, default: admin@ppanel.dev
|
Redis: # Redis configuration
|
||||||
Password: # Admin login password, default: password
|
Host: "localhost:6379" # Redis address
|
||||||
|
Pass: "" # Redis password
|
||||||
|
DB: 0 # Redis database index
|
||||||
|
Administer: # Admin login configuration
|
||||||
|
Email: "admin@ppanel.dev" # Admin login email
|
||||||
|
Password: "password" # Admin login password
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3.Configuration Descriptions
|
## 3. Configuration Details
|
||||||
|
|
||||||
- Host: Service listening address, default: 0.0.0.0
|
### 3.1 Server Settings
|
||||||
|
|
||||||
- Port: Service listening port, default: 8080
|
- **`Host`**: Address the server listens on.
|
||||||
- Debug: Enable debug mode; disables backend logging when enabled, default: false
|
- Default: `0.0.0.0` (all network interfaces).
|
||||||
|
- **`Port`**: Port the server listens on.
|
||||||
|
- Default: `8080`.
|
||||||
|
- **`Debug`**: Enables debug mode, disabling background logging.
|
||||||
|
- Default: `false`.
|
||||||
|
|
||||||
- JwtAuth: JWT authentication settings
|
### 3.2 JWT Authentication (`JwtAuth`)
|
||||||
|
|
||||||
- AccessSecret: Access token secret, default: randomly generated
|
- **`AccessSecret`**: Secret key for access tokens.
|
||||||
|
- Default: Randomly generated if not specified.
|
||||||
|
- **`AccessExpire`**: Token expiration time in seconds.
|
||||||
|
- Default: `604800` (7 days).
|
||||||
|
|
||||||
- AccessExpire: Access token expiration time in seconds, default: 604800
|
### 3.3 Logging (`Logger`)
|
||||||
|
|
||||||
- Logger: Logging configuration
|
- **`ServiceName`**: Identifier for logs, used as the log filename in `volume` mode.
|
||||||
|
- Default: `""`.
|
||||||
|
- **`Mode`**: Log output destination.
|
||||||
|
- Options: `console` (stdout/stderr), `file` (to a directory), `volume` (Docker volume).
|
||||||
|
- Default: `console`.
|
||||||
|
- **`Encoding`**: Log format.
|
||||||
|
- Options: `json` (structured JSON), `plain` (plain text with colors).
|
||||||
|
- Default: `json`.
|
||||||
|
- **`TimeFormat`**: Custom time format for logs.
|
||||||
|
- Default: `2006-01-02T15:04:05.000Z07:00`.
|
||||||
|
- **`Path`**: Directory for log files.
|
||||||
|
- Default: `logs`.
|
||||||
|
- **`Level`**: Log filtering level.
|
||||||
|
- Options: `info` (all logs), `error` (error and severe), `severe` (severe only).
|
||||||
|
- Default: `info`.
|
||||||
|
- **`Compress`**: Enable compression for log files (only in `file` mode).
|
||||||
|
- Default: `false`.
|
||||||
|
- **`KeepDays`**: Retention period for log files (in days).
|
||||||
|
- Default: `7`.
|
||||||
|
- **`StackCooldownMillis`**: Cooldown for stack trace logging to prevent log flooding.
|
||||||
|
- Default: `100`.
|
||||||
|
- **`MaxBackups`**: Maximum number of log backups (for `size` rotation).
|
||||||
|
- Default: `3`.
|
||||||
|
- **`MaxSize`**: Maximum log file size in MB (for `size` rotation).
|
||||||
|
- Default: `50`.
|
||||||
|
- **`Rotation`**: Log rotation strategy.
|
||||||
|
- Options: `daily` (rotate daily), `size` (rotate by size).
|
||||||
|
- Default: `daily`.
|
||||||
|
|
||||||
- FilePath: Log file path, default: ./ppanel.log
|
### 3.4 MySQL Database (`MySQL`)
|
||||||
|
|
||||||
- MaxSize: Maximum log file size in MB, default: 50
|
- **`Addr`**: MySQL server address.
|
||||||
|
- Required.
|
||||||
|
- **`Username`**: MySQL username.
|
||||||
|
- Required.
|
||||||
|
- **`Password`**: MySQL password.
|
||||||
|
- Required.
|
||||||
|
- **`Dbname`**: MySQL database name.
|
||||||
|
- Required.
|
||||||
|
- **`Config`**: MySQL connection parameters.
|
||||||
|
- Default: `charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai`.
|
||||||
|
- **`MaxIdleConns`**: Maximum idle connections.
|
||||||
|
- Default: `10`.
|
||||||
|
- **`MaxOpenConns`**: Maximum open connections.
|
||||||
|
- Default: `100`.
|
||||||
|
- **`LogMode`**: SQL logging level.
|
||||||
|
- Options: `debug`, `error`, `warn`, `info`.
|
||||||
|
- Default: `info`.
|
||||||
|
- **`LogZap`**: Enable Zap logging for SQL queries.
|
||||||
|
- Default: `true`.
|
||||||
|
- **`SlowThreshold`**: Threshold for slow query logging (in milliseconds).
|
||||||
|
- Default: `1000`.
|
||||||
|
|
||||||
- MaxBackup: Maximum number of log file backups, default: 3
|
### 3.5 Redis (`Redis`)
|
||||||
|
|
||||||
- MaxAge: Maximum log file retention time in days, default: 30
|
- **`Host`**: Redis server address.
|
||||||
|
- Default: `localhost:6379`.
|
||||||
|
- **`Pass`**: Redis password.
|
||||||
|
- Default: `""` (no password).
|
||||||
|
- **`DB`**: Redis database index.
|
||||||
|
- Default: `0`.
|
||||||
|
|
||||||
- Compress: Whether to compress log files, default: true
|
### 3.6 Admin Login (`Administer`)
|
||||||
|
|
||||||
- Level: Logging level, default: info; options: debug, info, warn, error, panic, fatal
|
- **`Email`**: Admin login email.
|
||||||
|
- Default: `admin@ppanel.dev`.
|
||||||
|
- **`Password`**: Admin login password.
|
||||||
|
- Default: `password`.
|
||||||
|
|
||||||
- MySQL: MySQL configuration
|
## 4. Environment Variables
|
||||||
|
|
||||||
- Addr: MySQL address, required
|
The following environment variables can be used to override configuration settings:
|
||||||
|
|
||||||
- Username: MySQL username, required
|
| Environment Variable | Configuration Section | Example Value |
|
||||||
|
|----------------------|-----------------------|----------------------------------------------|
|
||||||
|
| `PPANEL_DB` | MySQL | `root:password@tcp(localhost:3306)/vpnboard` |
|
||||||
|
| `PPANEL_REDIS` | Redis | `redis://localhost:6379` |
|
||||||
|
|
||||||
- Password: MySQL password, required
|
## 5. Best Practices
|
||||||
|
|
||||||
- Dbname: MySQL database name, required
|
- **Security**: Avoid using default `Administer` credentials in production. Update `Email` and `Password` to secure
|
||||||
|
values.
|
||||||
|
- **Logging**: Use `file` or `volume` mode for production to persist logs. Adjust `Level` to `error` or `severe` to
|
||||||
|
reduce log volume.
|
||||||
|
- **Database**: Ensure `MySQL` and `Redis` credentials are secure and not exposed in version control.
|
||||||
|
- **JWT**: Specify a strong `AccessSecret` for `JwtAuth` to enhance security.
|
||||||
|
|
||||||
- Config: MySQL configuration, default: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
|
For further assistance, refer to the official PPanel documentation or contact support.
|
||||||
|
|
||||||
- MaxIdleConns: Maximum idle connections, default: 10
|
|
||||||
|
|
||||||
- MaxOpenConns: Maximum open connections, default: 100
|
|
||||||
|
|
||||||
- LogMode: Log level, default: info; options: debug, error, warn, info
|
|
||||||
|
|
||||||
- LogZap: Whether to use zap for SQL logging, default: true
|
|
||||||
|
|
||||||
- SlowThreshold: Slow query threshold in milliseconds, default: 1000
|
|
||||||
|
|
||||||
- Redis: Redis configuration
|
|
||||||
|
|
||||||
- Host: Redis address, default: localhost:6379
|
|
||||||
|
|
||||||
- Pass: Redis password, default: ""
|
|
||||||
|
|
||||||
- DB: Redis database, default: 0
|
|
||||||
|
|
||||||
- Administer: Admin login configuration
|
|
||||||
|
|
||||||
- Email: Admin login email, default: admin@ppanel.dev
|
|
||||||
|
|
||||||
- Password: Admin login password, default: password
|
|
||||||
|
|
||||||
#### 4. Environment Variables
|
|
||||||
|
|
||||||
Supported environment variables are as follows:
|
|
||||||
|
|
||||||
| Environment Variable | Configuration | Example |
|
|
||||||
|-----------------------|---------------|:-------------------------------------------|
|
|
||||||
| PPANEL_DB | MySQL config | root:password@tcp(localhost:3306)/vpnboard |
|
|
||||||
| PPANEL_REDIS | Redis config | redis://localhost:6379" |
|
|
||||||
BIN
doc/image/architecture-en.png
Normal file
BIN
doc/image/architecture-en.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 553 KiB |
BIN
doc/image/architecture-zh.png
Normal file
BIN
doc/image/architecture-zh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 548 KiB |
@ -6,14 +6,14 @@
|
|||||||
#### 二进制安装
|
#### 二进制安装
|
||||||
1.确定系统架构,并下载对应的二进制文件
|
1.确定系统架构,并下载对应的二进制文件
|
||||||
|
|
||||||
下载地址:`https://github.com/perfect-panel/ppanel/releases`
|
下载地址:`https://github.com/perfect-panel/server/releases`
|
||||||
|
|
||||||
示例说明:系统:Linux amd64,用户:root,当前目录:/root
|
示例说明:系统:Linux amd64,用户:root,当前目录:/root
|
||||||
|
|
||||||
- 下载二进制文件
|
- 下载二进制文件
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ wget https://github.com/perfect-panel/ppanel/releases/download/v0.1.0/ppanel-server-linux-amd64.tar.gz
|
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
- 解压二进制文件
|
- 解压二进制文件
|
||||||
|
|||||||
@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
1. Determine your system architecture and download the corresponding binary file.
|
1. Determine your system architecture and download the corresponding binary file.
|
||||||
|
|
||||||
Download URL: `https://github.com/perfect-panel/ppanel/releases`
|
Download URL: `https://github.com/perfect-panel/server/releases`
|
||||||
|
|
||||||
Example setup: OS: Linux amd64, User: root, Current directory: `/root`
|
Example setup: OS: Linux amd64, User: root, Current directory: `/root`
|
||||||
|
|
||||||
- Download the binary file:
|
- Download the binary file:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ wget https://github.com/perfect-panel/ppanel/releases/download/v0.1.0/ppanel-server-linux-amd64.tar.gz
|
$ wget https://github.com/perfect-panel/server/releases/download/v1.0.0/ppanel-server-linux-amd64.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
- Extract the binary file:
|
- Extract the binary file:
|
||||||
|
|||||||
0
generate/gopure-amd64.exe
Normal file → Executable file
0
generate/gopure-amd64.exe
Normal file → Executable file
0
generate/gopure-arm64.exe
Normal file → Executable file
0
generate/gopure-arm64.exe
Normal file → Executable file
0
generate/gopure-darwin-amd64
Normal file → Executable file
0
generate/gopure-darwin-amd64
Normal file → Executable file
0
generate/gopure-darwin-arm64
Normal file → Executable file
0
generate/gopure-darwin-arm64
Normal file → Executable file
0
generate/gopure-linux-amd64
Normal file → Executable file
0
generate/gopure-linux-amd64
Normal file → Executable file
0
generate/gopure-linux-arm64
Normal file → Executable file
0
generate/gopure-linux-arm64
Normal file → Executable file
40
go.mod
40
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/perfect-panel/ppanel-server
|
module github.com/perfect-panel/server
|
||||||
|
|
||||||
go 1.23.3
|
go 1.23.3
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/go-sql-driver/mysql v1.8.1
|
github.com/go-sql-driver/mysql v1.8.1
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
|
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
|
||||||
github.com/gofrs/uuid/v5 v5.3.0
|
github.com/gofrs/uuid/v5 v5.3.0
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/gorilla/websocket v1.5.3
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/hibiken/asynq v0.24.1
|
github.com/hibiken/asynq v0.24.1
|
||||||
@ -28,21 +28,21 @@ require (
|
|||||||
github.com/klauspost/compress v1.17.7
|
github.com/klauspost/compress v1.17.7
|
||||||
github.com/nyaruka/phonenumbers v1.5.0
|
github.com/nyaruka/phonenumbers v1.5.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/redis/go-redis/v9 v9.6.1
|
github.com/redis/go-redis/v9 v9.7.2
|
||||||
github.com/smartwalle/alipay/v3 v3.2.23
|
github.com/smartwalle/alipay/v3 v3.2.23
|
||||||
github.com/spf13/cast v1.7.0 // indirect
|
github.com/spf13/cast v1.7.0 // indirect
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
github.com/stripe/stripe-go/v81 v81.1.0
|
github.com/stripe/stripe-go/v81 v81.1.0
|
||||||
github.com/twilio/twilio-go v1.23.11
|
github.com/twilio/twilio-go v1.23.11
|
||||||
go.opentelemetry.io/otel v1.24.0
|
go.opentelemetry.io/otel v1.29.0
|
||||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
|
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0
|
||||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0
|
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0
|
||||||
go.opentelemetry.io/otel/exporters/zipkin v1.24.0
|
go.opentelemetry.io/otel/exporters/zipkin v1.24.0
|
||||||
go.opentelemetry.io/otel/sdk v1.24.0
|
go.opentelemetry.io/otel/sdk v1.29.0
|
||||||
go.opentelemetry.io/otel/trace v1.24.0
|
go.opentelemetry.io/otel/trace v1.29.0
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
golang.org/x/crypto v0.32.0
|
golang.org/x/crypto v0.32.0
|
||||||
golang.org/x/oauth2 v0.25.0
|
golang.org/x/oauth2 v0.25.0
|
||||||
@ -56,16 +56,21 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/Masterminds/sprig/v3 v3.3.0
|
||||||
github.com/fatih/color v1.18.0
|
github.com/fatih/color v1.18.0
|
||||||
github.com/goccy/go-json v0.10.4
|
github.com/goccy/go-json v0.10.4
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.18.2
|
||||||
github.com/spaolacci/murmur3 v1.1.0
|
github.com/spaolacci/murmur3 v1.1.0
|
||||||
google.golang.org/grpc v1.61.1
|
google.golang.org/grpc v1.64.1
|
||||||
google.golang.org/protobuf v1.36.3
|
google.golang.org/protobuf v1.36.3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/compute/metadata v0.6.0 // indirect
|
cloud.google.com/go/compute/metadata v0.6.0 // indirect
|
||||||
|
dario.cat/mergo v1.0.1 // indirect
|
||||||
filippo.io/edwards25519 v1.1.0 // indirect
|
filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
|
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||||
|
github.com/Masterminds/semver/v3 v3.3.0 // indirect
|
||||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
|
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect
|
||||||
github.com/alibabacloud-go/debug v1.0.1 // indirect
|
github.com/alibabacloud-go/debug v1.0.1 // indirect
|
||||||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
||||||
@ -88,14 +93,17 @@ require (
|
|||||||
github.com/gin-contrib/sse v1.0.0 // indirect
|
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/golang/glog v1.1.2 // indirect
|
github.com/golang/glog v1.2.0 // indirect
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||||
github.com/gorilla/context v1.1.2 // indirect
|
github.com/gorilla/context v1.1.2 // indirect
|
||||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||||
github.com/gorilla/sessions v1.2.2 // indirect
|
github.com/gorilla/sessions v1.2.2 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||||
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
|
github.com/huandu/xstrings v1.5.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
@ -104,12 +112,15 @@ require (
|
|||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||||
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/openzipkin/zipkin-go v0.4.2 // indirect
|
github.com/openzipkin/zipkin-go v0.4.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||||
|
github.com/shopspring/decimal v1.4.0 // indirect
|
||||||
github.com/smartwalle/ncrypto v1.0.4 // indirect
|
github.com/smartwalle/ncrypto v1.0.4 // indirect
|
||||||
github.com/smartwalle/ngx v1.0.9 // indirect
|
github.com/smartwalle/ngx v1.0.9 // indirect
|
||||||
github.com/smartwalle/nsign v1.0.9 // indirect
|
github.com/smartwalle/nsign v1.0.9 // indirect
|
||||||
@ -119,17 +130,18 @@ require (
|
|||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
github.com/yuin/gopher-lua v1.1.1 // indirect
|
github.com/yuin/gopher-lua v1.1.1 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
go.opentelemetry.io/otel/metric v1.29.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||||
|
go.uber.org/atomic v1.7.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/arch v0.13.0 // indirect
|
golang.org/x/arch v0.13.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect
|
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect
|
||||||
golang.org/x/net v0.34.0 // indirect
|
golang.org/x/net v0.34.0 // indirect
|
||||||
golang.org/x/sys v0.29.0 // indirect
|
golang.org/x/sys v0.29.0 // indirect
|
||||||
golang.org/x/text v0.21.0 // indirect
|
golang.org/x/text v0.21.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
115
go.sum
115
go.sum
@ -1,11 +1,23 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
|
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
|
||||||
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
|
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
|
||||||
|
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
|
||||||
|
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
|
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
|
||||||
|
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/GUAIK-ORG/go-snowflake v0.0.0-20200116064823-220c4260e85f h1:RDkg3pyE1qGbBpRWmvSN9RNZC5nUrOaEPiEpEb8y2f0=
|
github.com/GUAIK-ORG/go-snowflake v0.0.0-20200116064823-220c4260e85f h1:RDkg3pyE1qGbBpRWmvSN9RNZC5nUrOaEPiEpEb8y2f0=
|
||||||
github.com/GUAIK-ORG/go-snowflake v0.0.0-20200116064823-220c4260e85f/go.mod h1:zA7AF9RTfpluCfz0omI4t5KCMaWHUMicsZoMccnaT44=
|
github.com/GUAIK-ORG/go-snowflake v0.0.0-20200116064823-220c4260e85f/go.mod h1:zA7AF9RTfpluCfz0omI4t5KCMaWHUMicsZoMccnaT44=
|
||||||
|
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||||
|
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||||
|
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
|
||||||
|
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
||||||
|
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
|
||||||
|
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
|
||||||
|
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||||
|
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
|
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
|
||||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 h1:zE8vH9C7JiZLNJJQ5OwjU9mSi4T9ef9u3BURT6LCLC8=
|
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 h1:zE8vH9C7JiZLNJJQ5OwjU9mSi4T9ef9u3BURT6LCLC8=
|
||||||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5/go.mod h1:tWnyE9AjF8J8qqLk645oUmVUnFybApTQWklQmi5tY6g=
|
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5/go.mod h1:tWnyE9AjF8J8qqLk645oUmVUnFybApTQWklQmi5tY6g=
|
||||||
@ -87,11 +99,23 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
|
|||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
|
github.com/dhui/dktest v0.4.4 h1:+I4s6JRE1yGuqflzwqG+aIaMdgXIorCf5P98JnaAWa8=
|
||||||
|
github.com/dhui/dktest v0.4.4/go.mod h1:4+22R4lgsdAXrDyaH4Nqx2JEz2hLp49MqQmm9HLCQhM=
|
||||||
|
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||||
|
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||||
|
github.com/docker/docker v27.2.0+incompatible h1:Rk9nIVdfH3+Vz4cyI/uhbINhEZ/oLmc+CBXmH6fbNk4=
|
||||||
|
github.com/docker/docker v27.2.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
|
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
|
||||||
|
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
|
||||||
|
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||||
|
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||||
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/forgoer/openssl v1.6.0 h1:IueL+UfH0hKo99xFPojHLlO3QzRBQqFY+Cht0WwtOC0=
|
github.com/forgoer/openssl v1.6.0 h1:IueL+UfH0hKo99xFPojHLlO3QzRBQqFY+Cht0WwtOC0=
|
||||||
github.com/forgoer/openssl v1.6.0/go.mod h1:9DZ4yOsQmveP0aXC/BpQ++Y5TKaz5yR9+emcxmIZNZs=
|
github.com/forgoer/openssl v1.6.0/go.mod h1:9DZ4yOsQmveP0aXC/BpQ++Y5TKaz5yR9+emcxmIZNZs=
|
||||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||||
@ -128,12 +152,16 @@ github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM=
|
|||||||
github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk=
|
github.com/gofrs/uuid/v5 v5.3.0 h1:m0mUMr+oVYUdxpMLgSYCZiXe7PuVPnI94+OMeVBNedk=
|
||||||
github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
|
github.com/gofrs/uuid/v5 v5.3.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
|
||||||
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.18.2 h1:2VSCMz7x7mjyTXx3m2zPokOY82LTRgxK1yQYKo6wWQ8=
|
||||||
|
github.com/golang-migrate/migrate/v4 v4.18.2/go.mod h1:2CM6tJvn2kqPXwnXO/d3rAQYiyoIm180VsO8PRX6Rpk=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
|
github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=
|
||||||
github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ=
|
github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||||
@ -179,10 +207,17 @@ github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTj
|
|||||||
github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ=
|
github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ=
|
||||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
|
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||||
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
|
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/hibiken/asynq v0.24.1 h1:+5iIEAyA9K/lcSPvx3qoPtsKJeKI5u9aOIvUmSsazEw=
|
github.com/hibiken/asynq v0.24.1 h1:+5iIEAyA9K/lcSPvx3qoPtsKJeKI5u9aOIvUmSsazEw=
|
||||||
github.com/hibiken/asynq v0.24.1/go.mod h1:u5qVeSbrnfT+vtG5Mq8ZPzQu/BmCKMHvTGb91uy9Tts=
|
github.com/hibiken/asynq v0.24.1/go.mod h1:u5qVeSbrnfT+vtG5Mq8ZPzQu/BmCKMHvTGb91uy9Tts=
|
||||||
|
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
|
||||||
|
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
|
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
|
||||||
@ -212,6 +247,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
|
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||||
|
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275 h1:IZycmTpoUtQK3PD60UYBwjaCUHUP7cML494ao9/O8+Q=
|
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275 h1:IZycmTpoUtQK3PD60UYBwjaCUHUP7cML494ao9/O8+Q=
|
||||||
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275/go.mod h1:zt6UU74K6Z6oMOYJbJzYpYucqdcQwSMPBEdSvGiaUMw=
|
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275/go.mod h1:zt6UU74K6Z6oMOYJbJzYpYucqdcQwSMPBEdSvGiaUMw=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
@ -220,8 +257,16 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
|
|||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
|
github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
|
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||||
|
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||||
|
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||||
|
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||||
|
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||||
|
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||||
|
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
|
||||||
|
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
@ -229,9 +274,15 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
|
|||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
|
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
||||||
|
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/nyaruka/phonenumbers v1.5.0 h1:0M+Gd9zl53QC4Nl5z1Yj1O/zPk2XXBUwR/vlzdXSJv4=
|
github.com/nyaruka/phonenumbers v1.5.0 h1:0M+Gd9zl53QC4Nl5z1Yj1O/zPk2XXBUwR/vlzdXSJv4=
|
||||||
github.com/nyaruka/phonenumbers v1.5.0/go.mod h1:gv+CtldaFz+G3vHHnasBSirAi3O2XLqZzVWz4V1pl2E=
|
github.com/nyaruka/phonenumbers v1.5.0/go.mod h1:gv+CtldaFz+G3vHHnasBSirAi3O2XLqZzVWz4V1pl2E=
|
||||||
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
|
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
|
||||||
|
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
|
||||||
github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA=
|
github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA=
|
||||||
github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY=
|
github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||||
@ -243,13 +294,15 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
|
|||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
|
github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
|
||||||
github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4=
|
github.com/redis/go-redis/v9 v9.7.2 h1:PSGhv13dJyrTCw1+55H0pIKM3WFov7HuUrKUmInGL0o=
|
||||||
github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA=
|
github.com/redis/go-redis/v9 v9.7.2/go.mod h1:yp5+a5FnEEP0/zTYuw6u6/2nn3zivwhv274qYgWQhDM=
|
||||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||||
|
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||||
github.com/smartwalle/alipay/v3 v3.2.23 h1:i1VwJeu70EmwpsXXz6GZZnMAtRx5MTfn2dPoql/L3zE=
|
github.com/smartwalle/alipay/v3 v3.2.23 h1:i1VwJeu70EmwpsXXz6GZZnMAtRx5MTfn2dPoql/L3zE=
|
||||||
github.com/smartwalle/alipay/v3 v3.2.23/go.mod h1:lVqFiupPf8YsAXaq5JXcwqnOUC2MCF+2/5vub+RlagE=
|
github.com/smartwalle/alipay/v3 v3.2.23/go.mod h1:lVqFiupPf8YsAXaq5JXcwqnOUC2MCF+2/5vub+RlagE=
|
||||||
github.com/smartwalle/ncrypto v1.0.4 h1:P2rqQxDepJwgeO5ShoC+wGcK2wNJDmcdBOWAksuIgx8=
|
github.com/smartwalle/ncrypto v1.0.4 h1:P2rqQxDepJwgeO5ShoC+wGcK2wNJDmcdBOWAksuIgx8=
|
||||||
@ -306,12 +359,14 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
|
|||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
||||||
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
||||||
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=
|
||||||
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8=
|
||||||
|
go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw=
|
||||||
|
go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8=
|
||||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
|
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
|
||||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
|
go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 h1:dIIDULZJpgdiHz5tXrTgKIMLkus6jEFa7x5SOKcyR7E=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0/go.mod h1:jlRVBe7+Z1wyxFSUs48L6OBQZ5JwH2Hg/Vbl+t9rAgI=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs=
|
||||||
@ -320,14 +375,16 @@ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 h1:s0PHtIkN+3xrbDO
|
|||||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA=
|
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA=
|
||||||
go.opentelemetry.io/otel/exporters/zipkin v1.24.0 h1:3evrL5poBuh1KF51D9gO/S+N/1msnm4DaBqs/rpXUqY=
|
go.opentelemetry.io/otel/exporters/zipkin v1.24.0 h1:3evrL5poBuh1KF51D9gO/S+N/1msnm4DaBqs/rpXUqY=
|
||||||
go.opentelemetry.io/otel/exporters/zipkin v1.24.0/go.mod h1:0EHgD8R0+8yRhUYJOGR8Hfg2dpiJQxDOszd5smVO9wM=
|
go.opentelemetry.io/otel/exporters/zipkin v1.24.0/go.mod h1:0EHgD8R0+8yRhUYJOGR8Hfg2dpiJQxDOszd5smVO9wM=
|
||||||
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
|
go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc=
|
||||||
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
|
go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8=
|
||||||
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
|
go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo=
|
||||||
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
|
go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok=
|
||||||
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
|
go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4=
|
||||||
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
|
go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=
|
||||||
go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI=
|
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
|
||||||
go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY=
|
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
|
||||||
|
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||||
|
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
@ -446,18 +503,16 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl
|
|||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos=
|
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No=
|
||||||
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY=
|
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
|
google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
|
||||||
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
|
google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
|||||||
@ -9,16 +9,16 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/logger"
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/perfect-panel/ppanel-server/initialize/migrate"
|
"github.com/perfect-panel/server/initialize/migrate"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/config"
|
"github.com/perfect-panel/server/internal/config"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/conf"
|
"github.com/perfect-panel/server/pkg/conf"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/orm"
|
"github.com/perfect-panel/server/pkg/orm"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/tool"
|
"github.com/perfect-panel/server/pkg/tool"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -141,12 +141,25 @@ func handleInitConfig(c *gin.Context) {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", request.MysqlUser, request.MysqlPassword, request.MysqlHost, request.MysqlPort, request.MysqlDatabase)
|
||||||
// init
|
// migrate database
|
||||||
if err := initMysql(db, request.AdminEmail, request.AdminPassword); err != nil {
|
if err = migrate.Migrate(dsn).Up(); err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
logger.Errorf("[Init Mysql] Migrate failed: %v", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 500,
|
"code": 500,
|
||||||
"msg": "MySQL initialization failed",
|
"msg": "Database migration failed",
|
||||||
|
"data": nil,
|
||||||
|
})
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// create admin user
|
||||||
|
if err = migrate.CreateAdminUser(request.AdminEmail, request.AdminPassword, db); err != nil {
|
||||||
|
logger.Errorf("[Init Mysql] Create admin user failed: %v", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": 500,
|
||||||
|
"msg": "Admin user creation failed",
|
||||||
"data": nil,
|
"data": nil,
|
||||||
})
|
})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
@ -154,7 +167,7 @@ func handleInitConfig(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write to file
|
// write to file
|
||||||
if err := os.WriteFile(configPath, fileData, 0644); err != nil {
|
if err = os.WriteFile(configPath, fileData, 0644); err != nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"code": 500,
|
"code": 500,
|
||||||
"msg": "Configuration initialization failed",
|
"msg": "Configuration initialization failed",
|
||||||
@ -258,20 +271,3 @@ func HandleRedisTest(c *gin.Context) {
|
|||||||
"status": true,
|
"status": true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func initMysql(tx *gorm.DB, email, password string) error {
|
|
||||||
tables, err := tx.Migrator().GetTables()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("database table validation failed: %w", err)
|
|
||||||
}
|
|
||||||
if len(tables) > 0 {
|
|
||||||
return errors.New("the database contains existing data. Please clear it before proceeding with the installation")
|
|
||||||
}
|
|
||||||
if err := migrate.InitPPanelSQL(tx); err != nil {
|
|
||||||
return fmt.Errorf("failed to initialize database: %w", err)
|
|
||||||
}
|
|
||||||
if err := migrate.CreateAdminUser(email, password, tx); err != nil {
|
|
||||||
return fmt.Errorf("failed to create admin user: %w", err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
26
initialize/device.go
Normal file
26
initialize/device.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package initialize
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/internal/config"
|
||||||
|
"github.com/perfect-panel/server/internal/model/auth"
|
||||||
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
|
"github.com/perfect-panel/server/pkg/tool"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Device(ctx *svc.ServiceContext) {
|
||||||
|
logger.Debug("device config initialization")
|
||||||
|
method, err := ctx.AuthModel.FindOneByMethod(context.Background(), "device")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
var cfg config.DeviceConfig
|
||||||
|
var deviceConfig auth.DeviceConfig
|
||||||
|
deviceConfig.Unmarshal(method.Config)
|
||||||
|
tool.DeepCopy(&cfg, deviceConfig)
|
||||||
|
cfg.Enable = *method.Enabled
|
||||||
|
ctx.Config.Device = cfg
|
||||||
|
}
|
||||||
@ -5,12 +5,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/logger"
|
"github.com/perfect-panel/server/internal/config"
|
||||||
|
"github.com/perfect-panel/server/internal/model/auth"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/config"
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/model/auth"
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/svc"
|
"github.com/perfect-panel/server/pkg/tool"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/tool"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Email get email smtp config
|
// Email get email smtp config
|
||||||
@ -18,13 +17,11 @@ func Email(ctx *svc.ServiceContext) {
|
|||||||
logger.Debug("Email config initialization")
|
logger.Debug("Email config initialization")
|
||||||
method, err := ctx.AuthModel.FindOneByMethod(context.Background(), "email")
|
method, err := ctx.AuthModel.FindOneByMethod(context.Background(), "email")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("failed to find email auth method: %v", err.Error()))
|
panic(fmt.Sprintf("[Error] Initialization Failed to find email auth method: %v", err.Error()))
|
||||||
}
|
}
|
||||||
var cfg config.EmailConfig
|
var cfg config.EmailConfig
|
||||||
var emailConfig = new(auth.EmailAuthConfig)
|
var emailConfig = new(auth.EmailAuthConfig)
|
||||||
if err := emailConfig.Unmarshal(method.Config); err != nil {
|
emailConfig.Unmarshal(method.Config)
|
||||||
panic(fmt.Sprintf("failed to unmarshal email auth config: %v", err.Error()))
|
|
||||||
}
|
|
||||||
tool.DeepCopy(&cfg, emailConfig)
|
tool.DeepCopy(&cfg, emailConfig)
|
||||||
cfg.Enable = *method.Enabled
|
cfg.Enable = *method.Enabled
|
||||||
value, _ := json.Marshal(emailConfig.PlatformConfig)
|
value, _ := json.Marshal(emailConfig.PlatformConfig)
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
package initialize
|
package initialize
|
||||||
|
|
||||||
import "github.com/perfect-panel/ppanel-server/internal/svc"
|
import (
|
||||||
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
|
)
|
||||||
|
|
||||||
func StartInitSystemConfig(svc *svc.ServiceContext) {
|
func StartInitSystemConfig(svc *svc.ServiceContext) {
|
||||||
// Initialize the system configuration
|
Migrate(svc)
|
||||||
Mysql(svc)
|
|
||||||
VerifyVersion(svc)
|
|
||||||
Site(svc)
|
Site(svc)
|
||||||
Node(svc)
|
Node(svc)
|
||||||
Email(svc)
|
Email(svc)
|
||||||
|
Device(svc)
|
||||||
Invite(svc)
|
Invite(svc)
|
||||||
Verify(svc)
|
Verify(svc)
|
||||||
Subscribe(svc)
|
Subscribe(svc)
|
||||||
Register(svc)
|
Register(svc)
|
||||||
Mobile(svc)
|
Mobile(svc)
|
||||||
TrafficDataToRedis(svc)
|
|
||||||
if !svc.Config.Debug {
|
if !svc.Config.Debug {
|
||||||
Telegram(svc)
|
Telegram(svc)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,10 @@ package initialize
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/perfect-panel/ppanel-server/internal/config"
|
"github.com/perfect-panel/server/internal/config"
|
||||||
"github.com/perfect-panel/ppanel-server/internal/svc"
|
"github.com/perfect-panel/server/internal/svc"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/logger"
|
"github.com/perfect-panel/server/pkg/logger"
|
||||||
"github.com/perfect-panel/ppanel-server/pkg/tool"
|
"github.com/perfect-panel/server/pkg/tool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Invite(ctx *svc.ServiceContext) {
|
func Invite(ctx *svc.ServiceContext) {
|
||||||
|
|||||||
36
initialize/migrate/database/00001_init_schema.down.sql
Normal file
36
initialize/migrate/database/00001_init_schema.down.sql
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
-- 000001_init_schema.down.sql
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user_subscribe_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_subscribe`;
|
||||||
|
DROP TABLE IF EXISTS `user_login_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_gift_amount_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_device`;
|
||||||
|
DROP TABLE IF EXISTS `user_commission_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_balance_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_auth_methods`;
|
||||||
|
DROP TABLE IF EXISTS `user`;
|
||||||
|
DROP TABLE IF EXISTS `traffic_log`;
|
||||||
|
DROP TABLE IF EXISTS `ticket_follow`;
|
||||||
|
DROP TABLE IF EXISTS `ticket`;
|
||||||
|
DROP TABLE IF EXISTS `system`;
|
||||||
|
DROP TABLE IF EXISTS `subscribe_type`;
|
||||||
|
DROP TABLE IF EXISTS `subscribe_group`;
|
||||||
|
DROP TABLE IF EXISTS `subscribe`;
|
||||||
|
DROP TABLE IF EXISTS `sms`;
|
||||||
|
DROP TABLE IF EXISTS `server_rule_group`;
|
||||||
|
DROP TABLE IF EXISTS `server_group`;
|
||||||
|
DROP TABLE IF EXISTS `server`;
|
||||||
|
DROP TABLE IF EXISTS `payment`;
|
||||||
|
DROP TABLE IF EXISTS `order`;
|
||||||
|
DROP TABLE IF EXISTS `message_log`;
|
||||||
|
DROP TABLE IF EXISTS `document`;
|
||||||
|
DROP TABLE IF EXISTS `coupon`;
|
||||||
|
DROP TABLE IF EXISTS `auth_method`;
|
||||||
|
DROP TABLE IF EXISTS `application_version`;
|
||||||
|
DROP TABLE IF EXISTS `application_config`;
|
||||||
|
DROP TABLE IF EXISTS `application`;
|
||||||
|
DROP TABLE IF EXISTS `announcement`;
|
||||||
|
DROP TABLE IF EXISTS `ads`;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
555
initialize/migrate/database/00001_init_schema.up.sql
Normal file
555
initialize/migrate/database/00001_init_schema.up.sql
Normal file
@ -0,0 +1,555 @@
|
|||||||
|
-- 000001_init_schema.up.sql
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `ads`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Ads title',
|
||||||
|
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Ads type',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Ads content',
|
||||||
|
`target_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Ads target url',
|
||||||
|
`start_time` datetime DEFAULT NULL COMMENT 'Ads start time',
|
||||||
|
`end_time` datetime DEFAULT NULL COMMENT 'Ads end time',
|
||||||
|
`status` tinyint(1) DEFAULT '0' COMMENT 'Ads status,0 disable,1 enable',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `announcement`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Title',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Show',
|
||||||
|
`pinned` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Pinned',
|
||||||
|
`popup` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Popup',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `application`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用名称',
|
||||||
|
`icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用图标',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '更新描述',
|
||||||
|
`subscribe_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订阅类型',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `application_config`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`app_id` bigint NOT NULL DEFAULT '0' COMMENT 'App id',
|
||||||
|
`encryption_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Encryption Key',
|
||||||
|
`encryption_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Encryption Method',
|
||||||
|
`domains` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
||||||
|
`startup_picture` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
||||||
|
`startup_picture_skip_time` bigint NOT NULL DEFAULT '0' COMMENT 'Startup Picture Skip Time',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `application_version`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用地址',
|
||||||
|
`version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用版本',
|
||||||
|
`platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用平台',
|
||||||
|
`is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认版本',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '更新描述',
|
||||||
|
`application_id` bigint DEFAULT NULL COMMENT '所属应用',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `fk_application_application_versions` (`application_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `auth_method`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'method',
|
||||||
|
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'OAuth Configuration',
|
||||||
|
`enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Enabled',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_auth_method` (`method`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `coupon`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Coupon Name',
|
||||||
|
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Coupon Code',
|
||||||
|
`count` bigint NOT NULL DEFAULT '0' COMMENT 'Count Limit',
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Coupon Type: 1: Percentage 2: Fixed Amount',
|
||||||
|
`discount` bigint NOT NULL DEFAULT '0' COMMENT 'Coupon Discount',
|
||||||
|
`start_time` bigint NOT NULL DEFAULT '0' COMMENT 'Start Time',
|
||||||
|
`expire_time` bigint NOT NULL DEFAULT '0' COMMENT 'Expire Time',
|
||||||
|
`user_limit` bigint NOT NULL DEFAULT '0' COMMENT 'User Limit',
|
||||||
|
`subscribe` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subscribe Limit',
|
||||||
|
`used_count` bigint NOT NULL DEFAULT '0' COMMENT 'Used Count',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enable',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_coupon_code` (`code`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `document`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Document Title',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Document Content',
|
||||||
|
`tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Document Tags',
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Show',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `message_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'email' COMMENT 'Message Type',
|
||||||
|
`platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'smtp' COMMENT 'Platform',
|
||||||
|
`to` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'To',
|
||||||
|
`subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subject',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Status',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `order`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`parent_id` bigint DEFAULT NULL COMMENT 'Parent Order Id',
|
||||||
|
`user_id` bigint NOT NULL DEFAULT '0' COMMENT 'User Id',
|
||||||
|
`order_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Order No',
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Order Type: 1: Subscribe, 2: Renewal, 3: ResetTraffic, 4: Recharge',
|
||||||
|
`quantity` bigint NOT NULL DEFAULT '1' COMMENT 'Quantity',
|
||||||
|
`price` bigint NOT NULL DEFAULT '0' COMMENT 'Original price',
|
||||||
|
`amount` bigint NOT NULL DEFAULT '0' COMMENT 'Order Amount',
|
||||||
|
`gift_amount` bigint NOT NULL DEFAULT '0' COMMENT 'User Gift Amount',
|
||||||
|
`discount` bigint NOT NULL DEFAULT '0' COMMENT 'Discount Amount',
|
||||||
|
`coupon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Coupon',
|
||||||
|
`coupon_discount` bigint NOT NULL DEFAULT '0' COMMENT 'Coupon Discount Amount',
|
||||||
|
`commission` bigint NOT NULL DEFAULT '0' COMMENT 'Order Commission',
|
||||||
|
`payment_id` bigint NOT NULL DEFAULT '-1' COMMENT 'Payment Id',
|
||||||
|
`method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Payment Method',
|
||||||
|
`fee_amount` bigint NOT NULL DEFAULT '0' COMMENT 'Fee Amount',
|
||||||
|
`trade_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Trade No',
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Order Status: 1: Pending, 2: Paid, 3:Close, 4: Failed, 5:Finished',
|
||||||
|
`subscribe_id` bigint NOT NULL DEFAULT '0' COMMENT 'Subscribe Id',
|
||||||
|
`subscribe_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Renewal Subscribe Token',
|
||||||
|
`is_new` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is New Order',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_order_order_no` (`order_no`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `payment`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Payment Name',
|
||||||
|
`platform` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Payment Platform',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Payment Description',
|
||||||
|
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Payment Icon',
|
||||||
|
`domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Notification Domain',
|
||||||
|
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Payment Configuration',
|
||||||
|
`fee_mode` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Fee Mode: 0: No Fee 1: Percentage 2: Fixed Amount 3: Percentage + Fixed Amount',
|
||||||
|
`fee_percent` bigint DEFAULT '0' COMMENT 'Fee Percentage',
|
||||||
|
`fee_amount` bigint DEFAULT '0' COMMENT 'Fixed Fee Amount',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Enabled',
|
||||||
|
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Payment Token',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_payment_token` (`token`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `server`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node Name',
|
||||||
|
`tags` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Tags',
|
||||||
|
`country` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Country',
|
||||||
|
`city` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'City',
|
||||||
|
`latitude` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'latitude',
|
||||||
|
`longitude` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'longitude',
|
||||||
|
`server_addr` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Address',
|
||||||
|
`relay_mode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'none' COMMENT 'Relay Mode',
|
||||||
|
`relay_node` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Relay Node',
|
||||||
|
`speed_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Speed Limit',
|
||||||
|
`traffic_ratio` decimal(4, 2) NOT NULL DEFAULT '0.00' COMMENT 'Traffic Ratio',
|
||||||
|
`group_id` bigint DEFAULT NULL COMMENT 'Group ID',
|
||||||
|
`protocol` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Protocol',
|
||||||
|
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Config',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enabled',
|
||||||
|
`sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
|
||||||
|
`last_reported_at` datetime(3) DEFAULT NULL COMMENT 'Last Reported Time',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_group_id` (`group_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `server_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Group Name',
|
||||||
|
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Group Description',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
-- if `sms` not exist, create it
|
||||||
|
CREATE TABLE IF NOT EXISTS `sms`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
||||||
|
`platform` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
|
`area_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
|
`telephone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||||
|
`status` tinyint(1) DEFAULT '1',
|
||||||
|
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `subscribe`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subscribe Name',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Subscribe Description',
|
||||||
|
`unit_price` bigint NOT NULL DEFAULT '0' COMMENT 'Unit Price',
|
||||||
|
`unit_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Unit Time',
|
||||||
|
`discount` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Discount',
|
||||||
|
`replacement` bigint NOT NULL DEFAULT '0' COMMENT 'Replacement',
|
||||||
|
`inventory` bigint NOT NULL DEFAULT '0' COMMENT 'Inventory',
|
||||||
|
`traffic` bigint NOT NULL DEFAULT '0' COMMENT 'Traffic',
|
||||||
|
`speed_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Speed Limit',
|
||||||
|
`device_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Device Limit',
|
||||||
|
`quota` bigint NOT NULL DEFAULT '0' COMMENT 'Quota',
|
||||||
|
`group_id` bigint DEFAULT NULL COMMENT 'Group Id',
|
||||||
|
`server_group` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Server Group',
|
||||||
|
`server` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Server',
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Show portal page',
|
||||||
|
`sell` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Sell',
|
||||||
|
`sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
|
||||||
|
`deduction_ratio` bigint DEFAULT '0' COMMENT 'Deduction Ratio',
|
||||||
|
`allow_deduction` tinyint(1) DEFAULT '1' COMMENT 'Allow deduction',
|
||||||
|
`reset_cycle` bigint DEFAULT '0' COMMENT 'Reset Cycle: 0: No Reset, 1: 1st, 2: Monthly, 3: Yearly',
|
||||||
|
`renewal_reset` tinyint(1) DEFAULT '0' COMMENT 'Renew Reset',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `subscribe_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Group Name',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Group Description',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `subscribe_type`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订阅类型',
|
||||||
|
`mark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订阅标识',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `system`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Category',
|
||||||
|
`key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Key Name',
|
||||||
|
`value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Key Value',
|
||||||
|
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Type',
|
||||||
|
`desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Description',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_system_key` (`key`),
|
||||||
|
KEY `index_key` (`key`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `ticket`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Title',
|
||||||
|
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Description',
|
||||||
|
`user_id` bigint NOT NULL DEFAULT '0' COMMENT 'UserId',
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Status',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `ticket_follow`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`ticket_id` bigint NOT NULL DEFAULT '0' COMMENT 'TicketId',
|
||||||
|
`from` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'From',
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Type: 1 text, 2 image',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `traffic_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`server_id` bigint NOT NULL COMMENT 'Server ID',
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`subscribe_id` bigint NOT NULL COMMENT 'Subscription ID',
|
||||||
|
`download` bigint DEFAULT '0' COMMENT 'Download Traffic',
|
||||||
|
`upload` bigint DEFAULT '0' COMMENT 'Upload Traffic',
|
||||||
|
`timestamp` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Traffic Log Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_subscribe_id` (`subscribe_id`),
|
||||||
|
KEY `idx_server_id` (`server_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'User Password',
|
||||||
|
`avatar` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'User Avatar',
|
||||||
|
`balance` bigint DEFAULT '0' COMMENT 'User Balance',
|
||||||
|
`telegram` bigint DEFAULT NULL COMMENT 'Telegram Account',
|
||||||
|
`refer_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Referral Code',
|
||||||
|
`referer_id` bigint DEFAULT NULL COMMENT 'Referrer ID',
|
||||||
|
`commission` bigint DEFAULT '0' COMMENT 'Commission',
|
||||||
|
`gift_amount` bigint DEFAULT '0' COMMENT 'User Gift Amount',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Is Account Enabled',
|
||||||
|
`is_admin` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Admin',
|
||||||
|
`valid_email` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Email Verified',
|
||||||
|
`enable_email_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Email Notifications',
|
||||||
|
`enable_telegram_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Telegram Notifications',
|
||||||
|
`enable_balance_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Balance Change Notifications',
|
||||||
|
`enable_login_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Login Notifications',
|
||||||
|
`enable_subscribe_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Subscription Notifications',
|
||||||
|
`enable_trade_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Trade Notifications',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
`deleted_at` datetime(3) DEFAULT NULL COMMENT 'Deletion Time',
|
||||||
|
`is_del` bigint unsigned DEFAULT NULL COMMENT '1: Normal 0: Deleted',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_referer` (`referer_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_auth_methods`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`auth_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Auth Type 1: apple 2: google 3: github 4: facebook 5: telegram 6: email 7: phone',
|
||||||
|
`auth_identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Auth Identifier',
|
||||||
|
`verified` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Verified',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `idx_auth_identifier` (`auth_identifier`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_balance_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Recharge 2: Withdraw 3: Payment 4: Refund 5: Reward',
|
||||||
|
`order_id` bigint DEFAULT NULL COMMENT 'Order ID',
|
||||||
|
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_commission_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_device`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`subscribe_id` bigint DEFAULT NULL COMMENT 'Subscribe ID',
|
||||||
|
`ip` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Ip.',
|
||||||
|
`Identifier` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Identifier.',
|
||||||
|
`user_agent` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device User Agent.',
|
||||||
|
`online` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Online',
|
||||||
|
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'EnableDeviceNumber',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_gift_amount_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`user_subscribe_id` bigint DEFAULT NULL COMMENT 'Deduction User Subscribe ID',
|
||||||
|
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Increase 2: Reduce',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||||
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Remark',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_login_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`login_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Login IP',
|
||||||
|
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||||
|
`success` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Login Success',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_subscribe`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`order_id` bigint NOT NULL COMMENT 'Order ID',
|
||||||
|
`subscribe_id` bigint NOT NULL COMMENT 'Subscription ID',
|
||||||
|
`start_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Subscription Start Time',
|
||||||
|
`expire_time` datetime(3) DEFAULT NULL COMMENT 'Subscription Expire Time',
|
||||||
|
`traffic` bigint DEFAULT '0' COMMENT 'Traffic',
|
||||||
|
`download` bigint DEFAULT '0' COMMENT 'Download Traffic',
|
||||||
|
`upload` bigint DEFAULT '0' COMMENT 'Upload Traffic',
|
||||||
|
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Token',
|
||||||
|
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UUID',
|
||||||
|
`status` tinyint(1) DEFAULT '0' COMMENT 'Subscription Status: 0: Pending 1: Active 2: Finished 3: Expired 4: Deducted',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_user_subscribe_token` (`token`),
|
||||||
|
UNIQUE KEY `uni_user_subscribe_uuid` (`uuid`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_subscribe_id` (`subscribe_id`),
|
||||||
|
KEY `idx_token` (`token`),
|
||||||
|
KEY `idx_uuid` (`uuid`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_subscribe_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`user_subscribe_id` bigint NOT NULL COMMENT 'User Subscribe ID',
|
||||||
|
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Token',
|
||||||
|
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'IP',
|
||||||
|
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `server_rule_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Rule Group Name',
|
||||||
|
`icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Rule Group Icon',
|
||||||
|
`tags` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Selected Node Tags',
|
||||||
|
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Rule Group Description',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Rule Group Enable',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `unique_name` (`name`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
21
initialize/migrate/database/00002_init_basic_data.down.sql
Normal file
21
initialize/migrate/database/00002_init_basic_data.down.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
-- 000002_init_data.down.sql
|
||||||
|
SET
|
||||||
|
FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM `auth_method`
|
||||||
|
WHERE `id` IN (1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
DELETE
|
||||||
|
FROM `payment`
|
||||||
|
WHERE `id` = -1;
|
||||||
|
DELETE
|
||||||
|
FROM `subscribe_type`
|
||||||
|
WHERE `id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
|
||||||
|
DELETE
|
||||||
|
FROM `system`
|
||||||
|
WHERE `id` IN
|
||||||
|
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||||
|
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41);
|
||||||
|
|
||||||
|
SET
|
||||||
|
FOREIGN_KEY_CHECKS = 1;
|
||||||
127
initialize/migrate/database/00002_init_basic_data.up.sql
Normal file
127
initialize/migrate/database/00002_init_basic_data.up.sql
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
-- 000002_init_data.up.sql
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- auth_method
|
||||||
|
INSERT IGNORE INTO `auth_method` (`id`, `method`, `config`, `enabled`, `created_at`, `updated_at`)
|
||||||
|
VALUES (1, 'email',
|
||||||
|
'{"platform":"smtp","platform_config":{"host":"","port":0,"user":"","pass":"","from":"","ssl":false},"enable_verify":false,"enable_notify":false,"enable_domain_suffix":false,"domain_suffix_list":"","verify_email_template":"","expiration_email_template":"","maintenance_email_template":"","traffic_exceed_email_template":""}',
|
||||||
|
1, '2025-04-22 14:25:16.642', '2025-04-22 14:25:16.642'),
|
||||||
|
(2, 'mobile',
|
||||||
|
'{"platform":"AlibabaCloud","platform_config":{"access":"","secret":"","sign_name":"","endpoint":"","template_code":""},"enable_whitelist":false,"whitelist":[]}',
|
||||||
|
0, '2025-04-22 14:25:16.642', '2025-04-22 14:25:16.642'),
|
||||||
|
(3, 'apple', '{"team_id":"","key_id":"","client_id":"","client_secret":"","redirect_url":""}', 0,
|
||||||
|
'2025-04-22 14:25:16.642', '2025-04-22 14:25:16.642'),
|
||||||
|
(4, 'google', '{"client_id":"","client_secret":"","redirect_url":""}', 0, '2025-04-22 14:25:16.642',
|
||||||
|
'2025-04-22 14:25:16.642'),
|
||||||
|
(5, 'github', '{"client_id":"","client_secret":"","redirect_url":""}', 0, '2025-04-22 14:25:16.642',
|
||||||
|
'2025-04-22 14:25:16.642'),
|
||||||
|
(6, 'facebook', '{"client_id":"","client_secret":"","redirect_url":""}', 0, '2025-04-22 14:25:16.642',
|
||||||
|
'2025-04-22 14:25:16.642'),
|
||||||
|
(7, 'telegram', '{"bot_token":"","enable_notify":false,"webhook_domain":""}', 0, '2025-04-22 14:25:16.642',
|
||||||
|
'2025-04-22 14:25:16.642'),
|
||||||
|
(8, 'device', '{"show_ads":false,"only_real_device":false,"enable_security":false,"security_secret":""}', 0,
|
||||||
|
'2025-04-22 14:25:16.642', '2025-04-22 14:25:16.642');
|
||||||
|
|
||||||
|
-- payment
|
||||||
|
INSERT IGNORE INTO `payment` (`id`, `name`, `platform`, `description`, `icon`, `domain`, `config`, `fee_mode`,
|
||||||
|
`fee_percent`, `fee_amount`, `enable`, `token`)
|
||||||
|
VALUES (-1, 'Balance', 'balance', '', '', '', '', 0, 0, 0, 1, '');
|
||||||
|
|
||||||
|
-- subscribe_type
|
||||||
|
INSERT IGNORE INTO `subscribe_type` (`id`, `name`, `mark`, `created_at`, `updated_at`)
|
||||||
|
VALUES (1, 'Clash', 'Clash', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(2, 'Hiddify', 'Hiddify', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(3, 'Loon', 'Loon', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(4, 'NekoBox', 'NekoBox', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(5, 'NekoRay', 'NekoRay', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(6, 'Netch', 'Netch', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(7, 'Quantumult', 'Quantumult', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(8, 'Shadowrocket', 'Shadowrocket', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(9, 'SingBox', ' SingBox', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(10, 'Surfboard', 'Surfboard', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(11, 'Surge', 'Surge', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(12, 'V2box', 'V2box', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(13, 'V2rayN', 'V2rayN', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648'),
|
||||||
|
(14, 'V2rayNg', 'V2rayNg', '2025-04-22 14:25:16.648', '2025-04-22 14:25:16.648');
|
||||||
|
|
||||||
|
-- system
|
||||||
|
INSERT IGNORE INTO `system` (`id`, `category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`)
|
||||||
|
VALUES (1, 'site', 'SiteLogo', '/favicon.svg', 'string', 'Site Logo', '2025-04-22 14:25:16.637',
|
||||||
|
'2025-04-22 14:25:16.637'),
|
||||||
|
(2, 'site', 'SiteName', 'Perfect Panel', 'string', 'Site Name', '2025-04-22 14:25:16.637',
|
||||||
|
'2025-04-22 14:25:16.637'),
|
||||||
|
(3, 'site', 'SiteDesc',
|
||||||
|
'PPanel is a pure, professional, and perfect open-source proxy panel tool, designed to be your ideal choice for learning and practical use.',
|
||||||
|
'string', 'Site Description', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
(4, 'site', 'Host', '', 'string', 'Site Host', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
(5, 'site', 'Keywords', 'Perfect Panel,PPanel', 'string', 'Site Keywords', '2025-04-22 14:25:16.637',
|
||||||
|
'2025-04-22 14:25:16.637'),
|
||||||
|
(6, 'site', 'CustomHTML', '', 'string', 'Custom HTML', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
(7, 'tos', 'TosContent', 'Welcome to use Perfect Panel', 'string', 'Terms of Service', '2025-04-22 14:25:16.637',
|
||||||
|
'2025-04-22 14:25:16.637'),
|
||||||
|
(8, 'tos', 'PrivacyPolicy', '', 'string', 'PrivacyPolicy', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
(9, 'ad', 'WebAD', 'false', 'bool', 'Display ad on the web', '2025-04-22 14:25:16.637',
|
||||||
|
'2025-04-22 14:25:16.637'),
|
||||||
|
(10, 'subscribe', 'SingleModel', 'false', 'bool', '是否单订阅模式', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(11, 'subscribe', 'SubscribePath', '/api/subscribe', 'string', '订阅路径', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(12, 'subscribe', 'SubscribeDomain', '', 'string', '订阅域名', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(13, 'subscribe', 'PanDomain', 'false', 'bool', '是否使用泛域名', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(14, 'verify', 'TurnstileSiteKey', '', 'string', 'TurnstileSiteKey', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(15, 'verify', 'TurnstileSecret', '', 'string', 'TurnstileSecret', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(16, 'verify', 'EnableLoginVerify', 'false', 'bool', 'is enable login verify', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(17, 'verify', 'EnableRegisterVerify', 'false', 'bool', 'is enable register verify', '2025-04-22 14:25:16.639',
|
||||||
|
'2025-04-22 14:25:16.639'),
|
||||||
|
(18, 'verify', 'EnableResetPasswordVerify', 'false', 'bool', 'is enable reset password verify',
|
||||||
|
'2025-04-22 14:25:16.639', '2025-04-22 14:25:16.639'),
|
||||||
|
(19, 'server', 'NodeSecret', '12345678', 'string', 'node secret', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(20, 'server', 'NodePullInterval', '10', 'int', 'node pull interval', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(21, 'server', 'NodePushInterval', '60', 'int', 'node push interval', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(22, 'server', 'NodeMultiplierConfig', '[]', 'string', 'node multiplier config', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(23, 'invite', 'ForcedInvite', 'false', 'bool', 'Forced invite', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(24, 'invite', 'ReferralPercentage', '20', 'int', 'Referral percentage', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(25, 'invite', 'OnlyFirstPurchase', 'false', 'bool', 'Only first purchase', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(26, 'register', 'StopRegister', 'false', 'bool', 'is stop register', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(27, 'register', 'EnableTrial', 'false', 'bool', 'is enable trial', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(28, 'register', 'TrialSubscribe', '', 'int', 'Trial subscription', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(29, 'register', 'TrialTime', '24', 'int', 'Trial time', '2025-04-22 14:25:16.640', '2025-04-22 14:25:16.640'),
|
||||||
|
(30, 'register', 'TrialTimeUnit', 'Hour', 'string', 'Trial time unit', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(31, 'register', 'EnableIpRegisterLimit', 'false', 'bool', 'is enable IP register limit',
|
||||||
|
'2025-04-22 14:25:16.640', '2025-04-22 14:25:16.640'),
|
||||||
|
(32, 'register', 'IpRegisterLimit', '3', 'int', 'IP Register Limit', '2025-04-22 14:25:16.640',
|
||||||
|
'2025-04-22 14:25:16.640'),
|
||||||
|
(33, 'register', 'IpRegisterLimitDuration', '64', 'int', 'IP Register Limit Duration (minutes)',
|
||||||
|
'2025-04-22 14:25:16.640', '2025-04-22 14:25:16.640'),
|
||||||
|
(34, 'currency', 'Currency', 'USD', 'string', 'Currency', '2025-04-22 14:25:16.641', '2025-04-22 14:25:16.641'),
|
||||||
|
(35, 'currency', 'CurrencySymbol', '$', 'string', 'Currency Symbol', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(36, 'currency', 'CurrencyUnit', 'USD', 'string', 'Currency Unit', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(37, 'currency', 'AccessKey', '', 'string', 'Exchangerate Access Key', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(38, 'verify_code', 'VerifyCodeExpireTime', '300', 'int', 'Verify code expire time', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(39, 'verify_code', 'VerifyCodeLimit', '15', 'int', 'limits of verify code', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(40, 'verify_code', 'VerifyCodeInterval', '60', 'int', 'Interval of verify code', '2025-04-22 14:25:16.641',
|
||||||
|
'2025-04-22 14:25:16.641'),
|
||||||
|
(41, 'system', 'Version', '0.2.0(02002)', 'string', 'System Version', '2025-04-22 14:25:16.642',
|
||||||
|
'2025-04-22 14:25:16.642');
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@ -1,54 +0,0 @@
|
|||||||
-- 先检查 `email` 列是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @col_exists FROM information_schema.columns
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND column_name = 'email';
|
|
||||||
|
|
||||||
SET @sql = IF(@col_exists > 0, 'ALTER TABLE `user` DROP COLUMN `email`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
-- 先检查 `telephone` 列是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @col_exists FROM information_schema.columns
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND column_name = 'telephone';
|
|
||||||
|
|
||||||
SET @sql = IF(@col_exists > 0, 'ALTER TABLE `user` DROP COLUMN `telephone`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
-- 先检查 `telephone_area_code` 列是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @col_exists FROM information_schema.columns
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND column_name = 'telephone_area_code';
|
|
||||||
|
|
||||||
SET @sql = IF(@col_exists > 0, 'ALTER TABLE `user` DROP COLUMN `telephone_area_code`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
|
|
||||||
-- 先检查 `idx_email` 索引是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @idx_exists FROM information_schema.statistics
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND index_name = 'idx_email';
|
|
||||||
|
|
||||||
SET @sql = IF(@idx_exists > 0, 'ALTER TABLE `user` DROP INDEX `idx_email`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
-- 先检查 `idx_telephone` 索引是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @idx_exists FROM information_schema.statistics
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND index_name = 'idx_telephone';
|
|
||||||
|
|
||||||
SET @sql = IF(@idx_exists > 0, 'ALTER TABLE `user` DROP INDEX `idx_telephone`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
|
|
||||||
-- 先检查 `idx_telephone_area_code` 索引是否存在,再删除
|
|
||||||
SELECT COUNT(*) INTO @idx_exists FROM information_schema.statistics
|
|
||||||
WHERE table_schema = DATABASE() AND table_name = 'user' AND index_name = 'idx_telephone_area_code';
|
|
||||||
|
|
||||||
SET @sql = IF(@idx_exists > 0, 'ALTER TABLE `user` DROP INDEX `idx_telephone_area_code`', 'SELECT 1');
|
|
||||||
PREPARE stmt FROM @sql;
|
|
||||||
EXECUTE stmt;
|
|
||||||
DEALLOCATE PREPARE stmt;
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
-- 检查表是否存在,如果存在则跳过创建
|
|
||||||
CREATE TABLE IF NOT EXISTS `oauth_config` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'platform',
|
|
||||||
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'OAuth Configuration',
|
|
||||||
`redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Redirect URL',
|
|
||||||
`enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Enabled',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `uni_oauth_config_platform` (`platform`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- 插入记录时忽略重复记录
|
|
||||||
BEGIN;
|
|
||||||
INSERT IGNORE INTO `oauth_config` (`id`, `platform`, `config`, `redirect`, `enabled`, `created_at`, `updated_at`) VALUES
|
|
||||||
(1, 'apple', '{\"team_id\":\"\",\"key_id\":\"\",\"client_id\":\"\",\"client_secret\":\"\"}', '', 0, '2025-01-26 20:11:15.292', '2025-01-26 20:11:15.292'),
|
|
||||||
(2, 'google', '{\"client_id\":\"\",\"client_secret\":\"\"}', '', 0, '2025-01-26 20:11:15.292', '2025-01-26 20:11:15.292'),
|
|
||||||
(3, 'github', '{\"client_id\":\"\",\"client_secret\":\"\"}', '', 0, '2025-01-26 20:11:15.292', '2025-01-26 20:11:15.292'),
|
|
||||||
(4, 'facebook', '{\"client_id\":\"\",\"client_secret\":\"\"}', '', 0, '2025-01-26 20:11:15.292', '2025-01-26 20:11:15.292'),
|
|
||||||
(5, 'telegram', '{\"bot\":\"\",\"bot_token\":\"\"}', '', 0, '2025-01-26 20:11:15.292', '2025-01-26 20:11:15.292');
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- 检测更新设置表
|
|
||||||
BEGIN;
|
|
||||||
INSERT IGNORE INTO `system` (`category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`) VALUES
|
|
||||||
('sms', 'SmsEnabled', 'false', 'bool', '是否启用短信功能', NOW(), NOW()),
|
|
||||||
('sms', 'SmsKey', 'your-key', 'string', '短信服务用户名或Key',NOW(), NOW()),
|
|
||||||
('sms', 'SmsSecret', 'your-secret', 'string', '短信服务密码或Secret', NOW(), NOW()),
|
|
||||||
('sms', 'SmsSign', 'your-sign', 'string', '短信签名', NOW(), NOW()),
|
|
||||||
('sms', 'SmsTemplate', 'your-template', 'string', '短信模板ID', NOW(), NOW()),
|
|
||||||
('sms', 'SmsRegion', 'cn-hangzhou', 'string', '短信服务所在区域(适用于阿里云)', NOW(), NOW()),
|
|
||||||
('sms', 'SmsTemplate', '您的验证码是{{.Code}},请在5分钟内使用。', 'string', '自定义短信模板', NOW(), NOW()),
|
|
||||||
('sms', 'SmsTemplateCode', 'SMS_12345678', 'string', '阿里云国内短信模板代码',NOW(),NOW()),
|
|
||||||
('sms', 'SmsTemplateParam', '{\"code\":{{.Code}}}', 'string', '短信模板参数', NOW(), NOW()),
|
|
||||||
('sms', 'SmsPlatform', 'smsbao', 'string', '当前使用的短信平台', NOW(), NOW()),
|
|
||||||
('sms', 'SmsLimit', '10', 'int64', '可以发送的短信最大数量', NOW(), NOW()),
|
|
||||||
('sms', 'SmsInterval', '60', 'int64', '发送短信的时间间隔(单位:秒)',NOW(), NOW()),
|
|
||||||
('sms', 'SmsExpireTime', '300', 'int64', '短信验证码的过期时间(单位:秒)',NOW(), NOW()),
|
|
||||||
('email', 'EmailEnabled', 'true', 'bool', '启用邮箱登陆',NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpHost', '', 'string', '邮箱服务器地址', NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpPort', '465', 'int', '邮箱服务器端口',NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpUser', 'domain@f1shyu.com', 'string', '邮箱服务器用户名', NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpPass', 'password', 'string', '邮箱服务器密码', NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpFrom', 'domain@f1shyu.com', 'string', '发送邮件的邮箱',NOW(), NOW()),
|
|
||||||
('email', 'EmailSmtpSSL', 'true', 'bool', '邮箱服务器加密方式',NOW(), NOW()),
|
|
||||||
('email', 'EmailTemplate', '%s', 'string', '邮件模板',NOW(), NOW()),
|
|
||||||
('email', 'VerifyEmailTemplate', '', 'string', 'Verify Email template',NOW(), NOW()),
|
|
||||||
('email', 'MaintenanceEmailTemplate', '', 'string', 'Maintenance Email template',NOW(), NOW()),
|
|
||||||
('email', 'ExpirationEmailTemplate', '', 'string', 'Expiration Email template', NOW(), NOW()),
|
|
||||||
('email', 'EmailEnableVerify', 'true', 'bool', '是否开启邮箱验证', NOW(), NOW()),
|
|
||||||
('email', 'EmailEnableDomainSuffix', 'false', 'bool', '是否开启邮箱域名后缀限制',NOW(), NOW()),
|
|
||||||
('email', 'EmailDomainSuffixList', 'qq.com', 'string', '邮箱域名后缀列表',NOW(), NOW());
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- User Device
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_device` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
|
||||||
`device_number` varchar(191) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Number.',
|
|
||||||
`online` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Online',
|
|
||||||
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'EnableDeviceNumber',
|
|
||||||
`last_online` datetime(3) DEFAULT NULL COMMENT 'Last Online',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `idx_user_id` (`user_id`),
|
|
||||||
CONSTRAINT `fk_user_user_devices` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- Mobile
|
|
||||||
CREATE TABLE IF NOT EXISTS `sms` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`content` text COLLATE utf8mb4_general_ci,
|
|
||||||
`platform` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
|
||||||
`area_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
|
||||||
`telephone` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL,
|
|
||||||
`status` tinyint(1) DEFAULT '1',
|
|
||||||
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- Application Config
|
|
||||||
CREATE TABLE IF NOT EXISTS `application_config` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`app_id` bigint NOT NULL DEFAULT '0' COMMENT 'App id',
|
|
||||||
`encryption_key` text COLLATE utf8mb4_general_ci COMMENT 'Encryption Key',
|
|
||||||
`encryption_method` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Encryption Method',
|
|
||||||
`domains` text COLLATE utf8mb4_general_ci,
|
|
||||||
`startup_picture` text COLLATE utf8mb4_general_ci,
|
|
||||||
`startup_picture_skip_time` bigint NOT NULL DEFAULT '0' COMMENT 'Startup Picture Skip Time',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- Application Version
|
|
||||||
CREATE TABLE IF NOT EXISTS `application_version` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`url` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用地址',
|
|
||||||
`version` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用版本',
|
|
||||||
`platform` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '应用平台',
|
|
||||||
`is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT '默认版本',
|
|
||||||
`description` text COLLATE utf8mb4_general_ci COMMENT '更新描述',
|
|
||||||
`application_id` bigint DEFAULT NULL COMMENT '所属应用',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT '创建时间',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT '更新时间',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `fk_application_application_versions` (`application_id`),
|
|
||||||
CONSTRAINT `fk_application_application_versions` FOREIGN KEY (`application_id`) REFERENCES `application` (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
UPDATE `subscribe` SET `unit_time`='Month' WHERE unit_time = '';
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `user_device`;
|
|
||||||
-- User Device
|
|
||||||
CREATE TABLE IF NOT EXISTS `user_device` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
|
||||||
`subscribe_id` bigint DEFAULT NULL COMMENT 'Subscribe ID',
|
|
||||||
`ip` varchar(191) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Ip.',
|
|
||||||
`Identifier` varchar(191) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Identifier.',
|
|
||||||
`user_agent` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device User Agent.',
|
|
||||||
`online` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Online',
|
|
||||||
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'EnableDeviceNumber',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `idx_user_id` (`user_id`),
|
|
||||||
CONSTRAINT `fk_user_user_devices` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for server_rule_group
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `server_rule_group`;
|
|
||||||
CREATE TABLE `server_rule_group` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Rule Group Name',
|
|
||||||
`icon` text COLLATE utf8mb4_general_ci COMMENT 'Rule Group Icon',
|
|
||||||
`description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Rule Group Description',
|
|
||||||
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Rule Group Enable',
|
|
||||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
|
||||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `unique_name` (`name`) -- Add unique constraint to `name`
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of server_rule_group
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
72
initialize/migrate/database/02003_update_payment.down.sql
Normal file
72
initialize/migrate/database/02003_update_payment.down.sql
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
-- migrations/02003_update_payment.down.sql
|
||||||
|
-- Purpose: Revert updates to payment and order tables
|
||||||
|
-- Author: PPanel Team, 2025-04-21
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- Drop payment_id column from order table (if exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'order'
|
||||||
|
AND COLUMN_NAME = 'payment_id');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `order` DROP COLUMN `payment_id`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Drop platform column from payment table (if exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'platform');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `payment` DROP COLUMN `platform`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Drop description column from payment table (if exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'description');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `payment` DROP COLUMN `description`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Drop token column from payment table (if exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'token');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `payment` DROP COLUMN `token`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Optionally restore mark column (if needed, adjust definition as per original schema)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'mark');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `payment` ADD COLUMN `mark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT \'Payment Mark\' AFTER `name`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
72
initialize/migrate/database/02003_update_payment.up.sql
Normal file
72
initialize/migrate/database/02003_update_payment.up.sql
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
-- 2025-04-22 16:16:00
|
||||||
|
-- Purpose: Update payment table
|
||||||
|
-- Author: PPanel Team, 2025-04-21
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- Alter the order table to add a payment_id column (if not exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'order'
|
||||||
|
AND COLUMN_NAME = 'payment_id');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `order` ADD COLUMN `payment_id` bigint NOT NULL DEFAULT \'-1\' COMMENT \'Payment Id\' AFTER `commission`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Alter the payment table to add a platform column (if not exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'platform');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `payment` ADD COLUMN `platform` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT \'Payment Platform\' AFTER `name`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Drop the mark column from the payment table (only if exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'mark');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `payment` DROP COLUMN `mark`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Alter the payment table to add a description column (if not exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'description');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `payment` ADD COLUMN `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT \'Payment Description\' AFTER `platform`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Alter the payment table to add a token column (if not exists)
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'payment'
|
||||||
|
AND COLUMN_NAME = 'token');
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `payment` ADD COLUMN `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT \'Payment Token\' AFTER `description`',
|
||||||
|
'SELECT 1');
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
4
initialize/migrate/database/02004_rebuild_rule.down.sql
Normal file
4
initialize/migrate/database/02004_rebuild_rule.down.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-- migrations/02003_rebuild_rule.up.sql
|
||||||
|
-- Purpose: Back rebuilding server rule table
|
||||||
|
-- Author: PPanel Team, 2025-04-21
|
||||||
|
DROP TABLE IF EXISTS server_rule_group;
|
||||||
22
initialize/migrate/database/02004_rebuild_rule.up.sql
Normal file
22
initialize/migrate/database/02004_rebuild_rule.up.sql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
-- migrations/02003_rebuild_rule.up.sql
|
||||||
|
-- Purpose: rebuilding server rule table
|
||||||
|
-- Author: PPanel Team, 2025-04-21
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `server_rule_group`;
|
||||||
|
|
||||||
|
CREATE TABLE `server_rule_group`
|
||||||
|
(
|
||||||
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Rule Group Name',
|
||||||
|
`icon` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Rule Group Icon',
|
||||||
|
`tags` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Selected Node Tags',
|
||||||
|
`rules` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Rules',
|
||||||
|
`enable` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Rule Group Enable',
|
||||||
|
`created_at` DATETIME(3) COMMENT 'Creation Time',
|
||||||
|
`updated_at` DATETIME(3) COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uni_server_rule_group_name` (`name`),
|
||||||
|
INDEX `idx_enable` (`enable`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
-- migrations/02004_create_user_device_online_record.down.sql
|
||||||
|
-- Purpose: Drop user device online record table
|
||||||
|
-- Author: PPanel Team, 2025-04-22
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user_device_online_record`;
|
||||||
|
|
||||||
|
-- User subscribe table migration for removing finished_at column
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'user_subscribe'
|
||||||
|
AND COLUMN_NAME = 'finished_at');
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `user_subscribe` DROP COLUMN `finished_at`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Application config table migration for removing invitation_link column
|
||||||
|
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'application_config'
|
||||||
|
AND COLUMN_NAME = 'invitation_link');
|
||||||
|
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `application_config` DROP COLUMN `invitation_link`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Application config table migration for removing kr_website_id column
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'application_config'
|
||||||
|
AND COLUMN_NAME = 'kr_website_id');
|
||||||
|
|
||||||
|
SET @sql = IF(@column_exists > 0,
|
||||||
|
'ALTER TABLE `application_config` DROP COLUMN `kr_website_id`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
-- migrations/02005_create_user_device_online_record.up.sql
|
||||||
|
-- Purpose: Create table for tracking user device online records
|
||||||
|
-- Author: PPanel Team, 2025-04-22
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_device_online_record`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` BIGINT NOT NULL COMMENT 'User ID',
|
||||||
|
`identifier` VARCHAR(255) NOT NULL COMMENT 'Device Identifier',
|
||||||
|
`online_time` DATETIME COMMENT 'Online Time',
|
||||||
|
`offline_time` DATETIME COMMENT 'Offline Time',
|
||||||
|
`online_seconds` BIGINT COMMENT 'Offline Seconds',
|
||||||
|
`duration_days` BIGINT COMMENT 'Duration Days',
|
||||||
|
`created_at` DATETIME COMMENT 'Creation Time'
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
|
||||||
|
-- User subscribe table migration for adding finished_at column
|
||||||
|
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'user_subscribe'
|
||||||
|
AND COLUMN_NAME = 'finished_at');
|
||||||
|
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `user_subscribe` ADD COLUMN `finished_at` DATETIME NULL COMMENT ''Subscribe Finished Time'' AFTER `expire_time`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
|
||||||
|
-- Application config table migration for adding Link column
|
||||||
|
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'application_config'
|
||||||
|
AND COLUMN_NAME = 'invitation_link');
|
||||||
|
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `application_config` ADD COLUMN `invitation_link` TEXT NULL DEFAULT NULL COMMENT ''Invitation Link'' AFTER `startup_picture_skip_time`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
-- Application config table migration for adding kr_website_id column
|
||||||
|
SET @column_exists = (SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'application_config'
|
||||||
|
AND COLUMN_NAME = 'kr_website_id');
|
||||||
|
|
||||||
|
SET @sql = IF(@column_exists = 0,
|
||||||
|
'ALTER TABLE `application_config` ADD COLUMN `kr_website_id` VARCHAR(255) NULL DEFAULT NULL COMMENT ''KR Website ID'' AFTER `invitation_link`',
|
||||||
|
'SELECT 1'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
-- migrations/02008_create_user_reset_subscribe_log.down.sql
|
||||||
|
-- Purpose: Drop user_reset_subscribe_log table
|
||||||
|
-- Author: PPanel Team, 2025-04-22
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user_reset_subscribe_log`;
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
-- migrations/02008_create_user_reset_subscribe_log.up.sql
|
||||||
|
-- Purpose: Create user_reset_subscribe_log table
|
||||||
|
-- Author: PPanel Team, 2025-04-22
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_reset_subscribe_log`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` BIGINT NOT NULL COMMENT 'User ID',
|
||||||
|
`type` TINYINT(1) NOT NULL COMMENT 'Type: 1: Auto 2: Advance 3: Paid',
|
||||||
|
`order_no` VARCHAR(255) DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`user_subscribe_id` BIGINT NOT NULL COMMENT 'User Subscribe ID',
|
||||||
|
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation Time',
|
||||||
|
INDEX `idx_user_id` (`user_id`),
|
||||||
|
INDEX `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
3
initialize/migrate/database/02007_adapte_rule.down.sql
Normal file
3
initialize/migrate/database/02007_adapte_rule.down.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE `server_rule_group`
|
||||||
|
DROP COLUMN `default`,
|
||||||
|
DROP COLUMN `type`;
|
||||||
3
initialize/migrate/database/02007_adapte_rule.up.sql
Normal file
3
initialize/migrate/database/02007_adapte_rule.up.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE `server_rule_group`
|
||||||
|
ADD COLUMN `default` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Is Default Group',
|
||||||
|
ADD COLUMN `type` VARCHAR(100) NOT NULL DEFAULT '' COMMENT 'Rule Group Type';
|
||||||
1
initialize/migrate/database/02100_task.down.sql
Normal file
1
initialize/migrate/database/02100_task.down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE IF EXISTS `email_task`;
|
||||||
23
initialize/migrate/database/02100_task.up.sql
Normal file
23
initialize/migrate/database/02100_task.up.sql
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
DROP TABLE IF EXISTS `email_task`;
|
||||||
|
CREATE TABLE `email_task` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
|
`subject` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Email Subject',
|
||||||
|
`content` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Email Content',
|
||||||
|
`recipient` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Email Recipient',
|
||||||
|
`scope` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Email Scope',
|
||||||
|
`register_start_time` datetime(3) DEFAULT NULL COMMENT 'Register Start Time',
|
||||||
|
`register_end_time` datetime(3) DEFAULT NULL COMMENT 'Register End Time',
|
||||||
|
`additional` text COLLATE utf8mb4_general_ci COMMENT 'Additional Information',
|
||||||
|
`scheduled` datetime(3) NOT NULL COMMENT 'Scheduled Time',
|
||||||
|
`interval` tinyint unsigned NOT NULL COMMENT 'Interval in Seconds',
|
||||||
|
`limit` bigint unsigned NOT NULL COMMENT 'Daily send limit',
|
||||||
|
`status` tinyint unsigned NOT NULL COMMENT 'Daily Status',
|
||||||
|
`errors` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Errors',
|
||||||
|
`total` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Total Number',
|
||||||
|
`current` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Current Number',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE IF EXISTS `subscribe_application`;
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
|||||||
|
INSERT IGNORE INTO `system` (`id`, `category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
(42, 'subscribe', 'UserAgentLimit', 'false', 'bool', 'User Agent Limit', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
(43, 'subscribe', 'UserAgentList', '', 'string', 'User Agent List', '2025-04-22 14:25:16.637','2025-04-22 14:25:16.637');
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
DROP TABLE IF EXISTS `application`;
|
||||||
|
DROP TABLE IF EXISTS `application_version`;
|
||||||
|
DROP TABLE IF EXISTS `application_config`;
|
||||||
106
initialize/migrate/database/02104_system_log.down.sql
Normal file
106
initialize/migrate/database/02104_system_log.down.sql
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `user_balance_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Recharge 2: Withdraw 3: Payment 4: Refund 5: Reward',
|
||||||
|
`order_id` bigint DEFAULT NULL COMMENT 'Order ID',
|
||||||
|
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_commission_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_gift_amount_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`user_subscribe_id` bigint DEFAULT NULL COMMENT 'Deduction User Subscribe ID',
|
||||||
|
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Increase 2: Reduce',
|
||||||
|
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||||
|
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||||
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Remark',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_login_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`login_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Login IP',
|
||||||
|
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||||
|
`success` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Login Success',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_reset_subscribe_log`
|
||||||
|
(
|
||||||
|
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` BIGINT NOT NULL COMMENT 'User ID',
|
||||||
|
`type` TINYINT(1) NOT NULL COMMENT 'Type: 1: Auto 2: Advance 3: Paid',
|
||||||
|
`order_no` VARCHAR(255) DEFAULT NULL COMMENT 'Order No.',
|
||||||
|
`user_subscribe_id` BIGINT NOT NULL COMMENT 'User Subscribe ID',
|
||||||
|
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation Time',
|
||||||
|
INDEX `idx_user_id` (`user_id`),
|
||||||
|
INDEX `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `user_subscribe_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||||
|
`user_subscribe_id` bigint NOT NULL COMMENT 'User Subscribe ID',
|
||||||
|
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Token',
|
||||||
|
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'IP',
|
||||||
|
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `message_log`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'email' COMMENT 'Message Type',
|
||||||
|
`platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'smtp' COMMENT 'Platform',
|
||||||
|
`to` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'To',
|
||||||
|
`subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subject',
|
||||||
|
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Status',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_general_ci;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `system_logs`;
|
||||||
19
initialize/migrate/database/02104_system_log.up.sql
Normal file
19
initialize/migrate/database/02104_system_log.up.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
DROP TABLE IF EXISTS `user_balance_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_commission_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_gift_amount_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_login_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_reset_subscribe_log`;
|
||||||
|
DROP TABLE IF EXISTS `user_subscribe_log`;
|
||||||
|
DROP TABLE IF EXISTS `message_log`;
|
||||||
|
DROP TABLE IF EXISTS `system_logs`;
|
||||||
|
CREATE TABLE `system_logs` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`type` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Log Type: 1: Email Message 2: Mobile Message 3: Subscribe 4: Subscribe Traffic 5: Server Traffic 6: Login 7: Register 8: Balance 9: Commission 10: Reset Subscribe 11: Gift',
|
||||||
|
`date` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Log Date',
|
||||||
|
`object_id` bigint NOT NULL DEFAULT '0' COMMENT 'Object ID',
|
||||||
|
`content` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Log Content',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_type` (`type`),
|
||||||
|
KEY `idx_object_id` (`object_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
2
initialize/migrate/database/02105_node.down.sql
Normal file
2
initialize/migrate/database/02105_node.down.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
DROP TABLE IF EXISTS `nodes`;
|
||||||
|
DROP TABLE IF EXISTS `servers`;
|
||||||
28
initialize/migrate/database/02105_node.up.sql
Normal file
28
initialize/migrate/database/02105_node.up.sql
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `servers` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Name',
|
||||||
|
`country` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Country',
|
||||||
|
`city` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'City',
|
||||||
|
`ratio` decimal(4,2) NOT NULL DEFAULT '0.00' COMMENT 'Traffic Ratio',
|
||||||
|
`address` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Address',
|
||||||
|
`sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
|
||||||
|
`protocols` text COLLATE utf8mb4_general_ci COMMENT 'Protocol',
|
||||||
|
`last_reported_at` datetime(3) DEFAULT NULL COMMENT 'Last Reported Time',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `nodes` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node Name',
|
||||||
|
`tags` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Tags',
|
||||||
|
`port` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Connect Port',
|
||||||
|
`address` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Connect Address',
|
||||||
|
`server_id` bigint NOT NULL DEFAULT '0' COMMENT 'Server ID',
|
||||||
|
`protocol` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Protocol',
|
||||||
|
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enabled',
|
||||||
|
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||||
|
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
5
initialize/migrate/database/02106_subscribe.down.sql
Normal file
5
initialize/migrate/database/02106_subscribe.down.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE `subscribe`
|
||||||
|
DROP COLUMN `nodes`,
|
||||||
|
DROP COLUMN `node_tags`,
|
||||||
|
ADD COLUMN `server` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Server',
|
||||||
|
ADD COLUMN `server_group` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Server Group';
|
||||||
7
initialize/migrate/database/02106_subscribe.up.sql
Normal file
7
initialize/migrate/database/02106_subscribe.up.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
ALTER TABLE `subscribe`
|
||||||
|
ADD COLUMN `nodes` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Node IDs',
|
||||||
|
ADD COLUMN `node_tags` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Node Tags',
|
||||||
|
DROP COLUMN `server`,
|
||||||
|
DROP COLUMN `server_group`;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `server_rule_group`;
|
||||||
4
initialize/migrate/database/02107_log_setting.up.sql
Normal file
4
initialize/migrate/database/02107_log_setting.up.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
INSERT IGNORE INTO `system` (`category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
('log', 'AutoClear', 'true', 'bool', 'Auto Clear Log', '2025-04-22 14:25:16.637', '2025-04-22 14:25:16.637'),
|
||||||
|
('log', 'ClearDays', '7', 'int', 'Clear Days', '2025-04-22 14:25:16.637','2025-04-22 14:25:16.637');
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user