usermsg.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?php
  2. $option = array
  3. (
  4. 'text' => '文本',
  5. 'voice' => '语音',
  6. 'video' => '视频',
  7. 'image' => '图片',
  8. 'event' => '事件',
  9. 'subscribe' => '订阅',
  10. 'unsubscribe' => '取消订阅',
  11. 'SCAN' => '扫描二维码',
  12. 'location' => '地址位置',
  13. 'CLICK' => '菜单点击',
  14. 'VIEW' => '菜单跳转',
  15. 'MASSSENDJOBFINISH' => '后台群发',
  16. //'TEMPLATESENDJOBFINISH' => '模板消息',
  17. );
  18. return array
  19. (
  20. # 表名
  21. 'name' => 'usermsg',
  22. # 显示给用户看的名称
  23. 'lang' => '消息列表',
  24. //'desc' => '注:这里面只保存了近一个月的数据,请注意!',
  25. # 数据结构
  26. 'struct' => array
  27. (
  28. 'id' => array
  29. (
  30. 'type' => 'int-11',
  31. 'name' => 'ID',
  32. 'default' => '',
  33. 'desc' => '',
  34. 'match' => 'is_numeric',
  35. 'search' => 'order',
  36. //'list' => true,
  37. ),
  38. 'site' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => '站点',
  42. 'default' => '',
  43. 'desc' => '请输入站点',
  44. 'match' => 'is_numeric',
  45. ),
  46. 'from' => array
  47. (
  48. 'type' => 'varchar-100',
  49. 'name' => '用户',
  50. 'default' => '',
  51. 'desc' => '用户',
  52. 'search' => 'fulltext',
  53. 'list' => 'Dever::load("weixin/user.name", "{from}")',
  54. 'match' => 'option',
  55. ),
  56. 'to' => array
  57. (
  58. 'type' => 'varchar-100',
  59. 'name' => '接收人',
  60. 'default' => '',
  61. 'desc' => '接收人',
  62. 'search' => 'fulltext',
  63. //'list' => true,
  64. 'match' => 'option',
  65. ),
  66. 'type' => array
  67. (
  68. 'type' => 'varchar-20',
  69. 'name' => '消息类型',
  70. 'default' => '',
  71. 'desc' => '发送类型',
  72. 'search' => 'select',
  73. 'list' => true,
  74. 'option' => $option,
  75. 'match' => 'option',
  76. 'show' => 'yes',
  77. ),
  78. 'mid' => array
  79. (
  80. 'type' => 'bigint-11',
  81. 'name' => '消息id',
  82. 'default' => '',
  83. 'desc' => '消息id',
  84. 'search' => 'fulltext',
  85. //'list' => true,
  86. 'match' => 'option',
  87. ),
  88. 'info' => array
  89. (
  90. 'type' => 'text-255',
  91. 'name' => '消息内容',
  92. 'default' => '',
  93. 'desc' => '消息内容',
  94. 'search' => 'fulltext',
  95. 'list' => 'Dever::load("weixin/user.msg", {id})',
  96. 'match' => 'option',
  97. ),
  98. 'ctime' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '发送时间',
  102. 'desc' => '',
  103. 'match' => 'option',
  104. 'list' => 'date("Y-m-d H:i:s", {ctime})',
  105. ),
  106. 'content' => array
  107. (
  108. 'type' => 'text-255',
  109. 'name' => '事件',
  110. 'default' => '',
  111. 'desc' => '事件',
  112. 'list' => 'table',
  113. 'decode' => true,
  114. 'modal' => '查看详情',
  115. 'match' => 'option',
  116. ),
  117. 'reply' => array
  118. (
  119. 'type' => 'text-255',
  120. 'name' => '系统回复',
  121. 'default' => '',
  122. 'desc' => '回复',
  123. 'list' => 'Dever::load("weixin/account.button", {id})',
  124. //'modal' => '点此查看',
  125. 'match' => 'option',
  126. ),
  127. 'cdate' => array
  128. (
  129. 'type' => 'int-11',
  130. 'name' => '录入时间',
  131. 'match' => array('is_numeric', time()),
  132. 'desc' => '',
  133. # 只有insert时才生效
  134. 'insert' => true,
  135. ),
  136. ),
  137. 'manage' => array
  138. (
  139. 'desc' => '注:这里的记录为用户发送给本公众号的消息',
  140. ),
  141. 'auth' => 'site',
  142. # request 请求接口定义
  143. 'request' => array
  144. (
  145. 'getOne' => array
  146. (
  147. # 匹配的正则或函数 必填项
  148. 'where' => array
  149. (
  150. 'mid' => 'yes',
  151. 'site' => 'yes',
  152. ),
  153. 'type' => 'one',
  154. ),
  155. # 获取一个用户最新的记录
  156. 'getNew' => array
  157. (
  158. # 匹配的正则或函数 必填项
  159. 'where' => array
  160. (
  161. 'from' => 'yes',
  162. 'site' => 'yes',
  163. ),
  164. 'type' => 'one',
  165. 'order' => array('ctime', 'desc'),
  166. ),
  167. # 获取能被用来聊天的数据
  168. 'getAll' => array
  169. (
  170. # 匹配的正则或函数 必填项
  171. 'where' => array
  172. (
  173. 'from' => 'yes',
  174. 'site' => 'yes',
  175. //'type' => array('"text","image"', 'in'),
  176. ),
  177. 'type' => 'all',
  178. 'order' => array('ctime', 'desc'),
  179. 'page' => array(10, 'list'),
  180. 'col' => '*',
  181. ),
  182. ## 获取前一个月的用户消息数据
  183. 'getTimeData' => array(
  184. 'where' => array
  185. (
  186. //'cdate' => 'yes',
  187. 'cdate' => array('1', '<='),
  188. ),
  189. 'limit'=> 'yes',
  190. 'type' => 'all',
  191. 'order' => array('cdate', 'desc'),
  192. 'col' => '*',
  193. )
  194. ),
  195. );