group.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. /**
  3. * user
  4. */
  5. # 定义几个常用的选项
  6. $option = array
  7. (
  8. 1 => '正常',
  9. 2 => '删除',
  10. );
  11. return array
  12. (
  13. # 表名
  14. 'name' => 'group',
  15. # 显示给用户看的名称
  16. 'lang' => '分组管理',
  17. 'desc' => '删除分组请慎重,我们这里做了限制,如果组内有用户,则不允许删除。另外星标组和黑名单无法改名。可加入到cron中:data.user_group?site=? site后的问号请替换为站点id',
  18. 'end' => array
  19. (
  20. # 创建分组到微信
  21. 'insert' => 'weixin/data.group_create',
  22. # 更新分组到微信
  23. 'update' => 'weixin/data.group_edit',
  24. ),
  25. 'start' => array
  26. (
  27. # 删除分组
  28. 'delete' => 'weixin/user.delete_group',
  29. ),
  30. # 数据结构
  31. 'struct' => array
  32. (
  33. 'id' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => 'ID',
  37. 'default' => '',
  38. 'desc' => '',
  39. 'match' => 'is_numeric',
  40. //'search' => 'order',
  41. //'list' => true,
  42. ),
  43. 'site' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '站点',
  47. 'default' => '',
  48. 'desc' => '请输入站点',
  49. 'match' => 'is_numeric',
  50. //'search' => 'order,fulltext',
  51. //'update' => 'text',
  52. //'list' => true,
  53. ),
  54. 'groupid' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '微信组id',
  58. 'default' => '',
  59. 'desc' => '请输入微信组id',
  60. 'match' => 'is_numeric',
  61. 'search' => 'order,fulltext',
  62. 'update' => 'hidden',
  63. 'list' => true,
  64. ),
  65. 'name' => array
  66. (
  67. 'type' => 'varchar-50',
  68. 'name' => '组名',
  69. 'default' => '',
  70. 'desc' => '请输入组名',
  71. 'match' => 'is_string',
  72. 'search' => 'fulltext',
  73. 'update' => 'text',
  74. 'list' => true,
  75. ),
  76. 'count' => array
  77. (
  78. 'type' => 'int-11',
  79. 'name' => '组内用户数',
  80. 'default' => '',
  81. 'desc' => '请输入组内用户数',
  82. 'match' => 'is_numeric',
  83. 'search' => 'order',
  84. //'update' => 'text',
  85. 'list' => true,
  86. ),
  87. 'mdate' => array
  88. (
  89. 'type' => 'int-11',
  90. 'name' => '更新时间',
  91. 'match' => array('is_numeric', time()),
  92. 'desc' => '',
  93. ),
  94. 'state' => array
  95. (
  96. 'type' => 'tinyint-1',
  97. 'name' => '状态',
  98. 'default' => '1',
  99. 'desc' => '请选择状态',
  100. 'match' => array('is_numeric', 1),
  101. 'option' => $option,
  102. //'update' => 'radio',
  103. //'list' => true,
  104. ),
  105. 'cdate' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '录入时间',
  109. 'match' => array('is_numeric', time()),
  110. 'desc' => '',
  111. # 只有insert时才生效
  112. 'insert' => true,
  113. ),
  114. ),
  115. 'manage' => array
  116. (
  117. //'insert' => false,
  118. 'list_button' => array(1 => array('用户', '"user&option_groupid={groupid}"'), 6 => '删除',),
  119. 'button' => array
  120. (
  121. '重新同步' => 'weixin/data.user_group',
  122. )
  123. ),
  124. 'auth' => 'site',
  125. # request 请求接口定义
  126. 'request' => array
  127. (
  128. # 根据hash取一条数据
  129. 'info' => array
  130. (
  131. # 匹配的正则或函数 必填项
  132. 'where' => array
  133. (
  134. 'groupid' => 'yes',
  135. 'site' => 'yes',
  136. ),
  137. 'type' => 'one',
  138. ),
  139. 'main' => array
  140. (
  141. 'where' => array
  142. (
  143. 'state' => 1,
  144. 'site' => 'yes',
  145. ),
  146. 'type' => 'all',
  147. 'order' => array('id', 'desc'),
  148. 'col' => '*|groupid',
  149. ),
  150. 'get' => array
  151. (
  152. 'where' => array
  153. (
  154. 'state' => 1,
  155. 'site' => 'yes',
  156. ),
  157. 'type' => 'all',
  158. 'order' => array('id', 'desc'),
  159. 'col' => 'name,groupid as id,groupid|groupid',
  160. ),
  161. # 更新数量
  162. 'upNum' => array
  163. (
  164. 'type' => 'update',
  165. 'where' => array
  166. (
  167. 'groupid' => 'yes',
  168. 'site' => 'yes',
  169. ),
  170. 'set' => array
  171. (
  172. 'count' => array('yes', '+='),
  173. ),
  174. ),
  175. ),
  176. );