This commit is contained in:
Your Name
2026-04-10 14:43:58 +08:00
parent fdf714f833
commit 4909ec6daa
38 changed files with 6549 additions and 735 deletions
+28 -1
View File
@@ -3,13 +3,40 @@
namespace app\api\controller;
use app\api\logic\ChatNotifyLogic;
use think\facade\Db;
/**
* 聊天相关接口(C端-患者)
*/
class ChatController extends BaseApiController
{
public array $notNeedLogin = ['notifyOpen'];
public array $notNeedLogin = ['notifyOpen', 'logAvPermission'];
/**
* 上报音视频权限拒绝日志
* 患者小程序请求摄像头/麦克风权限被拒绝,且用户点击「取消」未前往设置页时调用
*/
public function logAvPermission()
{
$patientId = trim((string) ($this->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('已记录');
}
/**
* 患者打开会话时通知医生