info.php 5.9 KB

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