admin.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  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. 'category' => array
  344. (
  345. 'type' => 'varchar-500',
  346. 'name' => '属性分类',
  347. 'default' => '',
  348. 'desc' => '分类',
  349. 'match' => 'is_string',
  350. 'search' => 'linkage',
  351. //'update' => $id ? false : 'linkage',
  352. 'update' => 'linkage',//这里select和radio也支持
  353. 'option' => Dever::url('category.get', 'product'),
  354. 'list' => 'Dever::load("product/category.string", "{category}")',
  355. 'load' => 'product-info_attr',
  356. 'tab' => 1,
  357. ),
  358. 'product-info_attr'=> array
  359. (
  360. 'name' => '属性设置',
  361. 'default' => '',
  362. 'desc' => '请先选择属性分类',
  363. 'match' => 'option',
  364. # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
  365. 'sync' => array('id', 'info_id'),
  366. # 根据category字段的值,获取product/attr.search接口的内容
  367. 'update' => 'load',
  368. 'update_load' => array('product/attr.getManageByCate', 'category'),
  369. 'tab' => 1,
  370. ),
  371. #设置分割条
  372. /*
  373. 'hr1' => array
  374. (
  375. 'name' => '基本信息',
  376. 'class' => '',//本项必须填写
  377. 'attr' => '',
  378. ),
  379. */
  380. /*
  381. 'cate' => array
  382. (
  383. 'type' => 'varchar-300',
  384. 'name' => '标签分类',
  385. 'default' => '1',
  386. 'desc' => '标签分类',
  387. 'match' => 'is_string',
  388. 'update' => 'select',
  389. 'option' => $cate,
  390. 'search' => 'fulltext',
  391. //'list' => true,
  392. 'control' => 'cate',
  393. ),
  394. # 标签,根据分类变化的标签
  395. 'tag' => array
  396. (
  397. 'type' => 'varchar-300',
  398. 'name' => '标签',
  399. 'default' => '',
  400. 'desc' => '标签',
  401. 'match' => 'is_string',
  402. 'update' => 'checkbox',
  403. # 新增接口 暂未实现
  404. 'adding' => 'tag/manage.getByCate?cate=',
  405. # 开启这个,需要将update更换为text类型,输入文字即可选择标签
  406. //'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),
  407. 'search' => 'fulltext',
  408. //'list' => true,
  409. # 与上边的cate联动(ajax)
  410. 'show' => 'cate=tag/manage.getByCate?cate=',
  411. # 或者加入可选项 待实现
  412. 'option' => $cate,
  413. ),
  414. # 标签,根据分类变化的标签
  415. 'tag' => array
  416. (
  417. 'type' => 'text-255',
  418. 'name' => '标签',
  419. 'default' => '',
  420. 'desc' => '标签',
  421. 'match' => 'is_string',
  422. // 多级联动+多选
  423. 'update' => 'linkage_checkbox',
  424. 'option' => array(Dever::url('api.get', 'area'), '', Dever::url('api.get', 'area')),//先选择多级联动,再选择多选
  425. ),
  426. # 加载地图
  427. 'map' => array
  428. (
  429. 'type' => 'varchar-300',
  430. 'name' => '地理位置',
  431. 'default' => '',
  432. 'desc' => '地理位置',
  433. 'match' => 'is_string',
  434. # 如果是map,必须在config的base.php中设置map信息
  435. //'update' => 'map',
  436. 'search' => 'fulltext',
  437. //'list' => true,
  438. //自定义编辑器右侧按钮
  439. 'editor' => array
  440. (
  441. 'name' => '选择插入模块',
  442. 'button' => array
  443. (
  444. array
  445. (
  446. # 名称
  447. 'name' => '图片',
  448. # 资源库id
  449. 'key' => 1,
  450. # 类型
  451. 'type' => 'image',
  452. ),
  453. array
  454. (
  455. 'name' => '音频',
  456. 'key' => 2,
  457. 'type' => 'media',
  458. ),
  459. array
  460. (
  461. 'name' => '视频',
  462. 'key' => 'video/lib/core.vod',
  463. ),
  464. array
  465. (
  466. 'name' => '直播',
  467. 'key' => 'video/lib/core.live',
  468. ),
  469. ),
  470. ),
  471. ),
  472. # 三级地区联动
  473. 'area' => array
  474. (
  475. 'type' => 'varchar-100',
  476. 'name' => '地区',
  477. 'default' => '',
  478. 'desc' => '地区',
  479. 'match' => 'is_string',
  480. 'search' => 'linkage',
  481. 'update' => 'linkage',//多级联动 option参数:请求地址(参数为level_num当前联动级数,level_id当前选择的id)
  482. 'option' => Dever::url('api.get', 'area'),
  483. 'list' => 'Dever::load("area/api.string", "{area}")',
  484. ),
  485. # 无限级联动
  486. 'category' => array
  487. (
  488. 'type' => 'varchar-500',
  489. 'name' => '分类',
  490. 'default' => '',
  491. 'desc' => '分类',
  492. 'match' => 'is_string',
  493. 'search' => 'linkage',
  494. //'update' => 'linkage',
  495. 'option' => Dever::url('api.get', 'category'),
  496. 'list' => 'Dever::load("category/api.string", "{category}")',
  497. ),
  498. # 属性管理
  499. 'attr' => array
  500. (
  501. 'type' => 'varchar-800',
  502. 'name' => '属性设置',
  503. 'default' => '',
  504. 'desc' => '属性设置',
  505. 'match' => 'option',
  506. 'update' => 'checkbox',
  507. 'option' => $attr,
  508. 'update_input' => '',
  509. 'update_input_default' => '',
  510. 'update_parent' => 'checkbox',
  511. ),
  512. # 属性管理 需要用这个来设置值
  513. 'attr_input' => array
  514. (
  515. 'type' => 'text-255',
  516. 'name' => '属性值设置',
  517. 'default' => '',
  518. 'desc' => '属性值设置',
  519. 'match' => 'option',
  520. ),
  521. */
  522. 'mobile' => array
  523. (
  524. 'type' => 'varchar-32',
  525. 'name' => '手机号',
  526. 'default' => '',
  527. 'desc' => '请输入手机号',
  528. 'match' => Dever::rule('mobile'),
  529. 'update' => 'text',
  530. 'search' => 'fulltext',
  531. 'list' => true,
  532. 'level' => 1,
  533. # 显示在table中
  534. //'list_table'=> '111',
  535. ),
  536. 'password' => array
  537. (
  538. 'type' => 'varchar-64',
  539. 'name' => '管理员密码',
  540. 'default' => '',
  541. 'desc' => '请输入管理员密码',
  542. 'match' => 'option',
  543. 'update' => 'password',
  544. 'callback' => 'hash.sha256',
  545. ),
  546. 'config' => array
  547. (
  548. 'type' => 'int-11',
  549. 'name' => '人性化配置',
  550. 'default' => '1',
  551. 'desc' => '个性化配置',
  552. 'match' => 'is_numeric',
  553. 'option' => $config,
  554. 'update' => 'select',
  555. //'list' => true,
  556. ),
  557. 'role' => array
  558. (
  559. 'type' => 'varchar-100',
  560. 'name' => '角色名称',
  561. 'default' => '1',
  562. 'desc' => '请选择角色',
  563. 'match' => 'is_string',
  564. 'option' => $role,
  565. 'update' => 'checkbox',
  566. 'list' => true,
  567. ),
  568. 'group' => array
  569. (
  570. 'type' => 'int-11',
  571. 'name' => '分组',
  572. 'default' => '1',
  573. 'desc' => '请选择分组',
  574. 'match' => 'is_numeric',
  575. 'option' => $group,
  576. 'update' => 'select',
  577. //'list' => true,
  578. # 取代option,从接口里读取选项
  579. //'update_search' => 'goods/lib/manage.search_sku',
  580. ),
  581. 'top' => array
  582. (
  583. 'type' => 'text-255',
  584. 'name' => '头部菜单-这里的头部菜单如果设置,则会覆盖角色中的头部菜单',
  585. 'default' => '',
  586. 'desc' => '请选择头部菜单',
  587. 'match' => 'option',
  588. //'update' => 'checkbox',
  589. 'option' => $top,
  590. ),
  591. 'state' => array
  592. (
  593. 'type' => 'tinyint-1',
  594. 'name' => '数据状态',
  595. 'default' => '1',
  596. 'desc' => '请选择状态',
  597. 'match' => 'is_numeric',
  598. //'option' => $option,
  599. //'update' => 'radio',
  600. //'list' => true,
  601. //'extend' => true,//扩展功能,该字段为虚拟字段,只在数据库中建立extend字段来保存 后续实现
  602. ),
  603. /*
  604. 提供冲突检测机制(乐观锁),保证高并发下的数据安全
  605. 这是模仿自 php 的 Memcached 扩展 后续实现
  606. 'token' => array
  607. (
  608. 'type' => 'int-11',
  609. 'name' => 'token',
  610. 'default' => '1',
  611. 'desc' => 'token',
  612. 'match' => 'is_numeric',
  613. ),
  614. */
  615. 'status' => array
  616. (
  617. 'type' => 'tinyint-1',
  618. 'name' => '状态',
  619. 'default' => '1',
  620. 'desc' => '请选择状态',
  621. 'match' => 'is_numeric',
  622. 'option' => $status,
  623. 'update' => 'radio',
  624. 'list' => true,
  625. 'edit' => true,
  626. ),
  627. 'cdate' => array
  628. (
  629. 'type' => 'int-11',
  630. 'name' => '录入时间',
  631. 'match' => array('is_numeric', DEVER_TIME),
  632. 'desc' => '',
  633. # 只有insert时才生效
  634. //'search' => 'month_eq',//month 是月份区间搜索,year是年份区间搜索,eq是相等月份搜索
  635. 'insert' => true,
  636. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  637. ),
  638. ),
  639. 'manage' => array
  640. (
  641. # 图片上传后调用的接口
  642. //'upload' => 'shop/lib/sign.upload?sign=1',
  643. # 开启语言包模式
  644. //'lang' => 'name',
  645. # 开启tab模式
  646. //'tab' => array('基础设置', '前端样式'),
  647. # 列表页的类型
  648. //'list_type' => 'tree',
  649. /*
  650. 'list_button' => array
  651. (
  652. 'add' => array('新增子分类', '"{category}" == -1 ? "category&option_category={id}" : "category&option_category={category},{id}"'),
  653. ),*/
  654. # 表格使用js模式,默认是html渲染模式
  655. //'list_table' => 'js',
  656. 'delete' => false,
  657. // 载入自定义资源
  658. 'res' => array
  659. (
  660. 'js' => 'demo',
  661. 'css' => 'demo',
  662. ),
  663. # 快捷更新
  664. /*
  665. 'list_button' => array
  666. (
  667. 'edit' => array('审核', 'name'),
  668. ),
  669. */
  670. /*
  671. 'insert' => false,
  672. 'edit' => false,
  673. //'delete' => false,
  674. # 自定义快捷新增和编辑
  675. 'button' => array
  676. (
  677. '新增' => array('fast', 'name,reorder'),
  678. '导入订单' = array('fast', '', 'import&project=upload&call=agent/lib/manage.import&key=4');
  679. //也可直接这样:Dever::load('upload/import.url', 'store/admin/order.import', 10)
  680. ),
  681. # 快捷更新
  682. 'list_button' => array
  683. (
  684. 'edit' => array('编辑', 'name,reorder'),
  685. ),
  686. */
  687. ),
  688. # 更新表结构
  689. 'alter' => array
  690. (
  691. 2 => array
  692. (
  693. //array('update', 'role', 'role', 'varchar-100 1 角色'),
  694. //array('add', 'config', 'config', 'int-11 1 配置'),
  695. ),
  696. 'version' => 2,
  697. ),
  698. # 默认值
  699. /*
  700. 'default' => array
  701. (
  702. 'col' => 'username,email,password,role,state,cdate',
  703. 'value' => array
  704. (
  705. //'"DMC","DMC@dever.cc","'. md5('admin_' . date('Y_m_d_H')) . '",1, 1,' . time(),
  706. '"admin","DMC@dever.cc","'. hash('sha256', 'admin_123') . '",1, 1,' . DEVER_TIME,
  707. ),
  708. ),
  709. */
  710. # 索引
  711. 'index' => array
  712. (
  713. # 索引名 => 索引id
  714. //'id' => 'id,state',
  715. ),
  716. # request 请求接口定义
  717. 'request' => array
  718. (
  719. # one 根据用户名和密码取一条数据
  720. 'user' => array
  721. (
  722. # 匹配的正则或函数 必填项
  723. 'where' => array
  724. (
  725. //'username' => '/^([A-Za-z0-9])/',
  726. //'username' => 'yes',
  727. 'email' => 'yes',
  728. 'status' => 1,
  729. 'state' => 1,
  730. //'password' => 'is_string',
  731. ),
  732. 'type' => 'one',
  733. # 为这个接口独立设置缓存
  734. 'cache' => true,
  735. ),
  736. # one 根据用户名和密码取一条数据
  737. 'email' => array
  738. (
  739. # 匹配的正则或函数 必填项
  740. 'where' => array
  741. (
  742. //'username' => '/^([A-Za-z0-9])/',
  743. //'username' => 'yes',
  744. 'email' => 'yes',
  745. 'status' => 1,
  746. 'state' => 1,
  747. //'password' => 'is_string',
  748. ),
  749. 'type' => 'one',
  750. # 为这个接口独立设置缓存
  751. 'cache' => true,
  752. ),
  753. # one 根据用户名和密码取一条数据
  754. 'mobile' => array
  755. (
  756. # 匹配的正则或函数 必填项
  757. 'where' => array
  758. (
  759. //'username' => '/^([A-Za-z0-9])/',
  760. //'username' => 'yes',
  761. 'mobile' => 'yes',
  762. 'status' => 1,
  763. 'state' => 1,
  764. //'password' => 'is_string',
  765. ),
  766. 'type' => 'one',
  767. # 为这个接口独立设置缓存
  768. 'cache' => true,
  769. ),
  770. # 更新密码
  771. 'password' => array
  772. (
  773. 'type' => 'update',
  774. 'where' => array
  775. (
  776. 'id' => 'yes',
  777. ),
  778. 'set' => array
  779. (
  780. 'password' => 'yes',
  781. ),
  782. ),
  783. 'getSearch' => array
  784. (
  785. # 匹配的正则或函数 选填项
  786. 'option' => array
  787. (
  788. 'col' => array('yes-mobile,username,email', 'like'),
  789. ),
  790. 'type' => 'all',
  791. 'col' => '*|id',
  792. ),
  793. ),
  794. );