Application.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace EasyWeChat\Work;
  11. use EasyWeChat\Kernel\ServiceContainer;
  12. use EasyWeChat\Work\MiniProgram\Application as MiniProgram;
  13. /**
  14. * Application.
  15. *
  16. * @author mingyoung <mingyoungcheung@gmail.com>
  17. *
  18. * @property \EasyWeChat\Work\OA\Client $oa
  19. * @property \EasyWeChat\Work\Auth\AccessToken $access_token
  20. * @property \EasyWeChat\Work\Agent\Client $agent
  21. * @property \EasyWeChat\Work\Department\Client $department
  22. * @property \EasyWeChat\Work\Media\Client $media
  23. * @property \EasyWeChat\Work\Menu\Client $menu
  24. * @property \EasyWeChat\Work\Message\Client $message
  25. * @property \EasyWeChat\Work\Message\Messenger $messenger
  26. * @property \EasyWeChat\Work\User\Client $user
  27. * @property \EasyWeChat\Work\User\TagClient $tag
  28. * @property \EasyWeChat\Work\Server\Guard $server
  29. * @property \EasyWeChat\Work\Jssdk\Client $jssdk
  30. * @property \Overtrue\Socialite\Providers\WeWorkProvider $oauth
  31. * @property \EasyWeChat\Work\Invoice\Client $invoice
  32. * @property \EasyWeChat\Work\Chat\Client $chat
  33. * @property \EasyWeChat\Work\ExternalContact\Client $external_contact
  34. * @property \EasyWeChat\Work\ExternalContact\ContactWayClient $contact_way
  35. * @property \EasyWeChat\Work\ExternalContact\StatisticsClient $external_contact_statistics
  36. * @property \EasyWeChat\Work\ExternalContact\MessageClient $external_contact_message
  37. * @property \EasyWeChat\Work\GroupRobot\Client $group_robot
  38. * @property \EasyWeChat\Work\GroupRobot\Messenger $group_robot_messenger
  39. * @property \EasyWeChat\Work\Calendar\Client $calendar
  40. * @property \EasyWeChat\Work\Schedule\Client $schedule
  41. * @property \EasyWeChat\Work\MsgAudit\Client $msg_audit
  42. * @property \EasyWeChat\Work\ExternalContact\SchoolClient $school
  43. *
  44. * @method mixed getCallbackIp()
  45. */
  46. class Application extends ServiceContainer
  47. {
  48. /**
  49. * @var array
  50. */
  51. protected $providers = [
  52. OA\ServiceProvider::class,
  53. Auth\ServiceProvider::class,
  54. Base\ServiceProvider::class,
  55. Menu\ServiceProvider::class,
  56. OAuth\ServiceProvider::class,
  57. User\ServiceProvider::class,
  58. Agent\ServiceProvider::class,
  59. Media\ServiceProvider::class,
  60. Message\ServiceProvider::class,
  61. Department\ServiceProvider::class,
  62. Server\ServiceProvider::class,
  63. Jssdk\ServiceProvider::class,
  64. Invoice\ServiceProvider::class,
  65. Chat\ServiceProvider::class,
  66. ExternalContact\ServiceProvider::class,
  67. GroupRobot\ServiceProvider::class,
  68. Calendar\ServiceProvider::class,
  69. Schedule\ServiceProvider::class,
  70. MsgAudit\ServiceProvider::class,
  71. ];
  72. /**
  73. * @var array
  74. */
  75. protected $defaultConfig = [
  76. // http://docs.guzzlephp.org/en/stable/request-options.html
  77. 'http' => [
  78. 'base_uri' => 'https://qyapi.weixin.qq.com/',
  79. ],
  80. ];
  81. /**
  82. * Creates the miniProgram application.
  83. */
  84. public function miniProgram(): MiniProgram
  85. {
  86. return new MiniProgram($this->getConfig());
  87. }
  88. /**
  89. * @param string $method
  90. * @param array $arguments
  91. *
  92. * @return mixed
  93. */
  94. public function __call($method, $arguments)
  95. {
  96. return $this['base']->$method(...$arguments);
  97. }
  98. }