interface.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. $config = array();
  3. $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'interface' . DIRECTORY_SEPARATOR;
  4. # 载入素材配置
  5. $config += include($path . 'media.php');
  6. # 载入素材配置
  7. $config += include($path . 'message.php');
  8. # 载入菜单配置
  9. $config += include($path . 'menu.php');
  10. # 载入二维码配置
  11. $config += include($path . 'code.php');
  12. # 载入统计配置
  13. $config += include($path . 'stat.php');
  14. # 数据收集的配置
  15. $config += array
  16. (
  17. # 获取分组
  18. 'user_group' => array
  19. (
  20. 'url' => 'https://api.weixin.qq.com/cgi-bin/groups/get?',
  21. 'param' => array
  22. (
  23. 'access_token' => 'token',
  24. ),
  25. # 对结果的后续操作
  26. 'action' => array
  27. (
  28. # 数据来源来openid
  29. 'data' => 'groups',
  30. # 根据哪个字段读取数据
  31. 'where' => array
  32. (
  33. # 这边的字段,对应微信的字段,如果相同就不用写key
  34. 'groupid' => 'id',
  35. ),
  36. 'update' => array
  37. (
  38. # 微信的字段,对应这边哪个字段,如果相同这里就不用加了。与上边正好相反,注意。
  39. 'id' => 'groupid',
  40. ),
  41. # 更新到哪个表中
  42. 'table' => 'group',
  43. ),
  44. ),
  45. # 创建分组
  46. 'group_create' => array
  47. (
  48. 'url' => 'https://api.weixin.qq.com/cgi-bin/groups/create?',
  49. 'param' => array
  50. (
  51. 'access_token' => 'token',
  52. 'group' => array('name' => urlencode(Dever::input('update_name'))),
  53. ),
  54. # json 传输
  55. 'json' => true,
  56. 'action' => array
  57. (
  58. 'data' => 'group',
  59. 'where' => array
  60. (
  61. 'groupid' => 'id',
  62. ),
  63. 'update' => array
  64. (
  65. 'id' => 'groupid',
  66. ),
  67. 'table' => 'group',
  68. ),
  69. ),
  70. # 更新分组
  71. 'group_edit' => array
  72. (
  73. 'url' => 'https://api.weixin.qq.com/cgi-bin/groups/update?',
  74. 'param' => array
  75. (
  76. 'access_token' => 'token',
  77. 'group' => array('id' => Dever::input('update_groupid'), 'name' => Dever::input('update_name')),
  78. ),
  79. 'json' => true,
  80. ),
  81. # 删除分组
  82. 'group_delete' => array
  83. (
  84. 'url' => 'https://api.weixin.qq.com/cgi-bin/groups/delete?',
  85. 'param' => array
  86. (
  87. 'access_token' => 'token',
  88. 'group' => array('id' => Dever::input('group')),
  89. ),
  90. 'json' => true,
  91. ),
  92. # 移动用户分组
  93. 'group_move' => array
  94. (
  95. 'url' => 'https://api.weixin.qq.com/cgi-bin/groups/members/update?',
  96. 'param' => array
  97. (
  98. 'access_token' => 'token',
  99. 'openid' => Dever::input('openid'),
  100. 'to_groupid' => Dever::input('to_groupid'),
  101. ),
  102. 'json' => true,
  103. ),
  104. # 获取用户list
  105. 'user_list' => array
  106. (
  107. 'url' => 'https://api.weixin.qq.com/cgi-bin/user/get?',
  108. 'param' => array
  109. (
  110. 'access_token' => 'token',
  111. 'next_openid' => '',
  112. ),
  113. # 对结果的后续操作
  114. 'action' => array
  115. (
  116. # 数据来源来openid
  117. 'data' => 'openid',
  118. # 调取的方法为user_info
  119. 'method' => 'user_info',
  120. ),
  121. ),
  122. # 获取用户基本信息
  123. 'user_info' => array
  124. (
  125. 'url' => 'https://api.weixin.qq.com/cgi-bin/user/info?',
  126. 'param' => array
  127. (
  128. 'access_token' => 'token',
  129. 'openid' => Dever::input('openid') ? Dever::input('openid') : 'openid',
  130. 'lang' => 'zh_CN'
  131. ),
  132. # 对结果的后续操作
  133. 'action' => array
  134. (
  135. # 根据哪个字段读取数据
  136. 'where' => array('openid'),
  137. # 更新到哪个表中
  138. 'table' => 'user',
  139. ),
  140. ),
  141. );
  142. return $config;