黄欣 10 months ago
commit 014fe6afee

@ -11,7 +11,6 @@
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" /> <ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" /> <ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" />
<ProjectReference Include="..\DS.Module.UserModule\DS.Module.UserModule.csproj" /> <ProjectReference Include="..\DS.Module.UserModule\DS.Module.UserModule.csproj" />
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -16,4 +16,10 @@ public interface ISaasDbService
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ISqlSugarClient GetMasterDb(); public ISqlSugarClient GetMasterDb();
/// <summary>
/// 主库根据Id获取业务库
/// </summary>
/// <returns></returns>
public ISqlSugarClient GetBizDbById(string configId);
} }

@ -1,5 +1,3 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule; using DS.Module.UserModule;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
@ -61,4 +59,25 @@ public class SaasDbService : ISaasDbService
{ {
return db.GetConnection("1288018625843826688"); return db.GetConnection("1288018625843826688");
} }
/// <summary>
/// 主库根据Id获取业务库
/// </summary>
/// <returns></returns>
public ISqlSugarClient GetBizDbById(string configId)
{
if(!db.IsAnyConnection(configId))
{
var connInfo = GetMasterDb().Queryable<SysTenantLink>().First(x => x.TenantId == long.Parse(configId));
//用非默认ConfigId进行测试
//添加业务库只在当前上下文有效原理SqlSugarScope模式入门文档去看
db.AddConnection(new ConnectionConfig() {
ConfigId = configId,
ConnectionString = connInfo.Connection,
DbType = connInfo.DbType,
IsAutoCloseConnection = true });
}
return db.GetConnection(configId);
}
} }

