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 b3e33366
authored
Dec 28, 2016
by
hanccc
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
完善发送消息
1 parent
ce435cad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
src/Core/MessageHandler.php
src/Core/MessageHandler.php
View file @
b3e3336
...
...
@@ -100,38 +100,33 @@ class MessageHandler
// Log::echo(json_encode($message));
}
private
function
send
(
$
response
,
$content
)
private
function
send
(
$
word
,
$content
)
{
if
(
!
$
response
&&
!
is_string
(
$response
)){
if
(
!
$
word
&&
!
is_string
(
$word
)){
return
false
;
}
$random
=
strval
(
time
()
*
1000
)
.
'0'
.
strval
(
rand
(
100
,
999
));
echo
$response
;
$result
=
$this
->
server
->
http
->
json
(
Server
::
BASE_URI
.
'/webwxsendmsg?pass_ticket='
.
$this
->
server
->
passTicket
,
[
echo
$word
;
$result
=
$this
->
server
->
http
->
post
(
Server
::
BASE_URI
.
'/webwxsendmsg?pass_ticket='
.
$this
->
server
->
passTicket
,
json_encode
([
'BaseRequest'
=>
$this
->
server
->
baseRequest
,
'Msg'
=>
[
'Type'
=>
1
,
'Content'
=>
$
response
,
'Content'
=>
$
word
,
'FromUserName'
=>
$this
->
server
->
getMyAccount
(),
'ToUserName'
=>
$content
->
rawMsg
[
'FromUserName'
],
'LocalID'
=>
$random
,
'ClientMsgId'
=>
$random
]
],
true
);
'ClientMsgId'
=>
$random
,
],
'Scene'
=>
0
],
JSON_UNESCAPED_UNICODE
),
true
);
if
(
$result
[
'BaseResponse'
][
'Ret'
]
!=
0
){
Log
::
echo
(
'发送消息失败'
);
}
}
private
function
unicode
(
$utf8_str
)
{
$unicode
=
(
ord
(
$utf8_str
[
0
])
&
0x1F
)
<<
12
;
$unicode
|=
(
ord
(
$utf8_str
[
1
])
&
0x3F
)
<<
6
;
$unicode
|=
(
ord
(
$utf8_str
[
2
])
&
0x3F
);
return
dechex
(
$unicode
);
}
/**
* get a message code
*
...
...
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