using QYZH.InteractiveMagazine.Models.Dto; using QYZH.InteractiveMagazine.Models.Enum; using Newtonsoft.Json; namespace QYZH.InteractiveMagazine.Models.WeChat; /// /// 微信小程序初次登录输入 /// public class WeChatLoginInput { /// /// 微信登录凭证(wx.login 获取的 code) /// public string Code { get; set; } = string.Empty; /// /// 手机号获取凭证(getPhoneNumber 按钮回调中的 code,可选) /// public string? PhoneCode { get; set; } } /// /// 微信小程序快捷登录输入(通过 OpenId 登录) /// public class WeChatQuickLoginInput { /// /// 微信OpenId(初次登录后客户端缓存的 OpenId) /// public string OpenId { get; set; } = string.Empty; } /// /// 微信登录输出 /// public class WeChatLoginOutput { /// /// 访问令牌 /// public string Token { get; set; } = string.Empty; /// /// 微信OpenId /// public string OpenId { get; set; } = string.Empty; /// /// 该 OpenId 下的用户列表 /// public List Users { get; set; } = []; } /// /// 微信用户创建/更新输入 /// public class WxUserInput { /// /// 微信OpenId /// public string OpenId { get; set; } = string.Empty; /// /// 微信UnionId /// public string? UnionId { get; set; } /// /// 昵称 /// public string? NickName { get; set; } /// /// 头像地址 /// public string? AvatarUrl { get; set; } /// /// 手机号 /// public string? Phone { get; set; } /// /// 积分余额 /// public int Points { get; set; } = 0; /// /// 用户类型: Normal, VIP /// public string Type { get; set; } = UsersTypeEnum.Normal.ToString(); /// /// 状态: Active, Disabled /// public string Status { get; set; } = UserStatusEnum.Active.ToString(); /// /// 密码,默认手机后4位 /// public string? Pwd { get; set; } /// /// 当前成长值 /// public int GrowthPoints { get; set; } = 0; } /// /// 微信用户输出 /// public class WxUserOutput { /// /// 主键ID /// public long Id { get; set; } /// /// 微信OpenId /// public string OpenId { get; set; } = string.Empty; /// /// 微信UnionId /// public string? UnionId { get; set; } /// /// 昵称 /// public string? NickName { get; set; } /// /// 头像地址 /// public string? AvatarUrl { get; set; } /// /// 手机号 /// public string? Phone { get; set; } /// /// 积分余额 /// public int Points { get; set; } /// /// 用户类型 /// public string Type { get; set; } = string.Empty; /// /// 状态 /// public string Status { get; set; } = string.Empty; /// /// 当前成长值 /// public int GrowthPoints { get; set; } /// /// 是否上次在线用户 /// public bool IsLastOnline { get; set; } /// /// 创建人 /// public string? CreatedBy { get; set; } /// /// 创建时间 /// public DateTime CreatedAt { get; set; } /// /// 更新人 /// public string? UpdatedBy { get; set; } /// /// 更新时间 /// public DateTime? UpdatedAt { get; set; } } /// /// 微信用户分页查询输入 /// public class WxUserQueryInput : PageQueryModel { /// /// 昵称(模糊查询) /// public string? NickName { get; set; } /// /// 手机号(模糊查询) /// public string? Phone { get; set; } } /// /// 微信 code2session 接口响应 /// public class WxCode2SessionResponse { /// /// 用户唯一标识 /// [JsonProperty("openid")] public string? OpenId { get; set; } /// /// 会话密钥 /// [JsonProperty("session_key")] public string? SessionKey { get; set; } /// /// 用户统一标识(在开放平台绑定了多个应用时使用) /// [JsonProperty("unionid")] public string? UnionId { get; set; } /// /// 错误码 /// [JsonProperty("errcode")] public int ErrCode { get; set; } /// /// 错误信息 /// [JsonProperty("errmsg")] public string? ErrMsg { get; set; } } /// /// 微信获取手机号接口响应 /// public class WxPhoneNumberResponse { /// /// 错误码 /// [JsonProperty("errcode")] public int ErrCode { get; set; } /// /// 错误信息 /// [JsonProperty("errmsg")] public string? ErrMsg { get; set; } /// /// 手机号信息 /// [JsonProperty("phone_info")] public WxPhoneInfo? PhoneInfo { get; set; } } /// /// 微信手机号信息 /// public class WxPhoneInfo { /// /// 用户绑定的手机号(国外手机号会有区号) /// [JsonProperty("phoneNumber")] public string? PhoneNumber { get; set; } /// /// 没有区号的手机号 /// [JsonProperty("purePhoneNumber")] public string? PurePhoneNumber { get; set; } /// /// 区号 /// [JsonProperty("countryCode")] public string? CountryCode { get; set; } } /// /// 微信 access_token 接口响应 /// public class WxAccessTokenResponse { /// /// 获取到的凭证 /// [JsonProperty("access_token")] public string? AccessToken { get; set; } /// /// 凭证有效时间(秒) /// [JsonProperty("expires_in")] public int ExpiresIn { get; set; } /// /// 错误码 /// [JsonProperty("errcode")] public int ErrCode { get; set; } /// /// 错误信息 /// [JsonProperty("errmsg")] public string? ErrMsg { get; set; } } /// /// 微信切换用户输入 /// public class WeChatSwitchUserInput { /// /// 目标用户ID /// public long UserId { get; set; } } /// /// 微信切换用户输出 /// public class WeChatSwitchUserOutput { /// /// 新的访问令牌 /// public string Token { get; set; } = string.Empty; /// /// 当前切换的用户详情 /// public WxUserOutput User { get; set; } = new(); }