request->post('patient_id', ''))); $doctorId = trim((string) ($this->request->post('doctor_id', ''))); $deniedScope = trim((string) ($this->request->post('denied_scope', ''))); $scene = trim((string) ($this->request->post('scene', ''))); $action = trim((string) ($this->request->post('action', 'cancel'))); $wxVersion = trim((string) ($this->request->post('wx_version', ''))); Db::name('av_permission_log')->insert([ 'patient_id' => $patientId, 'doctor_id' => $doctorId, 'denied_scope' => $deniedScope ?: 'unknown', 'scene' => $scene ?: 'unknown', 'action' => in_array($action, ['cancel', 'open_setting']) ? $action : 'cancel', 'wx_version' => $wxVersion, 'create_time' => time(), ]); return $this->success('已记录'); } /** * 患者打开会话时通知医生 * 无需登录,通过参数传递 */ public function notifyOpen() { $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::addNotify($doctorId, $patientId ?: '0', $patientName); return $this->success('已通知'); } }