diff --git a/apps/proxy/models.py b/apps/proxy/models.py index e33b89f6b4..1fe218c5e2 100644 --- a/apps/proxy/models.py +++ b/apps/proxy/models.py @@ -461,10 +461,6 @@ def ehco_relay_port(self): def relay_count(self): return self.relay_rules.all().count() - @property - def is_shared_node(self): - return not OccupancyConfig.objects.filter(proxy_node=self).exists() - @cached_property def online_info(self): return UserTrafficLog.get_latest_online_log_info(self) @@ -1107,6 +1103,10 @@ def get_user_occupancies(cls, user: User, out_of_usage=False, limit=None): query = query[:limit] return query + @classmethod + def check_node_occupied_by_user(cls, node: ProxyNode, user: User): + return cls._valid_occupancy_query().filter(proxy_node=node, user=user).exists() + def human_total_traffic(self): return utils.traffic_format(self.total_traffic) diff --git a/apps/sspanel/views.py b/apps/sspanel/views.py index 2491f3733d..bf49045d31 100644 --- a/apps/sspanel/views.py +++ b/apps/sspanel/views.py @@ -218,10 +218,10 @@ def get(self, request): shared_node_count = 0 occupied_node_count = 0 for node in user_active_nodes: - if node.is_shared_node: - shared_node_count += 1 - else: + if UserProxyNodeOccupancy.check_node_occupied_by_user(node, user): occupied_node_count += 1 + else: + shared_node_count += 1 context = { "user": user, diff --git a/templates/web/node_occupancy.html b/templates/web/node_occupancy.html index adfc32c54e..98b8b4364b 100644 --- a/templates/web/node_occupancy.html +++ b/templates/web/node_occupancy.html @@ -1,18 +1,14 @@ {% extends 'base.html' %} {% block authed %}
-
+

独享节点

  • 流量和共享节点分开计算
  • -
  • - 购买后,可在当前页面观察到流量的使用情况 -
  • -
  • - 购买后,直接从订阅连接里就能拉取到所有的独享节点 -
  • +
  • 购买后,可在当前页面观察到流量的使用情况
  • +
  • 购买后,直接从订阅连接里就能拉取到所有的独享节点
@@ -46,9 +42,9 @@

独享节点

-
+
{% for node in purchasable_proxy_nodes %} -