fix: 修复订阅列表查询逻辑并更新Dockerfile配置

修复订阅列表查询中服务器组为空时的处理逻辑,避免潜在错误
在getSubscribeListLogic.go中添加服务器数量统计功能
更新Dockerfile添加logs目录拷贝
清理ppanel.yaml配置文件中的合并冲突和冗余配置
This commit is contained in:
shanshanzhong 2025-08-17 04:28:32 -07:00
parent e898e6afbe
commit 41423ca666
4 changed files with 19 additions and 46 deletions

View File

@ -38,6 +38,7 @@ WORKDIR /app
COPY --from=builder /app/ppanel /app/ppanel
COPY --from=builder /build/etc /app/etc
COPY --from=builder /build/logs /app/logs
# Expose the port (optional)
EXPOSE 8080

View File

@ -1,44 +1,5 @@
Host: 0.0.0.0
Port: 8080
<<<<<<< HEAD
TLS:
Enable: false
CertFile: ""
KeyFile: ""
Debug: true
JwtAuth:
AccessSecret: 89270267-f1dc-4136-9c9c-dc38c4685d63
AccessExpire: 604800
Logger:
ServiceName: PPanel
Mode: file
Encoding: json
TimeFormat: "2006-01-02 15:04:05.000"
Path: logs
Level: info
MaxContentLength: 0
Compress: false
Stat: true
KeepDays: 0
StackCooldownMillis: 100
MaxBackups: 0
MaxSize: 0
Rotation: daily
FileTimeFormat: 2006-01-02T15:04:05.000Z07:00
MySQL:
Addr: ppanel-db:3306
Username: ppanel
Password: ppanelpassword
Dbname: ppanel
Config: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai
MaxIdleConns: 10
MaxOpenConns: 10
SlowThreshold: 1000
Redis:
Host: redis:6379
Pass:
DB: 0
=======
Debug: false
JwtAuth:
AccessSecret: 1234567890
@ -60,7 +21,7 @@ Logger:
Rotation: daily
FileTimeFormat: 2025-01-01T00:00:00.000Z00:00
MySQL:
Addr: 172.245.180.199:3306
Addr: ppanel-db:3306
Dbname: ppanel
Username: ppanel
Password: ppanelpassword
@ -75,4 +36,3 @@ Redis:
Administrator:
Password: password
Email: admin@ppanel.dev
>>>>>>> old

View File

@ -47,6 +47,13 @@ func (l *GetSubscribeListLogic) GetSubscribeList(req *types.GetSubscribeListRequ
l.Logger.Error("[GetSubscribeListLogic] JSON unmarshal failed: ", logger.Field("error", err.Error()), logger.Field("discount", item.Discount))
}
}
servers, err := l.svcCtx.ServerModel.FindServerListByGroupIds(l.ctx, sub.ServerGroup)
if err != nil {
l.Errorw("[QuerySubscribeListLogic] FindServerListByGroupIds error", logger.Field("error", err.Error()))
sub.ServerCount = 0
} else {
sub.ServerCount = int64(len(servers))
}
sub.Server = tool.StringToInt64Slice(item.Server)
sub.ServerGroup = tool.StringToInt64Slice(item.ServerGroup)
resultList = append(resultList, sub)

View File

@ -50,12 +50,17 @@ func (l *QuerySubscribeListLogic) QuerySubscribeList() (resp *types.QuerySubscri
}
list[i] = sub
// 通过服务组查询关联的节点数量
servers, err := l.svcCtx.ServerModel.FindServerListByGroupIds(l.ctx, sub.ServerGroup)
if err != nil {
l.Errorw("[QuerySubscribeListLogic] FindServerListByGroupIds error", logger.Field("error", err.Error()))
sub.ServerCount = 0
if item.ServerGroup != "" {
groupIds := tool.StringToInt64Slice(item.ServerGroup)
servers, err := l.svcCtx.ServerModel.FindServerListByGroupIds(l.ctx, groupIds)
if err != nil {
l.Errorw("[QuerySubscribeListLogic] FindServerListByGroupIds error", logger.Field("error", err.Error()))
sub.ServerCount = 0
} else {
sub.ServerCount = int64(len(servers))
}
} else {
sub.ServerCount = int64(len(servers))
sub.ServerCount = 0
}
list[i] = sub
}