| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078 | 
							- <?php
 
- /*
 
- |--------------------------------------------------------------------------
 
- | admin.php 管理员表
 
- |--------------------------------------------------------------------------
 
- */
 
- # 定义几个常用的选项
 
- $status = array
 
- (
 
- 	1 => '普通',
 
- 	2 => '封禁',
 
- );
 
- $cur = Dever::load('manage/auth.data', false);
 
- # 获取top权限
 
- //$auth = Dever::tops();
 
- $company = function()
 
- {
 
- 	$data = Dever::load('manage/company-state');
 
- 	return $data;
 
- };
 
- $desc = '';
 
- if($cur && $cur['role'] > 1)
 
- {
 
- 	$desc =  $cur['username'] . ',你好,你可以在此管理你的下属账号';
 
- 	$child = array_keys(Dever::db('manage/role')->all());
 
- 	$admin = Dever::db('manage/admin_role')->getData(array
 
- 	(
 
- 		'role_id' => implode(',', $child),
 
- 	));
 
- 	# 配置当前列表页的参数 只能查看自己下属的管理员
 
- 	Dever::$global['model']['manage/admin-list'] = array
 
- 	(
 
- 		'option' => array
 
- 		(
 
- 			'id' => array('yes', 'in'),
 
- 		),
 
- 		'option_id' => $admin ? array_keys($admin) : -1,
 
- 	);
 
- }
 
- $role = function()
 
- {
 
- 	return Dever::load('manage/role-getData');
 
- };
 
- $group = function()
 
- {
 
- 	return Dever::load('manage/group-all');
 
- };
 
- $company_group = function() 
 
- {
 
- 	$data = Dever::load('manage/company-all');
 
- 	if ($data) {
 
- 		foreach ($data as $k => $v) {
 
- 			$data[$k]['child'] = Dever::db('manage/group')->all(array('company_id' => $v['id']));
 
- 		}
 
- 		$data['state'] = 1;
 
- 	}
 
- 	return $data;
 
- };
 
- $config = function()
 
- {
 
- 	return Dever::load('manage/config-all');
 
- };
 
- # 获取权限list 建议这里使用匿名函数
 
- $auth = function() use($cur)
 
- {
 
- 	if($cur['role'] > 1)
 
- 	{
 
- 		$auth = Dever::load('manage/auth.get', false);
 
- 	}
 
- 	else
 
- 	{
 
- 		$auth = Dever::load('manage/auth.get', true);
 
- 	}
 
- 	return $auth;
 
- };
 
- # 获取头部菜单list 建议这里使用匿名函数
 
- $top = function()
 
- {
 
- 	$data = Dever::load('manage/top.all');
 
- 	$data['state'] = 1;
 
- 	return $data;
 
- };
 
- return array
 
