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\OpenWork; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\ServiceContainer; |
15
|
|
|
use EasyWeChat\OpenWork\Work\Application as Work; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Application. |
19
|
|
|
* |
20
|
|
|
* @author xiaomin <[email protected]> |
21
|
|
|
* |
22
|
|
|
* @property \EasyWeChat\OpenWork\Server\Guard $server |
23
|
|
|
* @property \EasyWeChat\OpenWork\Corp\Client $corp |
24
|
|
|
* @property \EasyWeChat\OpenWork\Provider\Client $provider |
25
|
|
|
*/ |
26
|
|
|
class Application extends ServiceContainer |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var array |
30
|
|
|
*/ |
31
|
|
|
protected $providers = [ |
32
|
|
|
Auth\ServiceProvider::class, |
33
|
|
|
SuiteAuth\ServiceProvider::class, |
34
|
|
|
Server\ServiceProvider::class, |
35
|
|
|
Corp\ServiceProvider::class, |
36
|
|
|
Provider\ServiceProvider::class, |
37
|
|
|
]; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $defaultConfig = [ |
43
|
|
|
// http://docs.guzzlephp.org/en/stable/request-options.html |
44
|
|
|
'http' => [ |
45
|
|
|
'base_uri' => 'https://qyapi.weixin.qq.com/', |
46
|
|
|
], |
47
|
|
|
]; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $authCorpId 企业 corp_id |
51
|
|
|
* @param string $permanentCode 企业永久授权码 |
52
|
|
|
* |
53
|
|
|
* @return Work |
54
|
|
|
*/ |
55
|
1 |
|
public function work(string $authCorpId, string $permanentCode): Work |
56
|
|
|
{ |
57
|
1 |
|
return new Work($authCorpId, $permanentCode, $this); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $method |
62
|
|
|
* @param array $arguments |
63
|
|
|
* |
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
1 |
|
public function __call($method, $arguments) |
67
|
|
|
{ |
68
|
1 |
|
return $this['base']->$method(...$arguments); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|