@ -0,0 +1,173 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using Microsoft.Extensions.DependencyInjection;
using NLog;
using SqlSugar;
namespace DS.Module.SqlSugar;
/// <summary>
/// SqlSugar 启动服务
/// </summary>
public static class SqlSugarSetup
{
// /// <summary>
// /// 数据库连接字符串
// /// </summary>
// private static string DbInfo = AppSetting.Configuration["ConnectionStrings:DbInfo"];
//
// /// <summary>
// /// 数据库类型
// /// </summary>
// private static string DbType = AppSetting.Configuration["ConnectionStrings:DbType"];
public static readonly Logger Logger = LogManager.GetCurrentClassLogger();
// private readonly IUser user;
// private ILogger<SqlsugarInstall> _logger;
/// <summary>
/// 将模块服务添加到依赖注入服务容器中
/// </summary>
/// <param name="services">依赖注入服务容器</param>
/// <returns></returns>
public static IServiceCollection AddSqlSugarSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
Console.WriteLine("开始加载sqlsugar模块");
Console.WriteLine("数据库配置id:" + AppSetting.app(new string[] { "DBInfo", "DefaultDbConnId" }));
var dbs = AppSetting.app<DbConfig>("DBInfo", "DBS");
//默认数据库
List<DbConfig> dbList = new List<DbConfig>();
DbConfig defaultdb = new DbConfig()
{
ConnId = AppSetting.app(new string[] { "DBInfo", "DefaultDbConnId" }),
Connection = AppSetting.app(new string[] { "DBInfo", "DefaultDbString" }),
DbType = AppSetting.app(new string[] { "DBInfo", "DefaultDbType" }).ObjToInt()
};
dbList.Add(defaultdb);
//业务数据库集合
foreach (var item in dbs)
{
dbList.Add(item);
}
var connectConfigList = SqlsugarHelper.ReturnConnectionConfig(dbList);
foreach (var item in dbList)
{
//防止数据库重复,导致的事务异常
if (connectConfigList.Any(a => a.ConfigId == (dynamic)item.ConnId || a.ConnectionString == item.Connection))
{
continue;
}
connectConfigList.Add(new ConnectionConfig()
{
ConnectionString = item.Connection,
DbType = (DbType)item.DbType,
IsAutoCloseConnection = true,
ConfigId = item.ConnId,
InitKeyType = InitKeyType.Attribute,
MoreSettings = new ConnMoreSettings()
{
IsAutoRemoveDataCache = true //自动清理缓存
},
// 自定义特性
ConfigureExternalServices = new ConfigureExternalServices()
{
}
});
}
var user = services.GetService<IUser>();
//全局上下文生效
SqlSugarScope sqlSugar = new SqlSugarScope(connectConfigList,
db =>
{
// 封装AOP
// SqlsugarAopHelper.AopForSqlsugar(db, user, dbList, connectConfigList);
///*
// * 默认只会配置到第一个数据库,这里按照官方文档进行多数据库/多租户文档的说明进行循环配置
// */
foreach (var c in connectConfigList)
{
var dbProvider = db.GetConnectionScope((string)c.ConfigId);
//单例参数配置,所有上下文生效
dbProvider.Ado.CommandTimeOut = 30;
dbProvider.Aop.OnLogExecuting = (sql, pars) =>
{
Logger.Log(LogLevel.Info,
DateTime.Now.ToString() + "\r\n" +
UtilMethods.GetSqlString(c.DbType, sql, pars));
};
dbProvider.Aop.DataExecuting = (oldValue, entityInfo) =>
{
if (entityInfo.OperationType == DataFilterType.InsertByObject)
{
if (entityInfo.PropertyName == "Id")
{
if (entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(string))
{
entityInfo.SetValue(GuidHelper.GetSnowflakeId());
}
if (entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
{
entityInfo.SetValue(SnowFlakeSingle.Instance.NextId());
}
}
if (entityInfo.PropertyName == "CreateTime")
entityInfo.SetValue(DateTime.Now);
if (!user.UserId.IsNullOrEmpty())
{
if (entityInfo.PropertyName == "TenantId")
entityInfo.SetValue(user.GetTenantId());
}
if (entityInfo.PropertyName == "CreateBy")
{
if (!user.UserId.IsNullOrEmpty())
{
entityInfo.SetValue(user.UserId);
}
else
{
entityInfo.SetValue(1288018625843826688);
}
}
if (entityInfo.PropertyName == "Deleted")
entityInfo.SetValue(false);
}
if (entityInfo.OperationType == DataFilterType.UpdateByObject)
{
if (entityInfo.PropertyName == "UpdateTime")
entityInfo.SetValue(DateTime.Now);
if (entityInfo.PropertyName == "UpdateBy" && user != null)
entityInfo.SetValue(user.UserId);
}
};
dbProvider.Aop.OnError = (exp) => //执行SQL 错误事件
{
Logger.Error(DateTime.Now.ToString() + "\r\n" + exp.Sql + "\r\n" + exp.Parametres);
};
// var tenantId = user.GetTenantId();
//全局过滤租户
dbProvider.QueryFilter.AddTableFilter<ITenantId>(m => m.TenantId ==long.Parse(user.TenantId));
//全局过滤机构Id
dbProvider.QueryFilter.AddTableFilter<IOrgId>(m => m.OrgId == user.GetOrgId());
//全局软删除过滤
dbProvider.QueryFilter.AddTableFilter<IDeleted>(m => m.Deleted == false);
}
});
services.AddSingleton<ISqlSugarClient>(sqlSugar); //这边是SqlSugarScope用AddSingleton
return services;
}
}

@ -0,0 +1,30 @@
using SqlSugar;
namespace DS.Module.SqlSugar;
/// <summary>
/// 租户数据库链接
/// </summary>
[global::SqlSugar.SugarTable("sys_tenant_dblink")]
public class SysTenantLink
{
/// <summary>
/// ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 租户id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 数据库类型
/// </summary>
[SugarColumn(ColumnDescription = "数据库类型")]
public global::SqlSugar.DbType DbType { get; set; } = global::SqlSugar.DbType.MySql;
/// <summary>
/// 数据库链接字符串
/// </summary>
public string Connection { get; set; }
}

@ -53,10 +53,10 @@ public class TenantApplyController : ApiController
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("AuditTenantApply")] [Route("RejectTenantApply")]
public DataResult AuditTenantApply([FromBody] CommonAuditInput model) public DataResult AuditTenantApply([FromBody] CommonAuditInput model)
{ {
var res = _invokeService.AuditTenantApply(model); var res = _invokeService.RejectTenantApply(model);
return res; return res;
} }

