瀏覽代碼

handle assign time

774056846 4 月之前
父節點
當前提交
9576c8d1c6
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/core/callcenter/agent.py

+ 8 - 0
src/core/callcenter/agent.py

@@ -553,10 +553,18 @@ class AgentStateService:
         if len(idle_agents) <= 0:
             return choose_phone_num
         choose_phone_num = self._choose_max_idle_time(idle_agents)
+        self.handle_assign_time(saas_id, service_id, choose_phone_num)
         return choose_phone_num
 
     def handle_assign_time(self, saas_id, service_id, choose_phone_num):
         key = self._key(saas_id, service_id)
+        cache_agent_map = self.get_cache_agent_map(saas_id, service_id)
+        if cache_agent_map and choose_phone_num in cache_agent_map:
+            state_data = cache_agent_map[choose_phone_num]
+            state_data.assign_time = datetime.utcnow().timestamp() * 1000
+            self.redis_handler.redis.hset(key, choose_phone_num, state_data.to_json_string())
+            self.redis_handler.redis.expire(key, self._get_expire_time())
+            # self.update_report_state(saas_id, service_id)
 
 
     def idle_agents(self, saas_id, service_id):