PHP Class NotifyModel, thinksns

Inheritance: extends AdvModel
Mostra file Open project: medz/thinksns-4 Class Usage Examples

Protected Properties

Property Type Description
$_config
$fields
$tableName

Public Methods

Method Description
_initialize ( ) 初始化方法,获取站点名称、系统邮箱、找回密码的URL
cleanCache ( ) 清除消息节点缓存
deleteNotify ( integer $id ) : mix 删除通知
getDataByNode ( string $node, array $config ) : array 获取指定节点的详细信息
getMessageDetail ( string $app, integer $uid ) : array 获取指定应用指定用户下的系统消息列表
getMessageList ( integer $uid ) : array 分组返回指定用户的系统消息列表
getNode ( string $node ) : array 获取指定节点信息
getNodeList ( ) : array 获取节点列表
getUnreadCount ( integer $uid ) : integer 获取指定用户未读消息的总数
getUnreadListForApi ( integer $uid, integer $since_id, integer $max_id, integer $limit = 20, $page ) : array 返回指定用户的未读消息列表,没有since_id 和 max_id 的时候返回未读消息
saveNodeList ( array $data ) : boolean 保存节点配置
saveTpl ( array $data ) : boolean 保存模版设置
send ( $toUid, $node, $config, $from = null ) TS2的兼容方法 同 sendNotify
sendEmail ( array $data ) : mix 发送邮件,添加到消息队列数据表中
sendEmailList ( integer $sendNums = 10 ) : array 发送邮件队列中的数据,每次执行默认发送10封邮件
sendIn ( string | integer | array $receive, string $type, array $data ) 系统对用户发送通知
sendMessage ( array $data ) : mix 发送系统消息,给指定用户
sendNotify ( array $toUid, string $node, array $config, intval $from ) 发送消息入口,对已注册用户发送的消息都可以通过此函数
sendNotifyChangeEmail ( $toUid, $node, $config, $email )
sendSysMessage ( array $user_group, string $content ) : boolean 发送系统消息,给用户组或全站用户
sendSystemMessage ( array $user_group, string $content ) : boolean 发送系统消息,给用户组或全站用户 - 并发送邮件
setRead ( integer $uid, string $appname = '', $node = null ) : mix 更改指定用户的消息从未读为已读

Private Methods

Method Description
_parseUser ( $touid ) 解析传入的用户ID

Method Details

_initialize() public method

初始化方法,获取站点名称、系统邮箱、找回密码的URL
public _initialize ( )

cleanCache() public method

清除消息节点缓存
public cleanCache ( )

deleteNotify() public method

删除通知
public deleteNotify ( integer $id ) : mix
$id integer 通知ID
return mix 删除失败返回false,删除成功返回删除的通知ID

getDataByNode() public method

获取指定节点的详细信息
public getDataByNode ( string $node, array $config ) : array
$node string 节点Key值
$config array 配置数据
return array 指定节点的详细信息

getMessageDetail() public method

获取指定应用指定用户下的系统消息列表
public getMessageDetail ( string $app, integer $uid ) : array
$app string 应用Key值
$uid integer 用户ID
return array 指定应用指定用户下的系统消息列表

getMessageList() public method

分组返回指定用户的系统消息列表
public getMessageList ( integer $uid ) : array
$uid integer 用户ID
return array 分组返回指定用户的系统消息列表

getNode() public method

获取指定节点信息
public getNode ( string $node ) : array
$node string 节点Key值
return array 指定节点信息

getNodeList() public method

获取节点列表
public getNodeList ( ) : array
return array 节点列表数据

getUnreadCount() public method

获取指定用户未读消息的总数
public getUnreadCount ( integer $uid ) : integer
$uid integer 用户ID
return integer 指定用户未读消息的总数

getUnreadListForApi() public method

返回指定用户的未读消息列表,没有since_id 和 max_id 的时候返回未读消息
public getUnreadListForApi ( integer $uid, integer $since_id, integer $max_id, integer $limit = 20, $page ) : array
$uid integer 用户ID
$since_id integer 开始的组件ID,默认为0
$max_id integer 最大主键ID,默认为0
$limit integer 结果集数目,默认为20
return array 指定用户的未读消息列表

saveNodeList() public method

保存节点配置
public saveNodeList ( array $data ) : boolean
$data array 节点修改信息
return boolean 是否保存成功

saveTpl() public method

保存模版设置
public saveTpl ( array $data ) : boolean
$data array 模板数据
return boolean 是否保存成功

send() public method

TS2的兼容方法 同 sendNotify
public send ( $toUid, $node, $config, $from = null )

sendEmail() public method

发送邮件,添加到消息队列数据表中
public sendEmail ( array $data ) : mix
$data array 消息的相关数据
return mix 添加失败返回false,添加成功返回新数据的ID

sendEmailList() public method

发送邮件队列中的数据,每次执行默认发送10封邮件
public sendEmailList ( integer $sendNums = 10 ) : array
$sendNums integer 发送邮件的个数,默认为10
return array 返回取出的数据个数与实际发送邮件的数据个数

sendIn() public method

系统对用户发送通知
public sendIn ( string | integer | array $receive, string $type, array $data )
$receive string | integer | array 接收人ID 多个时以英文的","分割或传入数组
$type string 通知类型, 必须与模版的类型相同, 使用下划线分割应用. 如$type = "weibo_follow"定位至/apps/weibo/Language/cn/notify.php的"weibo_follow"
$data array

sendMessage() public method

发送系统消息,给指定用户
public sendMessage ( array $data ) : mix
$data array 发送系统消息相关数据
return mix 发送失败返回false,发送成功返回新的消息ID

sendNotify() public method

发送消息入口,对已注册用户发送的消息都可以通过此函数
public sendNotify ( array $toUid, string $node, array $config, intval $from )
$toUid array 接收消息的用户ID数组
$node string 节点Key值
$config array 配置数据
$from intval 消息来源用户的UID

sendNotifyChangeEmail() public method

public sendNotifyChangeEmail ( $toUid, $node, $config, $email )

sendSysMessage() public method

发送系统消息,给用户组或全站用户
public sendSysMessage ( array $user_group, string $content ) : boolean
$user_group array 用户组ID
$content string 发送信息内容
return boolean 是否发送成功

sendSystemMessage() public method

发送系统消息,给用户组或全站用户 - 并发送邮件
public sendSystemMessage ( array $user_group, string $content ) : boolean
$user_group array 用户组ID
$content string 发送信息内容
return boolean 是否发送成功

setRead() public method

更改指定用户的消息从未读为已读
public setRead ( integer $uid, string $appname = '', $node = null ) : mix
$uid integer 用户ID
$appname string 应用Key值
return mix 更改失败返回false,更改成功返回消息ID

Property Details

$_config protected_oe property

protected $_config

$fields protected_oe property

protected $fields

$tableName protected_oe property

protected $tableName