Jelajahi Sumber

单个号优化

ck 4 tahun lalu
induk
melakukan
569f617af5
2 mengubah file dengan 18 tambahan dan 2 penghapusan
  1. 4 1
      data_manage/analysis_select.py
  2. 14 1
      data_manage/pitcher_panel.py

+ 4 - 1
data_manage/analysis_select.py

@@ -22,7 +22,10 @@ def channel_analysis_select(arg):
     if user_id in super_auth():
         op = ''
     else:
-        op = f' and channel in {tuple(get_auth_channel(user_id))}'
+        if len(get_auth_channel(user_id)) == 1:
+            op = f" and channel = '{get_auth_channel(user_id)[0]}'"
+        else:
+            op = f' and channel in {tuple(get_auth_channel(user_id))}'
 
     op1 = f" and channel in {tuple(channel.split(','))}" if channel else ''
 

+ 14 - 1
data_manage/pitcher_panel.py

@@ -120,6 +120,9 @@ def get_channel_overview(user_id,channel,pitcher,stage,start,end,page,page_size,
     else:
         if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
             return None, None, None
+
+        elif len(UserAuthUtils.get_auth_channel(user_id)) == 1:
+            op = f" and channel = '{UserAuthUtils.get_auth_channel(user_id)[0]}'"
         else:
             op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
 
@@ -374,6 +377,8 @@ def get_channel_active(user_id,channel,pitcher,start,end,page,page_size,order_by
     else:
         if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
             return None, None, None
+        elif len(UserAuthUtils.get_auth_channel(user_id)) == 1:
+            op = f" and channel = '{UserAuthUtils.get_auth_channel(user_id)[0]}'"
         else:
             op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
     op1 = f" and pitcher ='{pitcher}' " if pitcher else ''
@@ -457,6 +462,9 @@ def get_channel_order_trend(user_id,channel,pitcher,start,end,page,page_size,ord
     else:
         if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
             return None, None, None
+        elif len(UserAuthUtils.get_auth_channel(user_id)) == 1:
+            op = f" and channel = '{UserAuthUtils.get_auth_channel(user_id)[0]}'"
+
         else:
             op = f" and channel in {str(UserAuthUtils.get_auth_channel(user_id))}"
 
@@ -598,7 +606,12 @@ def get_channel_summary(user_id,channel,pitcher,page,page_size,order_by,order,st
     else:
         channel_li = UserAuthUtils.get_auth_channel(user_id)
         print(channel_li.__len__())
-        op = f" and a.channel in {tuple(channel_li)}"
+        if len(channel_li) == 0:
+            return None,None,None
+        elif len(channel_li) == 1:
+            op = f" and a.channel = '{channel_li[0]}'"
+        else:
+            op = f" and a.channel in {tuple(channel_li)}"
 
     op1=f" and a.channel='{channel}'" if channel else ''
     op2=f" and pitcher='{pitcher}'" if pitcher else ''