using MAX.Core.DependencyInjection; using Store.Management.Api; using Store.Management.Api.Authentication; namespace Store.Management.Framework.Services; /// 用户登录服务,复用应用 API 客户端的认证会话。 public interface ILoginService { /// 提交登录;passwordHash 为 UTF-8 密码的 32 位大写 MD5。 Task LoginAsync(string userName, string passwordHash, CancellationToken cancellationToken = default); } internal sealed class LoginService(StoreApiClient apiClient) : ILoginService, ISingletonDependency { public Task LoginAsync(string userName, string passwordHash, CancellationToken cancellationToken = default) => apiClient.Auth.LoginAsync(new LoginRequest { UserName = userName.Trim(), Password = passwordHash }, cancellationToken); }