80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
using System.Collections;
|
|||
|
|
|
|||
|
|
public static class WXData
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
const string _appId = "wx553b84f33be7a1ee";
|
|||
|
|
const string _appSecret = "20f00273fe7af898660d63b733ed40fd";
|
|||
|
|
static string _accessToken;
|
|||
|
|
static string _refreshToken;
|
|||
|
|
static string _openid;
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string GetApplyTokenURL(string code)
|
|||
|
|
{
|
|||
|
|
return string.Format("https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code", _appId, _appSecret, code);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string GetCheckTokenURL()
|
|||
|
|
{
|
|||
|
|
return string.Format("https://api.weixin.qq.com/sns/auth?access_token={0}&openid={1}", _accessToken, _openid);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string GetRefreshTokenURL()
|
|||
|
|
{
|
|||
|
|
return string.Format("https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={0}&grant_type=refresh_token&refresh_token={1}", _appId, _refreshToken);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string GetUserInfoURL()
|
|||
|
|
{
|
|||
|
|
return string.Format("https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}", _accessToken, _openid);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string RefreshToken
|
|||
|
|
{
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
_refreshToken = value;
|
|||
|
|
}
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return _refreshToken;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//-------------------------------------------------------------
|
|||
|
|
public static string AccessToken
|
|||
|
|
{
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
_accessToken = value;
|
|||
|
|
}
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return _accessToken;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public static string OpenID
|
|||
|
|
{
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
_openid = value;
|
|||
|
|
}
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return _openid;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|