Explorar el Código

fix: 修复busy和idle查询数据逻辑

余尚辉 hace 4 meses
padre
commit
99695826a1
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      src/core/callcenter/agent.py

+ 6 - 4
src/core/callcenter/agent.py

@@ -477,16 +477,14 @@ class AgentStateService:
         self.assigned_recycle_millisecond = 60000
     
     def idle(self, saas_id, agent_id, phone_num):
-        # HumanService 这个地方没实现 没看明白
-        human_service = HumanService(saas_id, agent_id)
+        human_service = _get_human_service_service(saas_id, agent_id)
         if human_service is None:
             print(f"agent engine idle not have human service {saas_id} {agent_id}")  # 使用print替代log
             return
         self.idle_hash(saas_id, agent_id, phone_num, human_service.service_id)
 
     def busy(self, saas_id, agent_id, phone_num):
-        # HumanService 这个地方没实现 没看明白
-        human_service = HumanService(saas_id, agent_id)
+        human_service = _get_human_service_service(saas_id, agent_id)
         if human_service is None:
             print(f"agent engine busy not hava human service {saas_id} {agent_id}")  # 使用print替代log
             return
@@ -656,3 +654,7 @@ def _get_agent_monitor(saas_id, agent_number):
 def _get_phone(saas_id, phone_num):
     phone = Phone.query.filter(Phone.saas_id == saas_id, Phone.phone_num == phone_num).first()
     return phone
+
+def _get_human_service_service(saas_id, agent_id):
+    human_service_map = HumanServiceMap.query.filter(HumanServiceMap.saas_id == saas_id, HumanServiceMap.agent_id ==agent_id).first()
+    return human_service_map