国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

476 line
17KB

  1. <?php
  2. namespace WeMini;
  3. if (!defined('DEDEINC')) exit ('dedebiz');
  4. use WeChat\Contracts\BasicWeChat;
  5. /**
  6. * 小程序导购助手
  7. * Class Guide
  8. * @package WeMini
  9. */
  10. class Guide extends BasicWeChat
  11. {
  12. /**
  13. * 服务号添加导购
  14. * @param array $data
  15. * @return array
  16. * @throws \WeChat\Exceptions\InvalidResponseException
  17. * @throws \WeChat\Exceptions\LocalCacheException
  18. */
  19. public function addGuideAcct($data)
  20. {
  21. $url = 'https://api.weixin.qq.com/cgi-bin/guide/addguideacct?access_token=ACCESS_TOKEN';
  22. return $this->callPostApi($url, $data, true);
  23. }
  24. /**
  25. * 服务号删除导购
  26. * @param array $data
  27. * @return array
  28. * @throws \WeChat\Exceptions\InvalidResponseException
  29. * @throws \WeChat\Exceptions\LocalCacheException
  30. */
  31. public function delGuideAcct($data)
  32. {
  33. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguideacct?access_token=ACCESS_TOKEN';
  34. return $this->callPostApi($url, $data, true);
  35. }
  36. /**
  37. * 服务号获取导购信息
  38. * @param array $data
  39. * @return array
  40. * @throws \WeChat\Exceptions\InvalidResponseException
  41. * @throws \WeChat\Exceptions\LocalCacheException
  42. */
  43. public function getGuideAcct($data)
  44. {
  45. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
  46. return $this->callPostApi($url, $data, true);
  47. }
  48. /**
  49. * 获取服务号的敏感词信息与自动回复信息
  50. * @return array
  51. * @throws \WeChat\Exceptions\InvalidResponseException
  52. * @throws \WeChat\Exceptions\LocalCacheException
  53. */
  54. public function getGuideAcctConfig()
  55. {
  56. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
  57. return $this->callPostApi($url, [], true);
  58. }
  59. /**
  60. * 服务号拉取导购列表
  61. * @param integer $page
  62. * @param integer $num
  63. * @return array
  64. * @throws \WeChat\Exceptions\InvalidResponseException
  65. * @throws \WeChat\Exceptions\LocalCacheException
  66. */
  67. public function getGuideAcctList($page = 0, $num = 10)
  68. {
  69. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
  70. return $this->callPostApi($url, ['page' => $page, 'num' => $num], true);
  71. }
  72. /**
  73. * 获取导购聊天记录
  74. * @param array $data
  75. * @return array
  76. * @throws \WeChat\Exceptions\InvalidResponseException
  77. * @throws \WeChat\Exceptions\LocalCacheException
  78. */
  79. public function getGuideBuyerChatRecord($data)
  80. {
  81. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
  82. return $this->callPostApi($url, $data, true);
  83. }
  84. /**
  85. * 获取导购快捷回复信息
  86. * @param array $data
  87. * @return array
  88. * @throws \WeChat\Exceptions\InvalidResponseException
  89. * @throws \WeChat\Exceptions\LocalCacheException
  90. */
  91. public function getGuideConfig($data)
  92. {
  93. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideconfig?access_token=ACCESS_TOKEN';
  94. return $this->callPostApi($url, $data, true);
  95. }
  96. /**
  97. * 生成导购二维码
  98. * @param array $data
  99. * @return array
  100. * @throws \WeChat\Exceptions\InvalidResponseException
  101. * @throws \WeChat\Exceptions\LocalCacheException
  102. */
  103. public function guideCreateQrCode($data)
  104. {
  105. $url = 'https://api.weixin.qq.com/cgi-bin/guide/guidecreateqrcode?access_token=ACCESS_TOKEN';
  106. return $this->callPostApi($url, $data, true);
  107. }
  108. /**
  109. * @param array $data
  110. * @return array
  111. * @throws \WeChat\Exceptions\InvalidResponseException
  112. * @throws \WeChat\Exceptions\LocalCacheException
  113. */
  114. public function pushShowWxaPathMenu($data)
  115. {
  116. $url = 'https://api.weixin.qq.com/cgi-bin/guide/pushshowwxapathmenu?access_token=ACCESS_TOKEN';
  117. return $this->callPostApi($url, $data, true);
  118. }
  119. /**
  120. * 为服务号设置敏感词与自动回复
  121. * @param array $data
  122. * @return array
  123. * @throws \WeChat\Exceptions\InvalidResponseException
  124. * @throws \WeChat\Exceptions\LocalCacheException
  125. */
  126. public function setGuideAcctConfig($data)
  127. {
  128. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideacctconfig?access_token=ACCESS_TOKEN';
  129. return $this->callPostApi($url, $data, true);
  130. }
  131. /**
  132. * 设置导购快捷回复信息
  133. * @param array $data
  134. * @return array
  135. * @throws \WeChat\Exceptions\InvalidResponseException
  136. * @throws \WeChat\Exceptions\LocalCacheException
  137. */
  138. public function setGuideConfig($data)
  139. {
  140. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
  141. return $this->callPostApi($url, $data, true);
  142. }
  143. /**
  144. * 更新导购昵称或者头像
  145. * @param array $data
  146. * @return array
  147. * @throws \WeChat\Exceptions\InvalidResponseException
  148. * @throws \WeChat\Exceptions\LocalCacheException
  149. */
  150. public function updateGuideAcct($data)
  151. {
  152. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
  153. return $this->callPostApi($url, $data, true);
  154. }
  155. /**
  156. * 添加展示标签信息
  157. * @param array $data
  158. * @return array
  159. * @throws \WeChat\Exceptions\InvalidResponseException
  160. * @throws \WeChat\Exceptions\LocalCacheException
  161. */
  162. public function addGuideBuyerDisplayTag($data)
  163. {
  164. $url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
  165. return $this->callPostApi($url, $data, true);
  166. }
  167. /**
  168. * 为粉丝添加可查询标签
  169. * @param array $data
  170. * @return array
  171. * @throws \WeChat\Exceptions\InvalidResponseException
  172. * @throws \WeChat\Exceptions\LocalCacheException
  173. */
  174. public function addGuideBuyerTag($data)
  175. {
  176. $url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyertag?access_token=ACCESS_TOKEN';
  177. return $this->callPostApi($url, $data, true);
  178. }
  179. /**
  180. * 添加标签可选值
  181. * @param array $data
  182. * @return array
  183. * @throws \WeChat\Exceptions\InvalidResponseException
  184. * @throws \WeChat\Exceptions\LocalCacheException
  185. */
  186. public function addGuideTagOption($data)
  187. {
  188. $url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidetagoption?access_token=ACCESS_TOKEN';
  189. return $this->callPostApi($url, $data, true);
  190. }
  191. /**
  192. * 删除粉丝标签
  193. * @param array $data
  194. * @return array
  195. * @throws \WeChat\Exceptions\InvalidResponseException
  196. * @throws \WeChat\Exceptions\LocalCacheException
  197. */
  198. public function delGuideBuyerTag($data)
  199. {
  200. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidebuyertag?access_token=ACCESS_TOKEN';
  201. return $this->callPostApi($url, $data, true);
  202. }
  203. /**
  204. * 查询展示标签信息
  205. * @param array $data
  206. * @return array
  207. * @throws \WeChat\Exceptions\InvalidResponseException
  208. * @throws \WeChat\Exceptions\LocalCacheException
  209. */
  210. public function getGuideBuyerDisplayTag($data)
  211. {
  212. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
  213. return $this->callPostApi($url, $data, true);
  214. }
  215. /**
  216. * 查询粉丝标签
  217. * @param array $data
  218. * @return array
  219. * @throws \WeChat\Exceptions\InvalidResponseException
  220. * @throws \WeChat\Exceptions\LocalCacheException
  221. */
  222. public function getGuideBuyerTag($data)
  223. {
  224. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyertag?access_token=ACCESS_TOKEN';
  225. return $this->callPostApi($url, $data, true);
  226. }
  227. /**
  228. * 查询标签可选值信息
  229. * @return array
  230. * @throws \WeChat\Exceptions\InvalidResponseException
  231. * @throws \WeChat\Exceptions\LocalCacheException
  232. */
  233. public function getGuideTagOption()
  234. {
  235. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidetagoption?access_token=ACCESS_TOKEN';
  236. return $this->callPostApi($url, [], true);
  237. }
  238. /**
  239. * 新建可查询标签类型,支持新建4类可查询标签
  240. * @param array $data
  241. * @return array
  242. * @throws \WeChat\Exceptions\InvalidResponseException
  243. * @throws \WeChat\Exceptions\LocalCacheException
  244. */
  245. public function newGuideTagOption($data)
  246. {
  247. $url = 'https://api.weixin.qq.com/cgi-bin/guide/newguidetagoption?access_token=ACCESS_TOKEN';
  248. return $this->callPostApi($url, $data, true);
  249. }
  250. /**
  251. * 根据标签值筛选粉丝
  252. * @param array $data
  253. * @return array
  254. * @throws \WeChat\Exceptions\InvalidResponseException
  255. * @throws \WeChat\Exceptions\LocalCacheException
  256. */
  257. public function queryGuideBuyerByTag($data)
  258. {
  259. $url = 'https://api.weixin.qq.com/cgi-bin/guide/queryguidebuyerbytag?access_token=ACCESS_TOKEN';
  260. $this->registerApi($url, __FUNCTION__, func_get_args());
  261. return $this->callPostApi($url, $data, true);
  262. }
  263. /**
  264. * 为服务号导购添加粉丝
  265. * @param array $data
  266. * @return array
  267. * @throws \WeChat\Exceptions\InvalidResponseException
  268. * @throws \WeChat\Exceptions\LocalCacheException
  269. */
  270. public function addGuideBuyerRelation($data)
  271. {
  272. $url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerrelation?access_token=ACCESS_TOKEN';
  273. $this->registerApi($url, __FUNCTION__, func_get_args());
  274. return $this->callPostApi($url, $data, true);
  275. }
  276. /**
  277. * 删除导购的粉丝
  278. * @param array $data
  279. * @return array
  280. * @throws \WeChat\Exceptions\InvalidResponseException
  281. * @throws \WeChat\Exceptions\LocalCacheException
  282. */
  283. public function delGuideBuyerRelation($data)
  284. {
  285. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidebuyerrelation?access_token=ACCESS_TOKEN';
  286. $this->registerApi($url, __FUNCTION__, func_get_args());
  287. return $this->callPostApi($url, $data, true);
  288. }
  289. /**
  290. * 查询某一个粉丝与导购的绑定关系
  291. * @param array $data
  292. * @return array
  293. * @throws \WeChat\Exceptions\InvalidResponseException
  294. * @throws \WeChat\Exceptions\LocalCacheException
  295. */
  296. public function getGuideBuyerRelation($data)
  297. {
  298. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelation?access_token=ACCESS_TOKEN';
  299. $this->registerApi($url, __FUNCTION__, func_get_args());
  300. return $this->callPostApi($url, $data, true);
  301. }
  302. /**
  303. * 通过粉丝信息查询该粉丝与导购的绑定关系
  304. * @param string $openid
  305. * @return array
  306. * @throws \WeChat\Exceptions\InvalidResponseException
  307. * @throws \WeChat\Exceptions\LocalCacheException
  308. */
  309. public function getGuideBuyerRelationByBuyer($openid)
  310. {
  311. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelation?access_token=ACCESS_TOKEN';
  312. $this->registerApi($url, __FUNCTION__, func_get_args());
  313. return $this->callPostApi($url, ['openid' => $openid], true);
  314. }
  315. /**
  316. * 拉取导购的粉丝列表
  317. * @param array $data
  318. * @return array
  319. * @throws \WeChat\Exceptions\InvalidResponseException
  320. * @throws \WeChat\Exceptions\LocalCacheException
  321. */
  322. public function getGuideBuyerRelationList($data)
  323. {
  324. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelationlist?access_token=ACCESS_TOKEN';
  325. $this->registerApi($url, __FUNCTION__, func_get_args());
  326. return $this->callPostApi($url, $data, true);
  327. }
  328. /**
  329. * 将粉丝从一个导购迁移到另外一个导购下
  330. * @param array $data
  331. * @return array
  332. * @throws \WeChat\Exceptions\InvalidResponseException
  333. * @throws \WeChat\Exceptions\LocalCacheException
  334. */
  335. public function rebindGuideAcctForBuyer($data)
  336. {
  337. $url = 'https://api.weixin.qq.com/cgi-bin/guide/rebindguideacctforbuyer?access_token=ACCESS_TOKEN';
  338. $this->registerApi($url, __FUNCTION__, func_get_args());
  339. return $this->callPostApi($url, $data, true);
  340. }
  341. /**
  342. * 更新粉丝昵称
  343. * @param array $data
  344. * @return array
  345. * @throws \WeChat\Exceptions\InvalidResponseException
  346. * @throws \WeChat\Exceptions\LocalCacheException
  347. */
  348. public function updateGuideBuyerRelation($data)
  349. {
  350. $url = 'https://api.weixin.qq.com/cgi-bin/guide/updateguidebuyerrelation?access_token=ACCESS_TOKEN';
  351. $this->registerApi($url, __FUNCTION__, func_get_args());
  352. return $this->callPostApi($url, $data, true);
  353. }
  354. /**
  355. * 删除小程序卡片素材
  356. * @param array $data
  357. * @return array
  358. * @throws \WeChat\Exceptions\InvalidResponseException
  359. * @throws \WeChat\Exceptions\LocalCacheException
  360. */
  361. public function delGuideCardMaterial($data)
  362. {
  363. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidecardmaterial?access_token=ACCESS_TOKEN';
  364. $this->registerApi($url, __FUNCTION__, func_get_args());
  365. return $this->callPostApi($url, $data, true);
  366. }
  367. /**
  368. * 删除图片素材
  369. * @param array $data
  370. * @return array
  371. * @throws \WeChat\Exceptions\InvalidResponseException
  372. * @throws \WeChat\Exceptions\LocalCacheException
  373. */
  374. public function delGuideImageMaterial($data)
  375. {
  376. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguideimagematerial?access_token=ACCESS_TOKEN';
  377. $this->registerApi($url, __FUNCTION__, func_get_args());
  378. return $this->callPostApi($url, $data, true);
  379. }
  380. /**
  381. * 删除文字素材
  382. * @param array $data
  383. * @return array
  384. * @throws \WeChat\Exceptions\InvalidResponseException
  385. * @throws \WeChat\Exceptions\LocalCacheException
  386. */
  387. public function delGuideWordMaterial($data)
  388. {
  389. $url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidewordmaterial?access_token=ACCESS_TOKEN';
  390. $this->registerApi($url, __FUNCTION__, func_get_args());
  391. return $this->callPostApi($url, $data, true);
  392. }
  393. /**
  394. * 获取小程序卡片素材信息
  395. * @param integer $type
  396. * @return array
  397. * @throws \WeChat\Exceptions\InvalidResponseException
  398. * @throws \WeChat\Exceptions\LocalCacheException
  399. */
  400. public function getGuideCardMaterial($type = 0)
  401. {
  402. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidecardmaterial?access_token=ACCESS_TOKEN';
  403. $this->registerApi($url, __FUNCTION__, func_get_args());
  404. return $this->callPostApi($url, ['type' => $type], true);
  405. }
  406. /**
  407. * 获取图片素材信息
  408. * @param integer $type 操作类型
  409. * @param integer $start 分页查询,起始位置
  410. * @param integer $num 分页查询,查询个数
  411. * @return array
  412. * @throws \WeChat\Exceptions\InvalidResponseException
  413. * @throws \WeChat\Exceptions\LocalCacheException
  414. */
  415. public function getGuideImageMaterial($type = 0, $start = 0, $num = 10)
  416. {
  417. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideimagematerial?access_token=ACCESS_TOKEN';
  418. $this->registerApi($url, __FUNCTION__, func_get_args());
  419. return $this->callPostApi($url, ['type' => $type, 'start' => $start, 'num' => $num], true);
  420. }
  421. /**
  422. * 获取文字素材信息
  423. * @param integer $type 操作类型
  424. * @param integer $start 分页查询,起始位置
  425. * @param integer $num 分页查询,查询个数
  426. * @return array
  427. * @throws \WeChat\Exceptions\InvalidResponseException
  428. * @throws \WeChat\Exceptions\LocalCacheException
  429. */
  430. public function getGuideWordMaterial($type = 0, $start = 0, $num = 10)
  431. {
  432. $url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidewordmaterial?access_token=ACCESS_TOKEN';
  433. $this->registerApi($url, __FUNCTION__, func_get_args());
  434. return $this->callPostApi($url, ['type' => $type, 'start' => $start, 'num' => $num], true);
  435. }
  436. /**
  437. * 添加小程序卡片素材
  438. * @param array $data
  439. * @return array
  440. * @throws \WeChat\Exceptions\InvalidResponseException
  441. * @throws \WeChat\Exceptions\LocalCacheException
  442. */
  443. public function setGuideCardMaterial($data)
  444. {
  445. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguidecardmaterial?access_token=ACCESS_TOKEN';
  446. $this->registerApi($url, __FUNCTION__, func_get_args());
  447. return $this->callPostApi($url, $data, true);
  448. }
  449. /**
  450. * 添加图片素材
  451. * @param array $data
  452. * @return array
  453. * @throws \WeChat\Exceptions\InvalidResponseException
  454. * @throws \WeChat\Exceptions\LocalCacheException
  455. */
  456. public function setGuideImageMaterial($data)
  457. {
  458. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideimagematerial?access_token=ACCESS_TOKEN';
  459. $this->registerApi($url, __FUNCTION__, func_get_args());
  460. return $this->callPostApi($url, $data, true);
  461. }
  462. /**
  463. * 为服务号添加文字素材
  464. * @param array $data
  465. * @return array
  466. * @throws \WeChat\Exceptions\InvalidResponseException
  467. * @throws \WeChat\Exceptions\LocalCacheException
  468. */
  469. public function setGuideWordMaterial($data)
  470. {
  471. $url = 'https://api.weixin.qq.com/cgi-bin/guide/setguidewordmaterial?access_token=ACCESS_TOKEN';
  472. $this->registerApi($url, __FUNCTION__, func_get_args());
  473. return $this->callPostApi($url, $data, true);
  474. }
  475. }
  476. ?>