admin.php 25 KB

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