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 1bf3ea16
authored
Mar 15, 2017
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改console输出
1 parent
3936b291
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
17 deletions
src/Core/Server.php
src/Core/Sync.php
src/Message/Entity/Emoticon.php
src/Message/Entity/GroupChange.php
src/Message/Entity/Image.php
src/Message/Entity/NewFriend.php
src/Message/Entity/Text.php
src/Message/Entity/Video.php
src/Message/UploadAble.php
src/Support/Console.php
src/Core/Server.php
View file @
1bf3ea1
...
...
@@ -88,8 +88,10 @@ class Server
$this
->
statusNotify
();
Console
::
log
(
'开始初始化联系人'
);
$this
->
initContact
();
Console
::
log
(
sprintf
(
"初始化联系人成功
\n
群数量: %d
\n
联系人数量: %d
\n
公众号数量: %d
\n
特殊号数量: %d"
,
group
()
->
count
(),
contact
()
->
count
(),
official
()
->
count
(),
Special
::
getInstance
()
->
count
()));
Console
::
log
(
'初始化联系人成功'
);
Console
::
log
(
sprintf
(
"群数量: %d"
,
group
()
->
count
()));
Console
::
log
(
sprintf
(
"联系人数量: %d"
,
contact
()
->
count
()));
Console
::
log
(
sprintf
(
"公众号数量: %d"
,
official
()
->
count
()));
MessageHandler
::
getInstance
()
->
listen
();
}
...
...
src/Core/Sync.php
View file @
1bf3ea1
...
...
@@ -107,7 +107,7 @@ class Sync
*/
public
function
debugMessage
(
$retCode
,
$selector
,
$sleep
=
null
)
{
Console
::
log
(
'
[DEBUG] retcode:'
.
$retCode
.
' selector:'
.
$selector
);
Console
::
log
(
'
retcode:'
.
$retCode
.
' selector:'
.
$selector
,
Console
::
WARNING
);
if
(
$sleep
){
sleep
(
$sleep
);
...
...
src/Message/Entity/Emoticon.php
View file @
1bf3ea1
...
...
@@ -35,7 +35,7 @@ class Emoticon extends Message implements MediaInterface, MessageInterface
$response
=
static
::
uploadMedia
(
$username
,
$file
);
if
(
!
$response
)
{
Console
::
log
(
"表情
{
$file
}
上传失败"
);
Console
::
log
(
"表情
{
$file
}
上传失败"
,
Console
::
WARNING
);
return
false
;
}
...
...
@@ -57,7 +57,7 @@ class Emoticon extends Message implements MediaInterface, MessageInterface
$result
=
http
()
->
json
(
$url
,
$data
,
true
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
)
{
Console
::
log
(
'发送表情失败'
);
Console
::
log
(
'发送表情失败'
,
Console
::
WARNING
);
return
false
;
}
...
...
src/Message/Entity/GroupChange.php
View file @
1bf3ea1
...
...
@@ -31,9 +31,9 @@ class GroupChange extends Message implements MessageInterface
{
if
(
str_contains
(
$this
->
msg
[
'Content'
],
'加入了群聊'
)){
$this
->
action
=
'ADD'
;
Console
::
lo
g
(
"检测到
{
$this
->
from
[
'NickName'
]
}
有新成员,正在刷新群成员列表..."
);
Console
::
debu
g
(
"检测到
{
$this
->
from
[
'NickName'
]
}
有新成员,正在刷新群成员列表..."
);
(
new
ContactFactory
())
->
makeContactList
();
Console
::
lo
g
(
'群成员更新成功!'
);
Console
::
debu
g
(
'群成员更新成功!'
);
}
elseif
(
str_contains
(
$this
->
msg
[
'Content'
],
'移出了群聊'
)){
$this
->
action
=
'REMOVE'
;
}
elseif
(
str_contains
(
$this
->
msg
[
'Content'
],
'改群名为'
)){
...
...
src/Message/Entity/Image.php
View file @
1bf3ea1
...
...
@@ -42,7 +42,7 @@ class Image extends Message implements MessageInterface, MediaInterface
$response
=
static
::
uploadMedia
(
$username
,
$file
);
if
(
!
$response
)
{
Console
::
log
(
"文件
{
$file
}
上传失败"
);
Console
::
log
(
"文件
{
$file
}
上传失败"
,
Console
::
WARNING
);
return
false
;
}
...
...
@@ -63,7 +63,7 @@ class Image extends Message implements MessageInterface, MediaInterface
$result
=
http
()
->
json
(
$url
,
$data
,
true
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
)
{
Console
::
log
(
'发送图片失败'
);
Console
::
log
(
'发送图片失败'
,
Console
::
WARNING
);
return
false
;
}
...
...
src/Message/Entity/NewFriend.php
View file @
1bf3ea1
...
...
@@ -24,8 +24,8 @@ class NewFriend extends Message implements MessageInterface
public
function
make
()
{
Console
::
lo
g
(
'检测到新加好友,正在刷新好友列表...'
);
Console
::
debu
g
(
'检测到新加好友,正在刷新好友列表...'
);
(
new
ContactFactory
())
->
makeContactList
();
Console
::
lo
g
(
'好友更新成功!'
);
Console
::
debu
g
(
'好友更新成功!'
);
}
}
\ No newline at end of file
src/Message/Entity/Text.php
View file @
1bf3ea1
...
...
@@ -58,7 +58,7 @@ class Text extends Message implements MessageInterface
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
)
{
Console
::
log
(
'发送消息失败'
);
Console
::
log
(
'发送消息失败'
,
Console
::
WARNING
);
return
false
;
}
...
...
src/Message/Entity/Video.php
View file @
1bf3ea1
...
...
@@ -34,7 +34,7 @@ class Video extends Message implements MessageInterface, MediaInterface
$response
=
static
::
uploadMedia
(
$username
,
$file
);
if
(
!
$response
)
{
Console
::
log
(
"视频
{
$file
}
上传失败"
);
Console
::
log
(
"视频
{
$file
}
上传失败"
,
Console
::
WARNING
);
return
false
;
}
...
...
@@ -55,7 +55,7 @@ class Video extends Message implements MessageInterface, MediaInterface
$result
=
http
()
->
json
(
$url
,
$data
,
true
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
)
{
Console
::
log
(
'发送视频失败'
);
Console
::
log
(
'发送视频失败'
,
Console
::
WARNING
);
return
false
;
}
...
...
@@ -90,7 +90,8 @@ class Video extends Message implements MessageInterface, MediaInterface
]
]);
if
(
strlen
(
$content
)
===
0
){
Console
::
log
(
'下载视频失败'
,
Console
::
ERROR
);
Console
::
log
(
'下载视频失败'
,
Console
::
WARNING
);
Console
::
log
(
'url:'
.
$url
);
}
else
{
FileManager
::
download
(
$this
->
msg
[
'MsgId'
]
.
'.mp4'
,
$content
,
static
::
$folder
);
}
...
...
src/Message/UploadAble.php
View file @
1bf3ea1
...
...
@@ -79,7 +79,7 @@ trait UploadAble
$response
=
static
::
uploadMedia
(
$username
,
$file
);
if
(
!
$response
){
Console
::
log
(
"文件
{
$file
}
上传失败"
);
Console
::
log
(
"文件
{
$file
}
上传失败"
,
Console
::
WARNING
);
return
false
;
}
...
...
@@ -100,7 +100,7 @@ trait UploadAble
$result
=
http
()
->
json
(
$url
,
$data
,
true
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
){
Console
::
log
(
'发送文件失败'
);
Console
::
log
(
'发送文件失败'
,
Console
::
WARNING
);
return
false
;
}
...
...
src/Support/Console.php
View file @
1bf3ea1
...
...
@@ -34,6 +34,18 @@ class Console
}
/**
* debug 模式下调试输出
*
* @param $str
*/
public
static
function
debug
(
$str
)
{
if
(
server
()
->
config
[
'debug'
])
{
static
::
log
(
$str
,
'DEBUG'
);
}
}
/**
* 初始化二维码style
*
* @param OutputInterface $output
...
...
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