- (
 
- 	# 表名
 
- 	'name' => 'admin',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '管理账户设置',
 
- 	'desc' => $desc,
 
- 	# 表类型 值为\innodb\myisam\,默认为innodb,仅在mysql类型有效
 
- 	'type' => 'innodb',
 
- 	# 分表设置 一般分为冷热数据,原理:自动建立一个dever_split表来记录分表的表名和数据,定时处理主表数据,当主表某些数据属于符合分表规则时,会建立分表,如admin-1 dever_split表里的结构为主表名、分表名、分表数据
 
- 	/*
 
- 	'split' => array
 
- 	(
 
- 		'type' => 'day',//分表类型,一般为day、week、month、year、value 其中value是按照某个确定的值分表
 
- 		'col' => 'cdate',//分表字段
 
- 		'step' => '1',//分表步进,如每3天分表,就填写3
 
- 	),
 
- 	*/
 
- 	# 分区设置,现在仅支持mysql
 
- 	/*
 
- 	'partition' => array
 
- 	(
 
- 		'type' => 'range',//分区类型
 
- 		'col' => 'year(cdate)',//分区字段,可以使用mysql内置函数
 
- 		'exp' => 'LESS THAN',
 
- 		//设置分区的值
 
- 		'value' => array
 
- 		(
 
- 			'1996',
 
- 			'1997',
 
- 			'1998',
 
- 		),
 
- 	),
 
- 	*/
 
- 	/* 设置上级菜单,当config里设置menu后,这里将失效
 
- 	'parent' => array
 
- 	(
 
- 		'key' => 'kefu',
 
- 		'order' => 1,
 
- 		'name' => '客服设置',
 
- 	),
 
- 	*/
 
- 	# 这个表不使用cache功能
 
- 	//'cache' => false,
 
- 	/*
 
- 	# 用到哪个后台菜单上,对应项目的key
 
- 	'menu' => 'project_niuyou_main',
 
- 	# 后台菜单排序
 
- 	'order' => 10,
 
- 	# 显示到后台快捷发布中,值为排序
 
- 	'fast' => 1,
 
- 	*/
 
- 	'order' => 9,
 
- 	# 检测email必须唯一
 
- 	'check' => 'email',
 
- 	# 同步更新另外一个或多个表的多条关联数据,以逗号隔开
 
- 	'sync' => array
 
- 	(
 
- 		'manage/admin_role' => array
 
- 		(
 
- 			# 更新时的条件,另外一个表的字段 => 本表的字段
 
- 			'where' => array('admin_id', 'id'),
 
- 			# 要更新的数据
 
- 			'update' => array('role_id' => 'role'),
 
- 			# 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
 
- 			'type' => 'delete',
 
- 		),
 
- 		'manage/admin_group' => array
 
- 		(
 
- 			# 更新时的条件,另外一个表的字段 => 本表的字段
 
- 			'where' => array('admin_id', 'id'),
 
- 			# 要更新的数据
 
- 			'update' => array('group_id' => 'group'),
 
- 			# 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
 
- 			'type' => 'delete',
 
- 		)
 
- 	),
 
- 	/*
 
- 	# 查询出数据时,填充默认数据
 
- 	'fill' => array
 
- 	(
 
- 		# 从哪个表填充
 
- 		'cover/hot_service' => array
 
- 		(
 
- 			# 条件,另外一个表的字段 => 本表的字段
 
- 			'where' => array('id' => 'service_id', 'seller_id' => '-1'),
 
- 			# 要填充的数据,另外一个表的字段 => 本表的字段,如果不填写就是所有的
 
- 			//'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'),
 
- 			# 不需要填充的字段 与update互斥
 
- 			'no' => array('id', 'seller_id', 'service_id', 'chose', 'state', 'cdate')
 
- 		)
 
- 	),
 
- 	*/
 
- 	# 同步更新另外一个或多个表的一条关联数据
 
- 	/*
 
- 	'syncone' => array
 
- 	(
 
- 		'manage/admin_role' => array
 
- 		(
 
- 			# 更新另外一个表的字段 => 本表的字段
 
- 			'where' => array('admin_id' => 'id'),
 
- 			# 要更新的数据
 
- 			'update' => array('role_id' => 'role'),
 
- 		)
 
- 	),
 
- 	*/
 
- 	/*该方法用check替代
 
- 	'start' => array
 
- 	(
 
- 		'update' => 'manage/auth.checkEmail',
 
- 		'insert' => 'manage/auth.checkEmail',
 
- 	),
 
- 	*/
 
- 	'end' => array
 
- 	(
 
- 		'insert' => 'manage/auth.update',
 
- 		'update' => 'manage/auth.update',
 
- 	),
 
- 	# 数据结构
 
- 	'struct' => array
 
- 	(
 
- 		'id' 		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '管理员ID',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '',
 
- 			'match' 	=> 'is_numeric',
 
- 			'search'	=> 'order',
 
- 			'list'		=> true,
 
- 		),
 
- 		
 
- 		'username'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-24',
 
- 			'name' 		=> '管理员名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入管理员名',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'text',
 
- 			# 自动完成功能,第一个参数是请求的地址,请自行实现,第二个参数是要使用的字段,共有id和value两个选择,id会特殊处理,value则直接把当前值写入,第三个参数是直接替换当前的值,第四个参数是当前表里的字段名,一般为分类的id
 
- 			//'autocomplete' => array('auth.role?json=1', 'value', 'manage/role-check#name', 'cate_id'),
 
- 			//'autocomplete' => array('auth.role?json=1'),
 
- 			'search'	=> 'order,fulltext',
 
- 			'list'		=> true,
 
- 			// 可以自定义表头 参考layui table表头自定义
 
- 			//'list_header'  => array('width' => '60%'),
 
- 			# 绑定js脚本,更新时使用,第一个参数是执行的方式,第二个参数执行的方法,第三个参数是传值。
 
- 			//'bind'		=> array('onblur', 'loading', array('url' => Dever::url("auth.blur"))),
 
- 		),
 
