Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
vbot
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a9347535
authored
Jan 17, 2017
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改红包判断
1 parent
df696b4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
14 deletions
example/index.php
src/Core/MessageFactory.php
src/Message/Entity/Message.php
example/index.php
View file @
a934753
...
...
@@ -32,6 +32,7 @@ $robot = new Robot([
$robot
->
server
->
setMessageHandler
(
function
(
$message
)
use
(
$path
)
{
/** @var $message Message */
print_r
(
$message
);
// 位置信息 返回位置文字
if
(
$message
instanceof
Location
)
{
...
...
@@ -41,7 +42,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 文字信息
if
(
$message
instanceof
Text
)
{
// 联系人自动回复
print_r
(
$message
);
if
(
$message
->
fromType
===
'Contact'
)
{
return
http
()
->
post
(
'http://www.tuling123.com/openapi/api'
,
[
...
...
@@ -149,7 +149,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 手机点击聊天事件
if
(
$message
instanceof
Touch
){
print_r
(
$message
);
Text
::
send
(
$message
->
to
[
'UserName'
],
"我点击了此群"
);
}
...
...
src/Core/MessageFactory.php
View file @
a934753
...
...
@@ -58,9 +58,10 @@ class MessageFactory
case
10002
:
return
new
Recall
(
$msg
);
case
10000
:
if
(
$msg
[
'Status'
]
==
4
){
if
(
in_array
(
$msg
[
'Content'
],
[
'利是'
,
'红包'
,
'Red Packet'
])
){
return
new
RedPacket
(
$msg
);
}
else
{
}
else
if
(
in_array
(
$msg
[
'Content'
],
[
'好友'
,
'friend'
])){
}
break
;
case
49
:
...
...
src/Message/Entity/Message.php
View file @
a934753
...
...
@@ -32,11 +32,6 @@ class Message
public
$sender
;
/**
* @var array 消息接收者
*/
public
$to
;
/**
* @var string 经过处理的内容
*/
public
$content
;
...
...
@@ -79,11 +74,6 @@ class Message
$this
->
from
=
account
()
->
getAccount
(
$this
->
msg
[
'FromUserName'
]);
}
private
function
setTo
()
{
$this
->
to
=
account
()
->
getAccount
(
$this
->
msg
[
'ToUserName'
]);
}
private
function
setFromType
()
{
if
(
$this
->
msg
[
'MsgType'
]
==
51
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment