user.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <?php
  2. /**
  3. * user
  4. */
  5. # 定义几个常用的选项
  6. $option = array
  7. (
  8. 1 => '正常',
  9. 2 => '冻结',
  10. );
  11. $group = function()
  12. {
  13. $array = array();
  14. $data = Dever::load('weixin/group-main');
  15. if($data)
  16. {
  17. $array += $data;
  18. }
  19. return $array;
  20. };
  21. $sex = array
  22. (
  23. 0 => '未知',
  24. -1 => '未知',
  25. 1 => '男性',
  26. 2 => '女性',
  27. );
  28. $subscribe = array
  29. (
  30. 2 => '未关注',
  31. 1 => '已关注',
  32. );
  33. return array
  34. (
  35. # 表名
  36. 'name' => 'user',
  37. # 显示给用户看的名称
  38. 'lang' => '用户信息',
  39. 'desc' => '注意:这里可以直接更改用户分组,是可以修改用户的分组的,不过一旦从未分组中移出,就不能再还原回去了。可加入到cron中:data.user_list?site=? site后的问号请替换为站点id',
  40. 'start' => array
  41. (
  42. # 修改分组到微信
  43. 'update_groupid' => 'weixin/user.update_group',
  44. ),
  45. # 数据结构
  46. 'struct' => array
  47. (
  48. 'id' => array
  49. (
  50. 'type' => 'int-11',
  51. 'name' => 'UID',
  52. 'default' => '',
  53. 'desc' => '',
  54. 'match' => 'is_numeric',
  55. //'search' => 'order',
  56. 'list' => true,
  57. ),
  58. 'site' => array
  59. (
  60. 'type' => 'int-11',
  61. 'name' => '站点',
  62. 'default' => '',
  63. 'desc' => '请输入站点',
  64. 'match' => 'is_numeric',
  65. //'search' => 'order,fulltext',
  66. //'update' => 'text',
  67. //'list' => true,
  68. ),
  69. 'openid' => array
  70. (
  71. 'type' => 'varchar-150',
  72. 'name' => 'openid',
  73. 'default' => '',
  74. 'desc' => '请输入openid',
  75. 'match' => 'is_string',
  76. 'search' => 'order,fulltext',
  77. //'update' => 'text',
  78. //'list' => 'table',
  79. //'modal' => '详细信息',
  80. ),
  81. 'unionid' => array
  82. (
  83. 'type' => 'varchar-150',
  84. 'name' => 'unionid',
  85. 'default' => '',
  86. 'desc' => '请输入unionid',
  87. 'match' => 'is_string',
  88. 'search' => 'order,fulltext',
  89. //'update' => 'text',
  90. //'list' => true,
  91. ),
  92. 'nickname' => array
  93. (
  94. 'type' => 'varchar-50',
  95. 'name' => '昵称',
  96. 'default' => '',
  97. 'desc' => '请输入昵称',
  98. 'match' => 'is_string',
  99. 'search' => 'fulltext',
  100. //'update' => 'text',
  101. 'list' => 'table',
  102. 'modal' => '{nickname}',
  103. ),
  104. 'sex' => array
  105. (
  106. 'type' => 'tinyint-1',
  107. 'name' => '性别',
  108. 'default' => '0',
  109. 'desc' => '请选择性别',
  110. 'match' => 'is_numeric',
  111. 'option' => $sex,
  112. 'search' => 'select',
  113. //'update' => 'radio',
  114. 'list' => true,
  115. 'show' => 'yes',
  116. ),
  117. 'groupid' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '分组',
  121. 'default' => '0',
  122. 'desc' => '请选择分组',
  123. 'match' => 'is_numeric',
  124. 'option' => $group,
  125. 'search' => 'select',
  126. 'update' => 'radio',
  127. 'list' => true,
  128. ),
  129. 'subscribe' => array
  130. (
  131. 'type' => 'tinyint-1',
  132. 'name' => '是否订阅',
  133. 'default' => '2',
  134. 'desc' => '请选择是否订阅',
  135. 'match' => 'is_numeric',
  136. 'option' => $subscribe,
  137. //'search' => 'select',
  138. //'update' => 'radio',
  139. 'list' => true,
  140. 'show' => 'yes',
  141. ),
  142. 'city' => array
  143. (
  144. 'type' => 'varchar-30',
  145. 'name' => '城市',
  146. 'default' => '',
  147. 'desc' => '请输入城市',
  148. 'match' => 'is_string',
  149. 'search' => 'fulltext',
  150. //'update' => 'text',
  151. //'list' => true,
  152. ),
  153. 'province' => array
  154. (
  155. 'type' => 'varchar-30',
  156. 'name' => '省份',
  157. 'default' => '',
  158. 'desc' => '请输入省份',
  159. 'match' => 'is_string',
  160. 'search' => 'fulltext',
  161. //'update' => 'text',
  162. //'list' => true,
  163. ),
  164. 'country' => array
  165. (
  166. 'type' => 'varchar-30',
  167. 'name' => '地区',
  168. 'default' => '',
  169. 'desc' => '请输入国家',
  170. 'match' => 'is_string',
  171. 'search' => 'fulltext',
  172. //'update' => 'text',
  173. 'list' => '"{country} {province} {city}"',
  174. ),
  175. 'language' => array
  176. (
  177. 'type' => 'varchar-30',
  178. 'name' => '语言',
  179. 'default' => '',
  180. 'desc' => '请输入语言',
  181. 'match' => 'is_string',
  182. 'search' => 'fulltext',
  183. //'update' => 'text',
  184. //'list' => true,
  185. ),
  186. 'remark' => array
  187. (
  188. 'type' => 'varchar-30',
  189. 'name' => '备注',
  190. 'default' => '',
  191. 'desc' => '请输入备注',
  192. 'match' => 'is_string',
  193. 'search' => 'fulltext',
  194. ),
  195. 'headimgurl' => array
  196. (
  197. 'type' => 'varchar-150',
  198. 'name' => '头像',
  199. 'default' => '',
  200. 'desc' => '请输入头像',
  201. 'match' => 'is_string',
  202. 'search' => 'fulltext',
  203. //'update' => 'text',
  204. ),
  205. 'subscribe_time' => array
  206. (
  207. 'type' => 'int-11',
  208. 'name' => '关注时间',
  209. 'default' => '',
  210. 'desc' => '请输入关注时间',
  211. 'match' => 'is_numeric',
  212. //'update' => 'text',
  213. 'list' => 'date("Y-m-d H:i:s", {subscribe_time})',
  214. ),
  215. 'mdate' => array
  216. (
  217. 'type' => 'int-11',
  218. 'name' => '更新时间',
  219. 'match' => array('is_numeric', time()),
  220. 'desc' => '',
  221. ),
  222. 'state' => array
  223. (
  224. 'type' => 'tinyint-1',
  225. 'name' => '状态',
  226. 'default' => '1',
  227. 'desc' => '请选择状态',
  228. 'match' => array('is_numeric', 1),
  229. 'option' => $option,
  230. //'update' => 'radio',
  231. 'list' => true,
  232. ),
  233. 'cdate' => array
  234. (
  235. 'type' => 'int-11',
  236. 'name' => '录入时间',
  237. 'match' => array('is_numeric', time()),
  238. 'desc' => '',
  239. # 只有insert时才生效
  240. 'insert' => true,
  241. ),
  242. ),
  243. 'manage' => array
  244. (
  245. 'insert' => false,
  246. 'edit' => false,
  247. //'list_button' => array(6 => '同步'),
  248. 'button' => array
  249. (
  250. //'重新同步' => 'manage/api.update',
  251. )
  252. ),
  253. # 后台新增功能,权限精细控制 他的值为需要控制的字段
  254. 'auth' => 'site',
  255. # request 请求接口定义
  256. 'request' => array
  257. (
  258. # 根据hash取一条数据
  259. 'info' => array
  260. (
  261. # 匹配的正则或函数 必填项
  262. 'where' => array
  263. (
  264. 'site' => 'yes',
  265. 'openid' => 'yes',
  266. ),
  267. 'type' => 'one',
  268. ),
  269. # 根据群组获取数据
  270. 'getByGroup' => array
  271. (
  272. # 匹配的正则或函数 必填项
  273. 'where' => array
  274. (
  275. 'state' => 1,
  276. 'site' => 'yes',
  277. 'groupid' => 'yes',
  278. ),
  279. 'type' => 'all',
  280. 'order' => array('id', 'desc'),
  281. 'col' => '*',
  282. ),
  283. # 根据用户id获取数据
  284. 'getByUid' => array
  285. (
  286. # 匹配的正则或函数 必填项
  287. 'where' => array
  288. (
  289. 'state' => 1,
  290. 'site' => 'yes',
  291. 'id' => array('yes', 'in'),
  292. ),
  293. 'type' => 'all',
  294. 'order' => array('id', 'desc'),
  295. 'col' => '*|openid',
  296. ),
  297. # 获取所有数据
  298. 'getAll' => array
  299. (
  300. # 匹配的正则或函数 必填项
  301. 'where' => array
  302. (
  303. 'state' => 1,
  304. 'site' => 'yes',
  305. ),
  306. 'type' => 'all',
  307. 'order' => array('id', 'desc'),
  308. 'col' => '*',
  309. ),
  310. # 根据unionid 获取信息
  311. 'getOne' => array
  312. (
  313. # 匹配的正则或函数 必填项
  314. 'where' => array
  315. (
  316. 'site' => 'yes',
  317. 'unionid' => 'yes',
  318. ),
  319. 'type' => 'one',
  320. ),
  321. # 改变订阅状态
  322. 'upSubscribe' => array
  323. (
  324. 'type' => 'update',
  325. 'where' => array
  326. (
  327. 'openid' => 'yes',
  328. 'site' => 'yes',
  329. ),
  330. 'set' => array
  331. (
  332. 'subscribe' => 'yes',
  333. ),
  334. ),
  335. ),
  336. );