Client.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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\MiniProgram\Base;
  11. use EasyWeChat\Kernel\BaseClient;
  12. /**
  13. * Class Client.
  14. *
  15. * @author mingyoung <mingyoungcheung@gmail.com>
  16. */
  17. class Client extends BaseClient
  18. {
  19. /**
  20. * Get paid unionid.
  21. *
  22. * @param string $openid
  23. * @param array $options
  24. *
  25. * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
  26. *
  27. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  28. * @throws \GuzzleHttp\Exception\GuzzleException
  29. */
  30. public function getPaidUnionid($openid, $options = [])
  31. {
  32. return $this->httpGet('wxa/getpaidunionid', compact('openid') + $options);
  33. }
  34. /**
  35. * Get user phone number by code
  36. *
  37. * @param string $code
  38. *
  39. * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
  40. *
  41. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  42. * @throws \GuzzleHttp\Exception\GuzzleException
  43. */
  44. public function getPhoneNumber($code)
  45. {
  46. return $this->httpPostJson('wxa/business/getuserphonenumber', ['code' => $code]);
  47. }
  48. }