😎同步升级及代码优化
This commit is contained in:
parent
3001840e6e
commit
ca55fb82cf
@ -34,7 +34,7 @@
|
|||||||
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
|
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
|
||||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.3.0" />
|
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.3.0" />
|
||||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.5.0" />
|
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.5.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.159" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.160" />
|
||||||
<PackageReference Include="SSH.NET" Version="2024.0.0" />
|
<PackageReference Include="SSH.NET" Version="2024.0.0" />
|
||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.2" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.2" />
|
||||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1034" />
|
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1034" />
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
using IPTools.Core;
|
|
||||||
|
|
||||||
namespace Admin.NET.Core;
|
namespace Admin.NET.Core;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -79,7 +77,7 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter, IDisposable
|
|||||||
if (string.IsNullOrEmpty(remoteIPv4))
|
if (string.IsNullOrEmpty(remoteIPv4))
|
||||||
remoteIPv4 = loggingMonitor.remoteIPv4;
|
remoteIPv4 = loggingMonitor.remoteIPv4;
|
||||||
|
|
||||||
(string ipLocation, double? longitude, double? latitude) = GetIpAddress(remoteIPv4);
|
(string ipLocation, double? longitude, double? latitude) = CommonUtil.GetIpAddress(remoteIPv4);
|
||||||
|
|
||||||
var browser = "";
|
var browser = "";
|
||||||
var os = "";
|
var os = "";
|
||||||
@ -201,26 +199,6 @@ public class DatabaseLoggingWriter : IDatabaseLoggingWriter, IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 解析IP地址
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ip"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal static (string ipLocation, double? longitude, double? latitude) GetIpAddress(string ip)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var ipInfo = IpTool.SearchWithI18N(ip); // 国际化查询,默认中文 中文zh-CN、英文en
|
|
||||||
var addressList = new List<string>() { ipInfo.Country, ipInfo.Province, ipInfo.City, ipInfo.NetworkOperator };
|
|
||||||
return (string.Join(" ", addressList.Where(u => u != "0" && !string.IsNullOrWhiteSpace(u)).ToList()), ipInfo.Longitude, ipInfo.Latitude); // 去掉0及空并用空格连接
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// 不做处理
|
|
||||||
}
|
|
||||||
return ("未知", 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 释放服务作用域
|
/// 释放服务作用域
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class ElasticSearchLoggingWriter : IDatabaseLoggingWriter, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
string remoteIPv4 = loggingMonitor.remoteIPv4;
|
string remoteIPv4 = loggingMonitor.remoteIPv4;
|
||||||
(string ipLocation, double? longitude, double? latitude) = DatabaseLoggingWriter.GetIpAddress(remoteIPv4);
|
(string ipLocation, double? longitude, double? latitude) = CommonUtil.GetIpAddress(remoteIPv4);
|
||||||
|
|
||||||
var sysLogOp = new SysLogOp
|
var sysLogOp = new SysLogOp
|
||||||
{
|
{
|
||||||
|
|||||||
@ -208,7 +208,7 @@ public class SysAuthService : IDynamicApiController, ITransient
|
|||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public virtual async Task<LoginOutput> CreateToken(SysUser user)
|
internal async Task<LoginOutput> CreateToken(SysUser user)
|
||||||
{
|
{
|
||||||
// 单用户登录
|
// 单用户登录
|
||||||
await _sysOnlineUserService.SingleLogin(user.Id);
|
await _sysOnlineUserService.SingleLogin(user.Id);
|
||||||
@ -238,16 +238,16 @@ public class SysAuthService : IDynamicApiController, ITransient
|
|||||||
// ke.global.setAllHeader('Authorization', 'Bearer ' + ke.response.headers['access-token']);
|
// ke.global.setAllHeader('Authorization', 'Bearer ' + ke.response.headers['access-token']);
|
||||||
|
|
||||||
// 更新用户登录信息
|
// 更新用户登录信息
|
||||||
string remoteIPv4 = App.HttpContext.GetRemoteIpAddressToIPv4();
|
user.LastLoginIp = _httpContextAccessor.HttpContext.GetRemoteIp();
|
||||||
(string ipLocation, double? longitude, double? latitude) = DatabaseLoggingWriter.GetIpAddress(remoteIPv4);
|
(user.LastLoginAddress, double? longitude, double? latitude) = CommonUtil.GetIpAddress(user.LastLoginIp);
|
||||||
user.LastLoginIp = remoteIPv4;
|
|
||||||
user.LastLoginAddress = ipLocation;
|
|
||||||
user.LastLoginTime = DateTime.Now;
|
user.LastLoginTime = DateTime.Now;
|
||||||
await _sysUserRep.AsUpdateable(user).UpdateColumns(it => new
|
user.LastLoginDevice = CommonUtil.GetClientDeviceInfo(_httpContextAccessor.HttpContext?.Request?.Headers?.UserAgent);
|
||||||
|
await _sysUserRep.AsUpdateable(user).UpdateColumns(u => new
|
||||||
{
|
{
|
||||||
it.LastLoginIp,
|
u.LastLoginIp,
|
||||||
it.LastLoginAddress,
|
u.LastLoginAddress,
|
||||||
it.LastLoginTime,
|
u.LastLoginTime,
|
||||||
|
u.LastLoginDevice,
|
||||||
}).ExecuteCommandAsync();
|
}).ExecuteCommandAsync();
|
||||||
|
|
||||||
return new LoginOutput
|
return new LoginOutput
|
||||||
|
|||||||
@ -14,18 +14,12 @@ public class SysConfigService : IDynamicApiController, ITransient
|
|||||||
{
|
{
|
||||||
private readonly SysCacheService _sysCacheService;
|
private readonly SysCacheService _sysCacheService;
|
||||||
private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
|
private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
||||||
private readonly UserManager _userManager;
|
|
||||||
|
|
||||||
public SysConfigService(SysCacheService sysCacheService,
|
public SysConfigService(SysCacheService sysCacheService,
|
||||||
SqlSugarRepository<SysConfig> sysConfigRep,
|
SqlSugarRepository<SysConfig> sysConfigRep)
|
||||||
IHttpContextAccessor httpContextAccessor,
|
|
||||||
UserManager userManager)
|
|
||||||
{
|
{
|
||||||
_sysCacheService = sysCacheService;
|
_sysCacheService = sysCacheService;
|
||||||
_sysConfigRep = sysConfigRep;
|
_sysConfigRep = sysConfigRep;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
|
||||||
_userManager = userManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
private readonly OSSProviderOptions _OSSProviderOptions;
|
private readonly OSSProviderOptions _OSSProviderOptions;
|
||||||
private readonly UploadOptions _uploadOptions;
|
private readonly UploadOptions _uploadOptions;
|
||||||
private readonly IOSSService _OSSService;
|
private readonly IOSSService _OSSService;
|
||||||
private readonly string _imageType = ".jpg.png.bmp.gif.tif";
|
private readonly string _imageType = ".jpeg.jpg.png.bmp.gif.tif";
|
||||||
|
|
||||||
public SysFileService(UserManager userManager,
|
public SysFileService(UserManager userManager,
|
||||||
SqlSugarRepository<SysFile> sysFileRep,
|
SqlSugarRepository<SysFile> sysFileRep,
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using IPTools.Core;
|
||||||
using Magicodes.ExporterAndImporter.Core.Models;
|
using Magicodes.ExporterAndImporter.Core.Models;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@ -369,4 +370,47 @@ public static class CommonUtil
|
|||||||
|
|
||||||
return propMappings;
|
return propMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解析IP地址
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ip"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static (string ipLocation, double? longitude, double? latitude) GetIpAddress(string ip)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ipInfo = IpTool.SearchWithI18N(ip); // 国际化查询,默认中文 中文zh-CN、英文en
|
||||||
|
var addressList = new List<string>() { ipInfo.Country, ipInfo.Province, ipInfo.City, ipInfo.NetworkOperator };
|
||||||
|
return (string.Join(" ", addressList.Where(u => u != "0" && !string.IsNullOrWhiteSpace(u)).ToList()), ipInfo.Longitude, ipInfo.Latitude); // 去掉0及空并用空格连接
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 不做处理
|
||||||
|
}
|
||||||
|
return ("未知", 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取客户端设备信息(操作系统+浏览器)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userAgent"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetClientDeviceInfo(string userAgent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (userAgent != null)
|
||||||
|
{
|
||||||
|
var client = Parser.GetDefault().Parse(userAgent);
|
||||||
|
if (client.Device.IsSpider)
|
||||||
|
return "爬虫";
|
||||||
|
return $"{client.OS.Family} {client.OS.Major} {client.OS.Minor}" +
|
||||||
|
$"|{client.UA.Family} {client.UA.Major}.{client.UA.Minor} / {client.Device.Family}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{ }
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace @Model.NameSpace;
|
namespace @Model.NameSpace;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// @(@Model.BusName)服务
|
/// @(@Model.BusName)服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Rezero.Api" Version="1.7.5" />
|
<PackageReference Include="Rezero.Api" Version="1.7.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<div ref="toolSetRef" class="tool-sortable">
|
<div ref="toolSetRef" class="tool-sortable">
|
||||||
<div class="tool-sortable-item" v-for="v in columns" :key="v.prop" v-show="!v.hideCheck && !v.fixed" :data-key="v.prop">
|
<div class="tool-sortable-item" v-for="v in columns" :key="v.prop" v-show="!v.hideCheck" :data-key="v.prop">
|
||||||
<i class="fa fa-arrows-alt handle cursor-pointer"></i>
|
<i class="fa fa-arrows-alt handle cursor-pointer"></i>
|
||||||
<el-checkbox v-model="v.isCheck" size="default" class="ml12 mr8" :label="v.label" @change="onCheckChange" />
|
<el-checkbox v-model="v.isCheck" size="default" class="ml12 mr8" :label="v.label" @change="onCheckChange" />
|
||||||
</div>
|
</div>
|
||||||
@ -71,7 +71,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else-if="!item.children" v-slot="scope">
|
<template v-else-if="!item.children" v-slot="scope">
|
||||||
<formatter v-if="item.formatter" :fn="item.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
<formatter v-if="item.formatter" :fn="item.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
||||||
<!-- <span v-if="item.formatter">{{ item.formatter(scope.row,scope.column,scope.cellValue,scope.index) }}</span> -->
|
|
||||||
<template v-else-if="item.type === 'image'">
|
<template v-else-if="item.type === 'image'">
|
||||||
<el-image
|
<el-image
|
||||||
:style="{ width: `${item.width}px`, height: `${item.height}px` }"
|
:style="{ width: `${item.width}px`, height: `${item.height}px` }"
|
||||||
@ -90,12 +89,10 @@
|
|||||||
<!-- 自定义列插槽,插槽名为columns属性的prop -->
|
<!-- 自定义列插槽,插槽名为columns属性的prop -->
|
||||||
<template #default="scope" v-if="$slots[childrenItem.prop]">
|
<template #default="scope" v-if="$slots[childrenItem.prop]">
|
||||||
<formatter v-if="childrenItem.formatter" :fn="childrenItem.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
<formatter v-if="childrenItem.formatter" :fn="childrenItem.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
||||||
<!-- <span v-if="childrenItem.formatter">{{ childrenItem.formatter(scope.row,scope.column,scope.cellValue,scope.index) }}</span> -->
|
|
||||||
<slot v-else :name="childrenItem.prop" v-bind="scope"></slot>
|
<slot v-else :name="childrenItem.prop" v-bind="scope"></slot>
|
||||||
</template>
|
</template>
|
||||||
<template v-else v-slot="scope">
|
<template v-else v-slot="scope">
|
||||||
<formatter v-if="childrenItem.formatter" :fn="childrenItem.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
<formatter v-if="childrenItem.formatter" :fn="childrenItem.formatter(scope.row, scope.column, scope.cellValue, scope.index)"> </formatter>
|
||||||
<!-- <span v-if="childrenItem.formatter">{{ childrenItem.formatter(scope.row,scope.column,scope.cellValue,scope.index) }}</span> -->
|
|
||||||
<template v-else-if="childrenItem.type === 'image'">
|
<template v-else-if="childrenItem.type === 'image'">
|
||||||
<el-image
|
<el-image
|
||||||
:style="{ width: `${childrenItem.width}px`, height: `${childrenItem.height}px` }"
|
:style="{ width: `${childrenItem.width}px`, height: `${childrenItem.height}px` }"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user