admin.php 29 KB

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