Poi.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. namespace WeMini;
  16. use WeChat\Contracts\BasicWeChat;
  17. /**
  18. * 微信小程序地址管理
  19. * Class Poi
  20. * @package WeMini
  21. */
  22. class Poi extends BasicWeChat
  23. {
  24. /**
  25. * 添加地点
  26. * @param string $related_name 经营资质主体
  27. * @param string $related_credential 经营资质证件号
  28. * @param string $related_address 经营资质地址
  29. * @param string $related_proof_material 相关证明材料照片临时素材mediaid
  30. * @return array
  31. * @throws \WeChat\Exceptions\InvalidResponseException
  32. * @throws \WeChat\Exceptions\LocalCacheException
  33. */
  34. public function addBearByPoi($related_name, $related_credential, $related_address, $related_proof_material)
  35. {
  36. $url = 'https://api.weixin.qq.com/wxa/addnearbypoi?access_token=ACCESS_TOKEN';
  37. $data = [
  38. 'related_name' => $related_name, 'related_credential' => $related_credential,
  39. 'related_address' => $related_address, 'related_proof_material' => $related_proof_material,
  40. ];
  41. return $this->callPostApi($url, $data, true);
  42. }
  43. /**
  44. * 查看地点列表
  45. * @param integer $page 起始页id(从1开始计数)
  46. * @param integer $page_rows 每页展示个数(最多1000个)
  47. * @return array
  48. * @throws \WeChat\Exceptions\InvalidResponseException
  49. * @throws \WeChat\Exceptions\LocalCacheException
  50. */
  51. public function getNearByPoiList($page = 1, $page_rows = 1000)
  52. {
  53. $url = "https://api.weixin.qq.com/wxa/getnearbypoilist?page={$page}&page_rows={$page_rows}&access_token=ACCESS_TOKEN";
  54. return $this->callGetApi($url);
  55. }
  56. /**
  57. * 删除地点
  58. * @param string $poi_id 附近地点ID
  59. * @return array
  60. * @throws \WeChat\Exceptions\InvalidResponseException
  61. * @throws \WeChat\Exceptions\LocalCacheException
  62. */
  63. public function delNearByPoiList($poi_id)
  64. {
  65. $url = "https://api.weixin.qq.com/wxa/delnearbypoi?access_token=ACCESS_TOKEN";
  66. return $this->callPostApi($url, ['poi_id' => $poi_id], true);
  67. }
  68. /**
  69. * 展示/取消展示附近小程序
  70. * @param string $poi_id 附近地点ID
  71. * @param string $status 0:取消展示;1:展示
  72. * @return array
  73. * @throws \WeChat\Exceptions\InvalidResponseException
  74. * @throws \WeChat\Exceptions\LocalCacheException
  75. */
  76. public function setNearByPoiShowStatus($poi_id, $status)
  77. {
  78. $url = "https://api.weixin.qq.com/wxa/setnearbypoishowstatus?access_token=ACCESS_TOKEN";
  79. return $this->callPostApi($url, ['poi_id' => $poi_id, 'status' => $status], true);
  80. }
  81. }