Compare commits
10 Commits
b5e1badf07
...
548cc42d60
Author | SHA1 | Date |
---|---|---|
|
548cc42d60 | |
|
61c853229a | |
|
5ed583a006 | |
|
aa79da6910 | |
|
250ba4a01a | |
|
0a217e7b50 | |
|
4e17fa54c1 | |
|
d6e19c291b | |
|
01391809a4 | |
|
cb1ef1db08 |
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
##
|
##
|
||||||
|
@ -289,3 +288,4 @@ __pycache__/
|
||||||
*.odx.cs
|
*.odx.cs
|
||||||
*.xsd.cs
|
*.xsd.cs
|
||||||
/LF[Ll]ow_Bin/
|
/LF[Ll]ow_Bin/
|
||||||
|
LFlow-dev.db
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace LFlow.Base;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static IServiceCollection? services;
|
internal static IServiceCollection? services;
|
||||||
private static IServiceProvider? ServiceProvider => services?.BuildServiceProvider();
|
private static IServiceProvider? ServiceProvider => services?.BuildServiceProvider();
|
||||||
public static T? GetService<T>()
|
public static T? GetService<T>()
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"Urls": "https://127.0.0.1:8443;http://127.0.0.1:8088",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Debug",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft.AspNetCore.Mvc": "Information",
|
"Microsoft.AspNetCore.Mvc": "Information",
|
||||||
"Microsoft.AspNetCore.Routing": "Information",
|
"Microsoft.AspNetCore.Routing": "Information",
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.Base.Utils;
|
||||||
|
using LFlow.OnlineManegement.Model;
|
||||||
|
using LFlow.OnlineManegement.Service;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Controller;
|
||||||
|
public class OnlineManagementController(IOnlineManagementService service) : BaseController
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public PagedApiResult<List<OnlineDto>> ListAll(int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
int dataTotal = 0;
|
||||||
|
var result = service.GetAllOnlineUser(pageIndex, pageSize, ref dataTotal);
|
||||||
|
return PagedApiResult<List<OnlineDto>>.SuccessResult(result, dataTotal, pageIndex, pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ApiResult<OnlineDto> OnlineRegistered(OnlineDto onlineInfo)
|
||||||
|
{
|
||||||
|
return ApiResult<OnlineDto>.SuccessResult(service.OnlineRegistered(onlineInfo));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<OutputPath>../LFlow_Bin/Services/</OutputPath>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LFlow.Base\LFlow.Base.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,15 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Model
|
||||||
|
{
|
||||||
|
public class OnlineDto : IModel
|
||||||
|
{
|
||||||
|
public string? ID { get; set; }
|
||||||
|
|
||||||
|
public string? HostName { get; set; }
|
||||||
|
public string? IPAddress { get; set; }
|
||||||
|
public string? MacAddress { get; set; }
|
||||||
|
public string? OS { get; set; }
|
||||||
|
public string? LastOnlineTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Model
|
||||||
|
{
|
||||||
|
[SugarTable("T_U_ONLINE")]
|
||||||
|
public class OnlineModel : IDataModel
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public string ID { get; set; }
|
||||||
|
|
||||||
|
public string HostName { get; set; }
|
||||||
|
public string IPAddress { get; set; }
|
||||||
|
public string MacAddress { get; set; }
|
||||||
|
public string OS { get; set; }
|
||||||
|
public string LastOnlineTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.Base.Utils;
|
||||||
|
using LFlow.OnlineManegement.Model;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Serilog;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement
|
||||||
|
{
|
||||||
|
public class OnlineManegementModule : IModule
|
||||||
|
{
|
||||||
|
public void ConfigureModule(IServiceCollection services)
|
||||||
|
{
|
||||||
|
// 将模型添加到需要初始化数据库表的队列中
|
||||||
|
CodeFirst.AddType(typeof(OnlineModel));
|
||||||
|
// 获取当前程序集
|
||||||
|
var assembly = Assembly.GetAssembly(typeof(OnlineManegementModule))!;
|
||||||
|
var types = assembly.GetTypes().ToList();
|
||||||
|
//注册服务
|
||||||
|
RegisterModule.RegisterAllService(types, services);
|
||||||
|
//注册仓储
|
||||||
|
RegisterModule.RegisterAllRepo(types, services);
|
||||||
|
//RegisterModule.RegisterAllModel(types, services);
|
||||||
|
services.AddControllers().AddApplicationPart(assembly);
|
||||||
|
Log.Logger?.Information("OnlineManegementModule ConfigureModule done");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using LFlow.Base.Default;
|
||||||
|
using LFlow.OnlineManegement.Model;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Repository
|
||||||
|
{
|
||||||
|
public class OnlineManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<OnlineModel, string>(db)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.OnlineManegement.Model;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Service;
|
||||||
|
public interface IOnlineManagementService : IService//<VersionDto>
|
||||||
|
{
|
||||||
|
List<OnlineDto> GetAllOnlineUser(int pageIndex, int pageSize, ref int dataTotal);
|
||||||
|
|
||||||
|
OnlineDto OnlineRegistered(OnlineDto onlineInfo);
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
using LFlow.Base.Interfaces;
|
||||||
|
using LFlow.OnlineManegement.Model;
|
||||||
|
using Mapster;
|
||||||
|
|
||||||
|
namespace LFlow.OnlineManegement.Service;
|
||||||
|
/// <summary>
|
||||||
|
/// 在线管理服务
|
||||||
|
/// </summary>
|
||||||
|
public class OnlineManagementService(IRepo<OnlineModel, string> _repo) : IOnlineManagementService
|
||||||
|
{
|
||||||
|
public List<OnlineDto> GetAllOnlineUser(int pageIndex, int pageSize, ref int dataTotal)
|
||||||
|
{
|
||||||
|
var result = _repo.GetAll(pageIndex, pageSize, ref dataTotal).Adapt<List<OnlineDto>>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnlineDto OnlineRegistered(OnlineDto onlineInfo)
|
||||||
|
{
|
||||||
|
bool isUpdate = false;
|
||||||
|
if (string.IsNullOrEmpty(onlineInfo.ID))
|
||||||
|
{
|
||||||
|
onlineInfo.ID = Guid.NewGuid().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_repo.Get(onlineInfo.ID) == null)
|
||||||
|
{
|
||||||
|
isUpdate = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _repo.SaveOrUpdate(onlineInfo.Adapt<OnlineModel>(), isUpdate).Adapt<OnlineDto>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,8 +68,8 @@ public class VersionManagementController(IVersionManagementService service) : Ba
|
||||||
|
|
||||||
//}
|
//}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ApiResult<VersionDto> GetLastUpdate(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
|
public ApiResult<VersionDto> GetLastUpdate(VersionChannel channel, UpgradeTargetType targetType)
|
||||||
{
|
{
|
||||||
return ApiResult<VersionDto>.SuccessResult(service.GetLastVersion(type, channel, targetType));
|
return ApiResult<VersionDto>.SuccessResult(service.GetLastVersion(channel, targetType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,4 @@
|
||||||
<ProjectReference Include="..\LFlow.Base\LFlow.Base.csproj" />
|
<ProjectReference Include="..\LFlow.Base\LFlow.Base.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Controller\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,17 +1,28 @@
|
||||||
using LFlow.Base.Default;
|
using LFlow.Base.Default;
|
||||||
using LFlow.Base.Utils;
|
using LFlow.Base.Utils;
|
||||||
|
using LFlow.VersionManagement.Enums;
|
||||||
using LFlow.VersionManagement.Model;
|
using LFlow.VersionManagement.Model;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace LFlow.VersionManagement.Repository;
|
namespace LFlow.VersionManagement.Repository;
|
||||||
public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<VersionModel, string>(db)
|
public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<VersionModel, string>(db)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据条件搜索
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="whereObj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public override List<VersionModel> Search(VersionModel whereObj)
|
public override List<VersionModel> Search(VersionModel whereObj)
|
||||||
{
|
{
|
||||||
return db.Queryable<VersionModel>()
|
return db.Queryable<VersionModel>()
|
||||||
.Where(whereObj.ToWhereExp())
|
.Where(whereObj.ToWhereExp())
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据条件搜索ID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="whereObj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public override List<string> WhereSearchId(VersionModel whereObj)
|
public override List<string> WhereSearchId(VersionModel whereObj)
|
||||||
{
|
{
|
||||||
return db.Queryable<VersionModel>()
|
return db.Queryable<VersionModel>()
|
||||||
|
@ -20,4 +31,19 @@ public class VersionManagementRepo(ISqlSugarClient db) : DefaultCurdRepo<Version
|
||||||
.Select(x => x.ID)
|
.Select(x => x.ID)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取最新版本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channel"></param>
|
||||||
|
/// <param name="targetType"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public VersionModel GetLatestVersion(VersionChannel channel, UpgradeTargetType targetType)
|
||||||
|
{
|
||||||
|
return db.Queryable<VersionModel>()
|
||||||
|
.Where(mt => channel == mt.VersionChannel && targetType == mt.UpgradeTargetType)
|
||||||
|
.GroupBy(mt => mt.CurrentVersion)
|
||||||
|
.OrderBy(mt => mt.LastPublishTime, OrderByType.Desc)
|
||||||
|
.First();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,5 @@ public interface IVersionManagementService : IService//<VersionDto>
|
||||||
|
|
||||||
List<VersionDto> GetAll(int pageIndex, int pageSize, ref int total);
|
List<VersionDto> GetAll(int pageIndex, int pageSize, ref int total);
|
||||||
|
|
||||||
VersionDto? GetLastVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType);
|
VersionDto? GetLastVersion(VersionChannel channel, UpgradeTargetType targetType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@ public class VersionManagementService : IVersionManagementService
|
||||||
// 搜索需要增加分页
|
// 搜索需要增加分页
|
||||||
public List<VersionDto> Search(VersionDto whereObj)
|
public List<VersionDto> Search(VersionDto whereObj)
|
||||||
=> _repo.Search(whereObj.Adapt<VersionModel>()).Adapt<List<VersionDto>>();
|
=> _repo.Search(whereObj.Adapt<VersionModel>()).Adapt<List<VersionDto>>();
|
||||||
public VersionDto? GetLastVersion(VersionType type, VersionChannel channel, UpgradeTargetType targetType)
|
public VersionDto? GetLastVersion(VersionChannel channel, UpgradeTargetType targetType)
|
||||||
{
|
{
|
||||||
if (_repo is VersionManagementRepo versionRepo)
|
if (_repo is VersionManagementRepo versionRepo)
|
||||||
{
|
{
|
||||||
return versionRepo.GetLatestVersion(type, channel, targetType).Adapt<VersionDto>();
|
return versionRepo.GetLatestVersion(channel, targetType).Adapt<VersionDto>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
using System.Reflection;
|
|
||||||
using LFlow.Base.Interfaces;
|
using LFlow.Base.Interfaces;
|
||||||
using LFlow.Base.Utils;
|
using LFlow.Base.Utils;
|
||||||
using LFlow.VersionManagement.Model;
|
using LFlow.VersionManagement.Model;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Serilog;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace LFlow.User;
|
namespace LFlow.User;
|
||||||
|
|
||||||
|
@ -15,8 +16,9 @@ public class VersionManagementModule : IModule
|
||||||
var types = assembly.GetTypes().ToList();
|
var types = assembly.GetTypes().ToList();
|
||||||
RegisterModule.RegisterAllService(types, services);
|
RegisterModule.RegisterAllService(types, services);
|
||||||
RegisterModule.RegisterAllRepo(types, services);
|
RegisterModule.RegisterAllRepo(types, services);
|
||||||
RegisterModule.RegisterAllModel(types, services);
|
//RegisterModule.RegisterAllModel(types, services);
|
||||||
services.AddControllers().AddApplicationPart(assembly);
|
services.AddControllers().AddApplicationPart(assembly);
|
||||||
Console.WriteLine("UserModule ConfigureModule");
|
Log.Logger?.Information("VersionManagementModule ConfigureModule done");
|
||||||
|
//Console.WriteLine("UserModule ConfigureModule");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@ VisualStudioVersion = 17.5.002.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LFlow.Base", "LFlow.Base\LFlow.Base.csproj", "{C581AFB2-50BA-4357-AD0A-AF287194837D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LFlow.Base", "LFlow.Base\LFlow.Base.csproj", "{C581AFB2-50BA-4357-AD0A-AF287194837D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LFlow.VersionManagement", "LFlow.VersionManagement\LFlow.VersionManagement.csproj", "{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LFlow.VersionManagement", "LFlow.VersionManagement\LFlow.VersionManagement.csproj", "{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LFlow.OnlineManegement", "LFlow.OnlineManegement\LFlow.OnlineManegement.csproj", "{E849310F-64AD-453A-A2AA-557731508BF1}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -21,6 +23,10 @@ Global
|
||||||
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D52CC594-B10C-4FC0-8B7A-68CE0645A95D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E849310F-64AD-453A-A2AA-557731508BF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E849310F-64AD-453A-A2AA-557731508BF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E849310F-64AD-453A-A2AA-557731508BF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E849310F-64AD-453A-A2AA-557731508BF1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Reference in New Issue