admin.php 29 KB

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