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
+24
View File
@@ -43,6 +43,30 @@ class ChatNotifyLogic extends BaseLogic
return true;
}
/**
* 患者离开会话页/诊室时通知医生端(管理后台轮询)
*/
public static function addPatientLeftNotify(int $doctorId, string $patientId, string $patientName): bool
{
$key = self::CACHE_PREFIX . $doctorId;
$item = [
'id' => uniqid('', true),
'type' => 'patient_left_chat',
'doctor_id' => $doctorId,
'patient_id' => $patientId,
'patient_name' => $patientName,
'created_at' => time(),
];
$list = Cache::get($key) ?: [];
if (!is_array($list)) {
$list = [];
}
array_unshift($list, $item);
$list = array_slice($list, 0, self::MAX_PER_DOCTOR);
Cache::set($key, $list, self::CACHE_TTL);
return true;
}
/**
* 添加面诊结束通知(医生完成接诊后通知对应医助)
* @param int $assistantId 医助ID (admin_id)