Commit 18f5ebbb authored by 杨培's avatar 杨培

提供发送系统消息的服务

parent b77427d1
......@@ -6,7 +6,6 @@
* Time: 4:52 PM
*/
use internalApi\ucenter\Member;
use internalApi\ucenter\Message;
......@@ -38,3 +37,6 @@ Message::setDebug();
//$info = \internalApi\ucenter\Message::pushMsg(1,0,0,'bbs','theme',0);
//print_r($info);
$ret = Message::sendSystemMessage('assistant', 0, 12, Message::TYPE_TEXT, ['msg'=>'新消息测试']);
print_r($ret);
......@@ -18,6 +18,14 @@ use internalApi\base\Client;
class Message extends Client
{
const TYPE_TEXT = 0; //文本
const TYPE_IMAGE = 1; //图片消息
const TYPE_AUDIO = 2; //语音消息
const TYPE_VIDEO = 3; //视频消息
const TYPE_INTERACTIVE = 4;//互动消息
const TYPE_PUSH = 5;//推送消息
const TYPE_REMIND = 6;//提醒消息
/**
* 向指定号码发送短信
*
......@@ -159,5 +167,35 @@ class Message extends Client
{
return self::call('message.pushMsg', compact('title', 'url', 'desc', 'userId','from','type'));
}
/**
* 发送互动消息
*
* @param array|int $from 发送者,可指定发送者ID,或使用的系统会话别名与发送者ID组合的数组
* 如:1000 代表使用 UID 1000 的用户发送,而 ['collector', 1000] 为使用 UID 1000 的用户发送,但记入 collector 这个系统会话中
* @param int $to 接收者UID
* @param string $subtitle 副标题
* 如“评论了你:你牛你上天。”,其中“评论了你”就是副标题,“你牛你上天”就是文本内容。
* @param string $text 文本内容
* @param string $url 跳转地址
* @return array
*/
/**
* 以系统会话发送消息
*
* @param int|string $systemSessionId 系统会话的ID或别名
* @param int $from 发送用户
* @param int $to 接收用户
* @param int $type 消息类型
* @param array $content 消息内容
* @param array|string $ext 消息扩展属性
* @return array
* @throws \ErrorException
*/
public static function sendSystemMessage($systemSessionId, $from, $to, $type, $content, $ext='')
{
return self::call('message.sendSystemMessage', compact('systemSessionId', 'from', 'to', 'type', 'content', 'ext'));
}
}
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