admin/src/SimpleAdmin.Api/WeChat/Dtos/WeChatDtos.cs
zzh 69d234c705 feat: simplify WeChat register and require contact before order
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 13:07:29 +08:00

106 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.ComponentModel.DataAnnotations;
namespace SimpleAdmin.Api.WeChat.Dtos;
public class WxLoginQrcodeOutput
{
/// <summary>PC 端轮询用的扫码 key(与二维码 scene 一致)。</summary>
public string LoginKey { get; set; } = string.Empty;
public string QrCodeUrl { get; set; } = string.Empty;
public int ExpiresIn { get; set; } = 600;
}
public class WxLoginStatusOutput
{
public bool Ready { get; set; }
public string? Account { get; set; }
}
public class WeChatOAuthCodeInput
{
[Required]
public string Code { get; set; } = string.Empty;
}
public class WeChatOAuthUserInfoOutput
{
public string Openid { get; set; } = string.Empty;
public string? Nickname { get; set; }
public int Sex { get; set; }
public string? Province { get; set; }
public string? City { get; set; }
public string? Country { get; set; }
public string? Headimgurl { get; set; }
public string? Unionid { get; set; }
public bool AlreadyBound { get; set; }
}
public class WeChatProfileInput
{
[Required]
public string Openid { get; set; } = string.Empty;
public string? Nickname { get; set; }
public string? Avatar { get; set; }
public string? Unionid { get; set; }
}
public class WeChatCustomerRegisterInput
{
public string? CustomerCode { get; set; }
[Required]
public string CustomerName { get; set; } = string.Empty;
/// <summary>可选;下单前再补全。</summary>
[StringLength(16)]
public string? Phone { get; set; }
/// <summary>可选;下单前再补全。</summary>
[EmailAddress]
[StringLength(64)]
public string? Email { get; set; }
[Required]
[MinLength(6)]
public string Password { get; set; } = string.Empty;
/// <summary>
/// 邀请码(可选)。来自邀请链接 / 二维码 ?ref=,注册时一次性绑定引荐人。
/// </summary>
public string? InviteCode { get; set; }
[Required]
public WeChatProfileInput Wechat { get; set; } = new();
}
public class WeChatCustomerRegisterOutput
{
public string CustomerCode { get; set; } = string.Empty;
}
public class WeChatCustomerBindInput
{
[Required]
public string Account { get; set; } = string.Empty;
[Required]
public string Password { get; set; } = string.Empty;
[Required]
public WeChatProfileInput Wechat { get; set; } = new();
}