WxServicesInterface.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace App\Repositories\Contracts;
  3. /**
  4. *
  5. * @author lilin
  6. *
  7. */
  8. interface WxServicesInterface
  9. {
  10. const TYPENAME = '微信公众号 ';
  11. /**
  12. * 购买成功通知
  13. * @var string
  14. */
  15. const TPL_ID_1 = '-B-JBCrJfBV-usheph5OuG6fTTXHydTyNEo-sw5mvao';
  16. const URL_ACCESS_TOKEN = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET';
  17. const URL_USER_INFO = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN';
  18. const URL_JSAPI_TICKET = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi';
  19. const URL_SEND_TPL_MSG = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN';
  20. const URL_SEND_MESSAGE = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN';
  21. const URL_SEND_CREATE_MENU = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN';
  22. /**
  23. * 获取用户ACCESS_TOKEN
  24. *
  25. */
  26. public function getAccessToken();
  27. /**
  28. * 获取用户基本信息
  29. *
  30. * @param string $openid
  31. */
  32. public function getUserInfo(string $openid);
  33. /**
  34. * 验证消息的确来自微信服务器
  35. *
  36. * @param string $signature
  37. * @param string $echostr 验证通过原样返回
  38. * @param string $timestamp
  39. * @param string $nonce
  40. */
  41. public function checkSignature(string $signature, string $echostr, string $timestamp, string $nonce);
  42. /**
  43. * jsapi_ticket是公众号用于调用微信JS接口的临时票据
  44. *
  45. */
  46. public function getJsapiTicket();
  47. /**
  48. * jsapi获取签名
  49. *
  50. * @param string $url 当前url
  51. */
  52. public function getJsapiSign(string $url);
  53. /**
  54. * 发送模板信息
  55. *
  56. * @param string $touser
  57. * @param string $templateId
  58. * @param string $jumpUrl
  59. * @param array $data
  60. */
  61. public function sendTplMsg(string $touser, string $templateId, string $jumpUrl, array $data);
  62. /**
  63. * 客服接口-发消息
  64. *
  65. * @param string $toUser
  66. * @param string $msgType
  67. * @param array $msg
  68. */
  69. public function sendMessage(string $toUser, string $msgType, array $msg);
  70. /**
  71. * 创建菜单
  72. *
  73. * @param array $menu
  74. */
  75. public function createMenu(array $menu);
  76. }