| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 | 
							- <?php
 
- # 定义几个常用的选项
 
- $option = array
 
- (
 
- 	1 => '正常',
 
- 	2 => '冻结',
 
- );
 
- /*
 
- $level = function()
 
- {
 
- 	return Dever::db('passport/level')->state();
 
- };
 
- */
 
- $sex = array
 
- (
 
- 	1 => '男',
 
- 	2 => '女',
 
- 	3 => '未知',
 
- );
 
- $weixin = array
 
- (
 
- 	1 => '已关注',
 
- 	2 => '未关注',
 
- );
 
- $temp = array
 
- (
 
- 	1 => '临时用户',
 
- 	2 => '正式用户',
 
- );
 
- $bind = array
 
- (
 
- 	1 => '已绑定',
 
- 	2 => '未绑定',
 
- );
 
- $source_type = array (
 
- 	'ios' => 'ios',
 
- 	'android' => 'android',
 
- 	'h5' => 'h5',
 
- 	'applet' => '小程序',
 
- 	'pc' => '网站',
 
- 	'service' => '公众号',
 
- );
 
- $email = Dever::rule('email');
 
- $email = 'option';
 
- $mobile = Dever::rule('mobile');
 
- $mobile = 'option';
 
- return array
 
- (
 
- 	'email' => $email,
 
- 	'mobile' => $mobile,
 
- 	# 表名
 
- 	'name' => 'user',
 
- 	# 显示给用户看的名称
 
- 	'lang' => '用户管理',
 
- 	'order' => 10,
 
- 	# 数据结构
 
- 	'struct' => array
 
- 	(
 
- 	
 
- 		'id' 		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '用户ID',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '',
 
- 			'match' 	=> 'is_numeric',
 
- 			'search'	=> 'order',
 
- 			'list'		=> true,
 
- 		),
 
- 		
 
- 		'username'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-50',
 
- 			'name' 		=> '用户名',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入用户名',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'text',
 
- 			'search'	=> 'fulltext',
 
- 			'list'		=> true,
 
- 		),
 
- 		'mobile'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-32',
 
- 			'name' 		=> '手机号',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入用户手机号',
 
- 			'match' 	=> $mobile,
 
- 			'update'	=> 'text',
 
- 			'search'	=> 'fulltext,exist',
 
- 			'exist'		=> array
 
- 			(
 
- 				'yes' => '有值',
 
- 				//'no' => '没有值',
 
- 			),
 
- 			'list'		=> true,
 
- 		),
 
- 		'source_type'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '用户来源',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请选择用户来源',
 
- 			'match' 	=> 'is_string',
 
- 			'update'	=> 'select',
 
- 			'option'	=> $source_type,
 
- 			'search'	=> 'select',
 
- 			'list'		=> true,
 
- 		),
 
- 		'email'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '邮箱',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入邮箱',
 
- 			'match' 	=> $email,
 
- 			'update'	=> 'text',
 
- 			//'search'	=> 'fulltext',
 
- 			//'list'		=> true,
 
- 		),
 
- 		
 
- 		'password'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-50',
 
- 			'name' 		=> '密码',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入密码',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'password',
 
- 			'callback'	=> 'sha1',
 
- 		),
 
- 		
 
- 		//search_exist_avatar=yes
 
- 		'avatar'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-150',
 
- 			'name' 		=> '头像',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请选择头像',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'image',
 
- 			'key' 		=> '1',
 
- 			'place'		=> '150',
 
- 			'list'		=> '"{avatar}" ? "<img src=\'{avatar}\' width=\'150\'>": ""',
 
- 		),
 
- 		'country'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '国家',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '国家',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 		),
 
- 		'province'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '省份',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '省份',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 		),
 
- 		'city'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-100',
 
- 			'name' 		=> '城市',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '城市',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 		),
 
- 		'area'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-800',
 
- 			'name' 		=> '地区',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '地区',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 			'list'		=> true,
 
