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:
@@ -33,7 +33,7 @@ class ChatMessage extends Model
|
||||
/**
|
||||
* 获取会话消息列表
|
||||
*/
|
||||
public static function getBySessionId(int $sessionId, int $limit = 50, int $lastId = 0): array
|
||||
public static function getBySessionId($sessionId, $limit = 50, $lastId = 0)
|
||||
{
|
||||
$query = self::where('session_id', $sessionId);
|
||||
if ($lastId > 0) {
|
||||
@@ -48,7 +48,7 @@ class ChatMessage extends Model
|
||||
/**
|
||||
* 获取会话未读消息
|
||||
*/
|
||||
public static function getUnreadBySessionId(int $sessionId, int $senderType, int $limit = 50): array
|
||||
public static function getUnreadBySessionId($sessionId, $senderType, $limit = 50)
|
||||
{
|
||||
return self::where('session_id', $sessionId)
|
||||
->where('sender_type', '<>', $senderType)
|
||||
@@ -62,7 +62,7 @@ class ChatMessage extends Model
|
||||
/**
|
||||
* 检查消息ID是否存在(幂等性)
|
||||
*/
|
||||
public static function existsByMsgId(int $msgId): bool
|
||||
public static function existsByMsgId($msgId)
|
||||
{
|
||||
return self::where('msg_id', $msgId)->count() > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user