Commit eeaf8f45 authored by 杨培's avatar 杨培

消息系统增加异步发送支持

parent c7b84071
...@@ -38,5 +38,8 @@ Message::setDebug(); ...@@ -38,5 +38,8 @@ Message::setDebug();
//$info = \internalApi\ucenter\Message::pushMsg(1,0,0,'bbs','theme',0); //$info = \internalApi\ucenter\Message::pushMsg(1,0,0,'bbs','theme',0);
//print_r($info); //print_r($info);
$ret = Message::sendSystemMessage('assistant', 0, 12, Message::TYPE_TEXT, ['msg'=>'新消息测试']); $ret = Message::sendSystemMessageAsync('remind', 0, 12, Message::TYPE_REMIND, [
'title' => '测试的标题',
'text'=>'新消息测试'.uniqid()
]);
print_r($ret); print_r($ret);
...@@ -66,6 +66,20 @@ class Message extends Client ...@@ -66,6 +66,20 @@ class Message extends Client
return self::call('message.sendTemplateSms', compact('tel', 'templateId', 'templateParams', 'signature')); return self::call('message.sendTemplateSms', compact('tel', 'templateId', 'templateParams', 'signature'));
} }
/**
* 向指定手机号发送模板短信
*
* @param string|array $tel 单个或多个号码数组
* @param string $templateId 内部短信模板ID
* @param array $templateParams 短信模板变量内容
* @param string $signature 短信签名
* @return int|false
*/
public static function sendTemplateSmsAsync($tel, $templateId, $templateParams=[], $signature=null)
{
return self::emit('message.sendTemplateSms', func_get_args());
}
/** /**
* 向指定用户发送模板短信 * 向指定用户发送模板短信
* *
...@@ -80,87 +94,19 @@ class Message extends Client ...@@ -80,87 +94,19 @@ class Message extends Client
return self::call('message.sendTemplateSmsByUid', compact('uid', 'templateId', 'templateParams', 'signature')); return self::call('message.sendTemplateSmsByUid', compact('uid', 'templateId', 'templateParams', 'signature'));
} }
/***
* @param $userId
* @param $title
* @param $sourceUrl
* @param $from 0:xue 1:bbs 2:s
* @param $type 0:评论 1:帖子
* @param $commentId
* @param $replyUserId
* @param string $replyedComment
* @param string $extra
* @return mixed
* @deprecated
*/
public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '', $extra = '')
{}
/**
* @param $userId
* @param $title
* @param $sourceUrl
* @param $from
* @param $type
* @param $sourceId 点赞的评论id
* @param $likeUserId
* @param $likedComment
* @return mixed
* @deprecated
*/
public static function addLike($userId, $title, $sourceUrl, $from, $type, $sourceId, $likeUserId, $likedComment = '')
{}
/**
* @param $userId
* @param $title
* @param $desc
* @param $from
* @param $type
* @param string $content
* @param int $toUser 0系统消息其它为用户id,多个用户id数组
* @return mixed
* @deprecated
*/
public static function add($userId, $title, $desc, $from, $type, $content = '', $toUser = 0)
{}
/**
* 删除评论消息
* @param $userId
* @param $from
* @param $type
* @param $commentId
* @return mixed
* @deprecated
*/
public static function deleteComment($userId, $from, $type, $commentId)
{}
/** /**
* 删除点赞 * 向指定用户发送模板短信
* @param $userId *
* @param $from * @param int $uid
* @param $type * @param string $templateId 内部短信模板ID
* @param $sourceId * @param array $templateParams 短信模板变量内容
* @return mixed * @param string $signature 短信签名
* @deprecated * @return int|false
*/
public static function deleteLiked($userId, $from, $type, $sourceId)
{}
/**
* @param $title 消息标题
* @param $url
* @param $desc 描述
* @param int $userId 用户id 0=>代表全部
* @param string $from 来自
* @param int $type 0 早报 1 求助 2 系统推送
* @return mixed
* @deprecated
*/ */
public static function pushMsg($title, $url, $desc, $userId = 0, $from = 'u', $type = 0) public static function sendTemplateSmsByUidAsync($uid, $templateId, $templateParams=[], $signature=null)
{} {
return self::emit('message.sendTemplateSmsByUid', func_get_args());
}
/** /**
* 以系统会话发送消息 * 以系统会话发送消息
...@@ -172,6 +118,7 @@ class Message extends Client ...@@ -172,6 +118,7 @@ class Message extends Client
* @param array $content 消息内容 * @param array $content 消息内容
* @param array $ext 消息扩展属性 * @param array $ext 消息扩展属性
* @return array * @return array
* @see http://dzzoffice.banshouhui.com/index.php?mod=corpus&op=list&cid=3#fid_1146
* @throws \internalApi\base\ApiException * @throws \internalApi\base\ApiException
*/ */
public static function sendSystemMessage($systemSessionId, $from, $to, $type, $content, $ext=[]) public static function sendSystemMessage($systemSessionId, $from, $to, $type, $content, $ext=[])
...@@ -179,5 +126,22 @@ class Message extends Client ...@@ -179,5 +126,22 @@ class Message extends Client
return self::call('message.sendSystemMessage', compact('systemSessionId', 'from', 'to', 'type', 'content', 'ext')); return self::call('message.sendSystemMessage', compact('systemSessionId', 'from', 'to', 'type', 'content', 'ext'));
} }
/**
* 以系统会话发送消息
*
* @param int|string $systemSessionId 系统会话的ID或别名
* @param int $from 发送用户,系统用户请指定0
* @param int $to 接收用户
* @param int $type 消息类型
* @param array $content 消息内容
* @param array $ext 消息扩展属性
* @return int|false
* @see http://dzzoffice.banshouhui.com/index.php?mod=corpus&op=list&cid=3#fid_1146
*/
public static function sendSystemMessageAsync($systemSessionId, $from, $to, $type, $content, $ext=[])
{
return self::emit('message.sendSystemMessage', func_get_args());
}
} }
...@@ -31,6 +31,15 @@ class Track extends Client ...@@ -31,6 +31,15 @@ class Track extends Client
return self::call('track.track', compact('event', 'uid', 'time', 'props')); return self::call('track.track', compact('event', 'uid', 'time', 'props'));
} }
/**
* 添加事件
*
* @param string $event 事件、32个字符以内
* @param int $uid 用户UID,0代表访客
* @param int|null $time 时间,默认为当前时间
* @param array $props 属性键值列表 (键32个字符以内,值128字符以内)
* @return int|false
*/
public static function trackAsync($event, $uid=0, $time=null, $props=[]) public static function trackAsync($event, $uid=0, $time=null, $props=[])
{ {
return self::emit('track.track', func_get_args()); return self::emit('track.track', func_get_args());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment