Skip to content

Commit eea7e82

Browse files
committed
更新命名空间,查询结果首行添加快递公司信息
1 parent 4a5156c commit eea7e82

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ $ composer require 96qbhy/vbot-express:dev-master
2121

2222

2323
## 使用示例
24-
![使用示例](https://raw.githubusercontent.com/96qbhy/vbot-express/master/example.png)
24+
![使用示例](http://resources.96qbhy.com/Y5019_9i33DsrrKzkK8s)
2525

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "96qbhy/vbot-express",
33
"description": "简单的快递查询接口。",
44
"license": "MIT",
5+
"version": "1.0.0",
56
"authors": [
67
{
78
"name": "96qbhy",
@@ -16,7 +17,7 @@
1617
},
1718
"autoload": {
1819
"psr-4": {
19-
"Qbhy\\VbotExpress\\": "src/"
20+
"Vbot\\Express\\": "src/"
2021
}
2122
}
2223
}

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
require 'vendor/autoload.php';
4+
5+
print_r(\Qbhy\Express\Express::query('885744925321174309'));

example.png

-51.5 KB
Binary file not shown.

src/VbotExpress.php renamed to src/Express.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22

3-
namespace Qbhy\VbotExpress;
3+
namespace Vbot\Express;
44

5-
use GuzzleHttp\Client;
65
use Hanson\Vbot\Extension\AbstractMessageHandler;
76
use Hanson\Vbot\Message\Text;
87
use Illuminate\Support\Collection;
9-
use Qbhy\Express\Express;
8+
use Qbhy\Express\Express as QbhyExpress;
109

11-
class VbotExpress extends AbstractMessageHandler
10+
class Express extends AbstractMessageHandler
1211
{
1312

1413
public $author = '96qbhy';
@@ -29,11 +28,11 @@ public function handler(Collection $message)
2928
if ($message['type'] === 'text' and strpos($message['content'], '查快递 ') === 0 and strlen($message['content']) > 4) {
3029
$postId = str_replace('查快递 ', '', $message['content']);
3130
$username = $message['from']['UserName'];
32-
$result = Express::query($postId);
31+
$result = QbhyExpress::query($postId);
3332
if (is_string($result)) {
3433
return Text::send($username, $result);
3534
} else if ($result['status'] === 6) {
36-
$str = '';
35+
$str = "快递单号: $postId, 快递公司: $result[company]" . PHP_EOL;
3736
foreach ($result['data'] as $item) {
3837
$str .= '| ' . $item['context'] . ' - ' . $item['time'] . PHP_EOL;
3938
}

0 commit comments

Comments
 (0)