user.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '正常',
  6. 2 => '冻结',
  7. );
  8. $level = array
  9. (
  10. 1 => '普通账号',
  11. 2 => '测试账号',
  12. //3 => '编辑',
  13. );
  14. $bind = array
  15. (
  16. 1 => '已绑定',
  17. 2 => '未绑定',
  18. );
  19. $auth = function()
  20. {
  21. return Dever::load('company/park-all');
  22. $data = Dever::load('company/park.all');
  23. return $data;
  24. };
  25. return array
  26. (
  27. # 表名
  28. 'name' => 'user',
  29. # 显示给用户看的名称
  30. 'lang' => '用户管理',
  31. # 后台菜单排序
  32. 'order' => 10,
  33. 'check' => 'mobile',
  34. # 数据结构
  35. 'struct' => array
  36. (
  37. 'id' => array
  38. (
  39. 'type' => 'int-11',
  40. 'name' => '用户ID',
  41. 'default' => '',
  42. 'desc' => '',
  43. 'match' => 'is_numeric',
  44. 'search' => 'order',
  45. 'list' => true,
  46. ),
  47. 'company' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => '所属公司',
  51. 'default' => '',
  52. 'desc' => '请选择所属公司',
  53. 'match' => 'is_numeric',
  54. ),
  55. 'username' => array
  56. (
  57. 'type' => 'varchar-80',
  58. 'name' => '用户名',
  59. 'default' => '',
  60. 'desc' => '请输入用户名',
  61. 'match' => 'is_string',
  62. 'update' => 'text',
  63. 'search' => 'fulltext',
  64. 'list' => true,
  65. ),
  66. 'auth' => array
  67. (
  68. 'type' => 'varchar-500',
  69. 'name' => '园区权限设置',
  70. 'default' => '',
  71. 'desc' => '请选择园区权限设置',
  72. 'match' => 'is_string',
  73. 'update' => 'radio',
  74. //每个项对应的一个input以及父级更新的类型
  75. //'update_input' => '数量',
  76. //'update_parent' => 'radio',
  77. 'option' => $auth,
  78. ),
  79. 'nickname' => array
  80. (
  81. 'type' => 'varchar-50',
  82. 'name' => '用户昵称',
  83. 'default' => '',
  84. 'desc' => '请输入用户昵称',
  85. 'match' => 'is_string',
  86. //'update' => 'text',
  87. //'search' => 'fulltext',
  88. //'list' => true,
  89. ),
  90. 'mobile' => array
  91. (
  92. 'type' => 'varchar-32',
  93. 'name' => '手机号',
  94. 'default' => '',
  95. 'desc' => '请输入用户手机号',
  96. 'match' => '/^(1(([358][0-9])|(45)|(47)))\d{8}$/',
  97. 'match' => 'option',
  98. 'update' => 'text',
  99. 'search' => 'fulltext',
  100. 'list' => true,
  101. ),
  102. 'password' => array
  103. (
  104. 'type' => 'varchar-50',
  105. 'name' => '密码',
  106. 'default' => '',
  107. 'desc' => '请输入密码',
  108. 'match' => 'option',
  109. 'update' => 'password',
  110. 'callback' => 'md5',
  111. ),
  112. 'avatar' => array
  113. (
  114. 'type' => 'varchar-150',
  115. 'name' => '头像',
  116. 'default' => '',
  117. 'desc' => '请选择头像',
  118. 'match' => 'option',
  119. 'update' => 'image',
  120. 'key' => '1',
  121. 'place' => '150',
  122. ),
  123. 'weixin' => array
  124. (
  125. 'type' => 'varchar-50',
  126. 'name' => '微信号',
  127. 'default' => '',
  128. 'desc' => '微信号',
  129. 'match' => 'option',
  130. 'update' => 'text',
  131. //'list' => true,
  132. ),
  133. 'level' => array
  134. (
  135. 'type' => 'tinyint-1',
  136. 'name' => '用户级别',
  137. 'default' => '1',
  138. 'desc' => '请选择用户级别',
  139. 'match' => 'is_numeric',
  140. 'option' => $level,
  141. 'update' => 'radio',
  142. 'list' => true,
  143. //'show' => 'yes',
  144. ),
  145. 'login_date' => array
  146. (
  147. 'type' => 'int-11',
  148. 'name' => '最近登录',
  149. 'match' => array('is_numeric', time()),
  150. 'desc' => '',
  151. 'default' => '0',
  152. //'list' => 'date("Y-m-d H:i:s", {login_date})',
  153. ),
  154. 'reg_date' => array
  155. (
  156. 'type' => 'int-11',
  157. 'name' => '注册时间',
  158. 'match' => array('is_numeric', time()),
  159. 'desc' => '',
  160. 'default' => '0',
  161. ),
  162. 'bind' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '是否绑定手机',
  166. 'default' => '2',
  167. 'desc' => '请选择是否绑定手机',
  168. 'match' => 'is_numeric',
  169. 'option' => $bind,
  170. 'update' => 'radio',
  171. 'show' => 'yes',
  172. 'list' => true,
  173. ),
  174. 'state' => array
  175. (
  176. 'type' => 'tinyint-1',
  177. 'name' => '状态',
  178. 'default' => '1',
  179. 'desc' => '请选择状态',
  180. 'match' => 'is_numeric',
  181. 'option' => $option,
  182. 'update' => 'radio',
  183. 'list' => true,
  184. ),
  185. 'cdate' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '录入时间',
  189. 'match' => array('is_numeric', time()),
  190. 'desc' => '',
  191. # 只有insert时才生效
  192. 'insert' => true,
  193. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  194. ),
  195. ),
  196. 'auth' => 'company',
  197. 'manage' => array
  198. (
  199. ),
  200. # request 请求接口定义
  201. 'request' => array
  202. (
  203. # 此处定义是为跳出auth
  204. 'login' => array
  205. (
  206. 'where' => array
  207. (
  208. 'username' => 'yes',
  209. 'password' => 'yes',
  210. ),
  211. 'type' => 'one',
  212. ),
  213. 'getByCompany' => array
  214. (
  215. 'where' => array
  216. (
  217. 'company' => array('yes', 'in'),
  218. 'state' => 1,
  219. ),
  220. 'type' => 'all',
  221. ),
  222. ),
  223. );