初始化

main
gzydong 2020-11-22 23:31:21 +08:00
parent db2ac5ed39
commit da44242310
4 changed files with 15 additions and 2 deletions

View File

@ -105,6 +105,8 @@ class GroupController extends CController
return $this->response->fail('群组解散失败...');
}
$this->socketRoomService->delRoom($params['group_id']);
// ... 推送群消息
return $this->response->success([], '群组解散成功...');

View File

@ -129,7 +129,7 @@ class WebSocketController implements OnMessageInterface, OnOpenInterface, OnClos
{
$user_id = $this->socketFDService->findFdUserId($fd);
// stdout_log()->notice("客户端FD:{$fd} 已关闭连接 用户ID为【{$user_id}】,关闭时间:" . date('Y-m-d H:i:s'));
stdout_log()->notice("客户端FD:{$fd} 已关闭连接 用户ID为【{$user_id}】,关闭时间:" . date('Y-m-d H:i:s'));
// 解除fd关系
$this->socketFDService->removeRelation($fd);

View File

@ -51,4 +51,15 @@ class SocketRoomService
{
return redis()->sRem($this->getRoomName($room), $members);
}
/**
* 删除房间
*
* @param string|int $room 房间名
* @return int
*/
public function delRoom($room)
{
return redis()->del($this->getRoomName($room));
}
}

View File

@ -46,7 +46,7 @@ return [
],
'settings' => [
'enable_coroutine' => true,
'worker_num' => 1,
'worker_num' => swoole_cpu_num(),
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
'open_tcp_nodelay' => true,
'max_coroutine' => 100000,