提交代码

This commit is contained in:
zpc 2024-07-15 14:13:56 +08:00
parent bdcf89bc35
commit 2bdd14da94
20 changed files with 393 additions and 75 deletions

View File

@ -84,7 +84,7 @@ namespace HuanMeng.MiaoYu.Code.Base
{
get
{
if (_mapper == null)
if (_HttpContextAccessor == null)
{
_HttpContextAccessor = _serviceProvider.GetRequiredService<IHttpContextAccessor>();
}
@ -184,25 +184,31 @@ namespace HuanMeng.MiaoYu.Code.Base
var accessToken = HttpContextAccessor.HttpContext.GetTokenAsync("Bearer", "access_token").Result;
if (string.IsNullOrEmpty(accessToken))
{
_userInfo = new RequestUserInfo()
{
UserId = 0
};
}
var (principal, jwtToken) = JwtAuthManager.DecodeJwtToken(accessToken);
if (jwtToken == null || !jwtToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256Signature))
else
{
throw new SecurityTokenException("无效的token");
var (principal, jwtToken) = JwtAuthManager.DecodeJwtToken(accessToken);
if (jwtToken == null || !jwtToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256Signature))
{
throw new SecurityTokenException("无效的token");
}
var userIdStr = principal.FindFirst("UserId")?.Value;
if (string.IsNullOrEmpty(userIdStr))
{
throw new SecurityTokenException("无效的token");
}
var nickName = principal.FindFirst("NickName")?.Value;
var userId = int.Parse(userIdStr);
_userInfo = new RequestUserInfo()
{
UserId = userId,
NickName = nickName
};
}
var userIdStr = principal.FindFirst("UserId")?.Value;
if (string.IsNullOrEmpty(userIdStr))
{
throw new SecurityTokenException("无效的token");
}
var nickName = principal.FindFirst("NickName")?.Value;
var userId = int.Parse(userIdStr);
_userInfo = new RequestUserInfo()
{
UserId = userId,
NickName = nickName
};
}
return _userInfo;
}
@ -221,7 +227,7 @@ namespace HuanMeng.MiaoYu.Code.Base
#endregion
#region
private MiaoYuCache? _miaoYuCache ; //new MiaoYuCache(Dao, Mapper);
private MiaoYuCache? _miaoYuCache; //new MiaoYuCache(Dao, Mapper);
/// <summary>
/// 妙语实现类
/// </summary>

View File

@ -1,5 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@ -34,19 +36,19 @@ namespace HuanMeng.MiaoYu.Code.Cache
{
if (_dataList == null)
{
_dataList = MemoryCacheHelper.GetCache<List<T>>(key);
if (_dataList == null)
var tempDataList = MemoryCacheHelper.GetCache<List<T>>(key);
if (tempDataList == null)
{
lock (lockObj)
{
if (_dataList == null)
if (tempDataList == null)
{
_dataList = GetDataList();
MemoryCacheHelper.SetCache(key, _dataList, cacheTime);
tempDataList = GetDataList();
MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
}
}
}
_dataList = JsonConvert.DeserializeObject<List<T>>(JsonConvert.SerializeObject(tempDataList));
}
return _dataList ?? new List<T>();
}

View File

@ -81,11 +81,39 @@ namespace HuanMeng.MiaoYu.Code.Cache
{
if (CharacterCache == null)
{
CharacterCache = new CharacterEntityCache(dao, mapper);
}
return CharacterCache.DataList ?? new List<CharacterCache>();
}
}
#endregion
#region
/// <summary>
/// 图片缓存表
/// </summary>
private static object ImageConfigLock = new object();
/// <summary>
/// 图片缓存表
/// </summary>
public MiaoYuDataEntityCache<T_Image_Config>? ImageConfigCache { get; set; }
/// <summary>
/// 图片
/// </summary>
public List<T_Image_Config> ImageConfigList
{
get
{
if (ImageConfigCache == null)
{
ImageConfigCache = new MiaoYuDataEntityCache<T_Image_Config>(dao, ImageConfigLock);
}
return ImageConfigCache.DataList ?? new List<T_Image_Config>();
}
}
#endregion
}
}

View File

