| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 | <?php# wechat基本配置$config['type'] = 5;# 基本的component token$config['token'] = array(	'name' => '获取第三方平台的token',	'method' => 'post',	'json' => true,	'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_component_token?',	'param' => array	(		'component_appid' => 'appid',		'component_appsecret' => 'secret',		'component_verify_ticket' => 'ticket',	),	//针对一些返回的名称,做转换	'response' => array	(		'component_access_token' => 'token',		//'expires_in' => 'expires_in',	),);# oauth token$config['oauth'] = array(	//第一步,请求code	'code' => array	(		'name' => '获取oauth code',		'method' => 'post',		'json' => true,		'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?',		'param' => array		(			'component_access_token' => 'token',			'component_appid' => 'appid',		),		'response' => array		(			'pre_auth_code' => 'oauth.code',		),	),		//第二步,拼装redirect,进行授权登录	'login' => array	(		'name' => '获取oauth login',		'method' => 'get',		'json' => false,		'url' => 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?',		'param' => array		(			'component_appid' => 'appid',			'pre_auth_code' => 'code',			'redirect_uri' => 'redirect',			'auth_type' => '3',		),	),	//第三步,获取到token	'oauth' => array	(		'name' => '获取oauth token',		'method' => 'post',		'json' => true,		'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_query_auth?',		'param' => array		(			'component_access_token' => 'token',			'component_appid' => 'appid',			'authorization_code' => 'auth_code',		),		'response' => array		(			'authorization_info.authorizer_appid' => 'openid',			'authorization_info.authorizer_appid.key' => 'unionid',			'authorization_info.authorizer_access_token' => 'oauth.oauth',			'authorization_info.authorizer_refresh_token' => 'refresh',			'authorization_info.expires_in' => 'expires_in',			'authorization_info.func_info' => 'callback.component/auth.saveOauthInfo',//定义回调		),	),	//第四步,根据refresh获取到token	'refresh' => array	(		'name' => '根据refresh获取oauth token',		'method' => 'post',		'json' => true,		'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?',		'param' => array		(			'component_access_token' => 'token',			'component_appid' => 'appid',			'authorizer_appid' => 'openid',			'authorizer_refresh_token' => 'refresh',		),		'response' => array		(			'authorizer_access_token' => 'oauth.refresh',			'authorizer_refresh_token' => 'refresh',		),	),);# 获取用户信息$config['user'] = array(	'name' => '获取用户信息',	'method' => 'post',	'json' => true,	'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?',	'param' => array	(		'component_access_token' => 'token',		'component_appid' => 'appid',		'authorizer_appid' => 'openid',	),);$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'component' . DIRECTORY_SEPARATOR;# 载入小程序接口配置$config += include($path . 'applet.php');return $config;
 |