admin.php 27 KB

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