- 		#多级联动
 
- 		//'update'	=> 'linkage',//多级联动 option参数:请求地址(返回参数为level_num当前联动级数,level_id当前选择的id),参考area组件:dever package area
 
- 		//'option'	=> Dever::url('api.get', 'area'),
 
- 		'email'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '邮箱-可用于登录,请准确填写,不允许重复',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入邮箱',
 
- 			'match' 	=> Dever::rule('email'),
 
- 			'update'	=> 'text',
 
- 			/*
 
- 			//'option_add' => array('[添加新单位]', 'scm_product/lib/unit.add'),
 
- 			* search_name:检索名称
 
- 			* search_order:检索排序
 
- 			* search_after:展示当前检索之后需要展示什么,默认为<br />
 
- 			
 
- 			* 列表页搜索选项,这里的search或者update的值为
 
- 			* fulltext:全文检索,模糊匹配
 
- 			* text:精确匹配
 
- 			* day:按照日期检索
 
- 			* date:按照具体时间检索
 
- 			* exp:大小判断,仅能选择一项
 
- 			* select:选择器,需要option项
 
- 			* group:组选择器,需要option项
 
- 			* linkage:多级联动选择器,需要option项,值为联动数据接口地址,参考area组件 'option'	=> Dever::url('api.get', 'area'), 'list'		=> 'Dever::load("area/api.string", "{area}")',
 
- 			* exist:是否存在,需要exist项,基本配置为
 
- 			$source_id = array
 
- 			(
 
- 				'yes' => '有值',
 
- 				'no' => '没有值',
 
- 				'no|2832' => '没有值或者有值为2832',
 
- 				'yes|2832' => '有值并且过滤值为2829',
 
- 				'2832' => '查找',
 
- 			);
 
- 			* 如果search的值为数组,则认为是接口,需要从接口获取数据后再进行查找
 
- 			* 如'search'	=> array
 
- 			(
 
- 				'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
 
- 				'col' => 'name',//要查询的字段
 
- 				'result' => 'id',//返回的字段
 
- 				'search' => 'uid',//本表的字段,默认为当前的字段
 
- 				//'option' => $option, //选择模式
 
- 			),
 
- 			* 就是将本字段email当做passport/user-one的name字段来查找id
 
- 			*/
 
- 			'search'	=> 'fulltext',
 
- 			'list'		=> true,
 
- 			# 在手机版或者小屏幕下,列表页的表格是否展示,1为展示,2、3、4、5、6均为在一定宽度下展示,详细参考:https://github.com/nadangergeo/RWD-Table-Patterns
 
- 			'level'		=> 1,
 
- 			//直接上传到云端
 
- 			//'upload'	=> 'qiniu',
 
- 			//上传大数据
 
- 			//'large' 	=> true,
 
- 		),
 
- 		# 比较特殊的一些设置,不断添加中:
 