@ -75,3 +75,101 @@
2024-01-18 17:07:17.6104 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config 2024-01-18 17:07:17.6104 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-18 17:07:17.6293 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-01-18 17:07:17.6293 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-18 17:07:17.6734 Info Configuration initialized. 2024-01-18 17:07:17.6734 Info Configuration initialized.
2024-01-22 14:38:52.8091 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 14:38:52.8589 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 14:38:52.8973 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 14:38:52.9534 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 14:38:53.0071 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 14:38:53.0277 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 14:38:53.0749 Info Configuration initialized.
2024-01-22 14:59:07.8924 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 14:59:07.9956 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 14:59:08.0176 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 14:59:08.0674 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 14:59:08.1070 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 14:59:08.1251 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 14:59:08.1577 Info Configuration initialized.
2024-01-22 15:29:02.4814 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 15:29:02.5203 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 15:29:02.5437 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 15:29:02.5710 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 15:29:02.5996 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 15:29:02.5996 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 15:29:02.6366 Info Configuration initialized.
2024-01-22 15:52:51.1603 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 15:52:51.1888 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 15:52:51.2173 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 15:52:51.2668 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 15:52:51.3120 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 15:52:51.3349 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 15:52:51.3947 Info Configuration initialized.
2024-01-22 15:56:06.0488 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 15:56:06.1718 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 15:56:06.2141 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 15:56:06.3018 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 15:56:06.3672 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 15:56:06.3909 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 15:56:06.4373 Info Configuration initialized.
2024-01-22 15:58:13.8365 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 15:58:13.9157 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 15:58:13.9290 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 15:58:13.9556 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 15:58:13.9749 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 15:58:13.9749 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 15:58:14.0035 Info Configuration initialized.
2024-01-22 16:01:26.1904 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:01:26.2958 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:01:26.3156 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:01:26.3762 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:01:26.4229 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:01:26.4515 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:01:26.4898 Info Configuration initialized.
2024-01-22 17:30:08.6155 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:30:08.6359 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:30:08.6546 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:30:08.6732 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:30:08.6964 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:30:08.7108 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:30:08.7447 Info Configuration initialized.
2024-01-22 17:33:29.3882 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:33:29.4266 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:33:29.4588 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:33:29.5174 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:33:29.5750 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:33:29.5977 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:33:29.6287 Info Configuration initialized.
2024-01-22 17:45:44.0418 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:45:44.1647 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:45:44.1940 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:45:44.2352 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:45:44.2693 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:45:44.2889 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:45:44.3228 Info Configuration initialized.
2024-01-22 17:50:03.3190 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:50:03.4275 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:50:03.4584 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:50:03.5223 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:50:03.5595 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:50:03.5764 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:50:03.6170 Info Configuration initialized.
2024-01-22 17:57:46.6775 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:57:46.7001 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:57:46.7125 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:57:46.7274 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:57:46.7432 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:57:46.7432 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:57:46.7677 Info Configuration initialized.
2024-01-22 18:00:11.0252 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 18:00:11.0766 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 18:00:11.1221 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 18:00:11.1815 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 18:00:11.2302 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-22 18:00:11.2558 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 18:00:11.3142 Info Configuration initialized.
2024-01-23 09:24:14.0758 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-23 09:24:14.1128 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-23 09:24:14.1407 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-23 09:24:14.1732 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-23 09:24:14.2152 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-01-23 09:24:14.2321 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-23 09:24:14.2606 Info Configuration initialized.

@ -27,11 +27,11 @@ builder.Host
builder.Services.AddAppWebInstal(); builder.Services.AddAppWebInstal();
builder.Services.AddCorsInstall(); builder.Services.AddCorsInstall();
builder.Services.AddUserModuleInstall(); //用户服务
builder.Services.AddSqlsugarInstall(); builder.Services.AddSqlsugarInstall();
builder.Services.AddSwaggerInstall(); builder.Services.AddSwaggerInstall();
builder.Services.AddUserModuleInstall(); //用户服务
builder.Services.AddJwtInstall(); builder.Services.AddJwtInstall();
builder.Services.AddSaasDbInstall();//分库服务
var app = builder.Build(); var app = builder.Build();

@ -35,7 +35,7 @@ public class CodeCountry: BaseModel<long>
public string Capital { get; set; } public string Capital { get; set; }
/// <summary> /// <summary>
/// 关税 /// 关税等级
/// </summary> /// </summary>
public int Tariff { get; set; } public int Tariff { get; set; }
/// <summary> /// <summary>
@ -44,12 +44,12 @@ public class CodeCountry: BaseModel<long>
public int TonnageTax { get; set; } public int TonnageTax { get; set; }
/// <summary> /// <summary>
/// 国家代码2 /// 国家3字代码
/// </summary> /// </summary>
public string CountryCode2 { get; set; } public string CountryCode3 { get; set; }
/// <summary> /// <summary>
/// 解释说明 /// 国家描述
/// </summary> /// </summary>
public string Explain { get; set; } public string Explain { get; set; }