- 		),
 
- 		
 
- 		'info'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-255',
 
- 			'name' 		=> '介绍-选填,如果想清空该介绍,请输入null。',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入介绍',
 
- 			'match' 	=> 'option',
 
- 			'update'	=> 'editor',
 
- 		),
 
- 		'score'		=> array
 
- 		(
 
- 			'type' 		=> 'varchar-50',
 
- 			'name' 		=> '积分',
 
- 			'default' 	=> '',
 
- 			'desc' 		=> '请输入积分',
 
- 			'match' 	=> 'option',
 
- 			//'update'	=> 'text',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'sex'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '用户性别',
 
- 			'default' 	=> '3',
 
- 			'desc' 		=> '用户性别',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $sex,
 
- 			'update'	=> 'radio',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'level'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '用户等级',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择用户等级',
 
- 			'match' 	=> 'is_numeric',
 
- 			//'option' 	=> $level,
 
- 			//'update'	=> 'select',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'temp'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '是否临时用户',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '是否临时用户',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $temp,
 
- 			//'update'	=> 'select',
 
- 			//'list'		=> true,
 
- 		),
 
- 		'login_date'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '最近登录',
 
- 			'match' 	=> array('is_numeric', time()),
 
- 			'desc' 		=> '',
 
- 			'default' 	=> '0',
 
- 			//'list'		=> 'date("Y-m-d H:i:s", {login_date})',
 
- 		),
 
- 		'bind'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '是否绑定手机',
 
- 			'default' 	=> '2',
 
- 			'desc' 		=> '请选择是否绑定手机',
 
- 			'match' 	=> 'is_numeric',
 
- 			//'option' 	=> $bind,
 
- 			//'update'	=> 'radio',
 
- 		),
 
- 		'state'		=> array
 
- 		(
 
- 			'type' 		=> 'tinyint-1',
 
- 			'name' 		=> '状态',
 
- 			'default' 	=> '1',
 
- 			'desc' 		=> '请选择状态',
 
- 			'match' 	=> 'is_numeric',
 
- 			'option' 	=> $option,
 
- 			'update'	=> 'radio',
 
- 		),
 
- 		
 
- 		'cdate'		=> array
 
- 		(
 
- 			'type' 		=> 'int-11',
 
- 			'name' 		=> '注册时间',
 
- 			'match' 	=> array('is_numeric', time()),
 
- 			'desc' 		=> '',
 
- 			# 只有insert时才生效
 
- 			'insert'	=> true,
 
- 			//'list'		=> 'date("Y-m-d H:i:s", {cdate})',
 
- 		),
 
- 	),
 
- 	'manage' => array
 
- 	(
 
- 		'excel' => true,
 
- 	),
 
- 	# 更新表结构
 
- 	/*
 
- 	'alter' => array
 
- 	(
 
- 		1 => array
 
- 		(
 
- 			array('add', 'bind', 'bind', 'tinyint-1 2 是否绑定手机'),
 
- 		),
 
- 		'version' => 1,
 
- 	),
 
- 	*/
 
- 	
 
- 	# request 请求接口定义
 
- 	'request' => array
 
- 	(
 
- 		# 此处定义是为跳出auth
 
- 		'login' => array
 
- 		(
 
- 			'option' => array
 
- 			(
 
- 				'username' => 'yes',
 
- 				'mobile' => 'yes',
 
- 				'email' => 'yes',
 
- 				'password' => 'yes',
 
- 			),
 
- 			'type' => 'one',
 
- 		),
 
- 		# 验证手机号是否被使用 
 
- 		'checkMobile' => array
 
- 		(
 
- 			# 匹配的正则或函数 选填项
 
- 			'where' => array
 
- 			(
 
- 				'mobile' => 'yes',
 
- 				'id' => array('yes', '!='),
 
- 			),
 
- 			'type' => 'one',
 
- 		),
 
- 	),
 
- );
 
 
  |