feat: 新增AI账户服务及扩展用户信息获取功能,支持通过userId查询用户信息
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
using Yi.Framework.Rbac.Domain.Shared.Dtos;
|
||||||
|
|
||||||
|
namespace Yi.Framework.AiHub.Application.Contracts.Dtos;
|
||||||
|
|
||||||
|
public class AiUserRoleMenuDto:UserRoleMenuDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否绑定服务号
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBindFuwuhao { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Volo.Abp.Application.Services;
|
||||||
|
using Volo.Abp.Users;
|
||||||
|
using Yi.Framework.AiHub.Application.Contracts.Dtos;
|
||||||
|
using Yi.Framework.AiHub.Domain.Entities;
|
||||||
|
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Dtos;
|
||||||
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||||
|
|
||||||
|
namespace Yi.Framework.AiHub.Application.Services;
|
||||||
|
|
||||||
|
public class AiAccountService : ApplicationService
|
||||||
|
{
|
||||||
|
private IAccountService _accountService;
|
||||||
|
private ISqlSugarRepository<AiUserExtraInfoEntity> _userRepository;
|
||||||
|
|
||||||
|
public AiAccountService(IAccountService accountService, ISqlSugarRepository<AiUserExtraInfoEntity> userRepository)
|
||||||
|
{
|
||||||
|
_accountService = accountService;
|
||||||
|
_userRepository = userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取ai用户信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Authorize]
|
||||||
|
[HttpGet("account/ai")]
|
||||||
|
public async Task<AiUserRoleMenuDto> GetAsync()
|
||||||
|
{
|
||||||
|
var userId = CurrentUser.GetId();
|
||||||
|
var userAccount = await _accountService.GetAsync(null, null, userId: CurrentUser.GetId());
|
||||||
|
var output = userAccount.Adapt<AiUserRoleMenuDto>();
|
||||||
|
output.IsBindFuwuhao = await _userRepository.IsAnyAsync(x => userId == x.UserId);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,8 +24,9 @@ namespace Yi.Framework.Rbac.Application.Contracts.IServices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userName"></param>
|
/// <param name="userName"></param>
|
||||||
/// <param name="phone"></param>
|
/// <param name="phone"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UserRoleMenuDto?> GetAsync(string? userName, long? phone);
|
Task<UserRoleMenuDto?> GetAsync(string? userName, long? phone,Guid? userId = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 校验电话验证码,需要与电话号码绑定
|
/// 校验电话验证码,需要与电话号码绑定
|
||||||
|
|||||||
@@ -284,11 +284,12 @@ namespace Yi.Framework.Rbac.Application.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RemoteService(isEnabled: false)]
|
[RemoteService(isEnabled: false)]
|
||||||
public async Task<UserRoleMenuDto?> GetAsync(string? userName, long? phone)
|
public async Task<UserRoleMenuDto?> GetAsync(string? userName, long? phone = null, Guid? userId = null)
|
||||||
{
|
{
|
||||||
var user = await _userRepository._DbQueryable
|
var user = await _userRepository._DbQueryable
|
||||||
.WhereIF(userName is not null, x => x.UserName == userName)
|
.WhereIF(userName is not null, x => x.UserName == userName)
|
||||||
.WhereIF(phone is not null, x => x.Phone == phone)
|
.WhereIF(phone is not null, x => x.Phone == phone)
|
||||||
|
.WhereIF(userId is not null, x => x.Id == userId)
|
||||||
.Where(x => x.State == true)
|
.Where(x => x.State == true)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Yi.Abp.Web
|
|||||||
//本地开发环境,可以禁用作业执行
|
//本地开发环境,可以禁用作业执行
|
||||||
if (host.IsDevelopment())
|
if (host.IsDevelopment())
|
||||||
{
|
{
|
||||||
Configure<AbpBackgroundWorkerOptions>(options => { options.IsEnabled = true; });
|
Configure<AbpBackgroundWorkerOptions>(options => { options.IsEnabled = false; });
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求日志
|
//请求日志
|
||||||
|
|||||||
Reference in New Issue
Block a user