admin.php 24 KB

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