瀏覽代碼

Update agent_service: add white list

StrayWarrior 19 小時之前
父節點
當前提交
d1c8ab9a81
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      agent_service.py

+ 5 - 2
agent_service.py

@@ -166,11 +166,14 @@ class AgentService:
         logger.warning(f"staff[{staff_id}] user[{user_id}]: response[{message_type}] {response}")
         current_ts = int(time.time() * 1000)
         user_tags = self.user_relation_manager.get_user_tags(user_id)
+        white_list_tags = {'AgentTest1', '04W4-YR-1', '04W4-YR-2', '04W4-KK-1', '04W4-SQ-1'}
+        hit_white_list_tags = len(set(user_tags).intersection(white_list_tags)) > 0
         # FIXME(zhoutian)
         # 测试期间临时逻辑,只发送特定的账号或特定用户
         user_black_lists = ['7881300148979455',]
-        if not (staff_id in set(['1688854492669990'])
-                or 'AgentTest1' in user_tags) or user_id in user_black_lists:
+        staff_white_lists = ['1688854492669990',]
+        if not (staff_id in staff_white_lists or hit_white_list_tags) \
+                or user_id in user_black_lists:
             logger.warning(f"staff[{staff_id}] user[{user_id}]: skip reply")
             return None
         self.send_queue.produce(