user.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. $weixin = array
  16. (
  17. 1 => '已关注',
  18. 2 => '未关注',
  19. );
  20. $bind = array
  21. (
  22. 1 => '已绑定',
  23. 2 => '未绑定',
  24. );
  25. $email = '^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$';
  26. $email = Dever::rule('email');
  27. $mobile = Dever::rule('mobile');
  28. return array
  29. (
  30. 'email' => $email,
  31. 'mobile' => $mobile,
  32. # 表名
  33. 'name' => 'user',
  34. # 显示给用户看的名称
  35. 'lang' => '用户管理',
  36. 'order' => 10,
  37. 'check' => 'mobile',
  38. # 数据结构
  39. 'struct' => array
  40. (
  41. 'id' => array
  42. (
  43. 'type' => 'int-11',
  44. 'name' => '用户ID',
  45. 'default' => '',
  46. 'desc' => '',
  47. 'match' => 'is_numeric',
  48. 'search' => 'order',
  49. 'list' => true,
  50. ),
  51. 'email' => array
  52. (
  53. 'type' => 'varchar-150',
  54. 'name' => '邮箱',
  55. 'default' => '',
  56. 'desc' => '请输入邮箱',
  57. 'match' => $email,
  58. //'update' => 'text',
  59. //'search' => 'fulltext',
  60. //'list' => true,
  61. ),
  62. 'name' => array
  63. (
  64. 'type' => 'varchar-50',
  65. 'name' => '园区名称',
  66. 'default' => '',
  67. 'desc' => '请输入园区名称',
  68. 'match' => 'is_string',
  69. 'update' => 'text',
  70. 'search' => 'fulltext',
  71. 'list' => true,
  72. ),
  73. 'username' => array
  74. (
  75. 'type' => 'varchar-50',
  76. 'name' => '用户名',
  77. 'default' => '',
  78. 'desc' => '请输入用户名',
  79. 'match' => 'is_string',
  80. 'update' => 'text',
  81. 'search' => 'fulltext',
  82. 'list' => true,
  83. ),
  84. 'mobile' => array
  85. (
  86. 'type' => 'varchar-32',
  87. 'name' => '手机号',
  88. 'default' => '',
  89. 'desc' => '请输入用户手机号',
  90. 'match' => $mobile,
  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' => 'md5',
  104. ),
  105. 'avatar' => array
  106. (
  107. 'type' => 'varchar-150',
  108. 'name' => '头像',
  109. 'default' => '',
  110. 'desc' => '请选择头像',
  111. 'match' => 'option',
  112. //'update' => 'image',
  113. 'key' => '1',
  114. 'place' => '150',
  115. ),
  116. 'info' => array
  117. (
  118. 'type' => 'varchar-255',
  119. 'name' => '介绍-选填,如果想清空该介绍,请输入null。',
  120. 'default' => '',
  121. 'desc' => '请输入介绍',
  122. 'match' => 'option',
  123. 'update' => 'editor',
  124. ),
  125. 'level' => array
  126. (
  127. 'type' => 'tinyint-1',
  128. 'name' => '用户等级',
  129. 'default' => '1',
  130. 'desc' => '请选择用户等级',
  131. 'match' => 'is_numeric',
  132. //'option' => $level,
  133. //'update' => 'radio',
  134. //'list' => true,
  135. ),
  136. 'login_date' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '最近登录',
  140. 'match' => array('is_numeric', time()),
  141. 'desc' => '',
  142. 'default' => '0',
  143. //'list' => 'date("Y-m-d H:i:s", {login_date})',
  144. ),
  145. 'reg_date' => array
  146. (
  147. 'type' => 'int-11',
  148. 'name' => '注册时间',
  149. 'match' => array('is_numeric', time()),
  150. 'desc' => '',
  151. 'default' => '0',
  152. ),
  153. 'bind' => array
  154. (
  155. 'type' => 'tinyint-1',
  156. 'name' => '是否绑定手机',
  157. 'default' => '2',
  158. 'desc' => '请选择是否绑定手机',
  159. 'match' => 'is_numeric',
  160. //'option' => $bind,
  161. //'update' => 'radio',
  162. ),
  163. 'state' => array
  164. (
  165. 'type' => 'tinyint-1',
  166. 'name' => '状态',
  167. 'default' => '1',
  168. 'desc' => '请选择状态',
  169. 'match' => 'is_numeric',
  170. 'option' => $option,
  171. 'update' => 'radio',
  172. ),
  173. 'cdate' => array
  174. (
  175. 'type' => 'int-11',
  176. 'name' => '注册时间',
  177. 'match' => array('is_numeric', time()),
  178. 'desc' => '',
  179. # 只有insert时才生效
  180. 'insert' => true,
  181. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  182. ),
  183. ),
  184. # 更新表结构
  185. /*
  186. 'alter' => array
  187. (
  188. 1 => array
  189. (
  190. array('add', 'bind', 'bind', 'tinyint-1 2 是否绑定手机'),
  191. ),
  192. 'version' => 1,
  193. ),
  194. */
  195. # request 请求接口定义
  196. 'request' => array
  197. (
  198. # 此处定义是为跳出auth
  199. 'login' => array
  200. (
  201. 'option' => array
  202. (
  203. 'username' => 'yes',
  204. 'mobile' => 'yes',
  205. 'email' => 'yes',
  206. 'password' => 'yes',
  207. ),
  208. 'type' => 'one',
  209. ),
  210. # 验证手机号是否被使用
  211. 'checkMobile' => array
  212. (
  213. # 匹配的正则或函数 选填项
  214. 'where' => array
  215. (
  216. 'mobile' => 'yes',
  217. 'id' => array('yes', '!='),
  218. ),
  219. 'type' => 'one',
  220. ),
  221. ),
  222. );