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 7ac668c3
authored
8 years ago
by
hanccc
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复公众号bug
1 parent
d15fb1b9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
28 deletions
composer.lock
example/group.php
example/groups.php
src/Collections/ContactFactory.php
src/Collections/Group.php
src/Support/FileManager.php
composer.lock
View file @
7ac668c
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
"This file is @generated automatically"
],
],
"hash": "
37f52ae2334d2a7d5f4435c7d835c45a
",
"hash": "
b8d45b4e0794f3855f36113b444420a7
",
"content-hash": "4
5acbc8560c0df766dc94338616aefe5
",
"content-hash": "4
208bf2e5381a25360c7b542e17fd4a0
",
"packages": [
"packages": [
{
{
"name": "doctrine/inflector",
"name": "doctrine/inflector",
...
@@ -76,23 +76,30 @@
...
@@ -76,23 +76,30 @@
},
},
{
{
"name": "endroid/qrcode",
"name": "endroid/qrcode",
"version": "1.
7.4
",
"version": "1.
9.1
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/endroid/QrCode.git",
"url": "https://github.com/endroid/QrCode.git",
"reference": "
ba35ed8f0686bc4ec82874752778ccb427261a41
"
"reference": "
ab09b42778ad67cfe850f9c23165f8d08b756680
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/endroid/QrCode/
ba35ed8f0686bc4ec82874752778ccb427261a41
.zip",
"url": "https://packagist.phpcomposer.com/files/endroid/QrCode/
ab09b42778ad67cfe850f9c23165f8d08b756680
.zip",
"reference": "
ba35ed8f0686bc4ec82874752778ccb427261a41
",
"reference": "
ab09b42778ad67cfe850f9c23165f8d08b756680
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
"ext-gd": "*",
"ext-gd": "*",
"php": ">=5.
3.0
",
"php": ">=5.
4
",
"symfony/options-resolver": "^2.3|^3.0"
"symfony/options-resolver": "^2.3|^3.0"
},
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.0",
"sensio/framework-extra-bundle": "^3.0",
"symfony/browser-kit": "^2.3|^3.0",
"symfony/framework-bundle": "^2.3|^3.0",
"symfony/http-kernel": "^2.3|^3.0"
},
"type": "library",
"type": "library",
"extra": {
"extra": {
"branch-alias": {
"branch-alias": {
...
@@ -118,12 +125,14 @@
...
@@ -118,12 +125,14 @@
"description": "Endroid QR Code",
"description": "Endroid QR Code",
"homepage": "https://github.com/endroid/QrCode",
"homepage": "https://github.com/endroid/QrCode",
"keywords": [
"keywords": [
"bundle",
"code",
"code",
"endroid",
"endroid",
"qr",
"qr",
"qrcode"
"qrcode",
"symfony"
],
],
"time": "201
6-07-26 09:39:07
"
"time": "201
7-01-03 11:02:14
"
},
},
{
{
"name": "guzzlehttp/guzzle",
"name": "guzzlehttp/guzzle",
...
@@ -189,28 +198,28 @@
...
@@ -189,28 +198,28 @@
},
},
{
{
"name": "guzzlehttp/promises",
"name": "guzzlehttp/promises",
"version": "
1.3.0
",
"version": "
v1.3.1
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"url": "https://github.com/guzzle/promises.git",
"reference": "
2693c101803ca78b27972d84081d027fca790a1e
"
"reference": "
a59da6cf61d80060647ff4d3eb2c03a2bc694646
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/guzzle/promises/
2693c101803ca78b27972d84081d027fca790a1e
.zip",
"url": "https://packagist.phpcomposer.com/files/guzzle/promises/
a59da6cf61d80060647ff4d3eb2c03a2bc694646
.zip",
"reference": "
2693c101803ca78b27972d84081d027fca790a1e
",
"reference": "
a59da6cf61d80060647ff4d3eb2c03a2bc694646
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
"php": ">=5.5.0"
"php": ">=5.5.0"
},
},
"require-dev": {
"require-dev": {
"phpunit/phpunit": "
~
4.0"
"phpunit/phpunit": "
^
4.0"
},
},
"type": "library",
"type": "library",
"extra": {
"extra": {
"branch-alias": {
"branch-alias": {
"dev-master": "1.
0
-dev"
"dev-master": "1.
4
-dev"
}
}
},
},
"autoload": {
"autoload": {
...
@@ -236,7 +245,7 @@
...
@@ -236,7 +245,7 @@
"keywords": [
"keywords": [
"promise"
"promise"
],
],
"time": "2016-1
1-18 17:47:58
"
"time": "2016-1
2-20 10:07:11
"
},
},
{
{
"name": "guzzlehttp/psr7",
"name": "guzzlehttp/psr7",
...
@@ -1341,16 +1350,16 @@
...
@@ -1341,16 +1350,16 @@
},
},
{
{
"name": "nette/robot-loader",
"name": "nette/robot-loader",
"version": "v2.4.
1
",
"version": "v2.4.
2
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/nette/robot-loader.git",
"url": "https://github.com/nette/robot-loader.git",
"reference": "
980d7c5f20f4792d0be49285c7b2ffde8c8d9fe5
"
"reference": "
f23f8885624b249d5ec7bb525b9d6b007ab00293
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/nette/robot-loader/
980d7c5f20f4792d0be49285c7b2ffde8c8d9fe5
.zip",
"url": "https://packagist.phpcomposer.com/files/nette/robot-loader/
f23f8885624b249d5ec7bb525b9d6b007ab00293
.zip",
"reference": "
980d7c5f20f4792d0be49285c7b2ffde8c8d9fe5
",
"reference": "
f23f8885624b249d5ec7bb525b9d6b007ab00293
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -1396,7 +1405,7 @@
...
@@ -1396,7 +1405,7 @@
],
],
"description": "Nette RobotLoader: comfortable autoloading",
"description": "Nette RobotLoader: comfortable autoloading",
"homepage": "https://nette.org",
"homepage": "https://nette.org",
"time": "201
6-09-29 15:55:27
"
"time": "201
7-01-02 17:15:22
"
},
},
{
{
"name": "nette/utils",
"name": "nette/utils",
...
...
This diff is collapsed.
Click to expand it.
example/group.php
View file @
7ac668c
...
@@ -16,12 +16,11 @@ $robot = new Robot([
...
@@ -16,12 +16,11 @@ $robot = new Robot([
'debug'
=>
true
'debug'
=>
true
]);
]);
$flag
=
false
;
$robot
->
server
->
setCustomerHandler
(
function
(){
$robot
->
server
->
setCustomerHandler
(
function
()
use
(
&
$flag
){
/** @var $message Message */
/** @var $message Message */
Message
::
send
(
'测试'
.
\Carbon\Carbon
::
now
()
->
toDateTimeString
(),
contact
()
->
getUsernameById
(
'L907159127'
));
$group
=
group
()
->
getGroupsByNickname
(
'stackoverflow'
,
true
)
->
first
();
Message
::
send
(
'测试'
.
\Carbon\Carbon
::
now
()
->
toDateTimeString
(),
$group
[
'UserName'
]);
});
});
...
...
This diff is collapsed.
Click to expand it.
example/groups.php
0 → 100644
View file @
7ac668c
<?php
/**
* 发送给所有群消息!!!慎重!!!
* User: HanSon
* Date: 2016/12/7
* Time: 16:33
*/
require_once
__DIR__
.
'./../vendor/autoload.php'
;
use
Hanson\Robot\Foundation\Robot
;
use
Hanson\Robot\Message\Message
;
$robot
=
new
Robot
([
'tmp'
=>
__DIR__
.
'./../tmp/'
,
'debug'
=>
true
]);
// 发送给所有群消息!!!慎重!!!
$robot
->
server
->
setCustomerHandler
(
function
(){
/** @var $message Message */
$groups
=
group
()
->
getGroupsByNickname
(
'stackoverflow'
,
true
);
foreach
(
$groups
as
$group
)
{
Message
::
send
(
'测试'
.
\Carbon\Carbon
::
now
()
->
toDateTimeString
(),
$group
[
'UserName'
]);
}
});
$robot
->
server
->
run
();
This diff is collapsed.
Click to expand it.
src/Collections/ContactFactory.php
View file @
7ac668c
...
@@ -48,7 +48,7 @@ class ContactFactory
...
@@ -48,7 +48,7 @@ class ContactFactory
protected
function
makeContactList
(
$memberList
)
protected
function
makeContactList
(
$memberList
)
{
{
foreach
(
$memberList
as
$contact
)
{
foreach
(
$memberList
as
$contact
)
{
if
(
$contact
[
'VerifyFlag'
]
&
8
!=
0
){
#公众号
if
(
(
$contact
[
'VerifyFlag'
]
&
8
)
!=
0
){
#公众号
OfficialAccount
::
getInstance
()
->
put
(
$contact
[
'UserName'
],
$contact
);
OfficialAccount
::
getInstance
()
->
put
(
$contact
[
'UserName'
],
$contact
);
}
elseif
(
in_array
(
$contact
[
'UserName'
],
static
::
SPECIAL_USERS
)){
# 特殊账户
}
elseif
(
in_array
(
$contact
[
'UserName'
],
static
::
SPECIAL_USERS
)){
# 特殊账户
SpecialAccount
::
getInstance
()
->
put
(
$contact
[
'UserName'
],
$contact
);
SpecialAccount
::
getInstance
()
->
put
(
$contact
[
'UserName'
],
$contact
);
...
...
This diff is collapsed.
Click to expand it.
src/Collections/Group.php
View file @
7ac668c
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
namespace
Hanson\Robot\Collections
;
namespace
Hanson\Robot\Collections
;
use
Hanson\Robot\Support\Console
;
use
Illuminate\Support\Collection
;
use
Illuminate\Support\Collection
;
class
Group
extends
Collection
class
Group
extends
Collection
...
@@ -51,7 +52,7 @@ class Group extends Collection
...
@@ -51,7 +52,7 @@ class Group extends Collection
public
function
getGroupsByNickname
(
$name
,
$blur
=
false
,
$onlyUsername
=
false
)
public
function
getGroupsByNickname
(
$name
,
$blur
=
false
,
$onlyUsername
=
false
)
{
{
$groups
=
$this
->
filter
(
function
(
$value
,
$key
)
use
(
$name
,
$blur
){
$groups
=
$this
->
filter
(
function
(
$value
,
$key
)
use
(
$name
,
$blur
){
if
(
$blur
){
if
(
!
$blur
){
return
$value
[
'NickName'
]
===
$name
;
return
$value
[
'NickName'
]
===
$name
;
}
else
{
}
else
{
return
str_contains
(
$value
[
'NickName'
],
$name
);
return
str_contains
(
$value
[
'NickName'
],
$name
);
...
...
This diff is collapsed.
Click to expand it.
src/Support/FileManager.php
View file @
7ac668c
...
@@ -15,7 +15,7 @@ class FileManager
...
@@ -15,7 +15,7 @@ class FileManager
public
static
function
download
(
$msgId
,
$data
,
$type
)
public
static
function
download
(
$msgId
,
$data
,
$type
)
{
{
$path
=
server
()
->
config
[
'tmp'
]
.
$type
;
$path
=
server
()
->
config
[
'tmp'
]
.
$type
;
if
(
!
is_dir
(
$path
)){
if
(
!
is_dir
(
realpath
(
$path
)
)){
mkdir
(
$path
,
0700
,
true
);
mkdir
(
$path
,
0700
,
true
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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