| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 | <?php/** * user */ # 定义几个常用的选项$option = array(	1 => '正常',	2 => '冻结',);$group = function(){	$array = array();	$data = Dever::load('weixin/group-main');	if($data)	{		$array += $data;	}		return $array;};$sex = array(	0 => '未知',	-1 => '未知',	1 => '男性',	2 => '女性',);$subscribe = array(	2 => '未关注',	1 => '已关注',);return array(	# 表名	'name' => 'user',	# 显示给用户看的名称	'lang' => '用户信息',	'desc' => '注意:这里可以直接更改用户分组,是可以修改用户的分组的,不过一旦从未分组中移出,就不能再还原回去了。可加入到cron中:data.user_list?site=? site后的问号请替换为站点id',	'start' => array	(		# 修改分组到微信		'update_groupid' => 'weixin/user.update_group',	),	# 数据结构	'struct' => array	(		'id' 		=> array		(			'type' 		=> 'int-11',			'name' 		=> 'UID',			'default' 	=> '',			'desc' 		=> '',			'match' 	=> 'is_numeric',			//'search'	=> 'order',			'list'		=> true,		),				'site'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '站点',			'default' 	=> '',			'desc' 		=> '请输入站点',			'match' 	=> 'is_numeric',			//'search'	=> 'order,fulltext',			//'update'	=> 'text',			//'list'		=> true,		),				'openid'		=> array		(			'type' 		=> 'varchar-150',			'name' 		=> 'openid',			'default' 	=> '',			'desc' 		=> '请输入openid',			'match' 	=> 'is_string',			'search'	=> 'order,fulltext',			//'update'	=> 'text',			//'list'		=> 'table',			//'modal' 	=> '详细信息',		),		'unionid'		=> array		(			'type' 		=> 'varchar-150',			'name' 		=> 'unionid',			'default' 	=> '',			'desc' 		=> '请输入unionid',			'match' 	=> 'is_string',			'search'	=> 'order,fulltext',			//'update'	=> 'text',			//'list'		=> true,		),				'nickname'		=> array		(			'type' 		=> 'varchar-50',			'name' 		=> '昵称',			'default' 	=> '',			'desc' 		=> '请输入昵称',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',			'list'		=> 'table',			'modal' 	=> '{nickname}',		),				'sex'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '性别',			'default' 	=> '0',			'desc' 		=> '请选择性别',			'match' 	=> 'is_numeric',			'option' 	=> $sex,			'search'	=> 'select',			//'update'	=> 'radio',			'list'		=> true,			'show'		=> 'yes',		),				'groupid'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '分组',			'default' 	=> '0',			'desc' 		=> '请选择分组',			'match' 	=> 'is_numeric',			'option' 	=> $group,			'search'	=> 'select',			'update'	=> 'radio',			'list'		=> true,		),				'subscribe'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '是否订阅',			'default' 	=> '2',			'desc' 		=> '请选择是否订阅',			'match' 	=> 'is_numeric',			'option' 	=> $subscribe,			//'search'	=> 'select',			//'update'	=> 'radio',			'list'		=> true,			'show'		=> 'yes',		),				'city'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '城市',			'default' 	=> '',			'desc' 		=> '请输入城市',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',			//'list'		=> true,		),		'province'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '省份',			'default' 	=> '',			'desc' 		=> '请输入省份',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',			//'list'		=> true,		),		'country'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '地区',			'default' 	=> '',			'desc' 		=> '请输入国家',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',			'list'		=> '"{country} {province} {city}"',		),				'language'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '语言',			'default' 	=> '',			'desc' 		=> '请输入语言',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',			//'list'		=> true,		),		'remark'		=> array		(			'type' 		=> 'varchar-30',			'name' 		=> '备注',			'default' 	=> '',			'desc' 		=> '请输入备注',			'match' 	=> 'is_string',			'search'	=> 'fulltext',		),		'headimgurl'		=> array		(			'type' 		=> 'varchar-150',			'name' 		=> '头像',			'default' 	=> '',			'desc' 		=> '请输入头像',			'match' 	=> 'is_string',			'search'	=> 'fulltext',			//'update'	=> 'text',		),				'subscribe_time'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '关注时间',			'default' 	=> '',			'desc' 		=> '请输入关注时间',			'match' 	=> 'is_numeric',			//'update'	=> 'text',			'list'		=> 'date("Y-m-d H:i:s", {subscribe_time})',		),				'mdate'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '更新时间',			'match' 	=> array('is_numeric', time()),			'desc' 		=> '',		),				'state'		=> array		(			'type' 		=> 'tinyint-1',			'name' 		=> '状态',			'default' 	=> '1',			'desc' 		=> '请选择状态',			'match' 	=> array('is_numeric', 1),			'option' 	=> $option,			//'update'	=> 'radio',			'list'		=> true,		),				'cdate'		=> array		(			'type' 		=> 'int-11',			'name' 		=> '录入时间',			'match' 	=> array('is_numeric', time()),			'desc' 		=> '',			# 只有insert时才生效			'insert'	=> true,		),	),		'manage' => array	(		'insert' => false,		'edit' => false,		//'list_button' => array(6 => '同步'),		'button' => array		(			//'重新同步' => 'manage/api.update',		)	),	# 后台新增功能,权限精细控制 他的值为需要控制的字段	'auth' => 'site',		# request 请求接口定义	'request' => array	(		# 根据hash取一条数据		'info' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'site' => 'yes',				'openid' => 'yes',			),			'type' => 'one',		),		# 根据群组获取数据		'getByGroup' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'state' => 1,				'site' => 'yes',				'groupid' => 'yes',			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*',		),				# 根据用户id获取数据		'getByUid' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'state' => 1,				'site' => 'yes',				'id' => array('yes', 'in'),			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*|openid',		),				# 获取所有数据		'getAll' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'state' => 1,				'site' => 'yes',			),			'type' => 'all',			'order' => array('id', 'desc'),			'col' => '*',		),		# 根据unionid 获取信息		'getOne' => array		(			# 匹配的正则或函数 必填项			'where' => array			(				'site' => 'yes',				'unionid' => 'yes',			),			'type' => 'one',		),				# 改变订阅状态		'upSubscribe' => array		(			'type' => 'update',			'where' => array			(				'openid' => 'yes',				'site' => 'yes',			),			'set' => array			(				'subscribe' => 'yes',			),		),	),);
 |