admin.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  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_check' => 'scm_servicer-out_order_goods',
  697. # 不展示保存按钮
  698. //'update_save' => false,
  699. # 显示描述
  700. //'desc' => 'test',
  701. # 定义sku对应的表,不填写则默认为info_spec和info_sku
  702. /*
  703. 'sku' => array
  704. (
  705. # 定义表名
  706. 'spec' => 'info_spec',
  707. 'sku' => 'info_sku',
  708. # 定义字段
  709. 'col' => array
  710. (
  711. 'pic' => array('name' => '图片', 'verify' => 'string', 'type' => 'image'),
  712. 'code' => array('name' => '商品编码', 'verify' => 'string', 'type' => 'input'),
  713. 'price' => array('name' => '销售价(元)', 'verify' => 'number', 'type' => 'input'),
  714. 'buy_price' => array('name' => '采购价(元)', 'verify' => 'number', 'type' => 'input'),
  715. 'cost_price' => array('name' => '成本价(元)', 'verify' => 'number', 'type' => 'input'),
  716. ),
  717. # 接口
  718. 'api' => array
  719. (
  720. 'spec' => 'product/sku.spec',
  721. 'sku' => 'product/sku.sku',
  722. # 上传接口
  723. 'upload' => 'upload/save.start?key=1',
  724. ),
  725. ),
  726. */
  727. # 图片上传后调用的接口
  728. //'upload' => 'shop/lib/sign.upload?sign=1',
  729. # 开启语言包模式
  730. //'lang' => 'name',
  731. # 开启tab模式
  732. //'tab' => array('基础设置', '前端样式'),
  733. # 列表页的类型
  734. //'list_type' => 'tree',
  735. /*
  736. 'list_button' => array
  737. (
  738. 'add' => array('新增子分类', '"{category}" == -1 ? "category&option_category={id}" : "category&option_category={category},{id}"'),
  739. ),*/
  740. # 表格使用js模式,默认是html渲染模式
  741. //'list_table' => 'js',
  742. 'delete' => false,
  743. // 载入自定义资源
  744. 'res' => array
  745. (
  746. 'js' => 'demo',
  747. 'css' => 'demo',
  748. ),
  749. # 快捷更新
  750. /*
  751. 'list_button' => array
  752. (
  753. 'edit' => array('审核', 'name'),
  754. ),
  755. */
  756. /*
  757. 'insert' => false,
  758. 'edit' => false,
  759. //'delete' => false,
  760. # 自定义快捷新增和编辑
  761. 'button' => array
  762. (
  763. # 快速新增
  764. '新增' => array('fast', 'name,reorder'),
  765. '导入订单' = array('fast', '', 'import&project=upload&call=agent/lib/manage.import&key=4');
  766. //也可直接这样:Dever::load('upload/import.url', 'store/admin/order.import', 10)
  767. # 批量创建订单
  768. '创建提现单' => array('oper_mul', 'option/auth.test'),
  769. ),
  770. # 快捷更新
  771. 'list_button' => array
  772. (
  773. 'edit' => array('编辑', 'name,reorder'),
  774. ),
  775. */
  776. 'button' => array
  777. (
  778. //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
  779. '公司设置' => array('list', 'company&oper_parent=admin'),
  780. '部门设置' => array('list', 'group&oper_parent=admin'),
  781. ),
  782. ),
  783. # 更新表结构
  784. 'alter' => array
  785. (
  786. 5 => array
  787. (
  788. array('update', 'group', 'group', 'varchar-1000 {} 部门'),
  789. //array('add', 'config', 'config', 'int-11 1 配置'),
  790. ),
  791. 'version' => 5,
  792. ),
  793. /*
  794. # 权限表
  795. 'end' => array
  796. (
  797. 'insert' => array
  798. (
  799. 'manage/top.sync',
  800. ),
  801. 'update' => array
  802. (
  803. 'manage/top.sync',
  804. ),
  805. ),
  806. 'top' => array
  807. (
  808. # 数据来源
  809. 'data' => 'find',
  810. # 菜单名
  811. 'name' => '期权公司设置',
  812. # 默认值
  813. 'value' => 1,
  814. # 对应的字段值,设置这个之后,所有设置等于这个值的字段,都要遵循这个权限的控制
  815. 'key' => 'option/company_id',
  816. # 本表中代表名称的字段
  817. 'col' => 'name',
  818. ),
  819. # 需要设置top权限的表
  820. 'top' => 'option/company_id',
  821. # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
  822. 'top_option' => array
  823. (
  824. array
  825. (
  826. 'value' => $auth,
  827. 'col' => 'company_id',
  828. ),
  829. array
  830. (
  831. 'value' => Dever::load('manage/auth.authData'),
  832. 'col' => 'id',
  833. ),
  834. ),
  835. */
  836. # 默认值
  837. /*
  838. 'default' => array
  839. (
  840. 'col' => 'username,email,password,role,state,cdate',
  841. 'value' => array
  842. (
  843. //'"DMC","DMC@dever.cc","'. md5('admin_' . date('Y_m_d_H')) . '",1, 1,' . time(),
  844. '"admin","DMC@dever.cc","'. hash('sha256', 'admin_123') . '",1, 1,' . DEVER_TIME,
  845. ),
  846. ),
  847. */
  848. # 索引
  849. /*
  850. 'index' => array
  851. (
  852. 1 => array
  853. (
  854. # 索引名 => 索引id 如果有后缀.unique,则为建立索引的类型,如id,state.unique
  855. 'id' => 'id,state',
  856. ),
  857. # 版本号 更改版本号会更新当前表的索引
  858. 'version' => 1,
  859. ),*/
  860. # request 请求接口定义
  861. 'request' => array
  862. (
  863. # one 根据用户名和密码取一条数据
  864. 'user' => array
  865. (
  866. # 匹配的正则或函数 必填项
  867. 'where' => array
  868. (
  869. //'username' => '/^([A-Za-z0-9])/',
  870. //'username' => 'yes',
  871. 'email' => 'yes',
  872. 'status' => 1,
  873. 'state' => 1,
  874. //'password' => 'is_string',
  875. ),
  876. 'type' => 'one',
  877. # 为这个接口独立设置缓存
  878. 'cache' => true,
  879. ),
  880. # one 根据用户名和密码取一条数据
  881. 'email' => array
  882. (
  883. # 匹配的正则或函数 必填项
  884. 'where' => array
  885. (
  886. //'username' => '/^([A-Za-z0-9])/',
  887. //'username' => 'yes',
  888. 'email' => 'yes',
  889. 'status' => 1,
  890. 'state' => 1,
  891. //'password' => 'is_string',
  892. ),
  893. 'type' => 'one',
  894. # 为这个接口独立设置缓存
  895. 'cache' => true,
  896. ),
  897. # one 根据用户名和密码取一条数据
  898. 'mobile' => array
  899. (
  900. # 匹配的正则或函数 必填项
  901. 'where' => array
  902. (
  903. //'username' => '/^([A-Za-z0-9])/',
  904. //'username' => 'yes',
  905. 'mobile' => 'yes',
  906. 'status' => 1,
  907. 'state' => 1,
  908. //'password' => 'is_string',
  909. ),
  910. 'type' => 'one',
  911. # 为这个接口独立设置缓存
  912. 'cache' => true,
  913. ),
  914. # 更新密码
  915. 'password' => array
  916. (
  917. 'type' => 'update',
  918. 'where' => array
  919. (
  920. 'id' => 'yes',
  921. ),
  922. 'set' => array
  923. (
  924. 'password' => 'yes',
  925. ),
  926. ),
  927. 'getSearch' => array
  928. (
  929. # 匹配的正则或函数 选填项
  930. 'option' => array
  931. (
  932. 'col' => array('yes-mobile,username,email', 'like'),
  933. ),
  934. 'type' => 'all',
  935. 'col' => '*|id',
  936. ),
  937. 'getAll' => array
  938. (
  939. # 匹配的正则或函数 选填项
  940. 'option' => array
  941. (
  942. 'ids' => array('yes-id', 'in'),
  943. 'status' => 1,
  944. 'state' => 1,
  945. ),
  946. 'type' => 'all',
  947. 'col' => '*,username as name',
  948. ),
  949. # 扩展list方法的option
  950. 'list_option' => array
  951. (
  952. 'col' => array('yes-username,mobile', 'like'),
  953. 'state' => 1,
  954. ),
  955. ),
  956. );