@@ -3,7 +3,6 @@ |
||
| 3 | 3 | * 案例演示 |
| 4 | 4 | */ |
| 5 | 5 | use Slince\SmartQQ\Credential; |
| 6 | -use GuzzleHttp\Cookie\CookieJar; |
|
| 7 | 6 | |
| 8 | 7 | include __DIR__ . '/../vendor/autoload.php'; |
| 9 | 8 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Slince\SmartQQ\Client; |
| 6 | 6 | use Slince\SmartQQ\Message\Response\FriendMessage; |
| 7 | 7 | use Slince\SmartQQ\Message\Response\GroupMessage; |
| 8 | -use Slince\SmartQQ\Message\Response\DiscussMessage; |
|
| 9 | 8 | use Slince\SmartQQ\Entity\Discuss; |
| 10 | 9 | use Slince\SmartQQ\Entity\DiscussDetail; |
| 11 | 10 | |
@@ -400,7 +400,7 @@ |
||
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | 402 | * @param RequestInterface $request |
| 403 | - * @return mixed|ResponseInterface |
|
| 403 | + * @return ResponseInterface |
|
| 404 | 404 | */ |
| 405 | 405 | protected function sendRequest(RequestInterface $request) |
| 406 | 406 | { |
@@ -9,7 +9,6 @@ discard block |
||
| 9 | 9 | use GuzzleHttp\Cookie\CookieJar; |
| 10 | 10 | use GuzzleHttp\Psr7\Request; |
| 11 | 11 | use Psr\Http\Message\ResponseInterface; |
| 12 | - |
|
| 13 | 12 | use Slince\SmartQQ\Entity\Discuss; |
| 14 | 13 | use Slince\SmartQQ\Entity\DiscussDetail; |
| 15 | 14 | use Slince\SmartQQ\Entity\Friend; |
@@ -41,7 +40,6 @@ discard block |
||
| 41 | 40 | use Slince\SmartQQ\Request\SendGroupMessageRequest; |
| 42 | 41 | use Slince\SmartQQ\Request\SendMessageRequest; |
| 43 | 42 | use Slince\SmartQQ\Request\VerifyQrCodeRequest; |
| 44 | - |
|
| 45 | 43 | use Slince\SmartQQ\Message\Request\Message as RequestMessage; |
| 46 | 44 | use Slince\SmartQQ\Message\Response\Message as ResponseMessage; |
| 47 | 45 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * 设置请求参数 |
| 105 | - * @param $name |
|
| 106 | - * @param $parameter |
|
| 105 | + * @param string $name |
|
| 106 | + * @param string $parameter |
|
| 107 | 107 | */ |
| 108 | 108 | public function setParameter($name, $parameter) |
| 109 | 109 | { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * 设置链接中的指定占位符 |
| 133 | - * @param $name |
|
| 133 | + * @param string $name |
|
| 134 | 134 | * @param $token |
| 135 | 135 | */ |
| 136 | 136 | public function setToken($name, $token) |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | */ |
| 146 | 146 | protected function processUri($uri) |
| 147 | 147 | { |
| 148 | - return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function ($matches) { |
|
| 148 | + return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function($matches) { |
|
| 149 | 149 | return isset($this->tokens[$matches[1]]) ? $this->tokens[$matches[1]] : ''; |
| 150 | 150 | }, $uri); |
| 151 | 151 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $discussMember = $smartQQ->getDiscussDetail($discuss) |
| 47 | 47 | ->getMembers() |
| 48 | 48 | ->firstByAttribute('nick', '张三'); |
| 49 | -$message = new FriendMessage($discussMember, '你好'); |
|
| 49 | +$message = new FriendMessage($discussMember, '你好'); |
|
| 50 | 50 | $result = $smartQQ->sendMessage($message); |
| 51 | 51 | printR($result ? 'Send Success' : 'Send Error'); |
| 52 | 52 | |
@@ -42,19 +42,19 @@ |
||
| 42 | 42 | //有时候获取好友接口retcode=100003时也可以获取数据,但数据不完整故当做无效返回 |
| 43 | 43 | if ($jsonData && $jsonData['retcode'] == 0) { |
| 44 | 44 | //好友基本信息 |
| 45 | - $friendDatas = (new Collection($jsonData['result']['friends']))->combine('uin', function ($entity) { |
|
| 45 | + $friendDatas = (new Collection($jsonData['result']['friends']))->combine('uin', function($entity) { |
|
| 46 | 46 | return $entity; |
| 47 | 47 | })->toArray(); |
| 48 | 48 | //markNames |
| 49 | - $markNames = (new Collection($jsonData['result']['marknames']))->combine('uin', function ($entity) { |
|
| 49 | + $markNames = (new Collection($jsonData['result']['marknames']))->combine('uin', function($entity) { |
|
| 50 | 50 | return $entity; |
| 51 | 51 | })->toArray(); |
| 52 | 52 | //分类 |
| 53 | - $categories = (new Collection($jsonData['result']['categories']))->combine('index', function ($entity) { |
|
| 53 | + $categories = (new Collection($jsonData['result']['categories']))->combine('index', function($entity) { |
|
| 54 | 54 | return $entity; |
| 55 | 55 | })->toArray(); |
| 56 | 56 | //vip信息 |
| 57 | - $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function ($entity) { |
|
| 57 | + $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function($entity) { |
|
| 58 | 58 | return $entity; |
| 59 | 59 | })->toArray(); |
| 60 | 60 | $friends = []; |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | class SendGroupMessageRequest extends SendMessageRequest |
| 12 | 12 | { |
| 13 | - protected $uri = 'http://d1.web2.qq.com/channel/send_qun_msg2'; |
|
| 13 | + protected $uri = 'http://d1.web2.qq.com/channel/send_qun_msg2'; |
|
| 14 | 14 | |
| 15 | 15 | protected $referer = 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2'; |
| 16 | 16 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $jsonData = \GuzzleHttp\json_decode($response->getBody(), true); |
| 41 | 41 | if ($jsonData && $jsonData['retcode'] == 0) { |
| 42 | 42 | //成员在线状态 |
| 43 | - $statuses = (new Collection($jsonData['result']['mem_status']))->combine('uin', function ($entity) { |
|
| 43 | + $statuses = (new Collection($jsonData['result']['mem_status']))->combine('uin', function($entity) { |
|
| 44 | 44 | return $entity; |
| 45 | 45 | })->toArray(); |
| 46 | 46 | //成员基本信息 |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $jsonData = \GuzzleHttp\json_decode($response->getBody(), true); |
| 41 | 41 | if ($jsonData && $jsonData['retcode'] == 0) { |
| 42 | 42 | //群成员的vip信息 |
| 43 | - $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function ($entity) { |
|
| 43 | + $vipInfos = (new Collection($jsonData['result']['vipinfo']))->combine('u', function($entity) { |
|
| 44 | 44 | return $entity; |
| 45 | 45 | })->toArray(); |
| 46 | 46 | //群成员的名片信息 |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $members = []; |
| 65 | 65 | foreach ($jsonData['result']['minfo'] as $memberData) { |
| 66 | 66 | $uin = $memberData['uin']; |
| 67 | - $member = EntityFactory::createEntity(GroupMember::class, [ |
|
| 67 | + $member = EntityFactory::createEntity(GroupMember::class, [ |
|
| 68 | 68 | 'flag' => isset($flags[$uin]) ? $flags[$uin] : null, |
| 69 | 69 | 'nick' => $memberData['nick'], |
| 70 | 70 | 'province' => $memberData['province'], |