Files
TakeoutSaaS.TenantApi/src/Modules/TakeoutSaaS.Module.Identity/Abstractions/IWeChatAuthService.cs

24 lines
636 B
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.
namespace TakeoutSaaS.Module.Identity.Abstractions;
/// <summary>
/// 微信登录服务抽象code2Session
/// </summary>
public interface IWeChatAuthService
{
/// <summary>
/// 使用小程序登录 code 换取 openid/unionid/session_key
/// </summary>
Task<WeChatSessionInfo> Code2SessionAsync(string code, CancellationToken cancellationToken = default);
}
/// <summary>
/// 微信会话信息
/// </summary>
public sealed class WeChatSessionInfo
{
public string OpenId { get; init; } = string.Empty;
public string? UnionId { get; init; }
public string SessionKey { get; init; } = string.Empty;
}