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 df696b4f
authored
Jan 16, 2017
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改命名空间
1 parent
c77778a2
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
211 additions
and
241 deletions
composer.json
example/custom.php
example/forward.php
example/from_type.php
example/group.php
example/groups.php
example/hongbao.php
example/image.php
example/index.php
example/is_at.php
example/recall.php
example/tuling.php
src/Collections/Account.php
src/Collections/Contact.php
src/Collections/ContactFactory.php
src/Collections/Group.php
src/Collections/Member.php
src/Collections/Message.php
src/Collections/Official.php
src/Collections/SpecialAccount.php
src/Core/Http.php
src/Core/MessageFactory.php
src/Core/MessageHandler.php
src/Core/Myself.php
src/Core/Server.php
src/Core/Sync.php
src/Foundation/Robot.php
src/Foundation/ServiceProviders/ServerServiceProvider.php
src/Message/Entity/Emoticon.php
src/Message/Entity/Image.php
src/Message/Entity/Location.php
src/Message/Entity/Message.php
src/Message/Entity/Recall.php
src/Message/Entity/Recommend.php
src/Message/Entity/RedPacket.php
src/Message/Entity/RequestFriend.php
src/Message/Entity/Share.php
src/Message/Entity/Text.php
src/Message/Entity/Touch.php
src/Message/Entity/Transfer.php
src/Message/Entity/Video.php
src/Message/Entity/Voice.php
src/Message/MediaInterface.php
src/Message/MediaTrait.php
src/Message/MessageInterface.php
src/Message/UploadAble.php
src/Robot.php
src/Support/Console.php
src/Support/FileManager.php
src/Support/ObjectAble.php
src/Support/helpers.php
composer.json
View file @
df696b4
...
...
@@ -23,7 +23,7 @@
"src/Support/helpers.php"
],
"psr-4"
:
{
"Hanson
\\
Ro
bot
\\
"
:
"src/"
"Hanson
\\
V
bot
\\
"
:
"src/"
}
},
"require-dev"
:
{
...
...
example/custom.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Robot\Message
\Text
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
Vbot\Message\Entity
\Text
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/forward.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/from_type.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/group.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Robot\Message
\Text
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
Vbot\Message\Entity
\Text
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/groups.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/hongbao.php
View file @
df696b4
...
...
@@ -8,9 +8,9 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
use
Hanson\
V
bot\Support\Console
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/image.php
View file @
df696b4
...
...
@@ -8,10 +8,10 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
Ro
bot\Message\Image
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
use
Hanson\
V
bot\Message\Image
;
use
Hanson\
V
bot\Support\Console
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/index.php
View file @
df696b4
...
...
@@ -8,21 +8,21 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Entity\Message
;
use
Hanson\
Ro
bot\Message\Entity\Image
;
use
Hanson\
Ro
bot\Message\Entity\Text
;
use
Hanson\
Ro
bot\Message\Entity\Emoticon
;
use
Hanson\
Ro
bot\Message\Entity\Location
;
use
Hanson\
Ro
bot\Message\Entity\Video
;
use
Hanson\
Ro
bot\Message\Entity\Voice
;
use
Hanson\
Ro
bot\Message\Entity\Recall
;
use
Hanson\
Ro
bot\Message\Entity\RedPacket
;
use
Hanson\
Ro
bot\Message\Entity\Transfer
;
use
Hanson\
Ro
bot\Message\Entity\Recommend
;
use
Hanson\
Ro
bot\Message\Entity\Share
;
use
Hanson\
Ro
bot\Message\Entity\Touch
;
use
Hanson\
Ro
bot\Message\Entity\RequestFriend
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Entity\Message
;
use
Hanson\
V
bot\Message\Entity\Image
;
use
Hanson\
V
bot\Message\Entity\Text
;
use
Hanson\
V
bot\Message\Entity\Emoticon
;
use
Hanson\
V
bot\Message\Entity\Location
;
use
Hanson\
V
bot\Message\Entity\Video
;
use
Hanson\
V
bot\Message\Entity\Voice
;
use
Hanson\
V
bot\Message\Entity\Recall
;
use
Hanson\
V
bot\Message\Entity\RedPacket
;
use
Hanson\
V
bot\Message\Entity\Transfer
;
use
Hanson\
V
bot\Message\Entity\Recommend
;
use
Hanson\
V
bot\Message\Entity\Share
;
use
Hanson\
V
bot\Message\Entity\Touch
;
use
Hanson\
V
bot\Message\Entity\RequestFriend
;
$path
=
__DIR__
.
'/./../tmp/'
;
$robot
=
new
Robot
([
...
...
@@ -41,6 +41,7 @@ $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'
,
[
...
...
@@ -148,9 +149,12 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 手机点击聊天事件
if
(
$message
instanceof
Touch
){
print_r
(
$message
);
Text
::
send
(
$message
->
to
[
'UserName'
],
"我点击了此群"
);
}
return
false
;
});
$robot
->
server
->
run
();
example/is_at.php
View file @
df696b4
...
...
@@ -8,9 +8,9 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
use
Hanson\
V
bot\Support\Console
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
example/recall.php
View file @
df696b4
...
...
@@ -8,12 +8,12 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
Ro
bot\Message\Image
;
use
Hanson\
Robot\Message
\Text
;
use
Hanson\
Ro
bot\Message\Emoticon
;
use
Hanson\
Ro
bot\Message\Video
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
use
Hanson\
V
bot\Message\Image
;
use
Hanson\
Vbot\Message\Entity
\Text
;
use
Hanson\
V
bot\Message\Emoticon
;
use
Hanson\
V
bot\Message\Video
;
$path
=
__DIR__
.
'/./../tmp/'
;
$robot
=
new
Robot
([
...
...
example/tuling.php
View file @
df696b4
...
...
@@ -8,8 +8,8 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\
Ro
bot\Foundation\Robot
;
use
Hanson\
Ro
bot\Message\Message
;
use
Hanson\
V
bot\Foundation\Robot
;
use
Hanson\
V
bot\Message\Message
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'/./../tmp/'
,
...
...
src/Collections/Account.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Illuminate\Support\Collection
;
...
...
src/Collections/Contact.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Illuminate\Support\Collection
;
...
...
src/Collections/ContactFactory.php
View file @
df696b4
...
...
@@ -6,11 +6,11 @@
* Time: 20:41
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Core\Server
;
use
Hanson\
V
bot\Support\Console
;
class
ContactFactory
{
...
...
src/Collections/Group.php
View file @
df696b4
...
...
@@ -6,10 +6,10 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Support\Console
;
use
Illuminate\Support\Collection
;
class
Group
extends
Collection
...
...
src/Collections/Member.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Illuminate\Support\Collection
;
...
...
src/Collections/Message.php
View file @
df696b4
...
...
@@ -6,10 +6,10 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Support\Console
;
use
Illuminate\Support\Collection
;
class
Message
extends
Collection
...
...
src/Collections/Official.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Illuminate\Support\Collection
;
...
...
src/Collections/SpecialAccount.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 20:56
*/
namespace
Hanson\
Ro
bot\Collections
;
namespace
Hanson\
V
bot\Collections
;
use
Illuminate\Support\Collection
;
...
...
src/Core/Http.php
View file @
df696b4
...
...
@@ -6,12 +6,12 @@
* Time: 21:13
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
use
GuzzleHttp\Client
as
HttpClient
;
use
GuzzleHttp\Cookie\CookieJar
;
use
GuzzleHttp\Cookie\FileCookieJar
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Support\Console
;
class
Http
{
...
...
src/Core/MessageFactory.php
View file @
df696b4
...
...
@@ -6,34 +6,30 @@
* Time: 11:54
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
use
Hanson\
Ro
bot\Message\Entity\Emoticon
;
use
Hanson\
Ro
bot\Message\Entity\Image
;
use
Hanson\
Ro
bot\Message\Entity\Location
;
use
Hanson\
Ro
bot\Message\Entity\Recall
;
use
Hanson\
Ro
bot\Message\Entity\Recommend
;
use
Hanson\
Ro
bot\Message\Entity\RedPacket
;
use
Hanson\
Ro
bot\Message\Entity\RequestFriend
;
use
Hanson\
Ro
bot\Message\Entity\Share
;
use
Hanson\
Ro
bot\Message\Entity\Text
;
use
Hanson\
Ro
bot\Message\Entity\Touch
;
use
Hanson\
Ro
bot\Message\Entity\Transfer
;
use
Hanson\
Ro
bot\Message\Entity\Video
;
use
Hanson\
Ro
bot\Message\Entity\Voice
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Message\Entity\Emoticon
;
use
Hanson\
V
bot\Message\Entity\Image
;
use
Hanson\
V
bot\Message\Entity\Location
;
use
Hanson\
V
bot\Message\Entity\Recall
;
use
Hanson\
V
bot\Message\Entity\Recommend
;
use
Hanson\
V
bot\Message\Entity\RedPacket
;
use
Hanson\
V
bot\Message\Entity\RequestFriend
;
use
Hanson\
V
bot\Message\Entity\Share
;
use
Hanson\
V
bot\Message\Entity\Text
;
use
Hanson\
V
bot\Message\Entity\Touch
;
use
Hanson\
V
bot\Message\Entity\Transfer
;
use
Hanson\
V
bot\Message\Entity\Video
;
use
Hanson\
V
bot\Message\Entity\Voice
;
use
Hanson\
V
bot\Support\Console
;
class
MessageFactory
{
public
$msg
;
public
function
make
(
$selector
,
$msg
)
{
$this
->
msg
=
$msg
;
return
$this
->
handleMessageByType
();
return
$this
->
handleMessageByType
(
$msg
);
}
...
...
@@ -41,55 +37,55 @@ class MessageFactory
* 处理消息类型
*
*/
private
function
handleMessageByType
()
private
function
handleMessageByType
(
$msg
)
{
Console
::
log
(
$
this
->
msg
[
'MsgType'
]);
switch
(
$
this
->
msg
[
'MsgType'
]){
Console
::
log
(
$msg
[
'MsgType'
]);
switch
(
$msg
[
'MsgType'
]){
case
1
:
//文本消息
if
(
Location
::
isLocation
(
$
this
->
msg
)){
return
new
Location
(
$
this
->
msg
);
if
(
Location
::
isLocation
(
$msg
)){
return
new
Location
(
$msg
);
}
else
{
return
new
Text
(
$
this
->
msg
);
return
new
Text
(
$msg
);
}
case
3
:
// 图片消息
return
new
Image
(
$
this
->
msg
);
return
new
Image
(
$msg
);
case
34
:
// 语音消息
return
new
Voice
(
$
this
->
msg
);
return
new
Voice
(
$msg
);
case
43
:
// 视频
return
new
Video
(
$
this
->
msg
);
return
new
Video
(
$msg
);
case
47
:
// 动画表情
return
new
Emoticon
(
$
this
->
msg
);
return
new
Emoticon
(
$msg
);
case
10002
:
return
new
Recall
(
$
this
->
msg
);
return
new
Recall
(
$msg
);
case
10000
:
if
(
$
this
->
msg
[
'Status'
]
==
4
){
return
new
RedPacket
(
$
this
->
msg
);
if
(
$msg
[
'Status'
]
==
4
){
return
new
RedPacket
(
$msg
);
}
else
{
}
break
;
case
49
:
if
(
$
this
->
msg
[
'Status'
]
==
3
&&
$this
->
msg
[
'FileName'
]
===
'微信转账'
){
return
new
Transfer
(
$
this
->
msg
);
if
(
$
msg
[
'Status'
]
==
3
&&
$
msg
[
'FileName'
]
===
'微信转账'
){
return
new
Transfer
(
$msg
);
}
else
{
return
new
Share
(
$
this
->
msg
);
return
new
Share
(
$msg
);
}
case
37
:
// 好友验证
return
new
RequestFriend
(
$
this
->
msg
);
return
new
RequestFriend
(
$msg
);
case
42
:
//共享名片
return
new
Recommend
(
$
this
->
msg
);
return
new
Recommend
(
$msg
);
case
62
:
$this
->
type
=
'Video'
;
//Video
break
;
case
51
:
if
(
$
this
->
msg
[
'ToUserName'
]
===
$this
->
msg
[
'StatusNotifyUserName'
]){
return
new
Touch
(
$
this
->
msg
);
if
(
$
msg
[
'ToUserName'
]
===
$
msg
[
'StatusNotifyUserName'
]){
return
new
Touch
(
$msg
);
}
break
;
case
53
:
$this
->
type
=
'VideoCall'
;
//VideoCall
break
;
default
:
$this
->
type
=
'Unknown'
;
//Unknown
break
;
}
}
...
...
src/Core/MessageHandler.php
View file @
df696b4
...
...
@@ -6,16 +6,16 @@
* Time: 23:08
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
use
Closure
;
use
Hanson\
Ro
bot\Collections\Account
;
use
Hanson\
Ro
bot\Message\Entity\Emoticon
;
use
Hanson\
Ro
bot\Message\Entity\Image
;
use
Hanson\
Ro
bot\Message\Entity\Message
;
use
Hanson\
Ro
bot\Message\Entity\Text
;
use
Hanson\
Ro
bot\Message\Entity\Video
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Collections\Account
;
use
Hanson\
V
bot\Message\Entity\Emoticon
;
use
Hanson\
V
bot\Message\Entity\Image
;
use
Hanson\
V
bot\Message\Entity\Message
;
use
Hanson\
V
bot\Message\Entity\Text
;
use
Hanson\
V
bot\Message\Entity\Video
;
use
Hanson\
V
bot\Support\Console
;
class
MessageHandler
{
...
...
@@ -88,7 +88,6 @@ class MessageHandler
public
function
listen
()
{
while
(
true
){
if
(
$this
->
customHandler
instanceof
Closure
){
call_user_func_array
(
$this
->
customHandler
,
[]);
}
...
...
@@ -123,7 +122,6 @@ class MessageHandler
if
(
$message
[
'AddMsgList'
]){
foreach
(
$message
[
'AddMsgList'
]
as
$msg
)
{
// $content = (new Message)->make($selector, $msg);
$content
=
$this
->
messageFactory
->
make
(
$selector
,
$msg
);
if
(
$content
){
$this
->
addToMessageCollection
(
$content
);
...
...
src/Core/Myself.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 21:54
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
class
Myself
...
...
src/Core/Server.php
View file @
df696b4
...
...
@@ -6,17 +6,16 @@
* Time: 21:10
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
use
Endroid\QrCode\QrCode
;
use
GuzzleHttp\Client
;
use
Hanson\Robot\Collections\Account
;
use
Hanson\Robot\Collections\ContactFactory
;
use
Hanson\Robot\Collections\Group
;
use
Hanson\Robot\Support\Console
;
use
Hanson\Robot\Support\ObjectAble
;
use
QueryPath\Exception
;
use
Hanson\Vbot\Collections\Account
;
use
Hanson\Vbot\Collections\ContactFactory
;
use
Hanson\Vbot\Collections\Group
;
use
Hanson\Vbot\Support\Console
;
use
Hanson\Vbot\Support\ObjectAble
;
use
Symfony\Component\DomCrawler\Crawler
;
class
Server
...
...
@@ -56,7 +55,7 @@ class Server
public
$pushUri
;
const
BASE_HOST
=
'wx2.qq.com'
;
public
$domain
=
'wx2.qq.com'
;
public
function
__construct
(
$config
=
[])
{
...
...
@@ -177,8 +176,9 @@ class Server
Console
::
log
(
'登录URL:'
.
$this
->
redirectUri
);
$domainList
=
[
'wx2.qq.com'
=>
[
'file.wx2.qq.com'
,
'webpush.wx2.qq.com'
],
'wx.qq.com'
=>
[
'file.wx.qq.com'
,
'webpush.wx.qq.com'
],
'wx8.qq.com'
=>
[
'file.wx8.qq.com'
,
'webpush.wx8.qq.com'
],
'qq.com'
=>
[
'file.wx.qq.com'
,
'webpush.wx.qq.com'
],
//
'qq.com' => ['file.wx.qq.com', 'webpush.wx.qq.com'],
'web2.wechat.com'
=>
[
'file.web2.wechat.com'
,
'webpushweb2.wechat.com'
],
'wechat.com'
=>
[
'file.web.wechat.com'
,
'webpushweb.web.wechat.com'
],
];
...
...
@@ -188,10 +188,8 @@ class Server
$this
->
fileUri
=
sprintf
(
$url
,
$list
[
0
]);
$this
->
pushUri
=
sprintf
(
$url
,
$list
[
1
]);
$this
->
baseUri
=
sprintf
(
$url
,
$domain
);
$this
->
domain
=
$domain
;
break
;
}
else
{
// $this->fileUri = $this->pushUri = $
throw
new
\Exception
(
'I can\'t believe it will be here'
);
}
}
Console
::
log
(
'url is:'
.
$this
->
baseUri
);
...
...
@@ -265,7 +263,7 @@ class Server
// print_r($this->baseRequest);
Console
::
log
(
'init URL:'
.
$url
);
throw
new
Exception
(
'[ERROR] init fail!'
);
throw
new
\
Exception
(
'[ERROR] init fail!'
);
}
}
...
...
src/Core/Sync.php
View file @
df696b4
...
...
@@ -6,10 +6,10 @@
* Time: 11:21
*/
namespace
Hanson\
Ro
bot\Core
;
namespace
Hanson\
V
bot\Core
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Support\Console
;
class
Sync
{
...
...
@@ -21,7 +21,7 @@ class Sync
*/
public
function
checkSync
()
{
$url
=
'https://webpush.'
.
Server
::
BASE_HOST
.
'/cgi-bin/mmwebwx-bin/synccheck?'
.
http_build_query
([
$url
=
'https://webpush.'
.
server
()
->
domain
.
'/cgi-bin/mmwebwx-bin/synccheck?'
.
http_build_query
([
'r'
=>
time
(),
'sid'
=>
server
()
->
sid
,
'uin'
=>
server
()
->
uin
,
...
...
src/Foundation/Robot.php
View file @
df696b4
...
...
@@ -6,17 +6,17 @@
* Time: 21:22
*/
namespace
Hanson\
Ro
bot\Foundation
;
namespace
Hanson\
V
bot\Foundation
;
use
Hanson\
Ro
bot\Core\Http
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
V
bot\Core\Http
;
use
Hanson\
V
bot\Core\Server
;
use
Illuminate\Support\Collection
;
use
Pimple\Container
;
/**
* Class Robot
* @package Hanson\
Ro
bot\Foundation
* @package Hanson\
V
bot\Foundation
* @property Server $server
*/
class
Robot
extends
Container
...
...
src/Foundation/ServiceProviders/ServerServiceProvider.php
View file @
df696b4
<?php
namespace
Hanson\
Ro
bot\Foundation\ServiceProviders
;
namespace
Hanson\
V
bot\Foundation\ServiceProviders
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
V
bot\Core\Server
;
use
Pimple\Container
;
use
Pimple\ServiceProviderInterface
;
...
...
src/Message/Entity/Emoticon.php
View file @
df696b4
...
...
@@ -6,16 +6,16 @@
* Time: 16:51
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
Ro
bot\Message\MediaInterface
;
use
Hanson\
Ro
bot\Message\MediaTrait
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
Ro
bot\Message\UploadAble
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
Ro
bot\Support\FileManager
;
use
Hanson\
V
bot\Core\Server
;
use
Hanson\
V
bot\Message\MediaInterface
;
use
Hanson\
V
bot\Message\MediaTrait
;
use
Hanson\
V
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\UploadAble
;
use
Hanson\
V
bot\Support\Console
;
use
Hanson\
V
bot\Support\FileManager
;
class
Emoticon
extends
Message
implements
MediaInterface
,
MessageInterface
{
...
...
src/Message/Entity/Image.php
View file @
df696b4
...
...
@@ -6,15 +6,15 @@
* Time: 16:51
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
Ro
bot\Support\FileManager
;
use
Hanson\
Ro
bot\Message\MediaInterface
;
use
Hanson\
Ro
bot\Message\MediaTrait
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
Ro
bot\Message\UploadAble
;
use
Hanson\
V
bot\Support\Console
;
use
Hanson\
V
bot\Support\FileManager
;
use
Hanson\
V
bot\Message\MediaInterface
;
use
Hanson\
V
bot\Message\MediaTrait
;
use
Hanson\
V
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\UploadAble
;
class
Image
extends
Message
implements
MessageInterface
,
MediaInterface
{
...
...
src/Message/Entity/Location.php
View file @
df696b4
...
...
@@ -6,10 +6,10 @@
* Time: 21:13
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Location
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Message.php
View file @
df696b4
...
...
@@ -6,17 +6,17 @@
* Time: 0:12
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Carbon\Carbon
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
Ro
bot\Collections\Contact
;
use
Hanson\
Ro
bot\Collections\Official
;
use
Hanson\
Ro
bot\Collections\SpecialAccount
;
use
Hanson\
Ro
bot\Support\FileManager
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
Ro
bot\Support\ObjectAble
;
use
Hanson\
V
bot\Core\Server
;
use
Hanson\
V
bot\Collections\Contact
;
use
Hanson\
V
bot\Collections\Official
;
use
Hanson\
V
bot\Collections\SpecialAccount
;
use
Hanson\
V
bot\Support\FileManager
;
use
Hanson\
V
bot\Support\Console
;
use
Hanson\
V
bot\Support\ObjectAble
;
class
Message
{
...
...
@@ -51,19 +51,6 @@ class Message
*/
public
$fromType
;
public
$isAt
=
false
;
const
USER_TYPE
=
[
0
=>
'Init'
,
1
=>
'Self'
,
2
=>
'FileHelper'
,
3
=>
'Group'
,
4
=>
'Contact'
,
5
=>
'Public'
,
6
=>
'Special'
,
99
=>
'UnKnown'
,
];
public
$msg
;
static
$mediaCount
=
-
1
;
...
...
@@ -134,7 +121,6 @@ class Message
$this
->
sender
=
account
()
->
getAccount
(
$uid
);
$this
->
msg
[
'Content'
]
=
$this
->
formatContent
(
$content
);
$this
->
isAt
=
str_contains
(
$this
->
msg
[
'Content'
],
'@'
.
myself
()
->
nickname
);
}
protected
function
formatContent
(
$content
)
...
...
@@ -142,22 +128,6 @@ class Message
return
str_replace
(
'<br/>'
,
"
\n
"
,
$content
);
}
/**
* 存储消息到 Message 集合
*/
public
function
addMessageCollection
()
{
message
()
->
put
(
$this
->
msg
[
'MsgId'
],
[
'content'
=>
$this
->
content
,
'username'
=>
$this
->
username
,
'sender'
=>
$this
->
sender
,
'msg_type'
=>
$this
->
msg
[
'MsgType'
],
'type'
=>
$this
->
type
,
'created_at'
=>
$this
->
msg
[
'CreateTime'
],
'from_type'
=>
$this
->
fromType
]);
}
public
function
__toString
()
{
return
$this
->
content
;
...
...
src/Message/Entity/Recall.php
View file @
df696b4
...
...
@@ -6,10 +6,10 @@
* Time: 15:48
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MediaTrait
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MediaTrait
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Recall
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Recommend.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Recommend
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/RedPacket.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
RedPacket
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/RequestFriend.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
RequestFriend
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Share.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Share
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Text.php
View file @
df696b4
...
...
@@ -6,15 +6,17 @@
* Time: 18:33
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
V
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Support\Console
;
class
Text
extends
Message
implements
MessageInterface
{
public
$isAt
;
public
function
__construct
(
$msg
)
{
parent
::
__construct
(
$msg
);
...
...
@@ -64,5 +66,7 @@ class Text extends Message implements MessageInterface
public
function
make
()
{
$this
->
content
=
$this
->
msg
[
'Content'
];
$this
->
isAt
=
str_contains
(
$this
->
content
,
'@'
.
myself
()
->
nickname
);
}
}
\ No newline at end of file
src/Message/Entity/Touch.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Touch
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Transfer.php
View file @
df696b4
...
...
@@ -6,9 +6,9 @@
* Time: 12:29
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\MessageInterface
;
class
Transfer
extends
Message
implements
MessageInterface
{
...
...
src/Message/Entity/Video.php
View file @
df696b4
...
...
@@ -6,15 +6,15 @@
* Time: 22:08
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MediaInterface
;
use
Hanson\
Ro
bot\Message\MediaTrait
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
Ro
bot\Message\UploadAble
;
use
Hanson\
Ro
bot\Support\Console
;
use
Hanson\
Ro
bot\Support\FileManager
;
use
Hanson\
V
bot\Message\MediaInterface
;
use
Hanson\
V
bot\Message\MediaTrait
;
use
Hanson\
V
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\UploadAble
;
use
Hanson\
V
bot\Support\Console
;
use
Hanson\
V
bot\Support\FileManager
;
class
Video
extends
Message
implements
MessageInterface
,
MediaInterface
{
...
...
src/Message/Entity/Voice.php
View file @
df696b4
...
...
@@ -6,14 +6,14 @@
* Time: 22:08
*/
namespace
Hanson\
Ro
bot\Message\Entity
;
namespace
Hanson\
V
bot\Message\Entity
;
use
Hanson\
Ro
bot\Message\MediaInterface
;
use
Hanson\
Ro
bot\Message\MediaTrait
;
use
Hanson\
Ro
bot\Message\MessageInterface
;
use
Hanson\
Ro
bot\Message\UploadAble
;
use
Hanson\
Ro
bot\Support\FileManager
;
use
Hanson\
V
bot\Message\MediaInterface
;
use
Hanson\
V
bot\Message\MediaTrait
;
use
Hanson\
V
bot\Message\MessageInterface
;
use
Hanson\
V
bot\Message\UploadAble
;
use
Hanson\
V
bot\Support\FileManager
;
class
Voice
extends
Message
implements
MessageInterface
,
MediaInterface
{
...
...
src/Message/MediaInterface.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 2:53
*/
namespace
Hanson\
Ro
bot\Message
;
namespace
Hanson\
V
bot\Message
;
interface
MediaInterface
...
...
src/Message/MediaTrait.php
View file @
df696b4
...
...
@@ -6,13 +6,13 @@
* Time: 3:20
*/
namespace
Hanson\
Ro
bot\Message
;
namespace
Hanson\
V
bot\Message
;
/**
* Class MediaTrait
* @property string $folder
* @package Hanson\
Ro
bot\Message
* @package Hanson\
V
bot\Message
*/
trait
MediaTrait
{
...
...
src/Message/MessageInterface.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 16:03
*/
namespace
Hanson\
Ro
bot\Message
;
namespace
Hanson\
V
bot\Message
;
interface
MessageInterface
...
...
src/Message/UploadAble.php
View file @
df696b4
...
...
@@ -6,14 +6,14 @@
* Time: 16:18
*/
namespace
Hanson\
Ro
bot\Message
;
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
Ro
bot\Support\Console
;
namespace
Hanson\
V
bot\Message
;
use
Hanson\
V
bot\Core\Server
;
use
Hanson\
V
bot\Support\Console
;
/**
* Class UploadAble
* @package Hanson\
Ro
bot\Message\
* @package Hanson\
V
bot\Message\
*
* @property string static $mediaCount
*/
...
...
src/Robot.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 16:12
*/
namespace
Hanson\
Ro
bot
;
namespace
Hanson\
V
bot
;
use
Endroid\QrCode\QrCode
;
...
...
src/Support/Console.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 22:51
*/
namespace
Hanson\
Ro
bot\Support
;
namespace
Hanson\
V
bot\Support
;
class
Console
...
...
src/Support/FileManager.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 22:21
*/
namespace
Hanson\
Ro
bot\Support
;
namespace
Hanson\
V
bot\Support
;
class
FileManager
...
...
src/Support/ObjectAble.php
View file @
df696b4
...
...
@@ -6,7 +6,7 @@
* Time: 17:23
*/
namespace
Hanson\
Ro
bot\Support
;
namespace
Hanson\
V
bot\Support
;
trait
ObjectAble
...
...
src/Support/helpers.php
View file @
df696b4
...
...
@@ -6,15 +6,15 @@
* Time: 0:10
*/
use
Hanson\
Ro
bot\Core\Server
;
use
Hanson\
Ro
bot\Core\Myself
;
use
Hanson\
Ro
bot\Core\Http
;
use
Hanson\
Ro
bot\Collections\Account
;
use
Hanson\
Ro
bot\Collections\Member
;
use
Hanson\
Ro
bot\Collections\Contact
;
use
Hanson\
Ro
bot\Collections\Message
;
use
Hanson\
Ro
bot\Collections\Group
;
use
Hanson\
Ro
bot\Collections\Official
;
use
Hanson\
V
bot\Core\Server
;
use
Hanson\
V
bot\Core\Myself
;
use
Hanson\
V
bot\Core\Http
;
use
Hanson\
V
bot\Collections\Account
;
use
Hanson\
V
bot\Collections\Member
;
use
Hanson\
V
bot\Collections\Contact
;
use
Hanson\
V
bot\Collections\Message
;
use
Hanson\
V
bot\Collections\Group
;
use
Hanson\
V
bot\Collections\Official
;
if
(
!
function_exists
(
'server'
))
{
/**
...
...
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