info.php 6.1 KB

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