@ -32,6 +32,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" /> <ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" /> <ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" />
<ProjectReference Include="..\DS.Module.SqlSugar\DS.Module.SqlSugar.csproj" />
<ProjectReference Include="..\DS.Module.UserModule\DS.Module.UserModule.csproj" /> <ProjectReference Include="..\DS.Module.UserModule\DS.Module.UserModule.csproj" />
<ProjectReference Include="..\Ds.Modules.DsEntity\Ds.Modules.DsEntity.csproj" /> <ProjectReference Include="..\Ds.Modules.DsEntity\Ds.Modules.DsEntity.csproj" />
</ItemGroup> </ItemGroup>

@ -0,0 +1,60 @@
using DS.Module.Core.Data;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 企业用户注册审核
/// </summary>
public class TenantApplyAuditReq
{
/// <summary>
/// 审核信息
/// </summary>
public CommonAuditInput AuditInfo { get; set; }
/// <summary>
/// 授权用户数
/// </summary>
public int AuthUserNum { get; set; }
/// <summary>
/// 授权Ids
/// </summary>
public List<long> PermissionIds { get; set; }
/// <summary>
/// 模块授权列表
/// </summary>
public List<PermissionAuth> PermissionAuthList { get; set; }
/// <summary>
/// 数据库信息
/// </summary>
public DbInfo DbInfo { get; set; }
}
/// <summary>
/// 模块授权
/// </summary>
public class PermissionAuth
{
/// <summary>
/// 模块Id
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 授权数
/// </summary>
public int AuthNum { get; set; }
}
/// <summary>
/// 数据库链接信息
/// </summary>
public class DbInfo
{
/// <summary>
/// 数据库类型
/// </summary>
public SqlSugar.DbType DbType { get; set; } = SqlSugar.DbType.MySql;
/// <summary>
/// 数据库链接字符串
/// </summary>
public string Connection { get; set; }
}

@ -41,9 +41,16 @@ public interface ITenantApplyService
public DataResult<TenantApplyInfoRes> GetTenantAuditInfo(string id); public DataResult<TenantApplyInfoRes> GetTenantAuditInfo(string id);
/// <summary> /// <summary>
/// 企业用户审批 /// 企业用户审批 驳回
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public DataResult AuditTenantApply(CommonAuditInput req); public DataResult RejectTenantApply(CommonAuditInput req);
/// <summary>
/// 企业用户审批 - 通过
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
Task<DataResult> TenantApplyAudit(TenantApplyAuditReq req);
} }

