API.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /**
  11. * Fundamental API.
  12. *
  13. * @author mingyoung <mingyoungcheung@gmail.com>
  14. * @copyright 2017
  15. *
  16. * @see https://github.com/overtrue
  17. * @see http://overtrue.me
  18. */
  19. namespace EasyWeChat\Fundamental;
  20. use EasyWeChat\Core\AbstractAPI;
  21. class API extends AbstractAPI
  22. {
  23. const API_CLEAR_QUOTA = 'https://api.weixin.qq.com/cgi-bin/clear_quota';
  24. const API_CALLBACK_IP = 'https://api.weixin.qq.com/cgi-bin/getcallbackip';
  25. /**
  26. * Clear quota.
  27. *
  28. * @return \EasyWeChat\Support\Collection
  29. */
  30. public function clearQuota()
  31. {
  32. $appid = $this->getAccessToken()->getAppId();
  33. return $this->parseJSON('json', [self::API_CLEAR_QUOTA, compact('appid')]);
  34. }
  35. /**
  36. * Get wechat callback ip.
  37. *
  38. * @return \EasyWeChat\Support\Collection
  39. */
  40. public function getCallbackIp()
  41. {
  42. return $this->parseJSON('get', [self::API_CALLBACK_IP]);
  43. }
  44. }