admin.php 28 KB

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