- 		/*
 
- 		//启用复制其他字段的值
 
- 		'testname'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-24',
 
- 			'name' 		=> '角色名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入角色名',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'copy.name',//直接复制name的值
 
- 			'search'	=> 'order,fulltext',
 
- 			'list'		=> true,
 
- 		),
 
- 		//当前的字段属于另外一个表,主要不要有type,当name不存在时,此处直接复用整个role_test表里的struct
 
- 		'manage-role_test-name'=> array
 
- 		(
 
- 			'name' 		=> '测试名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入角色名',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'text',//直接复制name的值
 
- 			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段,当前表、关联表
 
- 			'sync'		=> array('id', 'role_id'),
 
- 			'list'		=> true,
 
- 			//'list'      => 'Dever::load("setting/role-find#name", "{manage-role_test-name}")',
 
- 		),
 
- 		//同时设置另外一个表的数据,设置同上,只有update的值不同
 
- 		'manage-role_test' => array
 
-         (
 
-             'type'      => 'text-1000',
 
-             'name'      => '属性设置',
 
-             'default'   => '',
 
-             'desc'      => '属性设置',
 
-             'match'     => 'is_string',
 
-             'sync'      => array('id', 'category_id'),
 
-             'update'    => array(1),
 
-         ),
 
- 		
 
- 		'text'       => array
 
-         (
 
-             'type'      => 'text-1000',
 
-             'name'      => '文字设置',
 
-             'default'   => '',
 
-             'desc'      => '文字设置',
 
-             'match'     => 'is_string',
 
-             'option'    => $text,
 
-             'update'    => array
 
-             (
 
-                 array
 
-                 (
 
-                     'col'       => 'name',
 
-                     'name'      => '文字内容',
 
-                     'default'   => '',
 
-                     'desc'      => '文字内容',
 
-                     'match'     => 'is_string',
 
-                     'update'    => 'textarea',
 
-                 ),
 
-                 array
 
-                 (
 
-                     'col'       => 'color',
 
-                     'name'      => '文字颜色',
 
-                     'default'   => '#000000',
 
-                     'desc'      => '文字颜色',
 
-                     'match'     => 'is_string',
 
-                     'update'    => 'color',
 
-                 ),
 
-                 array
 
-                 (
 
-                     'col'       => 'bgcolor_type',
 
-                     'name'      => '是否设置背景颜色',
 
-                     'default'   => '2',
 
-                     'desc'      => '是否设置背景颜色',
 
-                     'match'     => 'is_string',
 
-                     'update'    => 'radio',
 
-                     'option'    => $bgcolor_type,
 
-                     'control'   => 'bgcolor_type',
 
-                 ),
 
-                 array
 
-                 (
 
-                     'col'       => 'bgcolor',
 
-                     'name'      => '背景颜色',
 
-                     'default'   => '#000000',
 
-                     'desc'      => '背景颜色',
 
-                     'match'     => 'is_string',
 
-                     'update'    => 'color',
 
-                     'show'      => 'bgcolor_type=1'
 
-                 ),
 
-                 array
 
-                 (
 
-                     'col'       => 'size',
 
-                     'name'      => '文字大小-直接输入像素数字',
 
-                     'default'   => '16',
 
-                     'desc'      => '结果描述',
 
-                     'match'     => 'is_numeric',
 
-                     'update'    => 'text',
 
-                 ),
 
-                 array
 
-                 (
 
-                     'col'      => 'goods_id',
 
-                     'name'      => '选择商品',
 
-                     'default'   => '',
 
-                     'desc'      => '选择商品',
 
-                     'match'     => 'option',
 
-                     'update'    => 'select',
 
-                     'update_search' => 'goods/lib/manage.search',
 
-                 ),
 
-             ),
 
-         ),
 
-         'category'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-500',
 
- 			'name' 		=> '属性分类',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '分类',
 
- 			'match' 	=> 'is_string',
 
- 			'search'	=> 'linkage',
 
- 			//'update'	=> $id ? false : 'linkage',
 
- 			'update'	=> 'linkage',//这里select和radio也支持
 
- 			'option'	=> Dever::url('category.get', 'product'),
 
- 			'list'		=> 'Dever::load("product/category.string", "{category}")',
 
- 			'load'		=> 'product-info_attr',
 
- 			'tab'		=> 1,
 
- 		),
 
- 		'product-info_attr'=> array
 
- 		(
 
- 			'name' 		=> '属性设置',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请先选择属性分类',
 
- 			'match' 	=> 'option',
 
- 			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
 
- 			'sync'		=> array('id', 'info_id'),
 
- 			# 根据category字段的值,获取product/attr.search接口的内容
 
- 			'update'	=> 'load',
 
- 			'update_load' => array('product/attr.getManageByCate', 'category'),
 
- 			'tab'		=> 1,
 
- 		),
 
- 	
 
- 		
 
- 		#设置分割条
 
- 		/*
 
- 		'hr1'		=> array
 
- 		(
 
- 			'name' 		=> '基本信息',
 
- 			'class'		=> '',//本项必须填写
 
- 			'attr'		=> '',
 
- 		),
 
- 		*/
 