@ -1,7 +1,9 @@
using AutoMapper;
using HuanMeng.MiaoYu.Code.DataAccess;
using HuanMeng.MiaoYu.Code.Other;
using HuanMeng.MiaoYu.Model.Dto.Character;
using HuanMeng.MiaoYu.Model.Dto.Label;
using System;
using System.Collections.Generic;
@ -21,37 +23,69 @@ namespace HuanMeng.MiaoYu.Code.Cache.Special
/// 锁
/// </summary>
private static object CharacterCacheLock = new object();
private static object ImageLock = new object();
private static object T_Character_LabelLock = new object();
private static object T_Character_Label_RelationLock = new object();
/// <summary>
/// 获取缓存数据
/// </summary>
/// <returns></returns>
public override List<CharacterCache> GetDataList()
{
List<CharacterCache> characterCaches = null;
List<CharacterCache> characterCaches = new List<CharacterCache>();
//读取角色表
var characters = _dao.daoDbMiaoYu.context.T_Character.ToList();
if (characters == null)
{
return new List<CharacterCache>();
return characterCaches;
}
characterCaches = mapper.Map<List<CharacterCache>>(characters);
string sqlString = $"select TOP 100 CharacterId,count(DISTINCT UserId ) UserCount from T_User_Char where isdelete=0 and TenantId='{_dao.daoDbMiaoYu.context.TenantInfo?.TenantId}' GROUP BY CharacterId";
//获取查看次数
var characteChatCounts = _dao.daoDbMiaoYu.SqlQueryList<CharacteChatCountModel>(sqlString);
//查询配置表
var modelConfigs = _dao.daoDbMiaoYu.context.T_Model_Config.ToList();
var ImageConfigCache = new MiaoYuDataEntityCache<T_Image_Config>(_dao, ImageLock);
var images = ImageConfigCache.DataList;
//标签
var labelCache = new MiaoYuDataEntityCache<T_Character_Label>(_dao, T_Character_LabelLock);
var labels = labelCache.DataList;
var labelRelationCache = new MiaoYuDataEntityCache<T_Character_Label_Relation>(_dao, T_Character_Label_RelationLock);
var labelRelations = labelRelationCache.DataList;
foreach (var characterCache in characterCaches)
{
var modelConfig = modelConfigs.FirstOrDefault(it => it.Id == characterCache.ModelConfigId);
if (modelConfig != null)
{
characterCache.ModelConfig = modelConfig;
//查询图片
characterCache.IconImage = images.GetImageUrl(characterCache.IconImg ?? 0);
characterCache.BgImage = images.GetImageUrl(characterCache.BgImg ?? 0);
var c = characteChatCounts.FirstOrDefault(it => it.CharacterId == characterCache.Id);
if (c != null)
{
characterCache.LookCount = c.UserCount;
}
var characterLabelIds = labelRelations.Where(it => it.CharacterId == characterCache.Id).Select(it => it.CharacterLabelId).ToList();
if (characterLabelIds.Count > 0)
{
var lab = labels.Where(it => characterLabelIds.Contains(it.Id)).ToList();
var labs = mapper.Map<List<LabelDto>>(lab);
characterCache.Label = labs;
}
else
{
characterCache.Label = new List<LabelDto>();
}
}
}
//移除没有配置模型的类
characterCaches.Where(it => it.ModelConfig == null).ToList().ForEach(characterCache =>
{
characterCaches.Remove(characterCache);
});
return characterCaches;
}
}

View File

