Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh_internal_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
杨培培
wxh_internal_api
Commits
18f5ebbb
Commit
18f5ebbb
authored
Aug 16, 2018
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供发送系统消息的服务
parent
b77427d1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
ucenter_message.php
example/ucenter_message.php
+3
-1
Message.php
src/ucenter/Message.php
+38
-0
No files found.
example/ucenter_message.php
View file @
18f5ebbb
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
* Time: 4:52 PM
* Time: 4:52 PM
*/
*/
use
internalApi\ucenter\Member
;
use
internalApi\ucenter\Member
;
use
internalApi\ucenter\Message
;
use
internalApi\ucenter\Message
;
...
@@ -38,3 +37,6 @@ Message::setDebug();
...
@@ -38,3 +37,6 @@ 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'
=>
'新消息测试'
]);
print_r
(
$ret
);
src/ucenter/Message.php
View file @
18f5ebbb
...
@@ -18,6 +18,14 @@ use internalApi\base\Client;
...
@@ -18,6 +18,14 @@ use internalApi\base\Client;
class
Message
extends
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
...
@@ -159,5 +167,35 @@ class Message extends Client
{
{
return
self
::
call
(
'message.pushMsg'
,
compact
(
'title'
,
'url'
,
'desc'
,
'userId'
,
'from'
,
'type'
));
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'
));
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment