feat: 为微信服务号用户信息响应模型添加JsonPropertyName映射并移除无用字段
This commit is contained in:
@@ -109,10 +109,7 @@ public class FuwuhaoManager : DomainService
|
|||||||
var jsonContent = await response.Content.ReadAsStringAsync();
|
var jsonContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
_logger.LogInformation($"服务号code获取用户基础信息:{jsonContent}");
|
_logger.LogInformation($"服务号code获取用户基础信息:{jsonContent}");
|
||||||
var result = JsonSerializer.Deserialize<UserBaseInfoResponse>(jsonContent, new JsonSerializerOptions
|
var result = JsonSerializer.Deserialize<UserBaseInfoResponse>(jsonContent);
|
||||||
{
|
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
|
|
||||||
});
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -133,10 +130,7 @@ public class FuwuhaoManager : DomainService
|
|||||||
|
|
||||||
var jsonContent = await response.Content.ReadAsStringAsync();
|
var jsonContent = await response.Content.ReadAsStringAsync();
|
||||||
_logger.LogInformation($"服务号code获取用户详细信息:{jsonContent}");
|
_logger.LogInformation($"服务号code获取用户详细信息:{jsonContent}");
|
||||||
var result = JsonSerializer.Deserialize<UserInfoResponse>(jsonContent, new JsonSerializerOptions
|
var result = JsonSerializer.Deserialize<UserInfoResponse>(jsonContent);
|
||||||
{
|
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
|
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Yi.Framework.AiHub.Domain.Managers.Fuwuhao;
|
namespace Yi.Framework.AiHub.Domain.Managers.Fuwuhao;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -8,35 +10,30 @@ public class UserBaseInfoResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 访问令牌
|
/// 访问令牌
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("access_token")]
|
||||||
public string AccessToken { get; set; }
|
public string AccessToken { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 过期时间(秒)
|
/// 过期时间(秒)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("expires_in")]
|
||||||
public int ExpiresIn { get; set; }
|
public int ExpiresIn { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 刷新令牌
|
/// 刷新令牌
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("refresh_token")]
|
||||||
public string RefreshToken { get; set; }
|
public string RefreshToken { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户OpenID
|
/// 用户OpenID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("openid")]
|
||||||
public string OpenId { get; set; }
|
public string OpenId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 授权作用域
|
/// 授权作用域
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("scope")]
|
||||||
public string Scope { get; set; }
|
public string Scope { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否为快照用户
|
|
||||||
/// </summary>
|
|
||||||
public int IsSnapshotUser { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户UnionID
|
|
||||||
/// </summary>
|
|
||||||
public string UnionId { get; set; }
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Yi.Framework.AiHub.Domain.Managers.Fuwuhao;
|
namespace Yi.Framework.AiHub.Domain.Managers.Fuwuhao;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -8,45 +10,42 @@ public class UserInfoResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户OpenID
|
/// 用户OpenID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("openid")]
|
||||||
public string OpenId { get; set; }
|
public string OpenId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户昵称
|
/// 用户昵称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("nickname")]
|
||||||
public string Nickname { get; set; }
|
public string Nickname { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户性别,值为1时是男性,值为2时是女性,值为0时是未知
|
/// 用户性别,值为1时是男性,值为2时是女性,值为0时是未知
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("sex")]
|
||||||
public int Sex { get; set; }
|
public int Sex { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户个人资料填写的省份
|
/// 用户个人资料填写的省份
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("province")]
|
||||||
public string Province { get; set; }
|
public string Province { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 普通用户个人资料填写的城市
|
/// 普通用户个人资料填写的城市
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("city")]
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 国家,如中国为CN
|
/// 国家,如中国为CN
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("country")]
|
||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像)
|
/// 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonPropertyName("headimgurl")]
|
||||||
public string HeadImgUrl { get; set; }
|
public string HeadImgUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户特权信息
|
|
||||||
/// </summary>
|
|
||||||
public string[] Privilege { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户UnionID
|
|
||||||
/// </summary>
|
|
||||||
public string UnionId { get; set; }
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user