39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
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;
|
|
}
|
|
} |