This commit is contained in:
Your Name
2026-05-07 16:42:29 +08:00
parent 576ef8e033
commit a9474356ff
6 changed files with 144 additions and 12 deletions
+18 -1
View File
@@ -10,7 +10,7 @@ use think\facade\Db;
*/
class ChatController extends BaseApiController
{
public array $notNeedLogin = ['notifyOpen', 'logAvPermission'];
public array $notNeedLogin = ['notifyOpen', 'notifyClose', 'logAvPermission'];
/**
* 上报音视频权限拒绝日志
@@ -55,4 +55,21 @@ class ChatController extends BaseApiController
ChatNotifyLogic::addNotify($doctorId, $patientId ?: '0', $patientName);
return $this->success('已通知');
}
/**
* 患者离开会话页时通知医生(管理后台轮询 + 可与 IM 信令配合)
*/
public function notifyClose()
{
$doctorId = (int) ($this->request->post('doctor_id') ?: $this->request->post('doctorId'));
$patientId = trim((string) ($this->request->post('patient_id') ?: $this->request->post('patientId') ?: ''));
$patientName = trim((string) ($this->request->post('patient_name') ?: $this->request->post('patientName') ?: '患者'));
if ($doctorId <= 0) {
return $this->fail('医生ID无效');
}
ChatNotifyLogic::addPatientLeftNotify($doctorId, $patientId ?: '0', $patientName);
return $this->success('已通知');
}
}