- 		/*
 
- 		'cate'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-300',
 
- 			'name' 		=> '标签分类',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '标签分类',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $cate,
 
- 			'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 			'control'	=> 'cate',
 
- 		),
 
- 		
 
- 		# 标签,根据分类变化的标签
 
- 		'tag'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-300',
 
- 			'name' 		=> '标签',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '标签',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'checkbox',
 
- 			# 新增接口 暂未实现
 
- 			'adding'	=> 'tag/manage.getByCate?cate=',
 
- 			# 开启这个,需要将update更换为text类型,输入文字即可选择标签
 
- 			//'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),
 
- 			'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 			# 与上边的cate联动(ajax)
 
- 			'show'	=> 'cate=tag/manage.getByCate?cate=',
 
- 			# 或者加入可选项 待实现
 
- 			'option' => $cate,
 
- 		),
 
- 		# 标签,根据分类变化的标签
 
- 		'tag'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '标签',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '标签',
 
- 			'match' 	=> 'is_string',
 
- 			// 多级联动+多选
 
- 			'update'	=> 'linkage_checkbox',
 
- 			'option'	=> array(Dever::url('api.get', 'area'), '', Dever::url('api.get', 'area')),//先选择多级联动,再选择多选
 
- 		),
 
- 		
 
- 		# 加载地图
 
- 		'map'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-300',
 
- 			'name' 		=> '地理位置',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '地理位置',
 
- 			'match' 	=> 'is_string',
 
- 			# 如果是map,必须在config的base.php中设置map信息
 
- 			//'update'	=> 'map',
 
- 			'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 			//自定义编辑器右侧按钮
 
- 			'editor'	=> array
 
- 			(
 
- 				'name' => '选择插入模块',
 
- 				'button' => array
 
- 				(
 
- 					array
 
- 					(
 
- 						# 名称
 
- 						'name' => '图片',
 
- 						# 资源库id
 
- 						'key' => 1,
 
- 						# 类型
 
- 						'type' => 'image',
 
- 					),
 
- 					array
 
- 					(
 
- 						'name' => '音频',
 
- 						'key' => 2,
 
- 						'type' => 'media',
 
- 					),
 
- 					array
 
- 					(
 
- 						'name' => '视频',
 
- 						'key' => 'video/lib/core.vod',
 
- 					),
 
- 					array
 
- 					(
 
- 						'name' => '直播',
 
- 						'key' => 'video/lib/core.live',
 
- 					),
 
- 				),
 
- 			),
 
- 		),
 
- 		# 三级地区联动
 
- 		'area'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '地区',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '地区',
 
- 			'match' 	=> 'is_string',
 
- 			'search'	=> 'linkage',
 
- 			'update'	=> 'linkage',//多级联动 option参数:请求地址(参数为level_num当前联动级数,level_id当前选择的id)
 
- 			'option'	=> Dever::url('api.get', 'area'),
 
- 			'list'		=> 'Dever::load("area/api.string", "{area}")',
 
- 		),
 
- 		# 无限级联动
 
- 		'category'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-500',
 
- 			'name' 		=> '分类',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '分类',
 
- 			'match' 	=> 'is_string',
 
- 			'search'	=> 'linkage',
 
- 			//'update'	=> 'linkage',
 
- 			'option'	=> Dever::url('api.get', 'category'),
 
- 			'list'		=> 'Dever::load("category/api.string", "{category}")',
 
- 		),
 
- 		# 属性管理
 
- 		'attr'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-800',
 
- 			'name' 		=> '属性设置',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '属性设置',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'checkbox',
 
- 			'option'	=> $attr,
 
- 			'update_input' => '',
 
- 			'update_input_default' => '',
 
- 			'update_parent' => 'checkbox',
 
- 		),
 
- 		# 属性管理 需要用这个来设置值
 
- 		'attr_input'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '属性值设置',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '属性值设置',
 
- 			'match' 	=> 'option',
 
- 		),
 
- 		*/
 
- 		'mobile'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-32',
 
- 			'name' 		=> '手机号',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入手机号',
 
- 			'match' 	=> Dever::rule('mobile'),
 
- 			'update'	=> 'text',
 
- 			'search'	=> 'fulltext',
 
- 			'list'		=> true,
 
- 			'level'		=> 1,
 
- 			# 显示在table中
 
- 			//'list_table'=> '111',
 
- 		),
 
- 		
 
- 		'password'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-64',
 
- 			'name' 		=> '管理员密码',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入管理员密码',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'password',
 
- 			'callback'	=> 'hash.sha256',
 
- 		),
 
- 		
 
- 		'config'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '人性化配置',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '个性化配置',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $config,
 
- 			'update'	=> 'select',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'company'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-2000',
 
- 			'name' 		=> '选择公司',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '选择公司',
 
- 			'match' 	=> 'is_string',
 
- 		),
 
- 		
 
- 		'role'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '所属角色',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择角色',
 
- 			'match' 	=> 'is_string',
 
