admin.php 29 KB

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