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 604428fe
authored
Mar 12, 2017
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
测试好友获取
1 parent
d5b7e805
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
src/Collections/ContactFactory.php
src/Core/Server.php
src/Collections/ContactFactory.php
View file @
604428f
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
namespace
Hanson\Vbot\Collections
;
namespace
Hanson\Vbot\Collections
;
use
Hanson\Vbot\Support\Console
;
use
Hanson\Vbot\Support\FileManager
;
use
Hanson\Vbot\Support\FileManager
;
class
ContactFactory
class
ContactFactory
...
@@ -48,13 +49,15 @@ class ContactFactory
...
@@ -48,13 +49,15 @@ class ContactFactory
/**
/**
* make instance model
* make instance model
*
*
@param int $seq
*/
*/
public
function
makeContactList
()
public
function
makeContactList
(
$seq
=
0
)
{
{
$url
=
sprintf
(
server
()
->
baseUri
.
'/webwxgetcontact?pass_ticket=%s&skey=%s&r=%s
'
,
server
()
->
passTicket
,
server
()
->
skey
,
time
()
);
$url
=
sprintf
(
server
()
->
baseUri
.
'/webwxgetcontact?pass_ticket=%s&skey=%s&r=%s
&seq=%s'
,
server
()
->
passTicket
,
server
()
->
skey
,
time
(),
$seq
);
$memberList
=
http
()
->
json
(
$url
,
[],
true
)[
'MemberList'
];
$result
=
http
()
->
json
(
$url
,
[],
true
);
$memberList
=
$result
[
'MemberList'
];
$seq
=
$result
[
'Seq'
];
foreach
(
$memberList
as
$contact
)
{
foreach
(
$memberList
as
$contact
)
{
if
(
official
()
->
isOfficial
(
$contact
[
'VerifyFlag'
])){
#公众号
if
(
official
()
->
isOfficial
(
$contact
[
'VerifyFlag'
])){
#公众号
...
@@ -67,6 +70,11 @@ class ContactFactory
...
@@ -67,6 +70,11 @@ class ContactFactory
contact
()
->
put
(
$contact
[
'UserName'
],
$contact
);
contact
()
->
put
(
$contact
[
'UserName'
],
$contact
);
}
}
}
}
if
(
$seq
!=
0
){
Console
::
log
(
'seq: '
.
$seq
);
$this
->
makeContactList
(
$seq
);
}
}
}
/**
/**
...
...
src/Core/Server.php
View file @
604428f
...
@@ -178,8 +178,8 @@ class Server
...
@@ -178,8 +178,8 @@ class Server
$this
->
redirectUri
=
$matches
[
1
]
.
'&fun=new'
;
$this
->
redirectUri
=
$matches
[
1
]
.
'&fun=new'
;
$domainList
=
[
$domainList
=
[
'wx2.qq.com'
=>
[
'file.wx2.qq.com'
,
'webpush.wx2.qq.com'
],
'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'
],
'wx8.qq.com'
=>
[
'file.wx8.qq.com'
,
'webpush.wx8.qq.com'
],
'qq.com'
=>
[
'file.wx.qq.com'
,
'webpush.wx.qq.com'
],
'web2.wechat.com'
=>
[
'file.web2.wechat.com'
,
'webpushweb2.wechat.com'
],
'web2.wechat.com'
=>
[
'file.web2.wechat.com'
,
'webpushweb2.wechat.com'
],
'wechat.com'
=>
[
'file.web.wechat.com'
,
'webpushweb.web.wechat.com'
],
'wechat.com'
=>
[
'file.web.wechat.com'
,
'webpushweb.web.wechat.com'
],
];
];
...
@@ -191,11 +191,13 @@ class Server
...
@@ -191,11 +191,13 @@ class Server
$this
->
baseUri
=
sprintf
(
$url
,
$domain
);
$this
->
baseUri
=
sprintf
(
$url
,
$domain
);
$this
->
domain
=
$domain
;
$this
->
domain
=
$domain
;
break
;
break
;
}
else
{
$this
->
fileUri
=
$this
->
pushUri
=
$this
->
redirectUri
;
}
}
}
}
return
;
return
;
case
'408'
:
case
'408'
:
Console
::
log
(
'登录超时,请重试'
,
Console
::
ERROR
);
Console
::
log
(
'登录超时,请重试'
,
Console
::
WARNING
);
$tip
=
1
;
$tip
=
1
;
$retryTime
-=
1
;
$retryTime
-=
1
;
sleep
(
1
);
sleep
(
1
);
...
...
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