- 			'option' 	=> $role,
 
- 			'update'	=> 'checkbox',
 
- 			'list'		=> true,
 
- 		),
 
- 		'group'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-2000',
 
- 			'name' 		=> '所属部门',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择所属部门',
 
- 			'match' 	=> 'option',
 
- 			'option' 	=> $company_group,
 
- 			'update'	=> 'checkbox',
 
- 			/*
 
- 			'option' 	=> $company,
 
- 			'update'	=> 'checkbox',
 
- 			'update'	=> array
 
- 			(
 
- 				array
 
-                 (
 
-                     'col'       => 'group_id',
 
-                     'name'      => '选择部门',
 
-                     'default'   => '',
 
-                     'desc'      => '选择部门',
 
-                     'match'     => 'is_string',
 
-                     'update'    => 'select',
 
-                     //'update_search' => 'manage/company.search',
 
-                     //异步搜索选择框,{id}是当前表id,role是当前更新页面选择的role的值,company也是,多个用逗号隔开
 
-                     'update_search' => 'scm_product/lib/manage.searchProduct?{id}{role,company}',
 
-                 ),
 
- 			),*/
 
- 			//'list'		=> true,
 
- 			# 取代option,从接口里读取选项
 
- 			//'update_search' => 'goods/lib/manage.search_sku',
 
- 		),
 
- 		'auth'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '功能权限',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请选择功能权限',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'checkbox',
 
- 			//每个项对应的一个input以及父级更新的类型
 
- 			//'update_input' => '数量',
 
- 			//'update_parent' => 'radio',
 
- 			'option'	=> $auth,
 
- 		),
 
- 		'top'		=> array
 
- 		(
 
- 			'type' 		=> 'text-255',
 
- 			'name' 		=> '头部菜单-这里的头部菜单如果设置,则会覆盖角色中的头部菜单',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请选择头部菜单',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'checkbox',
 
- 			'option'	=> $top,
 
- 		),
 
- 		
 
- 		'state'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '数据状态',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择状态',
 
- 			'match' 	=> 'is_numeric',
 
- 			//'option' 	=> $option,
 
- 			//'update'	=> 'radio',
 
- 			//'list'		=> true,
 
- 			//'extend'	=> true,//扩展功能,该字段为虚拟字段,只在数据库中建立extend字段来保存 后续实现
 
- 		),
 
- 		/*
 
- 		提供冲突检测机制(乐观锁),保证高并发下的数据安全
 
- 		这是模仿自 php 的 Memcached 扩展 后续实现
 
- 		'token'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> 'token',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> 'token',
 
- 			'match' 	=> 'is_numeric',
 
- 		),
 
- 		*/
 
- 		'status'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '状态',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择状态',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $status,
 
- 			'update'	=> 'radio',
 
- 			'list'		=> true,
 
- 			'edit'		=> true,
 
- 		),
 
- 		
 
- 		'cdate'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '录入时间',
 
- 			'match' 	=> array('is_numeric', DEVER_TIME),
 
- 			'desc' 		=> '',
 
- 			# 只有insert时才生效
 
- 			//'search'    => 'month_eq',//month 是月份区间搜索,year是年份区间搜索,eq是相等月份搜索,start是只有开始时间,end是只有结束时间,eqs是月份开始天和结束天搜索
 
- 			'insert'	=> true,
 
- 			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
 
- 		),
 
- 	),
 
- 	'manage' => array
 
