Refactor ChatConnect and related classes to use dynamic typing for properties and method parameters. Update event handling to use a consistent naming convention for emitted events. Adjust WebSocket message handling methods to accept event arrays instead of specific data structures. Update configuration for Swoole to increase ping intervals and timeouts.

This commit is contained in:
li
2026-01-29 03:04:40 +08:00
parent b8cd0c9418
commit ca996c227c
27 changed files with 441 additions and 148 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ class ChatSession extends Model
/**
* 获取用户活跃会话
*/
public static function getActiveByUserId(int $userId): ?array
public static function getActiveByUserId($userId)
{
$session = self::where('user_id', $userId)
->whereIn('status', [self::STATUS_PENDING, self::STATUS_ACTIVE])
@@ -39,7 +39,7 @@ class ChatSession extends Model
/**
* 获取客服进行中的会话列表
*/
public static function getActiveByAdminId(int $adminId): array
public static function getActiveByAdminId($adminId)
{
return self::where('admin_id', $adminId)
->where('status', self::STATUS_ACTIVE)
@@ -51,7 +51,7 @@ class ChatSession extends Model
/**
* 获取待分配会话数量
*/
public static function getPendingCount(): int
public static function getPendingCount()
{
return self::where('status', self::STATUS_PENDING)->count();
}