😎1、修复在线用户IP地址获取 2、优化取作业触发器运行记录 3、升级依赖及其他优化
This commit is contained in:
parent
747def5163
commit
61309499b1
@ -28,9 +28,9 @@
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.1" Aliases="BouncyCastleV2" />
|
||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.17.4" />
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.42" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.42" />
|
||||
<PackageReference Include="Furion.Pure" Version="4.9.7.42" />
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.43" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.43" />
|
||||
<PackageReference Include="Furion.Pure" Version="4.9.7.43" />
|
||||
<PackageReference Include="Hardware.Info" Version="101.0.1" />
|
||||
<PackageReference Include="Hashids.net" Version="1.7.0" />
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
@ -56,7 +56,7 @@
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1220" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1221" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -20,20 +20,14 @@ public class OnlineUserHub : Hub<IOnlineUserHub>
|
||||
private readonly SqlSugarRepository<SysOnlineUser> _sysOnlineUerRep;
|
||||
private readonly SysMessageService _sysMessageService;
|
||||
private readonly IHubContext<OnlineUserHub, IOnlineUserHub> _onlineUserHubContext;
|
||||
private readonly SysCacheService _sysCacheService;
|
||||
private readonly SysConfigService _sysConfigService;
|
||||
|
||||
public OnlineUserHub(SqlSugarRepository<SysOnlineUser> sysOnlineUerRep,
|
||||
SysMessageService sysMessageService,
|
||||
IHubContext<OnlineUserHub, IOnlineUserHub> onlineUserHubContext,
|
||||
SysCacheService sysCacheService,
|
||||
SysConfigService sysConfigService)
|
||||
IHubContext<OnlineUserHub, IOnlineUserHub> onlineUserHubContext)
|
||||
{
|
||||
_sysOnlineUerRep = sysOnlineUerRep;
|
||||
_sysMessageService = sysMessageService;
|
||||
_onlineUserHubContext = onlineUserHubContext;
|
||||
_sysCacheService = sysCacheService;
|
||||
_sysConfigService = sysConfigService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -50,6 +44,7 @@ public class OnlineUserHub : Hub<IOnlineUserHub>
|
||||
var loginMode = (LoginModeEnum)(httpContext.User.FindFirst(ClaimConst.LoginMode)?.Value).ToInt();
|
||||
loginMode = loginMode == 0 ? LoginModeEnum.PC : loginMode; // 默认PC登录模式
|
||||
var device = httpContext.GetClientDeviceInfo().Trim();
|
||||
var ipAddress = httpContext.Request.Headers["X-Forwarded-For"].FirstOrDefault();
|
||||
|
||||
if (userId < 0 || string.IsNullOrWhiteSpace(account)) return;
|
||||
var user = new SysOnlineUser
|
||||
@ -59,7 +54,7 @@ public class OnlineUserHub : Hub<IOnlineUserHub>
|
||||
UserName = account,
|
||||
RealName = realName,
|
||||
Time = DateTime.Now,
|
||||
Ip = httpContext.GetRemoteIpAddressToIPv4(true),
|
||||
Ip = string.IsNullOrWhiteSpace(ipAddress) ? httpContext.GetRemoteIpAddressToIPv4(true) : ipAddress,
|
||||
Browser = httpContext.GetClientBrowser(),
|
||||
Os = httpContext.GetClientOs(),
|
||||
TenantId = tenantId,
|
||||
|
||||
@ -182,5 +182,11 @@ public class DbJobPersistence : IJobPersistence
|
||||
|
||||
var jobTriggerRecord = context.Timeline.Adapt<SysJobTriggerRecord>();
|
||||
await db.Insertable(jobTriggerRecord).ExecuteCommandAsync();
|
||||
|
||||
//// 清空过期的作业触发器运行记录
|
||||
//int keepRecords = 100; // 保留记录条数
|
||||
//await db.Deleteable<SysJobTriggerRecord>().In(it => it.Id,
|
||||
// db.Queryable<SysJobTriggerRecord>().Skip(keepRecords).OrderByDescending(u => u.LastRunTime).Where(u => u.JobId == jobTriggerRecord.JobId && u.TriggerId == jobTriggerRecord.TriggerId).Select(u => u.Id)) // 注意Select不要ToList(), ToList就2次查询了
|
||||
// .ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
@ -351,8 +351,8 @@ public class SysJobService : IDynamicApiController, ITransient
|
||||
public async Task<SqlSugarPagedList<SysJobTriggerRecord>> PageJobTriggerRecord(PageJobTriggerRecordInput input)
|
||||
{
|
||||
return await _sysJobTriggerRecordRep.AsQueryable()
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.JobId), u => u.JobId.Contains(input.JobId))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.TriggerId), u => u.TriggerId.Contains(input.TriggerId))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.JobId), u => u.JobId == input.JobId)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.TriggerId), u => u.TriggerId == input.TriggerId)
|
||||
.OrderByDescending(u => u.Id)
|
||||
.ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class SysNoticeService : IDynamicApiController, ITransient
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("获取通知公告详情")]
|
||||
public async Task<SysNotice> GetNotice(NoticeInput input)
|
||||
public async Task<SysNotice> GetNotice([FromQuery] NoticeInput input)
|
||||
{
|
||||
return await _sysNoticeRep.GetFirstAsync(u => u.Id == input.Id);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "admin.net.pro",
|
||||
"type": "module",
|
||||
"version": "2.4.33",
|
||||
"lastBuildTime": "2025.04.14",
|
||||
"lastBuildTime": "2025.04.15",
|
||||
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
|
||||
"author": "zuohuaijun",
|
||||
"license": "MIT",
|
||||
@ -91,8 +91,8 @@
|
||||
"@types/node": "^20.17.30",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/sortablejs": "^1.15.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
||||
"@typescript-eslint/parser": "^8.29.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
||||
"@typescript-eslint/parser": "^8.30.1",
|
||||
"@vitejs/plugin-vue": "^5.2.3",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
||||
"@vue/compiler-sfc": "^3.5.13",
|
||||
|
||||
@ -132,11 +132,15 @@ export const SysNoticeApiAxiosParamCreator = function (configuration?: Configura
|
||||
/**
|
||||
*
|
||||
* @summary 获取通知公告详情
|
||||
* @param {NoticeInput} [body]
|
||||
* @param {number} id 主键Id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysNoticeNoticeGet: async (body?: NoticeInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
apiSysNoticeNoticeGet: async (id: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'id' is not null or undefined
|
||||
if (id === null || id === undefined) {
|
||||
throw new RequiredError('id','Required parameter id was null or undefined when calling apiSysNoticeNoticeGet.');
|
||||
}
|
||||
const localVarPath = `/api/sysNotice/notice`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
@ -157,7 +161,9 @@ export const SysNoticeApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
|
||||
if (id !== undefined) {
|
||||
localVarQueryParameter['Id'] = id;
|
||||
}
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
@ -169,8 +175,6 @@ export const SysNoticeApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@ -543,12 +547,12 @@ export const SysNoticeApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 获取通知公告详情
|
||||
* @param {NoticeInput} [body]
|
||||
* @param {number} id 主键Id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysNoticeNoticeGet(body?: NoticeInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultSysNotice>>> {
|
||||
const localVarAxiosArgs = await SysNoticeApiAxiosParamCreator(configuration).apiSysNoticeNoticeGet(body, options);
|
||||
async apiSysNoticeNoticeGet(id: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultSysNotice>>> {
|
||||
const localVarAxiosArgs = await SysNoticeApiAxiosParamCreator(configuration).apiSysNoticeNoticeGet(id, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@ -682,12 +686,12 @@ export const SysNoticeApiFactory = function (configuration?: Configuration, base
|
||||
/**
|
||||
*
|
||||
* @summary 获取通知公告详情
|
||||
* @param {NoticeInput} [body]
|
||||
* @param {number} id 主键Id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysNoticeNoticeGet(body?: NoticeInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultSysNotice>> {
|
||||
return SysNoticeApiFp(configuration).apiSysNoticeNoticeGet(body, options).then((request) => request(axios, basePath));
|
||||
async apiSysNoticeNoticeGet(id: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultSysNotice>> {
|
||||
return SysNoticeApiFp(configuration).apiSysNoticeNoticeGet(id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -792,13 +796,13 @@ export class SysNoticeApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 获取通知公告详情
|
||||
* @param {NoticeInput} [body]
|
||||
* @param {number} id 主键Id
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysNoticeApi
|
||||
*/
|
||||
public async apiSysNoticeNoticeGet(body?: NoticeInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultSysNotice>> {
|
||||
return SysNoticeApiFp(this.configuration).apiSysNoticeNoticeGet(body, options).then((request) => request(this.axios, this.basePath));
|
||||
public async apiSysNoticeNoticeGet(id: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultSysNotice>> {
|
||||
return SysNoticeApiFp(this.configuration).apiSysNoticeNoticeGet(id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
||||
@ -177,7 +177,7 @@ const handleView = async (row: any) => {
|
||||
};
|
||||
|
||||
// 表格事件
|
||||
const gridEvents: VxeGridListeners<PagePosOutput> = {
|
||||
const gridEvents: VxeGridListeners<SysNoticeUser> = {
|
||||
// 只对 pager-config 配置时有效,分页发生改变时会触发该事件
|
||||
async pageChange({ pageSize }) {
|
||||
state.localPageParam.pageSize = pageSize;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user