Commit a9347535 by HanSon

修改红包判断

1 parent df696b4f
...@@ -32,6 +32,7 @@ $robot = new Robot([ ...@@ -32,6 +32,7 @@ $robot = new Robot([
$robot->server->setMessageHandler(function ($message) use ($path) { $robot->server->setMessageHandler(function ($message) use ($path) {
/** @var $message Message */ /** @var $message Message */
print_r($message);
// 位置信息 返回位置文字 // 位置信息 返回位置文字
if ($message instanceof Location) { if ($message instanceof Location) {
...@@ -41,7 +42,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) { ...@@ -41,7 +42,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 文字信息 // 文字信息
if ($message instanceof Text) { if ($message instanceof Text) {
// 联系人自动回复 // 联系人自动回复
print_r($message);
if ($message->fromType === 'Contact') { if ($message->fromType === 'Contact') {
return http()->post('http://www.tuling123.com/openapi/api', [ return http()->post('http://www.tuling123.com/openapi/api', [
...@@ -149,7 +149,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) { ...@@ -149,7 +149,6 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 手机点击聊天事件 // 手机点击聊天事件
if($message instanceof Touch){ if($message instanceof Touch){
print_r($message);
Text::send($message->to['UserName'], "我点击了此群"); Text::send($message->to['UserName'], "我点击了此群");
} }
......
...@@ -58,9 +58,10 @@ class MessageFactory ...@@ -58,9 +58,10 @@ class MessageFactory
case 10002: case 10002:
return new Recall($msg); return new Recall($msg);
case 10000: case 10000:
if($msg['Status'] == 4){ if(in_array($msg['Content'], ['利是', '红包', 'Red Packet'])){
return new RedPacket($msg); return new RedPacket($msg);
}else{ }else if(in_array($msg['Content'], ['好友', 'friend'])){
} }
break; break;
case 49: case 49:
......
...@@ -32,11 +32,6 @@ class Message ...@@ -32,11 +32,6 @@ class Message
public $sender; public $sender;
/** /**
* @var array 消息接收者
*/
public $to;
/**
* @var string 经过处理的内容 * @var string 经过处理的内容
*/ */
public $content; public $content;
...@@ -79,11 +74,6 @@ class Message ...@@ -79,11 +74,6 @@ class Message
$this->from = account()->getAccount($this->msg['FromUserName']); $this->from = account()->getAccount($this->msg['FromUserName']);
} }
private function setTo()
{
$this->to = account()->getAccount($this->msg['ToUserName']);
}
private function setFromType() private function setFromType()
{ {
if ($this->msg['MsgType'] == 51) { if ($this->msg['MsgType'] == 51) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!