2025-08-30 16:38:53 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
|
|
|
public static class WXData
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2025-09-12 02:28:56 +08:00
|
|
|
|
const string _appId = "wx40ac640ee6bd1116";
|
|
|
|
|
|
const string _appSecret = "cde030153f5b97874c5e6063c70c0f97";
|
2025-08-30 16:38:53 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|