- 	(
 
- 		# 后台提交时,检测该值是否为空,多个用逗号隔开
 
-         //'update_check' => 'scm_servicer-out_order_goods',
 
- 		# 不展示保存按钮
 
-         //'update_save' => false,
 
-         # 显示描述
 
-         //'desc' => 'test',
 
- 		# 定义sku对应的表,不填写则默认为info_spec和info_sku
 
- 		/*
 
- 		'sku' => array
 
- 		(
 
- 			# 定义表名
 
- 			'spec' => 'info_spec', 
 
- 			'sku' => 'info_sku',
 
- 			# 定义字段
 
- 			'col' => array
 
- 			(
 
- 				'pic' => array('name' => '图片', 'verify' => 'string', 'type' => 'image'),
 
- 				'code' => array('name' => '商品编码', 'verify' => 'string', 'type' => 'input'),
 
- 				'price' => array('name' => '销售价(元)', 'verify' => 'number', 'type' => 'input'),
 
- 				'buy_price' => array('name' => '采购价(元)', 'verify' => 'number', 'type' => 'input'),
 
- 				'cost_price' => array('name' => '成本价(元)', 'verify' => 'number', 'type' => 'input'),
 
- 			),
 
- 			# 接口
 
- 			'api' => array
 
- 			(
 
- 				'spec' => 'product/sku.spec',
 
- 				'sku' => 'product/sku.sku',
 
- 				# 上传接口
 
- 				'upload' => 'upload/save.start?key=1',
 
- 			),
 
- 		),
 
- 		*/
 
- 		# 图片上传后调用的接口
 
-         //'upload' => 'shop/lib/sign.upload?sign=1',
 
- 		# 开启语言包模式
 
- 		//'lang' => 'name',
 
- 		# 开启tab模式
 
- 		//'tab' => array('基础设置', '前端样式'),
 
- 		# 列表页的类型
 
- 		//'list_type' => 'tree',
 
- 		/*
 
- 		'list_button' => array
 
- 		(
 
- 			'add' => array('新增子分类', '"{category}" == -1 ? "category&option_category={id}" : "category&option_category={category},{id}"'),
 
- 		),*/
 
- 		# 表格使用js模式,默认是html渲染模式
 
-         //'list_table' => 'js',
 
- 		'delete' => false,
 
- 		// 载入自定义资源
 
- 		'res' => array
 
- 		(
 
- 			'js' => 'demo',
 
- 			'css' => 'demo',
 
- 		),
 
- 		# 快捷更新
 
- 		/*
 
- 		'list_button' => array
 
- 		(
 
- 			'edit' => array('审核', 'name'),
 
- 		),
 
- 		*/
 
- 		/*
 
- 		'insert' => false,
 
- 		'edit' => false,
 
- 		//'delete' => false,
 
- 		# 自定义快捷新增和编辑
 
- 		'button' => array
 
- 		(
 
- 			# 快速新增
 
- 			'新增' => array('fast', 'name,reorder'),
 
- 			'导入订单' = array('fast', '', 'import&project=upload&call=agent/lib/manage.import&key=4');
 
- 			//也可直接这样:Dever::load('upload/import.url', 'store/admin/order.import', 10)
 
- 			# 批量创建订单
 
- 			'创建提现单' => array('oper_mul', 'option/auth.test'),
 
- 		),
 
- 		# 快捷更新
 
- 		'list_button' => array
 
- 		(
 
- 			'edit' => array('编辑', 'name,reorder'),
 
- 		),
 
- 		*/
 
- 		'button' => array
 
-         (
 
-             //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
 
-             '公司设置' => array('list', 'company&oper_parent=admin'),
 
-             '部门设置' => array('list', 'group&oper_parent=admin'),
 
-         ),
 
- 	),
 
- 	
 
- 	# 更新表结构
 
- 	'alter' => array
 
- 	(
 
- 		5 => array
 
- 		(
 
- 			array('update', 'group', 'group', 'varchar-1000 {} 部门'),
 
- 			//array('add', 'config', 'config', 'int-11 1 配置'),
 
- 		),
 
- 		'version' => 5,
 
- 	),
 
- 	/*
 
- 	# 权限表
 
- 	'end' => array
 
- 	(
 
- 		'insert' => array
 
- 		(
 
- 			'manage/top.sync',
 
- 		),
 
- 		'update' => array
 
- 		(
 
- 			'manage/top.sync',
 
- 		),
 
- 	),
 
- 	
 
- 	'top' => array
 
- 	(
 
- 		# 数据来源
 
- 		'data' => 'find',
 
- 		# 菜单名
 
- 		'name' => '期权公司设置',
 
- 		# 默认值
 
- 		'value' => 1,
 
- 		# 对应的字段值,设置这个之后,所有设置等于这个值的字段,都要遵循这个权限的控制
 
- 		'key' => 'option/company_id',
 
- 		# 本表中代表名称的字段
 
- 		'col' => 'name',
 
- 	),
 
- 	# 需要设置top权限的表
 
-     'top' => 'option/company_id',
 
-     # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
 
-     'top_option' => array
 
-     (
 
-         array
 
-         (
 
-             'value' => $auth,
 
-             'col' => 'company_id',
 
-         ),
 
-         array
 
-         (
 
-             'value' => Dever::load('manage/auth.authData'),
 
-             'col' => 'id',
 
-         ),
 
-     ),
 
-     */
 
