修改默认请求
This commit is contained in:
parent
a4413d2eaf
commit
9d79620c1a
|
|
@ -22,6 +22,7 @@ using CloudGaming.Code.Filter;
|
|||
using CloudGaming.Code.Contract;
|
||||
using Refit;
|
||||
using CloudGaming.Code.JY;
|
||||
using CloudGaming.Code.Extend;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
#region 日志
|
||||
// Add services to the container.
|
||||
|
|
@ -212,28 +213,6 @@ app.UseMiddlewareAll();
|
|||
//缓存中间件
|
||||
app.UseCloudGamingMiddlewareAll();
|
||||
#region 默认请求
|
||||
app.MapGet("/", () => "请求成功").WithName("默认请求");
|
||||
|
||||
var startDateTime = DateTime.Now;
|
||||
var InformationalVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
Console.WriteLine($"version:{InformationalVersion}");
|
||||
app.MapGet("/system", () =>
|
||||
{
|
||||
|
||||
using Process currentProcess = Process.GetCurrentProcess();
|
||||
// CPU使用率 (一般是一个0-100之间的值,但实际是时间占比,需要转换)
|
||||
double cpuUsage = currentProcess.TotalProcessorTime.TotalMilliseconds / Environment.TickCount * 100;
|
||||
// 已用内存 (字节)
|
||||
long memoryUsage = currentProcess.WorkingSet64;
|
||||
return new
|
||||
{
|
||||
msg = $"系统信息:启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
|
||||
|
||||
startDateTime,
|
||||
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
||||
CPUUsage = $"{cpuUsage:F2}%"
|
||||
|
||||
};
|
||||
}).WithName("获取系统数据");
|
||||
app.UseAppRequest("api");
|
||||
#endregion
|
||||
app.Run();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using CloudGaming.Code.AppExtend;
|
||||
using CloudGaming.Code.DataAccess.MultiTenantUtil;
|
||||
using CloudGaming.Code.Extend;
|
||||
using CloudGaming.Code.Filter;
|
||||
using CloudGaming.Code.Game;
|
||||
using CloudGaming.Code.Monitor;
|
||||
|
|
@ -134,28 +135,8 @@ app.UseMultiTenantExt();
|
|||
app.MapControllers();
|
||||
app.UseMiddlewareAll();
|
||||
#region 默认请求
|
||||
app.MapGet("/", () => "请求成功").WithName("默认请求");
|
||||
|
||||
var startDateTime = DateTime.Now;
|
||||
var InformationalVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
Console.WriteLine($"version:{InformationalVersion}");
|
||||
app.MapGet("/system", () =>
|
||||
{
|
||||
|
||||
using Process currentProcess = Process.GetCurrentProcess();
|
||||
// CPU使用率 (一般是一个0-100之间的值,但实际是时间占比,需要转换)
|
||||
double cpuUsage = currentProcess.TotalProcessorTime.TotalMilliseconds / Environment.TickCount * 100;
|
||||
// 已用内存 (字节)
|
||||
long memoryUsage = currentProcess.WorkingSet64;
|
||||
return new
|
||||
{
|
||||
msg = $"系统信息:启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
|
||||
|
||||
startDateTime,
|
||||
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
||||
CPUUsage = $"{cpuUsage:F2}%"
|
||||
|
||||
};
|
||||
}).WithName("获取系统数据");
|
||||
#region 默认请求
|
||||
app.UseAppRequest("ext");
|
||||
#endregion
|
||||
#endregion
|
||||
app.Run();
|
||||
|
|
|
|||
|
|
@ -2,13 +2,6 @@
|
|||
|
||||
# 此阶段用于在快速模式(默认为调试配置)下从 VS 运行时
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
# 设置时区为北京时间
|
||||
RUN apt-get update && apt-get install -y tzdata && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone && \
|
||||
dpkg-reconfigure -f noninteractive tzdata && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using CloudGaming.Code.AppExtend;
|
||||
using CloudGaming.Code.DataAccess.MultiTenantUtil;
|
||||
using CloudGaming.Code.Extend;
|
||||
using CloudGaming.Code.Filter;
|
||||
|
||||
using HuanMeng.DotNetCore.MiddlewareExtend;
|
||||
|
|
@ -112,28 +113,6 @@ app.UseMultiTenant();
|
|||
app.MapControllers();
|
||||
app.UseMiddlewareAll();
|
||||
#region 默认请求
|
||||
app.MapGet("/", () => "请求成功").WithName("默认请求");
|
||||
|
||||
var startDateTime = DateTime.Now;
|
||||
var InformationalVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
Console.WriteLine($"version:{InformationalVersion}");
|
||||
app.MapGet("/system", () =>
|
||||
{
|
||||
|
||||
using Process currentProcess = Process.GetCurrentProcess();
|
||||
// CPU使用率 (一般是一个0-100之间的值,但实际是时间占比,需要转换)
|
||||
double cpuUsage = currentProcess.TotalProcessorTime.TotalMilliseconds / Environment.TickCount * 100;
|
||||
// 已用内存 (字节)
|
||||
long memoryUsage = currentProcess.WorkingSet64;
|
||||
return new
|
||||
{
|
||||
msg = $"系统信息:启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
|
||||
|
||||
startDateTime,
|
||||
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
||||
CPUUsage = $"{cpuUsage:F2}%"
|
||||
|
||||
};
|
||||
}).WithName("获取系统数据");
|
||||
app.UseAppRequest("pay");
|
||||
#endregion
|
||||
app.Run();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.CreateApplyForSubMerchantApplymentRequest.Types.Business.Types.SaleScene.Types;
|
||||
|
||||
namespace CloudGaming.Code.Extend;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class UseAppDefaultRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加默认请求
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
public static void UseAppRequest(this WebApplication app, string name = "")
|
||||
{
|
||||
app.MapGet("/", () => $"请求成功{name}==>{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}").WithName("默认请求");
|
||||
|
||||
var startDateTime = DateTime.Now;
|
||||
var InformationalVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
Console.WriteLine($"version:{InformationalVersion}");
|
||||
app.MapGet("/system", () =>
|
||||
{
|
||||
|
||||
using Process currentProcess = Process.GetCurrentProcess();
|
||||
// CPU使用率 (一般是一个0-100之间的值,但实际是时间占比,需要转换)
|
||||
double cpuUsage = currentProcess.TotalProcessorTime.TotalMilliseconds / Environment.TickCount * 100;
|
||||
// 已用内存 (字节)
|
||||
long memoryUsage = currentProcess.WorkingSet64;
|
||||
return new
|
||||
{
|
||||
msg = $"系统信息:启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
|
||||
|
||||
startDateTime,
|
||||
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",
|
||||
CPUUsage = $"{cpuUsage:F2}%"
|
||||
|
||||
};
|
||||
}).WithName("获取系统数据");
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ public class OrderMonitorProcessor : AppJobBase
|
|||
}
|
||||
}
|
||||
|
||||
[QuartzTrigger("OrderHourMonitorProcessor", "0 5 * * * ?")]
|
||||
[QuartzTrigger("OrderHourMonitorProcessor", "0/5 * * * * ?")]
|
||||
public class OrderHourMonitorProcessor : AppJobBase
|
||||
{
|
||||
public OrderHourMonitorProcessor(IServiceScopeFactory scopeFactory) : base(scopeFactory)
|
||||
|
|
@ -82,7 +82,7 @@ public class OrderHourMonitorProcessor : AppJobBase
|
|||
public override async Task AppConfigProcessLoop(AppConfig appConfig, AppMonitorInfo appMonitorInfo, IServiceProvider serviceProvider, CloudGamingBase cloudGamingBase)
|
||||
{
|
||||
var dao = cloudGamingBase.Dao;
|
||||
var now = DateTime.Now.AddHours(-1);
|
||||
var now = DateTime.Now.AddHours(-0);
|
||||
int day = int.Parse(now.ToString("yyyyMMdd"));
|
||||
var newDayHour = now.Date.AddHours(now.Hour);
|
||||
var oldDayHour = now.Date.AddHours(now.AddHours(1).Hour);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ public static class PaymentExtend
|
|||
/// <returns></returns>
|
||||
public static T_User_IntentOrder ToIntentOrder(this ProductCache productCache, string payment, string orderId, string channel)
|
||||
{
|
||||
|
||||
T_User_IntentOrder t_User_IntentOrder = new T_User_IntentOrder()
|
||||
{
|
||||
Price = productCache.Price,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user