@ -1,3 +1,13 @@
using AutoMapper;
using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Model.Dto.Character;
using HuanMeng.MiaoYu.Model.Dto.Chat;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
@ -16,20 +26,74 @@ namespace HuanMeng.MiaoYu.Code.Character
}
/// <summary>
///
/// 首页获取角色列表
/// </summary>
/// <returns></returns>
public Task<object> GetCharacter(int index)
public async Task<BaseResponse<List<CharacterInfoDto>>> GetHomeCharacter(RequestCharacterInfoPage requestCharacterInfo)
{
var charactersList = MiaoYuCache.CharactersList.Where(it => it.Visibility).ToList();
var index = requestCharacterInfo.Index ?? 0;
var size = requestCharacterInfo.Size ?? 10;
var charactersList = MiaoYuCache.CharacterList.OrderByDescending(it => it.LookCount)
.Skip((index - 1) * size).Take(size).ToList();
if (charactersList.Count == 0)
{
return null;
return new BaseResponse<List<CharacterInfoDto>>();
}
return null;
var list = Mapper.Map<List<CharacterInfoDto>>(charactersList);
//不是游客
if (_UserId != 0)
{
List<int> characterIds = list.Select(it => it.CharacterId).ToList();
//获取亲密值
var intimacys = await Dao.daoDbMiaoYu.context.T_Character_User_Intimacy.Where(it => it.UserId == _UserId
&& characterIds.Contains(it.CharacterId)).ToListAsync();
list.ForEach(it =>
{
it.Intimacy = intimacys.FirstOrDefault(item => item.CharacterId == it.CharacterId)?.IntimacyValue ?? 0;
});
}
return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", list);
}
/// <summary>
/// 获取角色详情
/// </summary>
/// <param name="requestCharacterInfo"></param>
/// <returns></returns>
public async Task<BaseResponse<CharacterInfoDto>> GetCharacterInfo(RequestCharacterInfo requestCharacterInfo)
{
var charactersinfo = MiaoYuCache.CharacterList.FirstOrDefault(it => it.Id == requestCharacterInfo.CharacterId);
if (charactersinfo == null)
{
return new BaseResponse<CharacterInfoDto>();
}
var info = Mapper.Map<CharacterInfoDto>(charactersinfo);
//不是游客
if (_UserId != 0)
{
//获取亲密值
var intimacys = await Dao.daoDbMiaoYu.context.T_Character_User_Intimacy.Where(it => it.UserId == _UserId
&& it.CharacterId == info.CharacterId).FirstOrDefaultAsync();
info.Intimacy = intimacys?.IntimacyValue ?? 0;
}
return new BaseResponse<CharacterInfoDto>(ResonseCode.Success, "", info);
}
/// <summary>
/// 获取全部角色的Id
/// </summary>
/// <returns></returns>
public BaseResponse<List<int>> GetCharacters()
{
Random rng = new Random();
var charactersIds = MiaoYuCache.CharacterList.Select(it => it.Id).OrderBy(x => rng.Next()).ToList();
if (charactersIds == null)
{
charactersIds = new List<int>();
}
return new BaseResponse<List<int>>(ResonseCode.Success, "", charactersIds);
}
}
}

View File

@ -1,7 +1,7 @@
using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Code.Cache;
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
using HuanMeng.MiaoYu.Model.Dto.Home;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Code.Other
{
/// <summary>
/// 图片扩展类
/// </summary>
public static class ImageExtend
{
/// <summary>
/// 获取图片地址
/// </summary>
/// <param name="configs"></param>
/// <param name="imageId"></param>
/// <returns></returns>
public static string GetImageUrl(this List<T_Image_Config> configs, int imageId)
{
if (imageId > 0 && configs != null && configs.Count > 0)
{
return configs.FirstOrDefault(it => it.ImageId == imageId)?.Url ?? "";
}
return "";
}
}
}

View File

@ -180,12 +180,8 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
entity.ToTable(tb => tb.HasComment("关联角色和标签"));
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasComment("人物和标签的关联id");
entity.Property(e => e.CharacterId_)
.HasComment("人物Id")
.HasColumnName("CharacterId ");
entity.Property(e => e.Id).HasComment("人物和标签的关联id");
entity.Property(e => e.CharacterId).HasComment("人物Id");
entity.Property(e => e.CharacterLabelId).HasComment("人物标签id");
entity.Property(e => e.CreateTime)
.HasComment("创建时间")
@ -210,12 +206,16 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasComment("类型id");
entity.Property(e => e.CreateTime).HasComment("创建时间");
entity.Property(e => e.CreateTime)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.Name)
.HasMaxLength(255)
.HasComment("类型名称");
entity.Property(e => e.TenantId).HasComment("租户id");
entity.Property(e => e.UpdateTime).HasComment("更新时间");
entity.Property(e => e.UpdateTime)
.HasComment("更新时间")
.HasColumnType("datetime");
//添加全局筛选器
if (this.TenantInfo != null)
{
@ -229,9 +229,7 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
entity.ToTable(tb => tb.HasComment("存储用户和角色之间的亲密值"));
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasComment("亲密度id");
entity.Property(e => e.Id).HasComment("亲密度id");
entity.Property(e => e.CharacterId).HasComment("人物Id");
entity.Property(e => e.CreateTime)
.HasComment("创建时间")

View File

@ -12,24 +12,24 @@ public partial class T_Character_Label_Relation: MultiTenantEntity
/// </summary>
public int Id { get; set; }
/// <summary>
/// 人物Id
/// </summary>
public int? CharacterId_ { get; set; }
public int CharacterId { get; set; }
/// <summary>
/// 人物标签id
/// </summary>
public int? CharacterLabelId { get; set; }
public int CharacterLabelId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
}

