using System.Text.Json.Serialization;
namespace GDZZ.Core;
///
/// AccessToken参数
///
public class TokenModel
{
///
/// 会话密钥
///
[JsonPropertyName("session_key")]
public string SessionKey { get ;set; }
///
/// 平台唯一标识
///
[JsonPropertyName("unionid")]
public string Unionid { get; set; }
///
/// 错误码
///
[JsonPropertyName("errcode")]
public int ErrCode { get; set; }
///
/// 错误信息
///
[JsonPropertyName("errmsg")]
public string Errmsg { get; set; }
///
/// 用户标识
///
[JsonPropertyName("openid")]
public string OpenId { get; set; }
///
/// AccessToken
///
[JsonPropertyName("access_token")]
public string AccessToken { get; set; }
/////
///// Token 类型
/////
//[JsonPropertyName("token_type")]
//public string TokenType { get; set; }
/////
///// 用于刷新 AccessToken 的 Token
/////
//[JsonPropertyName("refresh_token")]
//public string RefreshToken { get; set; }
/////
///// 此 AccessToken 对应的权限
/////
//[JsonPropertyName("scope")]
//public string Scope { get; set; }
/////
///// AccessToken 过期时间
/////
//[JsonPropertyName("expires_in")]
//public dynamic ExpiresIn { get; set; }
/////
///// 错误的详细描述
/////
//[JsonPropertyName("errordescription")]
//public string ErrorDescription { get; set; }
}
public static class AccessTokenModelModelExtensions
{
///
/// 获取的Token是否包含错误
///
///
///
public static bool HasError(this TokenModel accessTokenModel)
{
return accessTokenModel == null || !string.IsNullOrEmpty(accessTokenModel.Errmsg);
}
}