- 	
 
- 	# 默认值
 
- 	/*
 
- 	'default' => array
 
- 	(
 
- 		'col' => 'username,email,password,role,state,cdate',
 
- 		'value' => array
 
- 		(
 
- 			//'"DMC","DMC@dever.cc","'. md5('admin_' . date('Y_m_d_H')) . '",1, 1,' . time(),
 
- 			'"admin","DMC@dever.cc","'. hash('sha256', 'admin_123') . '",1, 1,' . DEVER_TIME,
 
- 		),
 
- 	),
 
- 	*/
 
- 	
 
- 	# 索引
 
- 	/*
 
- 	'index' => array
 
- 	(
 
- 		1 => array
 
- 		(
 
- 			# 索引名 => 索引id 如果有后缀.unique,则为建立索引的类型,如id,state.unique
 
- 			'id' => 'id,state',
 
- 		),
 
- 		
 
- 		# 版本号 更改版本号会更新当前表的索引
 
- 		'version' => 1,
 
- 	),*/
 
- 	
 
- 	# request 请求接口定义
 
- 	'request' => array
 
- 	(
 
- 		# one 根据用户名和密码取一条数据
 
- 		'user' => array
 
- 		(
 
- 			# 匹配的正则或函数 必填项
 
- 			'where' => array
 
- 			(
 
- 				//'username' => '/^([A-Za-z0-9])/',
 
- 				//'username' => 'yes',
 
- 				'email' => 'yes',
 
- 				'status' => 1,
 
- 				'state' => 1,
 
- 				//'password' => 'is_string',
 
- 			),
 
- 			'type' => 'one',
 
- 			# 为这个接口独立设置缓存
 
- 			'cache' => true,
 
- 		),
 
- 		# one 根据用户名和密码取一条数据
 
- 		'email' => array
 
- 		(
 
- 			# 匹配的正则或函数 必填项
 
- 			'where' => array
 
- 			(
 
- 				//'username' => '/^([A-Za-z0-9])/',
 
- 				//'username' => 'yes',
 
- 				'email' => 'yes',
 
- 				'status' => 1,
 
- 				'state' => 1,
 
- 				//'password' => 'is_string',
 
- 			),
 
- 			'type' => 'one',
 
- 			# 为这个接口独立设置缓存
 
- 			'cache' => true,
 
- 		),
 
- 		# one 根据用户名和密码取一条数据
 
- 		'mobile' => array
 
- 		(
 
- 			# 匹配的正则或函数 必填项
 
- 			'where' => array
 
- 			(
 
- 				//'username' => '/^([A-Za-z0-9])/',
 
- 				//'username' => 'yes',
 
- 				'mobile' => 'yes',
 
- 				'status' => 1,
 
- 				'state' => 1,
 
- 				//'password' => 'is_string',
 
- 			),
 
- 			'type' => 'one',
 
- 			# 为这个接口独立设置缓存
 
- 			'cache' => true,
 
- 		),
 
- 		
 
- 		# 更新密码
 
- 		'password' => array
 
- 		(
 
- 			'type' => 'update',
 
- 			'where' => array
 
- 			(
 
- 				'id' => 'yes',
 
- 			),
 
- 			'set' => array
 
- 			(
 
- 				'password' => 'yes',
 
- 			),
 
- 		),
 
- 		'getSearch' => array
 
-         (
 
-             # 匹配的正则或函数 选填项
 
-             'option' => array
 
-             (
 
-                 'col' => array('yes-mobile,username,email', 'like'),
 
-             ),
 
-             'type' => 'all',
 
-             'col' => '*|id',
 
-         ),
 
-         'getAll' => array
 
-         (
 
-             # 匹配的正则或函数 选填项
 
-             'option' => array
 
-             (
 
-                 'ids' => array('yes-id', 'in'),
 
-                 'status' => 1,
 
-                 'state' => 1,
 
-             ),
 
-             'type' => 'all',
 
-             'col' => '*,username as name',
 
-         ),
 
-         # 扩展list方法的option
 
-         'list_option' => array
 
-         (
 
-         	'col' => array('yes-username,mobile', 'like'),
 
-         	'state' => 1,
 
-         ),
 
- 	),
 
- );
 
 
  |