1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the overtrue/wechat. |
5
|
|
|
* |
6
|
|
|
* (c) overtrue <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace EasyWeChat\MiniProgram\Express; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Client. |
18
|
|
|
* |
19
|
|
|
* @author kehuanhuan <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class Client extends BaseClient |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
25
|
|
|
* |
26
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
27
|
|
|
*/ |
28
|
1 |
|
public function listProviders() |
29
|
|
|
{ |
30
|
1 |
|
return $this->httpGet('cgi-bin/express/business/delivery/getall'); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
35
|
|
|
* |
36
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
37
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
38
|
|
|
*/ |
39
|
|
|
public function getBindAccounts() |
40
|
|
|
{ |
41
|
1 |
|
return $this->httpGet('cgi-bin/express/business/account/getall'); |
42
|
|
|
} |
43
|
1 |
|
|
44
|
|
|
/** |
45
|
|
|
* @param array $params |
46
|
|
|
* |
47
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
48
|
|
|
* |
49
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
50
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
51
|
|
|
*/ |
52
|
|
|
public function createWaybill(array $params = []) |
53
|
|
|
{ |
54
|
1 |
|
return $this->httpPostJson('cgi-bin/express/business/order/add', $params); |
55
|
|
|
} |
56
|
1 |
|
|
57
|
|
|
/** |
58
|
|
|
* @param array $params |
59
|
|
|
* |
60
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
61
|
|
|
* |
62
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
63
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
64
|
|
|
*/ |
65
|
|
|
public function deleteWaybill(array $params = []) |
66
|
|
|
{ |
67
|
1 |
|
return $this->httpPostJson('cgi-bin/express/business/order/cancel', $params); |
68
|
|
|
} |
69
|
1 |
|
|
70
|
|
|
/** |
71
|
|
|
* @param array $params |
72
|
|
|
* |
73
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
74
|
|
|
* |
75
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
76
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
77
|
|
|
*/ |
78
|
|
|
public function getWaybill(array $params = []) |
79
|
|
|
{ |
80
|
1 |
|
return $this->httpPostJson('cgi-bin/express/business/order/get', $params); |
81
|
|
|
} |
82
|
1 |
|
|
83
|
|
|
/** |
84
|
|
|
* @param array $params |
85
|
|
|
* |
86
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
87
|
|
|
* |
88
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
89
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
90
|
|
|
*/ |
91
|
|
|
public function getWaybillTrack(array $params = []) |
92
|
|
|
{ |
93
|
|
|
return $this->httpPostJson('cgi-bin/express/business/path/get', $params); |
94
|
1 |
|
} |
95
|
|
|
|
96
|
1 |
|
/** |
97
|
1 |
|
* @param string $deliveryId |
98
|
1 |
|
* @param string $bizId |
99
|
|
|
* |
100
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
101
|
|
|
* |
102
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
103
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
104
|
|
|
*/ |
105
|
|
|
public function getBalance(string $deliveryId, string $bizId) |
106
|
|
|
{ |
107
|
|
|
return $this->httpPostJson('cgi-bin/express/business/quota/get', [ |
108
|
|
|
'delivery_id' => $deliveryId, |
109
|
|
|
'biz_id' => $bizId, |
110
|
1 |
|
]); |
111
|
|
|
} |
112
|
1 |
|
|
113
|
1 |
|
/** |
114
|
1 |
|
* @param string $openid |
115
|
|
|
* |
116
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
117
|
|
|
* |
118
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
119
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
120
|
|
|
*/ |
121
|
|
|
public function bindPrinter(string $openid) |
122
|
|
|
{ |
123
|
|
|
return $this->httpPostJson('cgi-bin/express/business/printer/update', [ |
124
|
|
|
'update_type' => 'bind', |
125
|
|
|
'openid' => $openid, |
126
|
1 |
|
]); |
127
|
|
|
} |
128
|
1 |
|
|
129
|
1 |
|
/** |
130
|
1 |
|
* @param string $openid |
131
|
|
|
* |
132
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
133
|
|
|
* |
134
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
135
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
136
|
|
|
*/ |
137
|
|
|
public function unbindPrinter(string $openid) |
138
|
|
|
{ |
139
|
|
|
return $this->httpPostJson('cgi-bin/express/business/printer/update', [ |
140
|
|
|
'update_type' => 'unbind', |
141
|
|
|
'openid' => $openid, |
142
|
|
|
]); |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|