添加项目文件。
This commit is contained in:
6
QYZH.InteractiveMagazine.IService/Class1.cs
Normal file
6
QYZH.InteractiveMagazine.IService/Class1.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
64
QYZH.InteractiveMagazine.IService/Dto/AuthDto.cs
Normal file
64
QYZH.InteractiveMagazine.IService/Dto/AuthDto.cs
Normal file
@ -0,0 +1,64 @@
|
||||
namespace QYZH.InteractiveMagazine.IService.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// 登录输入
|
||||
/// </summary>
|
||||
public class LoginInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string Account { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册输入
|
||||
/// </summary>
|
||||
public class RegisterInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string Account { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录输出
|
||||
/// </summary>
|
||||
public class LoginOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问令牌
|
||||
/// </summary>
|
||||
public string Token { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 刷新令牌
|
||||
/// </summary>
|
||||
public string RefreshToken { get; set; } = string.Empty;
|
||||
}
|
||||
38
QYZH.InteractiveMagazine.IService/Dto/WeChatDto.cs
Normal file
38
QYZH.InteractiveMagazine.IService/Dto/WeChatDto.cs
Normal file
@ -0,0 +1,38 @@
|
||||
namespace QYZH.InteractiveMagazine.IService.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// 微信登录输出
|
||||
/// </summary>
|
||||
public class WeChatLoginOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问令牌
|
||||
/// </summary>
|
||||
public string Token { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 微信OpenId
|
||||
/// </summary>
|
||||
public string OpenId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 微信手机号获取输出
|
||||
/// </summary>
|
||||
public class WeChatPhoneNumberOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
}
|
||||
31
QYZH.InteractiveMagazine.IService/IAuthService.cs
Normal file
31
QYZH.InteractiveMagazine.IService/IAuthService.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using QYZH.InteractiveMagazine.IService.Dto;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 认证服务接口
|
||||
/// </summary>
|
||||
public interface IAuthService
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户登录
|
||||
/// </summary>
|
||||
/// <param name="account">账号</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <returns>登录结果</returns>
|
||||
Task<LoginOutput> LoginAsync(string account, string password);
|
||||
|
||||
/// <summary>
|
||||
/// 用户注册
|
||||
/// </summary>
|
||||
/// <param name="input">注册输入参数</param>
|
||||
/// <returns>是否成功</returns>
|
||||
Task<bool> RegisterAsync(RegisterInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 刷新令牌
|
||||
/// </summary>
|
||||
/// <param name="refreshToken">刷新令牌</param>
|
||||
/// <returns>新的登录结果</returns>
|
||||
Task<LoginOutput> RefreshTokenAsync(string refreshToken);
|
||||
}
|
||||
51
QYZH.InteractiveMagazine.IService/IBaseService.cs
Normal file
51
QYZH.InteractiveMagazine.IService/IBaseService.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 基础服务接口
|
||||
/// </summary>
|
||||
/// <typeparam name="T">实体类型</typeparam>
|
||||
public interface IBaseService<T> where T : class, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据ID获取实体
|
||||
/// </summary>
|
||||
/// <param name="id">实体ID</param>
|
||||
/// <returns>实体对象</returns>
|
||||
Task<T?> GetByIdAsync(long id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有实体列表
|
||||
/// </summary>
|
||||
/// <returns>实体列表</returns>
|
||||
Task<List<T>> GetListAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="pageQuery">分页查询参数</param>
|
||||
/// <returns>分页数据</returns>
|
||||
Task<PageListModel<T>> GetPageListAsync(PageQueryModel pageQuery);
|
||||
|
||||
/// <summary>
|
||||
/// 新增实体
|
||||
/// </summary>
|
||||
/// <param name="entity">实体对象</param>
|
||||
/// <returns>是否成功</returns>
|
||||
Task<bool> InsertAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 更新实体
|
||||
/// </summary>
|
||||
/// <param name="entity">实体对象</param>
|
||||
/// <returns>是否成功</returns>
|
||||
Task<bool> UpdateAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 根据ID删除实体
|
||||
/// </summary>
|
||||
/// <param name="id">实体ID</param>
|
||||
/// <returns>是否成功</returns>
|
||||
Task<bool> DeleteByIdAsync(long id);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
using QYZH.InteractiveMagazine.IService.Dto;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.IService;
|
||||
|
||||
/// <summary>
|
||||
/// 微信小程序服务接口
|
||||
/// </summary>
|
||||
public interface IWeChatMiniProgramService
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信登录
|
||||
/// </summary>
|
||||
/// <param name="code">微信登录凭证</param>
|
||||
/// <returns>微信登录结果</returns>
|
||||
Task<WeChatLoginOutput> WeChatLoginAsync(string code);
|
||||
|
||||
/// <summary>
|
||||
/// 获取手机号
|
||||
/// </summary>
|
||||
/// <param name="code">获取手机号凭证</param>
|
||||
/// <returns>手机号信息</returns>
|
||||
Task<WeChatPhoneNumberOutput> GetPhoneNumberAsync(string code);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\QYZH.InteractiveMagazine.Common\QYZH.InteractiveMagazine.Common.csproj" />
|
||||
<ProjectReference Include="..\QYZH.InteractiveMagazine.Models\QYZH.InteractiveMagazine.Models.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user