fix(chat): 避免群信息查不到时对 null 取下标(PHP 7.4 报错)
processMessage 中 room_id 未在 Rooms/qiweRooms 表中登记时,find() 返回 null,PHP 7.4 起取 ['type'] 会抛 Trying to access array offset on value of type null。改用 ?? 取默认 null,行为与升级前一致:落 switch default 返回"群聊类型未命中"。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
8d56189d4e
commit
a73f3b1c2a
@ -525,11 +525,11 @@ class Chat extends Frontend
|
|||||||
switch($this->SOURCE){
|
switch($this->SOURCE){
|
||||||
case "wx":
|
case "wx":
|
||||||
$roominfo = $this->RoomsModel->where(["room_id"=>$fromid])->find();
|
$roominfo = $this->RoomsModel->where(["room_id"=>$fromid])->find();
|
||||||
$roomtype = $roominfo['type'];
|
$roomtype = $roominfo['type'] ?? null;
|
||||||
break;
|
break;
|
||||||
case "qiwe":
|
case "qiwe":
|
||||||
$roominfo = $this->qiweRoomsModel->where(["room_id"=>$fromid])->find();
|
$roominfo = $this->qiweRoomsModel->where(["room_id"=>$fromid])->find();
|
||||||
$roomtype = $roominfo['type'];
|
$roomtype = $roominfo['type'] ?? null;
|
||||||
Log::error("企微的查找群信息".json_encode($roominfo));
|
Log::error("企微的查找群信息".json_encode($roominfo));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user