Application.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Libs\TikTok\MiniProgram;
  3. use App\Libs\TikTok\Kernel\ServiceContainer;
  4. use App\Libs\TikTok\Kernel\Traits\ResponseCastable;
  5. use App\Libs\TikTok\MiniProgram\Pay\Server as PayServer;
  6. /**
  7. * Class Application.
  8. * @property Base\Client $base
  9. * @property Auth\AccessToken $access_token
  10. * @property Auth\Client $auth
  11. * @property QrCode\Client $qr_code
  12. * @property Server\Encryptor $encryptor
  13. * @property Pay\Client $pay
  14. * @property PayServer $pay_server
  15. * @property Order\Client $order
  16. * @property Share\Client $share
  17. * @property Capacity\Client $capacity
  18. * @author zhaoxiang <zhaoxiang051405@gmail.com>
  19. */
  20. class Application extends ServiceContainer {
  21. use ResponseCastable;
  22. /**
  23. * @var array
  24. */
  25. protected $providers = [
  26. Base\ServiceProvider::class,
  27. Auth\ServiceProvider::class,
  28. QrCode\ServiceProvider::class,
  29. Server\ServiceProvider::class,
  30. Pay\ServiceProvider::class,
  31. Order\ServiceProvider::class,
  32. Share\ServiceProvider::class,
  33. Capacity\ServiceProvider::class,
  34. ];
  35. /**
  36. * 初始化小程序的基础接口
  37. * @var array|\string[][]
  38. */
  39. protected $defaultConfig = [
  40. 'http' => [
  41. 'base_uri' => 'https://developer.toutiao.com/api/',
  42. ],
  43. ];
  44. /**
  45. * Handle dynamic calls.
  46. *
  47. * @param string $method
  48. * @param array $args
  49. *
  50. * @return mixed
  51. */
  52. public function __call(string $method, array $args) {
  53. return $this->base->$method(...$args);
  54. }
  55. }