Poi.php 3.3 KB

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