|
@@ -37,10 +37,10 @@ class AgentOperService:
|
|
|
db.session.commit()
|
|
|
|
|
|
def disable(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
if agent.agent_state == AgentState.DISABLE.code:
|
|
|
return
|
|
|
- agent_monitor = _get_agent_monitor(req.saas_id, req.agent_number)
|
|
|
+ agent_monitor = _get_agent_monitor(req.saas_id, agent.agent_number)
|
|
|
if agent_monitor.check_state == AgentCheck.IN.code and \
|
|
|
agent_monitor.service_state == AgentServiceState.CALLING.code:
|
|
|
raise BizException(BizErrorCode.AGENT_CALLING_NOT_ALLOW_OPERATE)
|
|
@@ -54,12 +54,12 @@ class AgentOperService:
|
|
|
db.session.commit()
|
|
|
|
|
|
def checkin(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
if not agent or agent.agent_state == AgentState.DISABLE.code:
|
|
|
raise BizException(BizErrorCode.ERROR_NOT_FOLLOW_CHECK_IN)
|
|
|
phone = _get_phone(req.saas_id, agent.phone_num)
|
|
|
|
|
|
- agent_monitor = _get_agent_monitor(req.saas_id, req.agent_number)
|
|
|
+ agent_monitor = _get_agent_monitor(req.saas_id, agent.agent_number)
|
|
|
|
|
|
agent_monitor.check_scene = req.scene
|
|
|
self.agent_monitor_service.update_checkin(agent_monitor)
|
|
@@ -72,11 +72,11 @@ class AgentOperService:
|
|
|
return self._push_event_for_checkin(agent, agent_monitor, phone, req.scene)
|
|
|
|
|
|
def checkout(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
if not agent or agent.agent_state == AgentState.DISABLE.code:
|
|
|
raise BizException(BizErrorCode.AGENT_DISABLE_NOT_ALLOW_OPERATE)
|
|
|
|
|
|
- agent_monitor = _get_agent_monitor(req.saas_id, req.agent_number)
|
|
|
+ agent_monitor = _get_agent_monitor(req.saas_id, agent.agent_number)
|
|
|
if not agent_monitor or agent_monitor.service_state == AgentServiceState.CALLING.code:
|
|
|
raise BizException(BizErrorCode.AGENT_CALLING_NOT_ALLOW_OPERATE)
|
|
|
|
|
@@ -111,7 +111,7 @@ class AgentOperService:
|
|
|
self._push_event_for_busy(agent, req.scene)
|
|
|
|
|
|
def idle(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
if not agent or agent.agent_state == AgentState.DISABLE.code:
|
|
|
raise BizException(BizErrorCode.AGENT_DISABLE_NOT_ALLOW_OPERATE)
|
|
|
self._handle_idle(req.scene, agent)
|
|
@@ -123,8 +123,8 @@ class AgentOperService:
|
|
|
pass
|
|
|
|
|
|
def turn_on(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
- agent_monitor = _get_agent_monitor(req.saas_id, req.agent_number)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
+ agent_monitor = _get_agent_monitor(req.saas_id, agent.agent_number)
|
|
|
agent_scene = AgentScene.get_by_code(req.scene)
|
|
|
if not agent_monitor:
|
|
|
raise BizException(BizErrorCode.RECORD_NOT_EXIST_ERROR)
|
|
@@ -206,7 +206,7 @@ class AgentService:
|
|
|
self.agent_monitor_service = AgentMonitorService(client, logger)
|
|
|
|
|
|
def get_and_check(self, req: AgentActionRequest):
|
|
|
- agent = _get_agent(req.saas_id, req.agent_number, req.out_id)
|
|
|
+ agent = _get_agent(req.saas_id, req.agent_id)
|
|
|
if not agent:
|
|
|
return {}
|
|
|
phone = _get_phone(req.saas_id, agent.phone_num)
|