diff --git a/internal/logic/public/subscribe/querySubscribeListLogic.go b/internal/logic/public/subscribe/querySubscribeListLogic.go index 2208559..16d538e 100644 --- a/internal/logic/public/subscribe/querySubscribeListLogic.go +++ b/internal/logic/public/subscribe/querySubscribeListLogic.go @@ -3,6 +3,7 @@ package subscribe import ( "context" "encoding/json" + "strings" "github.com/perfect-panel/server/internal/model/subscribe" "github.com/perfect-panel/server/internal/svc" @@ -53,8 +54,35 @@ func (l *QuerySubscribeListLogic) QuerySubscribeList(req *types.QuerySubscribeLi var discount []types.SubscribeDiscount _ = json.Unmarshal([]byte(item.Discount), &discount) sub.Discount = discount - list[i] = sub } + + // 计算节点数量 + var nodeIds []int64 + var tags []string + + // 解析节点ID + if item.Nodes != "" { + nodeIds = tool.StringToInt64Slice(item.Nodes) + } + + // 解析标签 + if item.NodeTags != "" { + tagStrs := strings.Split(item.NodeTags, ",") + for _, tag := range tagStrs { + if tag != "" { + tags = append(tags, tag) + } + } + } + + // 获取节点数量 + nodeCount, err := l.svcCtx.NodeModel.CountNodesByIdsAndTags(l.ctx, nodeIds, tags) + if err != nil { + l.Errorw("[QuerySubscribeListLogic] Count nodes failed", logger.Field("error", err.Error()), logger.Field("subscribeId", item.Id)) + nodeCount = 0 // 出错时设置为0 + } + sub.NodeCount = nodeCount + list[i] = sub } resp.List = list diff --git a/ppanel-server b/ppanel-server deleted file mode 100755 index 428ec44..0000000 Binary files a/ppanel-server and /dev/null differ diff --git a/server b/server deleted file mode 100755 index 7b60a49..0000000 Binary files a/server and /dev/null differ