Application.php
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\OpenWork;
use EasyWeChat\Kernel\ServiceContainer;
use EasyWeChat\OpenWork\Work\Application as Work;
/**
* Application.
*
* @author xiaomin <keacefull@gmail.com>
*
* @property \EasyWeChat\OpenWork\Server\Guard $server
* @property \EasyWeChat\OpenWork\Corp\Client $corp
* @property \EasyWeChat\OpenWork\Provider\Client $provider
* @property \EasyWeChat\OpenWork\SuiteAuth\AccessToken $suite_access_token
* @property \EasyWeChat\OpenWork\Auth\AccessToken $provider_access_token
* @property \EasyWeChat\OpenWork\SuiteAuth\SuiteTicket $suite_ticket
* @property \EasyWeChat\OpenWork\MiniProgram\Auth\Client $mini_program
*/
class Application extends ServiceContainer
{
/**
* @var array
*/
protected $providers = [
Auth\ServiceProvider::class,
SuiteAuth\ServiceProvider::class,
Server\ServiceProvider::class,
Corp\ServiceProvider::class,
Provider\ServiceProvider::class,
MiniProgram\ServiceProvider::class,
];
/**
* @var array
*/
protected $defaultConfig = [
// http://docs.guzzlephp.org/en/stable/request-options.html
'http' => [
'base_uri' => 'https://qyapi.weixin.qq.com/',
],
];
/**
* Creates the miniProgram application.
*/
public function miniProgram(): \EasyWeChat\Work\MiniProgram\Application
{
return new \EasyWeChat\Work\MiniProgram\Application($this->getConfig());
}
/**
* @param string $authCorpId 企业 corp_id
* @param string $permanentCode 企业永久授权码
*/
public function work(string $authCorpId, string $permanentCode): Work
{
return new Work($authCorpId, $permanentCode, $this);
}
/**
* @param string $method
* @param array $arguments
*
* @return mixed
*/
public function __call($method, $arguments)
{
return $this['base']->$method(...$arguments);
}
}