admin.php 23 KB

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