admin.php 26 KB

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