添加跨域
This commit is contained in:
parent
79a4e26f4e
commit
5c2ecf0936
|
|
@ -4,6 +4,7 @@ using CloudGaming.Code.Filter;
|
||||||
using CloudGaming.Code.Game;
|
using CloudGaming.Code.Game;
|
||||||
using CloudGaming.Code.Monitor;
|
using CloudGaming.Code.Monitor;
|
||||||
|
|
||||||
|
using HuanMeng.DotNetCore.CustomExtension;
|
||||||
using HuanMeng.DotNetCore.MiddlewareExtend;
|
using HuanMeng.DotNetCore.MiddlewareExtend;
|
||||||
using HuanMeng.DotNetCore.SwaggerUtile;
|
using HuanMeng.DotNetCore.SwaggerUtile;
|
||||||
|
|
||||||
|
|
@ -39,7 +40,10 @@ builder.Services.AddSingleton(typeof(ILogger<ExceptionMiddleware>), serviceProvi
|
||||||
return loggerFactory.CreateLogger<ExceptionMiddleware>();
|
return loggerFactory.CreateLogger<ExceptionMiddleware>();
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
#region 添加跨域
|
||||||
|
var _myAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||||
|
builder.Services.AddCustomCors(_myAllowSpecificOrigins);
|
||||||
|
#endregion
|
||||||
builder.Services.AddHttpContextAccessor(); //添加httpContext注入访问
|
builder.Services.AddHttpContextAccessor(); //添加httpContext注入访问
|
||||||
#region 返回数据解析
|
#region 返回数据解析
|
||||||
//builder.Services.AddControllers();
|
//builder.Services.AddControllers();
|
||||||
|
|
@ -107,7 +111,8 @@ app.UseSwaggerUI(c =>
|
||||||
c.InjectStylesheet("/custom.css");
|
c.InjectStylesheet("/custom.css");
|
||||||
});
|
});
|
||||||
//}
|
//}
|
||||||
|
//使用跨域
|
||||||
|
app.UseCors(_myAllowSpecificOrigins);
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
//数据库中间件
|
//数据库中间件
|
||||||
app.UseMultiTenantExt();
|
app.UseMultiTenantExt();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using CloudGaming.DtoModel.Other;
|
using CloudGaming.DtoModel.Other;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -30,9 +31,28 @@ public class MonitorBLL : CloudGamingBase
|
||||||
/// 获取近一月活跃人数统计
|
/// 获取近一月活跃人数统计
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task GetActiveUserCount()
|
public async Task GetActiveUserCount(long startTimeStamp = 0, long endTimeStamp = 0)
|
||||||
{
|
{
|
||||||
|
if (endTimeStamp == 0)
|
||||||
|
{
|
||||||
|
endTimeStamp = DateTime.Now.ToUnixTimestamp();
|
||||||
|
}
|
||||||
|
if (startTimeStamp == 0)
|
||||||
|
{
|
||||||
|
startTimeStamp = DateTime.Now.AddMonths(-1).ToUnixTimestamp();
|
||||||
|
}
|
||||||
|
//开始时间
|
||||||
|
DateOnly startDate = DateOnly.FromDateTime(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(startTimeStamp));
|
||||||
|
//结束时间
|
||||||
|
DateOnly endDate = DateOnly.FromDateTime(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(endTimeStamp));
|
||||||
|
DateOnly curr = startDate;
|
||||||
|
var userStatisticsList = await Dao.DaoExt.Context.T_Statistics_User.Where(it => it.LoginDate > startDate && it.LoginDate < endDate).ToListAsync();
|
||||||
|
while (curr <= endDate)
|
||||||
|
{
|
||||||
|
int day = int.Parse(curr.ToString("yyyyMMdd"));
|
||||||
|
|
||||||
|
curr.AddDays(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user