user.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '正常',
  6. 2 => '冻结',
  7. );
  8. $level = array
  9. (
  10. 1 => '普通',
  11. 2 => '元老',
  12. 3 => '小编',
  13. 10 => '管理员',
  14. );
  15. $sex = array
  16. (
  17. 1 => '男',
  18. 2 => '女',
  19. 3 => '未知',
  20. );
  21. $weixin = array
  22. (
  23. 1 => '已关注',
  24. 2 => '未关注',
  25. );
  26. $bind = array
  27. (
  28. 1 => '已绑定',
  29. 2 => '未绑定',
  30. );
  31. $email = Dever::rule('email');
  32. $email = 'option';
  33. $mobile = Dever::rule('mobile');
  34. $mobile = 'option';
  35. return array
  36. (
  37. 'email' => $email,
  38. 'mobile' => $mobile,
  39. # 表名
  40. 'name' => 'user',
  41. # 显示给用户看的名称
  42. 'lang' => '用户管理',
  43. 'order' => 10,
  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',
  55. 'list' => true,
  56. ),
  57. 'username' => 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' => $mobile,
  75. 'update' => 'text',
  76. 'search' => 'fulltext,exist',
  77. 'exist' => array
  78. (
  79. 'yes' => '有值',
  80. //'no' => '没有值',
  81. ),
  82. 'list' => true,
  83. ),
  84. 'email' => array
  85. (
  86. 'type' => 'varchar-150',
  87. 'name' => '邮箱',
  88. 'default' => '',
  89. 'desc' => '请输入邮箱',
  90. 'match' => $email,
  91. 'update' => 'text',
  92. 'search' => 'fulltext',
  93. 'list' => true,
  94. ),
  95. 'password' => array
  96. (
  97. 'type' => 'varchar-50',
  98. 'name' => '密码',
  99. 'default' => '',
  100. 'desc' => '请输入密码',
  101. 'match' => 'option',
  102. 'update' => 'password',
  103. 'callback' => 'sha1',
  104. ),
  105. //search_exist_avatar=yes
  106. 'avatar' => array
  107. (
  108. 'type' => 'varchar-150',
  109. 'name' => '头像',
  110. 'default' => '',
  111. 'desc' => '请选择头像',
  112. 'match' => 'option',
  113. 'update' => 'image',
  114. 'key' => '1',
  115. 'place' => '150',
  116. 'list' => '"{avatar}" ? "<img src=\'{avatar}\' width=\'150\'>": ""',
  117. ),
  118. 'country' => array
  119. (
  120. 'type' => 'varchar-100',
  121. 'name' => '国家',
  122. 'default' => '',
  123. 'desc' => '国家',
  124. 'match' => 'option',
  125. //'update' => 'text',
  126. ),
  127. 'province' => array
  128. (
  129. 'type' => 'varchar-100',
  130. 'name' => '省份',
  131. 'default' => '',
  132. 'desc' => '省份',
  133. 'match' => 'option',
  134. //'update' => 'text',
  135. ),
  136. 'city' => array
  137. (
  138. 'type' => 'varchar-100',
  139. 'name' => '城市',
  140. 'default' => '',
  141. 'desc' => '城市',
  142. 'match' => 'option',
  143. //'update' => 'text',
  144. ),
  145. 'area' => array
  146. (
  147. 'type' => 'varchar-800',
  148. 'name' => '地区',
  149. 'default' => '',
  150. 'desc' => '地区',
  151. 'match' => 'option',
  152. //'update' => 'text',
  153. 'list' => true,
  154. ),
  155. 'info' => array
  156. (
  157. 'type' => 'varchar-255',
  158. 'name' => '介绍-选填,如果想清空该介绍,请输入null。',
  159. 'default' => '',
  160. 'desc' => '请输入介绍',
  161. 'match' => 'option',
  162. 'update' => 'editor',
  163. ),
  164. 'sex' => array
  165. (
  166. 'type' => 'tinyint-1',
  167. 'name' => '用户性别',
  168. 'default' => '1',
  169. 'desc' => '用户性别',
  170. 'match' => 'is_numeric',
  171. 'option' => $sex,
  172. 'update' => 'radio',
  173. 'list' => true,
  174. ),
  175. 'level' => array
  176. (
  177. 'type' => 'tinyint-1',
  178. 'name' => '用户等级',
  179. 'default' => '1',
  180. 'desc' => '请选择用户等级',
  181. 'match' => 'is_numeric',
  182. //'option' => $level,
  183. //'update' => 'radio',
  184. //'list' => true,
  185. ),
  186. 'login_date' => array
  187. (
  188. 'type' => 'int-11',
  189. 'name' => '最近登录',
  190. 'match' => array('is_numeric', time()),
  191. 'desc' => '',
  192. 'default' => '0',
  193. //'list' => 'date("Y-m-d H:i:s", {login_date})',
  194. ),
  195. 'bind' => array
  196. (
  197. 'type' => 'tinyint-1',
  198. 'name' => '是否绑定手机',
  199. 'default' => '2',
  200. 'desc' => '请选择是否绑定手机',
  201. 'match' => 'is_numeric',
  202. //'option' => $bind,
  203. //'update' => 'radio',
  204. ),
  205. 'state' => array
  206. (
  207. 'type' => 'tinyint-1',
  208. 'name' => '状态',
  209. 'default' => '1',
  210. 'desc' => '请选择状态',
  211. 'match' => 'is_numeric',
  212. 'option' => $option,
  213. 'update' => 'radio',
  214. ),
  215. 'cdate' => array
  216. (
  217. 'type' => 'int-11',
  218. 'name' => '注册时间',
  219. 'match' => array('is_numeric', time()),
  220. 'desc' => '',
  221. # 只有insert时才生效
  222. 'insert' => true,
  223. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  224. ),
  225. ),
  226. 'manage' => array
  227. (
  228. 'excel' => true,
  229. ),
  230. # 更新表结构
  231. /*
  232. 'alter' => array
  233. (
  234. 1 => array
  235. (
  236. array('add', 'bind', 'bind', 'tinyint-1 2 是否绑定手机'),
  237. ),
  238. 'version' => 1,
  239. ),
  240. */
  241. # request 请求接口定义
  242. 'request' => array
  243. (
  244. # 此处定义是为跳出auth
  245. 'login' => array
  246. (
  247. 'option' => array
  248. (
  249. 'username' => 'yes',
  250. 'mobile' => 'yes',
  251. 'email' => 'yes',
  252. 'password' => 'yes',
  253. ),
  254. 'type' => 'one',
  255. ),
  256. # 验证手机号是否被使用
  257. 'checkMobile' => array
  258. (
  259. # 匹配的正则或函数 选填项
  260. 'where' => array
  261. (
  262. 'mobile' => 'yes',
  263. 'id' => array('yes', '!='),
  264. ),
  265. 'type' => 'one',
  266. ),
  267. ),
  268. );