admin.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | admin.php 管理员表
  5. |--------------------------------------------------------------------------
  6. */
  7. # 定义几个常用的选项
  8. $status = array
  9. (
  10. 1 => '普通',
  11. 2 => '封禁',
  12. );
  13. $cur = Dever::load('manage/auth.data', false);
  14. $desc = '';
  15. if($cur && $cur['role'] > 1)
  16. {
  17. $desc = $cur['username'] . ',你好,你可以在此管理你的下属账号';
  18. $child = array_keys(Dever::db('manage/role')->all());
  19. $admin = Dever::db('manage/admin_role')->getData(array
  20. (
  21. 'role_id' => implode(',', $child),
  22. ));
  23. # 配置当前列表页的参数 只能查看自己下属的管理员
  24. Dever::$global['model']['manage/admin-list'] = array
  25. (
  26. 'option' => array
  27. (
  28. 'id' => array('yes', 'in'),
  29. ),
  30. 'option_id' => $admin ? array_keys($admin) : -1,
  31. );
  32. }
  33. $role = function()
  34. {
  35. return Dever::load('manage/role-getData');
  36. };
  37. $group = function()
  38. {
  39. return Dever::load('manage/group-all');
  40. };
  41. $config = function()
  42. {
  43. return Dever::load('manage/config-all');
  44. };
  45. # 获取头部菜单list 建议这里使用匿名函数
  46. $top = function()
  47. {
  48. $data = Dever::load('manage/top.all');
  49. $data['state'] = 1;
  50. return $data;
  51. };
  52. return array
  53. (
  54. # 表名
  55. 'name' => 'admin',
  56. # 显示给用户看的名称
  57. 'lang' => '管理账户设置',
  58. 'desc' => $desc,
  59. # 表类型 值为\innodb\myisam\,默认为innodb,仅在mysql类型有效
  60. 'type' => 'innodb',
  61. # 分区设置,现在仅支持mysql
  62. /*
  63. 'partition' => array
  64. (
  65. 'type' => 'range',//分区类型
  66. 'col' => 'year(cdate)',//分区字段,可以使用mysql内置函数
  67. 'exp' => 'LESS THAN',
  68. //设置分区的值
  69. 'value' => array
  70. (
  71. '1996',
  72. '1997',
  73. '1998',
  74. ),
  75. ),
  76. */
  77. /* 设置上级菜单,当config里设置menu后,这里将失效
  78. 'parent' => array
  79. (
  80. 'key' => 'kefu',
  81. 'order' => 1,
  82. 'name' => '客服设置',
  83. ),
  84. */
  85. # 这个表不使用cache功能
  86. //'cache' => false,
  87. /*
  88. # 用到哪个后台菜单上,对应项目的key
  89. 'menu' => 'project_niuyou_main',
  90. # 后台菜单排序
  91. 'order' => 10,
  92. # 显示到后台快捷发布中,值为排序
  93. 'fast' => 1,
  94. */
  95. 'order' => 9,
  96. # 检测email必须唯一
  97. 'check' => 'email',
  98. # 同步更新另外一个或多个表的多条关联数据,以逗号隔开
  99. 'sync' => array
  100. (
  101. 'manage/admin_role' => array
  102. (
  103. # 更新时的条件,另外一个表的字段 => 本表的字段
  104. 'where' => array('admin_id', 'id'),
  105. # 要更新的数据
  106. 'update' => array('role_id' => 'role'),
  107. # 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
  108. 'type' => 'delete',
  109. )
  110. ),
  111. /*
  112. # 查询出数据时,填充默认数据
  113. 'fill' => array
  114. (
  115. # 从哪个表填充
  116. 'cover/hot_service' => array
  117. (
  118. # 条件,另外一个表的字段 => 本表的字段
  119. 'where' => array('id' => 'service_id', 'seller_id' => '-1'),
  120. # 要填充的数据,另外一个表的字段 => 本表的字段,如果不填写就是所有的
  121. //'update' => array('name', 'title', 'desc', 'desc', 'back_color', 'pic', 'min_pic1', 'min_pic2', 'top', 'top_name', 'top_cover', 'hot_pic', 'case_pic', 'gradient', 'share_name', 'share_desc', 'share_pic', 'content', 'reorder'),
  122. # 不需要填充的字段 与update互斥
  123. 'no' => array('id', 'seller_id', 'service_id', 'chose', 'state', 'cdate')
  124. )
  125. ),
  126. */
  127. # 同步更新另外一个或多个表的一条关联数据
  128. /*
  129. 'syncone' => array
  130. (
  131. 'manage/admin_role' => array
  132. (
  133. # 更新另外一个表的字段 => 本表的字段
  134. 'where' => array('admin_id' => 'id'),
  135. # 要更新的数据
  136. 'update' => array('role_id' => 'role'),
  137. )
  138. ),
  139. */
  140. /*该方法用check替代
  141. 'start' => array
  142. (
  143. 'update' => 'manage/auth.checkEmail',
  144. 'insert' => 'manage/auth.checkEmail',
  145. ),
  146. */
  147. 'end' => array
  148. (
  149. 'update' => 'manage/auth.update',
  150. ),
  151. # 数据结构
  152. 'struct' => array
  153. (
  154. 'id' => array
  155. (
  156. 'type' => 'int-11',
  157. 'name' => '管理员ID',
  158. 'default' => '',
  159. 'desc' => '',
  160. 'match' => 'is_numeric',
  161. 'search' => 'order',
  162. 'list' => true,
  163. ),
  164. 'username' => array
  165. (
  166. 'type' => 'varchar-24',
  167. 'name' => '管理员名',
  168. 'default' => '',
  169. 'desc' => '请输入管理员名',
  170. 'match' => 'is_string',
  171. 'update' => 'text',
  172. # 自动完成功能,第一个参数是请求的地址,请自行实现,第二个参数是要使用的字段,共有id和value两个选择,id会特殊处理,value则直接把当前值写入,第三个参数是直接替换当前的值,第四个参数是当前表里的字段名,一般为分类的id
  173. //'autocomplete' => array('auth.role?json=1', 'value', 'manage/role-check#name', 'cate_id'),
  174. //'autocomplete' => array('auth.role?json=1'),
  175. 'search' => 'order,fulltext',
  176. 'list' => true,
  177. // 可以自定义表头 参考layui table表头自定义
  178. //'list_header' => array('width' => '60%'),
  179. # 绑定js脚本,更新时使用,第一个参数是执行的方式,第二个参数执行的方法,第三个参数是传值。
  180. //'bind' => array('onblur', 'loading', array('url' => Dever::url("auth.blur"))),
  181. ),
  182. #多级联动
  183. //'update' => 'linkage',//多级联动 option参数:请求地址(返回参数为level_num当前联动级数,level_id当前选择的id),参考area组件:dever package area
  184. //'option' => Dever::url('api.get', 'area'),
  185. 'email' => array
  186. (
  187. 'type' => 'varchar-150',
  188. 'name' => '邮箱-可用于登录,请准确填写,不允许重复',
  189. 'default' => '',
  190. 'desc' => '请输入邮箱',
  191. 'match' => Dever::rule('email'),
  192. 'update' => 'text',
  193. /*
  194. * search_name:检索名称
  195. * search_order:检索排序
  196. * search_after:展示当前检索之后需要展示什么,默认为<br />
  197. * 列表页搜索选项,这里的search或者update的值为
  198. * fulltext:全文检索,模糊匹配
  199. * text:精确匹配
  200. * day:按照日期检索
  201. * date:按照具体时间检索
  202. * exp:大小判断,仅能选择一项
  203. * select:选择器,需要option项
  204. * group:组选择器,需要option项
  205. * linkage:多级联动选择器,需要option项,值为联动数据接口地址,参考area组件 'option' => Dever::url('api.get', 'area'), 'list' => 'Dever::load("area/api.string", "{area}")',
  206. * exist:是否存在,需要exist项,基本配置为
  207. $source_id = array
  208. (
  209. 'yes' => '有值',
  210. 'no' => '没有值',
  211. 'no|2832' => '没有值或者有值为2832',
  212. 'yes|2832' => '有值并且过滤值为2829',
  213. '2832' => '查找',
  214. );
  215. * 如果search的值为数组,则认为是接口,需要从接口获取数据后再进行查找
  216. * 如'search' => array
  217. (
  218. 'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
  219. 'col' => 'name',//要查询的字段
  220. 'result' => 'id',//返回的字段
  221. 'search' => 'uid',//本表的字段,默认为当前的字段
  222. //'option' => $option, //选择模式
  223. ),
  224. * 就是将本字段email当做passport/user-one的name字段来查找id
  225. */
  226. 'search' => 'fulltext',
  227. 'list' => true,
  228. # 在手机版或者小屏幕下,列表页的表格是否展示,1为展示,2、3、4、5、6均为在一定宽度下展示,详细参考:https://github.com/nadangergeo/RWD-Table-Patterns
  229. 'level' => 1,
  230. //直接上传到云端
  231. //'upload' => 'qiniu',
  232. //上传大数据
  233. //'large' => true,
  234. ),
  235. # 比较特殊的一些设置,不断添加中:
  236. /*
  237. //启用复制其他字段的值
  238. 'testname' => array
  239. (
  240. 'type' => 'varchar-24',
  241. 'name' => '角色名',
  242. 'default' => '',
  243. 'desc' => '请输入角色名',
  244. 'match' => 'is_string',
  245. 'update' => 'copy.name',//直接复制name的值
  246. 'search' => 'order,fulltext',
  247. 'list' => true,
  248. ),
  249. //当前的字段属于另外一个表,主要不要有type,当name不存在时,此处直接复用整个role_test表里的struct
  250. 'manage-role_test-name'=> array
  251. (
  252. 'name' => '测试名',
  253. 'default' => '',
  254. 'desc' => '请输入角色名',
  255. 'match' => 'option',
  256. 'update' => 'text',//直接复制name的值
  257. # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段,当前表、关联表
  258. 'sync' => array('id', 'role_id'),
  259. 'list' => true,
  260. //'list' => 'Dever::load("setting/role-find#name", "{manage-role_test-name}")',
  261. ),
  262. //同时设置另外一个表的数据,设置同上,只有update的值不同
  263. 'manage-role_test' => array
  264. (
  265. 'type' => 'text-1000',
  266. 'name' => '属性设置',
  267. 'default' => '',
  268. 'desc' => '属性设置',
  269. 'match' => 'is_string',
  270. 'sync' => array('id', 'category_id'),
  271. 'update' => array(1),
  272. ),
  273. 'text' => array
  274. (
  275. 'type' => 'text-1000',
  276. 'name' => '文字设置',
  277. 'default' => '',
  278. 'desc' => '文字设置',
  279. 'match' => 'is_string',
  280. 'option' => $text,
  281. 'update' => array
  282. (
  283. array
  284. (
  285. 'col' => 'name',
  286. 'name' => '文字内容',
  287. 'default' => '',
  288. 'desc' => '文字内容',
  289. 'match' => 'is_string',
  290. 'update' => 'textarea',
  291. ),
  292. array
  293. (
  294. 'col' => 'color',
  295. 'name' => '文字颜色',
  296. 'default' => '#000000',
  297. 'desc' => '文字颜色',
  298. 'match' => 'is_string',
  299. 'update' => 'color',
  300. ),
  301. array
  302. (
  303. 'col' => 'bgcolor_type',
  304. 'name' => '是否设置背景颜色',
  305. 'default' => '2',
  306. 'desc' => '是否设置背景颜色',
  307. 'match' => 'is_string',
  308. 'update' => 'radio',
  309. 'option' => $bgcolor_type,
  310. 'control' => 'bgcolor_type',
  311. ),
  312. array
  313. (
  314. 'col' => 'bgcolor',
  315. 'name' => '背景颜色',
  316. 'default' => '#000000',
  317. 'desc' => '背景颜色',
  318. 'match' => 'is_string',
  319. 'update' => 'color',
  320. 'show' => 'bgcolor_type=1'
  321. ),
  322. array
  323. (
  324. 'col' => 'size',
  325. 'name' => '文字大小-直接输入像素数字',
  326. 'default' => '16',
  327. 'desc' => '结果描述',
  328. 'match' => 'is_numeric',
  329. 'update' => 'text',
  330. ),
  331. array
  332. (
  333. 'col' => 'goods_id',
  334. 'name' => '选择商品',
  335. 'default' => '',
  336. 'desc' => '选择商品',
  337. 'match' => 'option',
  338. 'update' => 'select',
  339. 'update_search' => 'goods/lib/manage.search',
  340. ),
  341. ),
  342. ),
  343. #设置分割条
  344. /*
  345. 'hr1' => array
  346. (
  347. 'name' => '基本信息',
  348. 'class' => '',//本项必须填写
  349. 'attr' => '',
  350. ),
  351. */
  352. /*
  353. 'cate' => array
  354. (
  355. 'type' => 'varchar-300',
  356. 'name' => '标签分类',
  357. 'default' => '1',
  358. 'desc' => '标签分类',
  359. 'match' => 'is_string',
  360. 'update' => 'select',
  361. 'option' => $cate,
  362. 'search' => 'fulltext',
  363. //'list' => true,
  364. 'control' => 'cate',
  365. ),
  366. # 标签,根据分类变化的标签
  367. 'tag' => array
  368. (
  369. 'type' => 'varchar-300',
  370. 'name' => '标签',
  371. 'default' => '',
  372. 'desc' => '标签',
  373. 'match' => 'is_string',
  374. 'update' => 'checkbox',
  375. # 新增接口 暂未实现
  376. 'adding' => 'tag/manage.getByCate?cate=',
  377. # 开启这个,需要将update更换为text类型,输入文字即可选择标签
  378. //'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),
  379. 'search' => 'fulltext',
  380. //'list' => true,
  381. # 与上边的cate联动(ajax)
  382. 'show' => 'cate=tag/manage.getByCate?cate=',
  383. # 或者加入可选项 待实现
  384. 'option' => $cate,
  385. ),
  386. # 标签,根据分类变化的标签
  387. 'tag' => array
  388. (
  389. 'type' => 'text-255',
  390. 'name' => '标签',
  391. 'default' => '',
  392. 'desc' => '标签',
  393. 'match' => 'is_string',
  394. // 多级联动+多选
  395. 'update' => 'linkage_checkbox',
  396. 'option' => array(Dever::url('api.get', 'area'), '', Dever::url('api.get', 'area')),//先选择多级联动,再选择多选
  397. ),
  398. # 加载地图
  399. 'map' => array
  400. (
  401. 'type' => 'varchar-300',
  402. 'name' => '地理位置',
  403. 'default' => '',
  404. 'desc' => '地理位置',
  405. 'match' => 'is_string',
  406. # 如果是map,必须在config的base.php中设置map信息
  407. //'update' => 'map',
  408. 'search' => 'fulltext',
  409. //'list' => true,
  410. //自定义编辑器右侧按钮
  411. 'editor' => array
  412. (
  413. 'name' => '选择插入模块',
  414. 'button' => array
  415. (
  416. array
  417. (
  418. # 名称
  419. 'name' => '图片',
  420. # 资源库id
  421. 'key' => 1,
  422. # 类型
  423. 'type' => 'image',
  424. ),
  425. array
  426. (
  427. 'name' => '音频',
  428. 'key' => 2,
  429. 'type' => 'media',
  430. ),
  431. array
  432. (
  433. 'name' => '视频',
  434. 'key' => 'video/lib/core.vod',
  435. ),
  436. array
  437. (
  438. 'name' => '直播',
  439. 'key' => 'video/lib/core.live',
  440. ),
  441. ),
  442. ),
  443. ),
  444. # 三级地区联动
  445. 'area' => array
  446. (
  447. 'type' => 'varchar-100',
  448. 'name' => '地区',
  449. 'default' => '',
  450. 'desc' => '地区',
  451. 'match' => 'is_string',
  452. 'search' => 'linkage',
  453. 'update' => 'linkage',//多级联动 option参数:请求地址(参数为level_num当前联动级数,level_id当前选择的id)
  454. 'option' => Dever::url('api.get', 'area'),
  455. 'list' => 'Dever::load("area/api.string", "{area}")',
  456. ),
  457. # 无限级联动
  458. 'category' => array
  459. (
  460. 'type' => 'varchar-500',
  461. 'name' => '分类',
  462. 'default' => '',
  463. 'desc' => '分类',
  464. 'match' => 'is_string',
  465. 'search' => 'linkage',
  466. //'update' => 'linkage',
  467. 'option' => Dever::url('api.get', 'category'),
  468. 'list' => 'Dever::load("category/api.string", "{category}")',
  469. ),
  470. # 属性管理
  471. 'attr' => array
  472. (
  473. 'type' => 'varchar-800',
  474. 'name' => '属性设置',
  475. 'default' => '',
  476. 'desc' => '属性设置',
  477. 'match' => 'option',
  478. 'update' => 'checkbox',
  479. 'option' => $attr,
  480. 'update_input' => '',
  481. 'update_input_default' => '',
  482. 'update_parent' => 'checkbox',
  483. ),
  484. # 属性管理 需要用这个来设置值
  485. 'attr_input' => array
  486. (
  487. 'type' => 'text-255',
  488. 'name' => '属性值设置',
  489. 'default' => '',
  490. 'desc' => '属性值设置',
  491. 'match' => 'option',
  492. ),
  493. */
  494. 'mobile' => array
  495. (
  496. 'type' => 'varchar-32',
  497. 'name' => '手机号',
  498. 'default' => '',
  499. 'desc' => '请输入手机号',
  500. 'match' => Dever::rule('mobile'),
  501. 'update' => 'text',
  502. 'search' => 'fulltext',
  503. 'list' => true,
  504. 'level' => 1,
  505. # 显示在table中
  506. //'list_table'=> '111',
  507. ),
  508. 'password' => array
  509. (
  510. 'type' => 'varchar-64',
  511. 'name' => '管理员密码',
  512. 'default' => '',
  513. 'desc' => '请输入管理员密码',
  514. 'match' => 'option',
  515. 'update' => 'password',
  516. 'callback' => 'hash.sha256',
  517. ),
  518. 'config' => array
  519. (
  520. 'type' => 'int-11',
  521. 'name' => '人性化配置',
  522. 'default' => '1',
  523. 'desc' => '个性化配置',
  524. 'match' => 'is_numeric',
  525. 'option' => $config,
  526. 'update' => 'select',
  527. //'list' => true,
  528. ),
  529. 'role' => array
  530. (
  531. 'type' => 'varchar-100',
  532. 'name' => '角色名称',
  533. 'default' => '1',
  534. 'desc' => '请选择角色',
  535. 'match' => 'is_string',
  536. 'option' => $role,
  537. 'update' => 'checkbox',
  538. 'list' => true,
  539. ),
  540. 'group' => array
  541. (
  542. 'type' => 'int-11',
  543. 'name' => '分组',
  544. 'default' => '1',
  545. 'desc' => '请选择分组',
  546. 'match' => 'is_numeric',
  547. 'option' => $group,
  548. 'update' => 'select',
  549. //'list' => true,
  550. # 取代option,从接口里读取选项
  551. //'update_search' => 'goods/lib/manage.search_sku',
  552. ),
  553. 'top' => array
  554. (
  555. 'type' => 'text-255',
  556. 'name' => '头部菜单-这里的头部菜单如果设置,则会覆盖角色中的头部菜单',
  557. 'default' => '',
  558. 'desc' => '请选择头部菜单',
  559. 'match' => 'option',
  560. //'update' => 'checkbox',
  561. 'option' => $top,
  562. ),
  563. 'state' => array
  564. (
  565. 'type' => 'tinyint-1',
  566. 'name' => '数据状态',
  567. 'default' => '1',
  568. 'desc' => '请选择状态',
  569. 'match' => 'is_numeric',
  570. //'option' => $option,
  571. //'update' => 'radio',
  572. //'list' => true,
  573. //'extend' => true,//扩展功能,该字段为虚拟字段,只在数据库中建立extend字段来保存 后续实现
  574. ),
  575. /*
  576. 提供冲突检测机制(乐观锁),保证高并发下的数据安全
  577. 这是模仿自 php 的 Memcached 扩展 后续实现
  578. 'token' => array
  579. (
  580. 'type' => 'int-11',
  581. 'name' => 'token',
  582. 'default' => '1',
  583. 'desc' => 'token',
  584. 'match' => 'is_numeric',
  585. ),
  586. */
  587. 'status' => array
  588. (
  589. 'type' => 'tinyint-1',
  590. 'name' => '状态',
  591. 'default' => '1',
  592. 'desc' => '请选择状态',
  593. 'match' => 'is_numeric',
  594. 'option' => $status,
  595. 'update' => 'radio',
  596. 'list' => true,
  597. 'edit' => true,
  598. ),
  599. 'cdate' => array
  600. (
  601. 'type' => 'int-11',
  602. 'name' => '录入时间',
  603. 'match' => array('is_numeric', DEVER_TIME),
  604. 'desc' => '',
  605. # 只有insert时才生效
  606. 'insert' => true,
  607. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  608. ),
  609. ),
  610. 'manage' => array
  611. (
  612. # 图片上传后调用的接口
  613. //'upload' => 'shop/lib/sign.upload?sign=1',
  614. # 开启语言包模式
  615. //'lang' => 'name',
  616. # 开启tab模式
  617. //'tab' => array('基础设置', '前端样式'),
  618. # 列表页的类型
  619. //'list_type' => 'tree',
  620. /*
  621. 'list_button' => array
  622. (
  623. 'add' => array('新增子分类', '"{category}" == -1 ? "category&option_category={id}" : "category&option_category={category},{id}"'),
  624. ),*/
  625. # 表格使用js模式,默认是html渲染模式
  626. //'list_table' => 'js',
  627. 'delete' => false,
  628. // 载入自定义资源
  629. 'res' => array
  630. (
  631. 'js' => 'demo',
  632. 'css' => 'demo',
  633. ),
  634. # 快捷更新
  635. /*
  636. 'list_button' => array
  637. (
  638. 'edit' => array('审核', 'name'),
  639. ),
  640. */
  641. /*
  642. 'insert' => false,
  643. 'edit' => false,
  644. //'delete' => false,
  645. # 自定义快捷新增和编辑
  646. 'button' => array
  647. (
  648. '新增' => array('fast', 'name,reorder'),
  649. '导入订单' = array('fast', '', 'import&project=upload&call=agent/lib/manage.import&key=4');
  650. //也可直接这样:Dever::load('upload/import.url', 'store/admin/order.import', 10)
  651. ),
  652. # 快捷更新
  653. 'list_button' => array
  654. (
  655. 'edit' => array('编辑', 'name,reorder'),
  656. ),
  657. */
  658. ),
  659. # 更新表结构
  660. 'alter' => array
  661. (
  662. 2 => array
  663. (
  664. //array('update', 'role', 'role', 'varchar-100 1 角色'),
  665. //array('add', 'config', 'config', 'int-11 1 配置'),
  666. ),
  667. 'version' => 2,
  668. ),
  669. # 默认值
  670. /*
  671. 'default' => array
  672. (
  673. 'col' => 'username,email,password,role,state,cdate',
  674. 'value' => array
  675. (
  676. //'"DMC","DMC@dever.cc","'. md5('admin_' . date('Y_m_d_H')) . '",1, 1,' . time(),
  677. '"admin","DMC@dever.cc","'. hash('sha256', 'admin_123') . '",1, 1,' . DEVER_TIME,
  678. ),
  679. ),
  680. */
  681. # 索引
  682. 'index' => array
  683. (
  684. # 索引名 => 索引id
  685. //'id' => 'id,state',
  686. ),
  687. # request 请求接口定义
  688. 'request' => array
  689. (
  690. # one 根据用户名和密码取一条数据
  691. 'user' => array
  692. (
  693. # 匹配的正则或函数 必填项
  694. 'where' => array
  695. (
  696. //'username' => '/^([A-Za-z0-9])/',
  697. //'username' => 'yes',
  698. 'email' => 'yes',
  699. 'status' => 1,
  700. 'state' => 1,
  701. //'password' => 'is_string',
  702. ),
  703. 'type' => 'one',
  704. # 为这个接口独立设置缓存
  705. 'cache' => true,
  706. ),
  707. # one 根据用户名和密码取一条数据
  708. 'email' => array
  709. (
  710. # 匹配的正则或函数 必填项
  711. 'where' => array
  712. (
  713. //'username' => '/^([A-Za-z0-9])/',
  714. //'username' => 'yes',
  715. 'email' => 'yes',
  716. 'status' => 1,
  717. 'state' => 1,
  718. //'password' => 'is_string',
  719. ),
  720. 'type' => 'one',
  721. # 为这个接口独立设置缓存
  722. 'cache' => true,
  723. ),
  724. # one 根据用户名和密码取一条数据
  725. 'mobile' => array
  726. (
  727. # 匹配的正则或函数 必填项
  728. 'where' => array
  729. (
  730. //'username' => '/^([A-Za-z0-9])/',
  731. //'username' => 'yes',
  732. 'mobile' => 'yes',
  733. 'status' => 1,
  734. 'state' => 1,
  735. //'password' => 'is_string',
  736. ),
  737. 'type' => 'one',
  738. # 为这个接口独立设置缓存
  739. 'cache' => true,
  740. ),
  741. # 更新密码
  742. 'password' => array
  743. (
  744. 'type' => 'update',
  745. 'where' => array
  746. (
  747. 'id' => 'yes',
  748. ),
  749. 'set' => array
  750. (
  751. 'password' => 'yes',
  752. ),
  753. ),
  754. 'getSearch' => array
  755. (
  756. # 匹配的正则或函数 选填项
  757. 'option' => array
  758. (
  759. 'col' => array('yes-mobile,username,email', 'like'),
  760. ),
  761. 'type' => 'all',
  762. 'col' => '*|id',
  763. ),
  764. ),
  765. );