@ -10,9 +10,8 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
using System.Diagnostics; using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using DS.Module.SqlSugar;
using Mapster; using Mapster;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -27,6 +26,7 @@ public class CommonService : ICommonService
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db; private readonly ISqlSugarClient db;
private readonly IUser user; private readonly IUser user;
private readonly ISaasDbService saasService;
private readonly IHttpContextAccessor IhttpContext; private readonly IHttpContextAccessor IhttpContext;
private readonly IWebHostEnvironment _environment; private readonly IWebHostEnvironment _environment;
@ -39,6 +39,7 @@ public class CommonService : ICommonService
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>(); db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>(); user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
IhttpContext = _serviceProvider.GetRequiredService<IHttpContextAccessor>(); IhttpContext = _serviceProvider.GetRequiredService<IHttpContextAccessor>();
_environment = _serviceProvider.GetRequiredService<IWebHostEnvironment>(); _environment = _serviceProvider.GetRequiredService<IWebHostEnvironment>();
} }
@ -345,16 +346,16 @@ public class CommonService : ICommonService
{ {
return DataResult<string>.Failed("密码错误!"); return DataResult<string>.Failed("密码错误!");
} }
//取第一个机构 // //取第一个机构
var orgRelation = db.Queryable<SysOrgUser>() // var orgRelation = db.Queryable<SysOrgUser>()
.First(x => x.UserId == userInfo.Id); // .First(x => x.UserId == userInfo.Id);
var tokenModel = new JwtHelper.JwtTokenModel var tokenModel = new JwtHelper.JwtTokenModel
{ {
Uid = userInfo.Id.ToString(), Uid = userInfo.Id.ToString(),
OrgId = orgRelation.OrgId.ToString(), // OrgId = orgRelation.OrgId.ToString(),
TenantId = userInfo.TenantId.ToString(), TenantId = userInfo.TenantId.ToString(),
}; };
var token = JwtHelper.Encrypt(tokenModel,false,true); var token = JwtHelper.Encrypt(tokenModel,false,false);
return DataResult<string>.Success(token); return DataResult<string>.Success(token);
} }
@ -367,19 +368,19 @@ public class CommonService : ICommonService
{ {
var userId = long.Parse(user.UserId); var userId = long.Parse(user.UserId);
var tenantId = user.GetTenantId(); var tenantId = user.GetTenantId();
//取第一个机构 // //取第一个机构
var orgRelations = db.Queryable<SysOrgUser>() // var orgRelations = db.Queryable<SysOrgUser>()
.LeftJoin<SysOrg>((a,b)=>a.OrgId==b.Id) // .LeftJoin<SysOrg>((a,b)=>a.OrgId==b.Id)
.Where(a => a.UserId == userId) // .Where(a => a.UserId == userId)
.Select<UserOrgListRes>() // .Select<UserOrgListRes>()
.ToList(); // .ToList();
var tokenModel = new JwtHelper.JwtTokenModel var tokenModel = new JwtHelper.JwtTokenModel
{ {
Uid = user.UserId, Uid = user.UserId,
OrgId = user.GetOrgId().ToString(), // OrgId = user.GetOrgId().ToString(),
TenantId = tenantId.ToString(), TenantId = tenantId.ToString(),
}; };
var refreshToken = JwtHelper.Encrypt(tokenModel,true,true); var refreshToken = JwtHelper.Encrypt(tokenModel,true,false);
var data = db.Queryable<SysUser>().Filter(null, true).Where(x => x.Id == userId) var data = db.Queryable<SysUser>().Filter(null, true).Where(x => x.Id == userId)
.Select(a => new CurrentUserViewModel .Select(a => new CurrentUserViewModel
@ -393,7 +394,7 @@ public class CommonService : ICommonService
ClientId = a.ClientId, ClientId = a.ClientId,
IsLimitClient = a.IsLimitClient, IsLimitClient = a.IsLimitClient,
RefreshToken = refreshToken, RefreshToken = refreshToken,
UserOrgs = orgRelations, // UserOrgs = orgRelations,
// OrgId = a.OrgId.ToString(), CompanyName = a.CustomerName // OrgId = a.OrgId.ToString(), CompanyName = a.CustomerName
}) })
.Mapper(it => .Mapper(it =>
@ -456,12 +457,12 @@ public class CommonService : ICommonService
//超级管理员 //超级管理员
if (userInfo.UserType == 0) if (userInfo.UserType == 0)
{ {
list = db.Queryable<SysPermissionTenant>().Where(x => list = db.Queryable<SysPermission>().Where(x =>
x.MenuType == 1 && x.IsHidden == false && (x.PermissionType == 1 || x.PermissionType == 0)) x.MenuType == 1 && x.IsHidden == false && (x.PermissionType == 1 || x.PermissionType == 0))
.OrderBy(x => x.SortCode) .OrderBy(x => x.SortCode)
.Select(a => new RouteItem .Select(a => new RouteItem
{ {
Id = a.PermissionId, Id = a.Id,
Path = a.Url, Path = a.Url,
Name = a.PermissionName, Name = a.PermissionName,
Component = a.Component, Component = a.Component,
@ -476,7 +477,7 @@ public class CommonService : ICommonService
foreach (var item in list) foreach (var item in list)
{ {
var childs = db.Queryable<SysPermissionTenant>().Filter(null, true) var childs = db.Queryable<SysPermission>().Filter(null, true)
.Where(x => x.MenuType == 2 && x.ParentId == item.Id && x.IsHidden == false && .Where(x => x.MenuType == 2 && x.ParentId == item.Id && x.IsHidden == false &&
(x.PermissionType == 1 || x.PermissionType == 0)) (x.PermissionType == 1 || x.PermissionType == 0))
.OrderBy(x => x.SortCode) .OrderBy(x => x.SortCode)

@ -1,6 +1,7 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule; using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos; using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity; using DS.WMS.Core.System.Entity;
@ -9,6 +10,7 @@ using Mapster;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
using SysTenantLink = DS.Module.SqlSugar.SysTenantLink;
namespace DS.WMS.Core.System.Method; namespace DS.WMS.Core.System.Method;
@ -17,7 +19,7 @@ public class TenantApplyService : ITenantApplyService
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db; private readonly ISqlSugarClient db;
private readonly IUser user; private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -26,6 +28,7 @@ public class TenantApplyService : ITenantApplyService
{ {
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>(); db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
user = _serviceProvider.GetRequiredService<IUser>(); user = _serviceProvider.GetRequiredService<IUser>();
} }
@ -61,11 +64,11 @@ public class TenantApplyService : ITenantApplyService
return DataResult<TenantApplyInfoRes>.Success(data); return DataResult<TenantApplyInfoRes>.Success(data);
} }
/// <summary> /// <summary>
/// 企业用户审批 /// 企业用户审批 - 驳回
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public DataResult AuditTenantApply(CommonAuditInput req) public DataResult RejectTenantApply(CommonAuditInput req)
{ {
var userId = user.UserId; var userId = user.UserId;
@ -82,42 +85,99 @@ public class TenantApplyService : ITenantApplyService
} }
if (req.Status == 1) if (req.Status == 1)
{
return DataResult.Failed("非法状态!");
}
else
{
apply.AuditStatus = (AuditStatusEnum)(int)req.Status;
apply.AuditNote = req.AuditNote;
db.Updateable(req).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("驳回成功!");
}
}
/// <summary>
/// 企业用户审批 - 通过
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult> TenantApplyAudit(TenantApplyAuditReq req)
{
var userId = user.UserId;
var apply = db.Queryable<SysTenantApply>().Where(x => x.Id == req.AuditInfo.Id).First();
if (apply.IsNull())
{
return DataResult.Failed("企业用户信息不存在!");
}
if (apply.AuditStatus == AuditStatusEnum.Approve)
{
return DataResult.Failed("已审批通过!");
}
if (req.PermissionIds.Count==0 )
{
return DataResult.Failed("请勾选权限模块!");
}
if (req.AuditInfo.Status == 1)
{ {
try try
{ {
//开启事务 //开启事务
db.Ado.BeginTran(); await db.Ado.BeginTranAsync();
apply.AuditStatus = (AuditStatusEnum)(int)req.Status; apply.AuditStatus = (AuditStatusEnum)(int)req.AuditInfo.Status;
apply.AuditNote = req.AuditNote; apply.AuditNote = req.AuditInfo.AuditNote;
db.Updateable(apply).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); await db.Updateable(apply).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
var entity = apply.Adapt<SysTenant>();
var tenant = db.Insertable(entity).ExecuteReturnEntityAsync();
var link = req.DbInfo.Adapt<SysTenantLink>();
link.TenantId = tenant.Id;
await db.Insertable(link).ExecuteReturnEntityAsync();
var permissions = db.Queryable<SysPermission>().Where(x => req.PermissionIds.Contains(x.Id)).ToList();
var tenantPerList = new List<SysPermissionTenant>();
foreach (var item in permissions)
{
var tenantPer = item.Adapt<SysPermissionTenant>();
tenantPer.PermissionId = item.Id;
tenantPerList.Add(tenantPer);
}
await db.Insertable(tenantPerList).ExecuteReturnEntityAsync();
//TODO 处理租户相关数据 //TODO 处理租户相关数据
// var client = company.Adapt<info_client>();; // var client = company.Adapt<info_client>();;
// client.CODENAME = PinYinUtil.GetFristLetter(company.SHORTNAME); // client.CODENAME = PinYinUtil.GetFristLetter(company.SHORTNAME);
// client.GID = clientId.ToString(); // client.GID = clientId.ToString();
// client.STATUS = 0; // client.STATUS = 0;
// db.Insertable(client).ExecuteCommand(); // db.Insertable(client).ExecuteCommand();
db.Ado.CommitTran(); await db.Ado.CommitTranAsync();
return DataResult.Successed("审批成功!"); return DataResult.Successed("审批成功!");
} }
catch (Exception ex) catch (Exception ex)
{ {
db.Ado.RollbackTran(); await db.Ado.RollbackTranAsync();
return DataResult.Failed("审批失败!" + ",请联系管理员!"); return DataResult.Failed("审批失败!" + ",请联系管理员!");
} }
} }
else else
{ {
apply.AuditStatus = (AuditStatusEnum)(int)req.Status; return DataResult.Failed("非法状态!");
apply.AuditNote = req.AuditNote;
db.Updateable(req).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("驳回成功!");
} }
} }
#endregion #endregion

@ -966,3 +966,101 @@
2024-01-18 14:48:33.0934 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config 2024-01-18 14:48:33.0934 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-18 14:48:33.1122 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-01-18 14:48:33.1122 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-18 14:48:33.1658 Info Configuration initialized. 2024-01-18 14:48:33.1658 Info Configuration initialized.
2024-01-22 15:18:57.1479 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 15:18:57.1686 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 15:18:57.1844 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 15:18:57.2066 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 15:18:57.2354 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 15:18:57.2480 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 15:18:57.2769 Info Configuration initialized.
2024-01-22 16:11:53.9861 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:11:54.0302 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:11:54.0712 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:11:54.1114 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:11:54.1588 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:11:54.1834 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:11:54.2363 Info Configuration initialized.
2024-01-22 16:17:28.5416 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:17:28.7349 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:17:28.7731 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:17:28.8478 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:17:28.8949 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:17:28.9140 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:17:28.9622 Info Configuration initialized.
2024-01-22 16:19:31.3193 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:19:31.4294 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:19:31.4543 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:19:31.5105 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:19:31.5425 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:19:31.5582 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:19:31.6040 Info Configuration initialized.
2024-01-22 16:22:11.3077 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:22:11.3525 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:22:11.4058 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:22:11.4603 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:22:11.5181 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:22:11.5392 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:22:11.5904 Info Configuration initialized.
2024-01-22 16:23:57.5375 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:23:57.6010 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:23:57.6645 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:23:57.7428 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:23:57.8082 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:23:57.8326 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:23:57.9674 Info Configuration initialized.
2024-01-22 16:25:22.1126 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:25:22.1912 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:25:22.2641 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:25:22.3211 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:25:22.3911 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:25:22.4242 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:25:22.4972 Info Configuration initialized.
2024-01-22 16:30:03.5352 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:30:03.7027 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:30:03.8252 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:30:03.9327 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:30:04.0564 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:30:04.0944 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:30:04.1599 Info Configuration initialized.
2024-01-22 16:36:41.7569 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 16:36:41.8678 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 16:36:41.8983 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 16:36:41.9574 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 16:36:41.9998 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 16:36:42.0175 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 16:36:42.0638 Info Configuration initialized.
2024-01-22 17:09:45.8109 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:09:45.8727 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:09:45.8855 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:09:45.9162 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:09:45.9538 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:09:45.9705 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:09:46.0098 Info Configuration initialized.
2024-01-22 17:18:56.9648 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:18:57.0166 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:18:57.0491 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:18:57.0920 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:18:57.1469 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:18:57.1705 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:18:57.2093 Info Configuration initialized.
2024-01-22 17:23:26.9678 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:23:27.0791 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:23:27.1138 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:23:27.1776 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:23:27.2255 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:23:27.2460 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:23:27.2884 Info Configuration initialized.
2024-01-22 17:26:00.9683 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 17:26:01.0832 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 17:26:01.1089 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 17:26:01.1548 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 17:26:01.1881 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 17:26:01.2052 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 17:26:01.2354 Info Configuration initialized.
2024-01-22 18:00:25.0523 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-01-22 18:00:25.0941 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-01-22 18:00:25.1050 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-01-22 18:00:25.1268 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-01-22 18:00:25.1412 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-01-22 18:00:25.1494 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-01-22 18:00:25.1659 Info Configuration initialized.

@ -30,10 +30,11 @@ builder.Host
builder.Services.AddAppWebInstal(); builder.Services.AddAppWebInstal();
builder.Services.AddCorsInstall(); builder.Services.AddCorsInstall();
builder.Services.AddUserModuleInstall(); //用户服务
builder.Services.AddSqlsugarInstall(); builder.Services.AddSqlsugarInstall();
builder.Services.AddSwaggerInstall(); builder.Services.AddSwaggerInstall();
builder.Services.AddUserModuleInstall(); //用户服务
builder.Services.AddJwtInstall(); builder.Services.AddJwtInstall();
builder.Services.AddSaasDbInstall();//分库服务
// builder.Services.AddEndpointsApiExplorer(); // builder.Services.AddEndpointsApiExplorer();
// builder.Services.AddSwaggerGen(); // builder.Services.AddSwaggerGen();

Loading…
Cancel
Save