View File

@ -15,8 +15,7 @@ public partial class T_Character_Type: MultiTenantEntity
/// <summary>
/// 类型名称
/// </summary>
public string? Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// 创建时间
@ -27,4 +26,5 @@ public partial class T_Character_Type: MultiTenantEntity
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
}

View File

@ -16,25 +16,25 @@ public partial class T_Character_User_Intimacy: MultiTenantEntity
/// <summary>
/// 人物Id
/// </summary>
public int? CharacterId { get; set; }
public int CharacterId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public int? UserId { get; set; }
public int UserId { get; set; }
/// <summary>
/// 亲密值
/// </summary>
public int? IntimacyValue { get; set; }
public int IntimacyValue { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Model.Dto.Character
{
/// <summary>
/// 角色聊天次数
/// </summary>
public class CharacteChatCountModel
{
/// <summary>
/// 角色Id
/// </summary>
public int CharacterId { get; set; }
/// <summary>
/// 聊天次数
/// </summary>
public int UserCount { get; set; }
}
}

View File

@ -1,6 +1,7 @@
using AutoMapper;
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
using HuanMeng.MiaoYu.Model.Dto.Label;
using System;
using System.Collections.Generic;
@ -25,5 +26,20 @@ namespace HuanMeng.MiaoYu.Model.Dto.Character
/// 多少人聊天过
/// </summary>
public int LookCount { get; set; }
/// <summary>
/// 背景图片
/// </summary>
public string BgImage { get; set; }
/// <summary>
/// 用户头像url
/// </summary>
public string IconImage { get; set; }
/// <summary>
/// 标签
/// </summary>
public List<LabelDto> Label { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Model.Dto.Character
{
/// <summary>
///
/// </summary>
public class RequestCharacterInfo
{
/// <summary>
/// 角色Id
/// </summary>
public int CharacterId { get; set; }
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Model.Dto.Character
{
/// <summary>
/// 请求参数
/// </summary>
public class RequestCharacterInfoPage
{
/// <summary>
/// 起始页
/// </summary>
public int? Index { get; set; } = 1;
/// <summary>
/// 页大小
/// </summary>
public int? Size { get; set; } = 10;
}
}

View File

@ -1,10 +1,16 @@
using AutoMapper;
using AutoMapper.Configuration.Annotations;
using HuanMeng.MiaoYu.Model.Dto.Character;
using HuanMeng.MiaoYu.Model.Dto.Label;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Model.Dto.Home
namespace HuanMeng.MiaoYu.Model.Dto.Chat
{
public class CharacterInfo
{
@ -13,11 +19,13 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
/// <summary>
/// 用户和人物信息
/// </summary>
[AutoMap(typeof(CharacterCache))]
public class CharacterInfoDto
{
/// <summary>
/// 头像
/// </summary>
[SourceMember(nameof(CharacterCache.IconImage))]
public string Icon { get; set; }
/// <summary>
@ -28,16 +36,19 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
/// <summary>
/// 人物id
/// </summary>
[SourceMember(nameof(CharacterCache.Id))]
public int CharacterId { get; set; }
/// <summary>
/// 人物名称
/// </summary>
[SourceMember(nameof(CharacterCache.Name))]
public string CharacterName { get; set; }
/// <summary>
/// 性别
/// </summary>
public int Gender { get; set; }
/// <summary>
@ -48,11 +59,13 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
/// <summary>
/// 背景图片
/// </summary>
[SourceMember(nameof(CharacterCache.BgImage))]
public string BgUrl { get; set; }
/// <summary>
/// 简介
/// </summary>
public string Biography { get; set; }
/// <summary>
@ -63,6 +76,7 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
/// <summary>
/// 标签
/// </summary>
[SourceMember(nameof(CharacterCache.Label))]
public List<LabelDto> Label { get; set; }
/// <summary>
@ -71,14 +85,6 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
//public int RemainingChatCount { get; set; }
}
/// <summary>
/// 人物角色标签
/// </summary>
public class LabelDto
{
public int Id { get; set; }
public string Name { get; set; }
}
/// <summary>
/// 聊天列表信息
@ -128,6 +134,6 @@ namespace HuanMeng.MiaoYu.Model.Dto.Home
/// <summary>
/// 人物id
/// </summary>
public int CharacterId { get; set; }
public int CharacterId { get; set; }
}
}

View File

@ -0,0 +1,32 @@
using AutoMapper;
using AutoMapper.Configuration.Annotations;
using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu;
using HuanMeng.MiaoYu.Model.Dto.Character;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HuanMeng.MiaoYu.Model.Dto.Label
{
/// <summary>
/// 人物角色标签
/// </summary>
[AutoMap(typeof(T_Character_Label))]
public class LabelDto
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
/// <summary>
/// 标签名称
/// </summary>
[SourceMember(nameof(T_Character_Label.LabelName))]
public string Name { get; set; }
}
}

View File

@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>
<ItemGroup>

View File

@ -1,6 +1,8 @@
using HuanMeng.DotNetCore.Base;
using HuanMeng.MiaoYu.Code.Character;
using HuanMeng.MiaoYu.Code.Chat;
using HuanMeng.MiaoYu.Model.Dto.Home;
using HuanMeng.MiaoYu.Model.Dto.Character;
using HuanMeng.MiaoYu.Model.Dto.Chat;
using HuanMeng.MiaoYu.WebApi.Base;
using Microsoft.AspNetCore.Authorization;
@ -29,16 +31,32 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
}
/// <summary>
/// 获取人物信息
/// 获取角色Id
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<BaseResponse<List<CharacterInfoDto>>> GetCharacterInfo()
public BaseResponse<List<int>> GetCharacterIdList()
{
CharacterBLL characterBLL = new CharacterBLL(ServiceProvider);
var obj = characterBLL.GetCharacters();
return obj;
}
/// <summary>
/// 获取角色人物信息
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<BaseResponse<CharacterInfoDto>> GetCharacterInfo([FromQuery] RequestCharacterInfo requestCharacterInfo)
{
CharacterBLL characterBLL = new CharacterBLL(ServiceProvider);
var obj = await characterBLL.GetCharacterInfo(requestCharacterInfo);
return obj;
var obj = JsonConvert.DeserializeObject<List<CharacterInfoDto>>("[{\"Icon\":\"\",\"Intimacy\":10,\"CharacterId\":2,\"CharacterName\":\"许荷姻\",\"Gender\":1,\"LookCount\":2,\"BgUrl\":\"\",\"Biography\":\"你那商业联姻得来的妻子,原本的天才女孩,聪明伶俐,生的漂亮、端庄,不知贵圈多少人梦寐以求的存在。\",\"Prologue\":\"坐在轮椅上,眼神平静的看着你,语气也同样平静)你回来了。饭菜在桌上,我刚刚热了。(说到这,又垂下眸子道)我还做了碗醒酒汤,记得喝\",\"Label\":[{\"Id\":1,\"Name\":\"美女\"},{\"Id\":2,\"Name\":\"二次元\"}],\"RemainingChatCount\":1}]");
return new BaseResponse<List<CharacterInfoDto>>(ResonseCode.Success, "", obj);
}
/// <summary>

View File

@ -13,6 +13,7 @@ using HuanMeng.DotNetCore.CustomExtension;
using HuanMeng.MiaoYu.Code.Cache;
using HuanMeng.MiaoYu.Code.Chat;
using Serilog;
using HuanMeng.MiaoYu.Model.Dto;
var builder = WebApplication.CreateBuilder(args);
//Log.Logger = new LoggerConfiguration()
// .WriteTo.Console()
@ -30,7 +31,20 @@ builder.Services.AddHttpContextAccessor(); //添加httpContext注入访问
var _myAllowSpecificOrigins = "_myAllowSpecificOrigins";
builder.Services.AddCustomCors(_myAllowSpecificOrigins);
#endregion
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies().Where(it => it.FullName.Contains("HuanMeng") || it.FullName.Contains("XLib.")).ToList());
#region automap
var mapperDomain = AppDomain.CurrentDomain.GetAssemblies().Where(it => it.FullName.Contains("HuanMeng") || it.FullName.Contains("XLib.")).ToList();
Type type = typeof(ResponseUserInfo);
if (type != null)
{
Assembly assembly = Assembly.GetAssembly(type);
if (!mapperDomain.Any(it => it.FullName == assembly.FullName))
{
mapperDomain.Add(assembly);
}
}
builder.Services.AddAutoMapper(mapperDomain);
#endregion
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();