PHP Class WebMessageModel, thinksns

Author: xiewei ([email protected])
Show file Open project: medz/thinksns-4

Protected Properties

Property Type Description
$member
$models
$room
$userId

Public Methods

Method Description
__construct ( )
addGroupMember ( $roomId, $memberUids ) : boolean 添加群成员
appendRoomListMember ( array $data ) : array | mixed
checkGroupPermissions ( integer $roomId, boolean $checkMaster = false, integer $type = 2 ) : boolean 检查群组权限
clearMessage ( $roomId, $type = 'unread' )
content ( ) : Model
createGroupRoom ( $uids, null $title = null ) : array | boolean
getClientByUser ( string | array $uids, boolean $removeCurrentUser = true ) : array 根据用户Id,获取全部客户端连接ID
getMessageList ( $roomId, $messageId = null, $direction = 'lt', $limit = null )
getMessageRoom ( $toUid ) : array | boolean
getRoomList ( $limit = null, $page = true, $appendMember = false )
getRoomMember ( $roomId )
getUserId ( )
hasRoom ( $roomId )
member ( ) : Model
model ( $name, null $propName = null ) : Model
parseMessage ( array $list ) : array 将消息列表整理为标准的返回格式
push ( )
pushMessage ( $toUids, $data ) TODO JPush Code
quitGroupRoom ( integer $roomId ) : boolean 主动退出群房间
refreshRoomMember ( integer $roomId, boolean $changeMaster = false ) : integer 刷新房间成员信息
removeGroupMember ( $roomId, $memberUids ) : boolean 删除群成员
room ( ) : Model
roomHasUser ( $roomId, $uid, $checkRoom = false )
sendMessage ( array $message, $isNotify = false, $isPush = true )
setRoom ( $roomId, $data ) : boolean 设置房间信息
setUserId ( $userId )
table ( $table )
ucmap ( )

Protected Methods

Method Description
formatInList ( array | string $ints, string $default = '', boolean $unique = true ) : string 将一个包含id列表的数组或字符串格式化为标准的逗号分隔值
getUserList ( $uids )
htmlDecode ( string $string, integer $flags = ENT_QUOTES ) : string html编码,默认包括单引号
htmlEncode ( string $string, integer $flags = ENT_QUOTES, $charset = 'UTF-8' ) : string html编码,默认包括单引号

Method Details

__construct() public method

public __construct ( )

addGroupMember() public method

添加群成员
public addGroupMember ( $roomId, $memberUids ) : boolean
$memberUids
return boolean

appendRoomListMember() public method

public appendRoomListMember ( array $data ) : array | mixed
$data array
return array | mixed

checkGroupPermissions() public method

检查群组权限
public checkGroupPermissions ( integer $roomId, boolean $checkMaster = false, integer $type = 2 ) : boolean
$roomId integer 房间ID
$checkMaster boolean 是否检查uid为群主
$type integer 群房间类型 null 为不限制
return boolean

clearMessage() public method

public clearMessage ( $roomId, $type = 'unread' )

content() public method

public content ( ) : Model
return Model

createGroupRoom() public method

public createGroupRoom ( $uids, null $title = null ) : array | boolean
$uids
$title null
return array | boolean

formatInList() protected static method

将一个包含id列表的数组或字符串格式化为标准的逗号分隔值
protected static formatInList ( array | string $ints, string $default = '', boolean $unique = true ) : string
$ints array | string 需要整理的id列表
$default string 如果列表中没有符合的ID,则返回此值
$unique boolean 是否需要去除重复
return string 整理好的字符串,如果没有则返回默认值

getClientByUser() public method

根据用户Id,获取全部客户端连接ID
public getClientByUser ( string | array $uids, boolean $removeCurrentUser = true ) : array
$uids string | array 用户ID列表,逗号分隔或一个数组
$removeCurrentUser boolean 如果为false,那么如果查询结果有当前用户将会保留
return array 返回一个包含指定用户id的客户端连接Id数组

getMessageList() public method

public getMessageList ( $roomId, $messageId = null, $direction = 'lt', $limit = null )

getMessageRoom() public method

public getMessageRoom ( $toUid ) : array | boolean
$toUid
return array | boolean

getRoomList() public method

public getRoomList ( $limit = null, $page = true, $appendMember = false )

getRoomMember() public method

public getRoomMember ( $roomId )

getUserId() public method

public getUserId ( )

getUserList() protected method

protected getUserList ( $uids )
$uids

hasRoom() public method

public hasRoom ( $roomId )

htmlDecode() protected static method

html编码,默认包括单引号
protected static htmlDecode ( string $string, integer $flags = ENT_QUOTES ) : string
$string string
$flags integer
return string

htmlEncode() protected static method

html编码,默认包括单引号
protected static htmlEncode ( string $string, integer $flags = ENT_QUOTES, $charset = 'UTF-8' ) : string
$string string
$flags integer
return string

member() public method

public member ( ) : Model
return Model

model() public method

public model ( $name, null $propName = null ) : Model
$name
$propName null
return Model

parseMessage() public method

将消息列表整理为标准的返回格式
public parseMessage ( array $list ) : array
$list array 需要整理的消息列表
return array 返回整理好的消息列表

push() public method

public push ( )

pushMessage() public method

TODO JPush Code
public pushMessage ( $toUids, $data )

quitGroupRoom() public method

主动退出群房间
public quitGroupRoom ( integer $roomId ) : boolean
$roomId integer 房间ID
return boolean

refreshRoomMember() public method

刷新房间成员信息
public refreshRoomMember ( integer $roomId, boolean $changeMaster = false ) : integer
$roomId integer 房间ID
$changeMaster boolean
return integer 返回群成员数量

removeGroupMember() public method

删除群成员
public removeGroupMember ( $roomId, $memberUids ) : boolean
$roomId
$memberUids
return boolean

room() public method

public room ( ) : Model
return Model

roomHasUser() public method

public roomHasUser ( $roomId, $uid, $checkRoom = false )

sendMessage() public method

public sendMessage ( array $message, $isNotify = false, $isPush = true )
$message array

setRoom() public method

设置房间信息
public setRoom ( $roomId, $data ) : boolean
$roomId
$data
return boolean

setUserId() public method

public setUserId ( $userId )

table() public method

public table ( $table )

ucmap() public method

public ucmap ( )

Property Details

$member protected property

protected $member

$models protected property

protected $models

$room protected property

protected $room

$userId protected property

protected $userId