info.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?php
  2. $button = array();
  3. $list_button = array
  4. (
  5. 'list' => array('认证', '"auth&search_option_uid={id}&oper_table=info"'),
  6. 'list1' => array('地址', '"address&search_option_uid={id}&oper_table=info"'),
  7. );
  8. if (Dever::project('account')) {
  9. $list_button += array
  10. (
  11. 'list99' => array('钱包', '"info_log&project=account&config_key=qianbao&search_option_uid={id}&oper_table=info&oper_project=user"'),
  12. );
  13. }
  14. if (Dever::project('score')) {
  15. $list_button += array
  16. (
  17. 'list100' => array('积分', '"user&project=score&search_option_uid={id}&oper_table=info&oper_project=user"'),
  18. 'list101' => array('等级', '"user_level&project=score&search_option_uid={id}&oper_table=info&oper_project=user"'),
  19. );
  20. }
  21. $project = function()
  22. {
  23. return Dever::db('user/project')->state();
  24. };
  25. $sex = array
  26. (
  27. 1 => '男',
  28. 2 => '女',
  29. 3 => '未知',
  30. );
  31. $system_source = Dever::config('base')->system_source;
  32. return array
  33. (
  34. # 表名
  35. 'name' => 'info',
  36. # 显示给用户看的名称
  37. 'lang' => '用户管理',
  38. 'order' => 10,
  39. 'set' => array
  40. (
  41. 'system_source' => $system_source,
  42. 'sex' => $sex,
  43. ),
  44. # 数据结构
  45. 'struct' => array
  46. (
  47. 'id' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => '用户ID',
  51. 'default' => '',
  52. 'desc' => '',
  53. 'match' => 'is_numeric',
  54. 'search' => 'order,fulltext',
  55. 'list' => true,
  56. ),
  57. 'name' => array
  58. (
  59. 'type' => 'varchar-50',
  60. 'name' => '用户名',
  61. 'default' => '',
  62. 'desc' => '请输入用户名',
  63. 'match' => 'is_string',
  64. 'update' => 'text',
  65. 'search' => 'fulltext',
  66. 'list' => true,
  67. ),
  68. 'mobile' => array
  69. (
  70. 'type' => 'varchar-32',
  71. 'name' => '手机号',
  72. 'default' => '',
  73. 'desc' => '请输入用户手机号',
  74. 'match' => Dever::rule('mobile'),
  75. 'update' => 'text',
  76. 'search' => 'fulltext',
  77. 'list' => true,
  78. ),
  79. 'email' => array
  80. (
  81. 'type' => 'varchar-150',
  82. 'name' => '邮箱',
  83. 'default' => '',
  84. 'desc' => '请输入邮箱',
  85. 'match' => 'option',
  86. 'update' => 'text',
  87. //'search' => 'fulltext',
  88. //'list' => true,
  89. ),
  90. 'password' => array
  91. (
  92. 'type' => 'varchar-50',
  93. 'name' => '密码',
  94. 'default' => '',
  95. 'desc' => '请输入密码',
  96. 'match' => 'option',
  97. 'update' => 'password',
  98. 'callback' => 'sha1',
  99. ),
  100. 'project_id' => array
  101. (
  102. 'type' => 'int-11',
  103. 'name' => '所属项目',
  104. 'default' => '1',
  105. 'desc' => '所属项目',
  106. 'match' => 'is_numeric',
  107. 'option' => $project,
  108. 'update' => 'radio',
  109. 'search' => 'select',
  110. 'list' => true,
  111. ),
  112. 'system_source' => array
  113. (
  114. 'type' => 'tinyint-1',
  115. 'name' => '用户来源',
  116. 'default' => '100',
  117. 'desc' => '用户来源',
  118. 'match' => 'is_numeric',
  119. 'option' => $system_source,
  120. 'update' => 'radio',
  121. 'search' => 'select',
  122. 'list' => true,
  123. ),
  124. 'avatar_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '头像',
  128. 'default' => '1',
  129. 'desc' => '头像',
  130. 'match' => 'is_numeric',
  131. ),
  132. 'avatar' => array
  133. (
  134. 'type' => 'varchar-150',
  135. 'name' => '头像',
  136. 'default' => '',
  137. 'desc' => '请选择头像',
  138. 'match' => 'option',
  139. 'update' => 'image',
  140. 'key' => '1',
  141. 'place' => '150',
  142. ),
  143. 'sex' => array
  144. (
  145. 'type' => 'tinyint-1',
  146. 'name' => '性别',
  147. 'default' => '3',
  148. 'desc' => '性别',
  149. 'match' => 'is_numeric',
  150. 'option' => $sex,
  151. 'update' => 'radio',
  152. 'list' => true,
  153. ),
  154. 'state' => array
  155. (
  156. 'type' => 'tinyint-1',
  157. 'name' => '状态',
  158. 'default' => '1',
  159. 'desc' => '请选择状态',
  160. 'match' => 'is_numeric',
  161. ),
  162. 'cdate' => array
  163. (
  164. 'type' => 'int-11',
  165. 'name' => '注册时间',
  166. 'match' => array('is_numeric', time()),
  167. 'desc' => '',
  168. # 只有insert时才生效
  169. 'insert' => true,
  170. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  171. ),
  172. ),
  173. 'manage' => array
  174. (
  175. 'excel' => true,
  176. 'button' => $button,
  177. 'list_button' => $list_button,
  178. ),
  179. # 更新表结构
  180. /*
  181. 'alter' => array
  182. (
  183. 1 => array
  184. (
  185. array('add', 'bind', 'bind', 'tinyint-1 2 是否绑定手机'),
  186. ),
  187. 'version' => 1,
  188. ),
  189. */
  190. # 索引
  191. 'index' => array
  192. (
  193. 1 => array
  194. (
  195. 'mobile' => 'mobile',
  196. ),
  197. # 版本号 更改版本号会更新当前表的索引
  198. 'version' => 1,
  199. ),
  200. # request 请求接口定义
  201. 'request' => array
  202. (
  203. # 此处定义是为跳出auth
  204. 'login' => array
  205. (
  206. 'option' => array
  207. (
  208. 'username' => 'yes',
  209. 'mobile' => 'yes',
  210. 'email' => 'yes',
  211. 'password' => 'yes',
  212. ),
  213. 'type' => 'one',
  214. ),
  215. # 验证手机号是否被使用
  216. 'checkMobile' => array
  217. (
  218. # 匹配的正则或函数 选填项
  219. 'where' => array
  220. (
  221. 'mobile' => 'yes',
  222. 'id' => array('yes', '!='),
  223. ),
  224. 'type' => 'one',
  225. ),
  226. # 后台搜索用到
  227. 'search' => array
  228. (
  229. # 匹配的正则或函数 选填项
  230. 'option' => array
  231. (
  232. 'ids' => array('yes-id', 'in'),
  233. 'search' => array('yes-mobile,name', 'like'),
  234. 'id' => 'yes',
  235. 'state' => 1,
  236. ),
  237. 'type' => 'all',
  238. 'order' => array('id' => 'desc'),
  239. 'limit' => '0,1000',
  240. 'col' => 'concat(name, "-", mobile) as name, id, id as value, "" as selected, "" as disabled|id',
  241. ),
  242. 'getNum' => array
  243. (
  244. # 匹配的正则或函数 选填项
  245. 'option' => array
  246. (
  247. 'start' => array('yes-cdate', '>='),
  248. 'end' => array('yes-cdate', '<='),
  249. 'state' => 1,
  250. ),
  251. 'type' => 'count',
  252. 'col' => '*',
  253. ),
  254. 'like' => array
  255. (
  256. # 匹配的正则或函数 选填项
  257. 'option' => array
  258. (
  259. 'search' => array('yes-mobile,name', 'like'),
  260. 'mobile' => array('yes', 'like'),
  261. 'name' => array('yes', 'like'),
  262. 'id' => 'yes',
  263. 'state' => 1,
  264. ),
  265. 'type' => 'all',
  266. 'order' => array('id' => 'desc'),
  267. 'col' => '*|id',
  268. ),
  269. ),
  270. );