修复Linux签名验签失败的问题

This commit is contained in:
ChenYi 2025-11-03 16:10:58 +08:00
parent a9e34a5546
commit a453fb96b1
4 changed files with 101 additions and 91 deletions

View File

@ -5,9 +5,6 @@
},
"ConnectionStrings": {
"Default": "Data Source=mysql;Port=3306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;"
// //
// "PrepayDB": "server=rm-m5el3d1u1k0wzk70n2o.sqlserver.rds.aliyuncs.com,3433;database=jishe.sysdb;uid=v3sa;pwd=JiShe123;Encrypt=False;Trust Server Certificate=False",
// "EnergyDB": "server=rm-wz9hw529i3j1e3b5fbo.sqlserver.rds.aliyuncs.com,3433;database=db_energy;uid=yjdb;pwd=Kdjdhf+9*7ad222LL;Encrypt=False;Trust Server Certificate=False"
},
"Hangfire": {
"Redis": {
@ -67,7 +64,7 @@
"UseTableSessionPoolByDefault": false
},
"ServerApplicationOptions": {
"ServerTagName": "JiSheCollectBus01",
"ServerTagName": "JiSheCollectBus12",
"FirstCollectionTime": "2025-04-28 15:07:00",
"AutomaticVerificationTime": "16:07:00",
"AutomaticTerminalVersionTime": "17:07:00",
@ -75,7 +72,8 @@
"AutomaticDayFreezeTime": "02:30:00",
"AutomaticMonthFreezeTime": "03:30:00",
"DefaultProtocolPlugin": "T37612012ProtocolPlugin",
"VerifySignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh",
"SignatureToken": "SIcPQnpMgaFDmNlIjNmzq5smshz7cKrh",
"AesSecurityKey": "RPTEIGCA1KvDEXS1",
"IsAesEncrypted": false,
"DistributedMessage": 2,
"SnowflakeWorkerId": 1

View File

@ -56,6 +56,11 @@ namespace JiShe.IoT
{
configuration.GetSection(nameof(DataChannelOptions)).Bind(options);
});
Configure<ServerApplicationOptions>(options =>
{
configuration.GetSection(nameof(ServerApplicationOptions)).Bind(options);
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)

View File

@ -1,3 +1,6 @@
using JiShe.ServicePro.Core;
using Microsoft.Extensions.Configuration;
namespace JiShe.IoT;
public class Program
@ -22,9 +25,13 @@ public class Program
var env = context.HostingEnvironment.EnvironmentName;
string[] filePathArray = new string[] { System.AppDomain.CurrentDomain.BaseDirectory, "configs"};
string jsonPath = Path.Combine(filePathArray);
Log.Warning($"当前环境 {env},配置文件路径:{jsonPath}");
builder.AddJsonFile(Path.Combine(jsonPath, "appsettings.json"), false, true);
builder.AddJsonFile(Path.Combine(jsonPath, $"appsettings.{env}.json"), false, true);
string defaultJson = Path.Combine(new string[] { jsonPath, "appsettings.json" });
var environmentJson = Path.Combine(new string[] { jsonPath, $"appsettings.{env}.json" } );
builder.AddJsonFile(defaultJson, false, true);
builder.AddJsonFile(environmentJson, false, true);
Console.WriteLine($"当前环境 {env},配置文件路径:{environmentJson}");
});
await builder.AddApplicationAsync<JiShe.IoT.IoTHttpApiHostModule>();

View File

@ -85,7 +85,7 @@ namespace JiShe.IoT
/// <returns></returns>
protected HttpDataResult<T> HandleOpenApiRequest<T>(OpenApiRequest input, ServerApplicationOptions serverOptions) where T : class
{
if (input == null || serverOptions == null || string.IsNullOrWhiteSpace(input.Message) || string.IsNullOrWhiteSpace(input.Nonce) || string.IsNullOrWhiteSpace(input.Signature))
if (input == null || serverOptions == null || string.IsNullOrWhiteSpace(input.Message) || string.IsNullOrWhiteSpace(input.Nonce) || string.IsNullOrWhiteSpace(input.Signature) || serverOptions == null || string.IsNullOrWhiteSpace(serverOptions.SignatureToken))
{
return HttpDataResultExtensions.Failed<T>(null, "请求参数不能为空", -1101);
}