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\Work; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\ServiceContainer; |
15
|
|
|
use EasyWeChat\Work\MiniProgram\Application as MiniProgram; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Application. |
19
|
|
|
* |
20
|
|
|
* @author mingyoung <[email protected]> |
21
|
|
|
* |
22
|
|
|
* @property \EasyWeChat\Work\OA\Client $oa |
23
|
|
|
* @property \EasyWeChat\Work\Auth\AccessToken $access_token |
24
|
|
|
* @property \EasyWeChat\Work\Agent\Client $agent |
25
|
|
|
* @property \EasyWeChat\Work\Department\Client $department |
26
|
|
|
* @property \EasyWeChat\Work\Media\Client $media |
27
|
|
|
* @property \EasyWeChat\Work\Menu\Client $menu |
28
|
|
|
* @property \EasyWeChat\Work\Message\Client $message |
29
|
|
|
* @property \EasyWeChat\Work\Message\Messenger $messenger |
30
|
|
|
* @property \EasyWeChat\Work\User\Client $user |
31
|
|
|
* @property \EasyWeChat\Work\User\TagClient $tag |
32
|
|
|
* @property \EasyWeChat\Work\Server\ServiceProvider $server |
33
|
|
|
* @property \EasyWeChat\BasicService\Jssdk\Client $jssdk |
34
|
|
|
* @property \Overtrue\Socialite\Providers\WeWorkProvider $oauth |
35
|
|
|
* @property \EasyWeChat\Work\Invoice\Client $invoice |
36
|
|
|
* |
37
|
|
|
* @method mixed getCallbackIp() |
38
|
|
|
*/ |
39
|
|
|
class Application extends ServiceContainer |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $providers = [ |
45
|
|
|
OA\ServiceProvider::class, |
46
|
|
|
Auth\ServiceProvider::class, |
47
|
|
|
Base\ServiceProvider::class, |
48
|
|
|
Menu\ServiceProvider::class, |
49
|
|
|
OAuth\ServiceProvider::class, |
50
|
|
|
User\ServiceProvider::class, |
51
|
|
|
Agent\ServiceProvider::class, |
52
|
|
|
Media\ServiceProvider::class, |
53
|
|
|
Message\ServiceProvider::class, |
54
|
|
|
Department\ServiceProvider::class, |
55
|
|
|
Server\ServiceProvider::class, |
56
|
|
|
Jssdk\ServiceProvider::class, |
57
|
|
|
Invoice\ServiceProvider::class, |
58
|
|
|
]; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var array |
62
|
|
|
*/ |
63
|
|
|
protected $defaultConfig = [ |
64
|
|
|
// http://docs.guzzlephp.org/en/stable/request-options.html |
65
|
|
|
'http' => [ |
66
|
|
|
'base_uri' => 'https://qyapi.weixin.qq.com/', |
67
|
|
|
], |
68
|
|
|
]; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Creates the miniProgram application. |
72
|
|
|
* |
73
|
|
|
* @return \EasyWeChat\Work\MiniProgram\Application |
74
|
|
|
*/ |
75
|
|
|
public function miniProgram(): MiniProgram |
76
|
|
|
{ |
77
|
|
|
return new MiniProgram($this->getConfig()); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param string $method |
82
|
|
|
* @param array $arguments |
83
|
|
|
* |
84
|
|
|
* @return mixed |
85
|
|
|
*/ |
86
|
|
|
public function __call($method, $arguments) |
87
|
|
|
{ |
88
|
|
|
return $this['base']->$method(...$arguments); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|