You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookingHeChuan/Myshipping.Core/OAuth/UserInfoModel.cs

62 lines
1.5 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Myshipping.Core;
/// <summary>
/// 微信用户参数
/// </summary>
public class UserInfoModel
{
[JsonPropertyName("nickname")]
public string Name { get; set; }
[JsonPropertyName("headimgurl")]
public string Avatar { get; set; }
[JsonPropertyName("language")]
public string Language { get; set; }
[JsonPropertyName("openid")]
public string Openid { get; set; }
[JsonPropertyName("sex")]
public int Sex { get; set; }
[JsonPropertyName("province")]
public string Province { get; set; }
[JsonPropertyName("city")]
public string City { get; set; }
[JsonPropertyName("country")]
public string Country { get; set; }
/// <summary>
/// 用户特权信息json 数组如微信沃卡用户为chinaunicom
/// </summary>
[JsonPropertyName("privilege")]
public List<string> Privilege { get; set; }
[JsonPropertyName("unionid")]
public string UnionId { get; set; }
[JsonPropertyName("errmsg")]
public string ErrorMessage { get; set; }
}
public static class UserInfoModelExtensions
{
/// <summary>
/// 获取的用户是否包含错误
/// </summary>
/// <param name="userInfoModel"></param>
/// <returns></returns>
public static bool HasError(this UserInfoModel userInfoModel)
{
return userInfoModel == null ||
string.IsNullOrEmpty(userInfoModel.Name) ||
!string.IsNullOrEmpty(userInfoModel.ErrorMessage);
}
}