admin.php 28 KB

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