初始化
This commit is contained in:
51
BLW_Log/Models/DevMonitorLog_EX.cs
Normal file
51
BLW_Log/Models/DevMonitorLog_EX.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using BLW_Log.Controllers;
|
||||
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
|
||||
public class SSS
|
||||
{
|
||||
public List<DAL.PGModels.SkyworthTvMonitorlog> SkyworthTvMonitorlogs { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
|
||||
public class TTT
|
||||
{
|
||||
public List<DAL.PGModels.TclTvMonitorlog> TclTvMonitorlogs { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
public class DevMonitorLog_EX
|
||||
{
|
||||
public string FrameNo { get; set; }
|
||||
}
|
||||
|
||||
public class DevMonitorLogResult
|
||||
{
|
||||
public DAL.PGModels.DevMonitorlog DevLog { get; set; }
|
||||
public DevMonitorLog_EX EXData { get; set; }
|
||||
}
|
||||
public class DevMonitorLogResult_WITH_Count
|
||||
{
|
||||
public List<DevMonitorLogResult> devMonitorLogResults { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
|
||||
public class DevMonitorIOTLogResult_WITH_Count
|
||||
{
|
||||
public List<DAL.PGModels.IotMonitorlog> devMonitorLogResults { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
}
|
||||
public class DevMonitorWebAPILogResult_WITH_Count
|
||||
{
|
||||
public List<WebAPIAnalysis_FinallyData> devMonitorLogResults { get; set; }
|
||||
}
|
||||
public class DevMonitorWebAPILogResult
|
||||
{
|
||||
public string MethodName { get; set; }
|
||||
public int TotalInvokeCount { get; set; }
|
||||
public string IP { get; set; }
|
||||
public int TotalIP_InvokeCount { get; set; }
|
||||
public string HotelCode { get; set; }
|
||||
public int TotalHotelCode_InvokeCount { get; set; }
|
||||
}
|
||||
}
|
||||
41
BLW_Log/Models/DevMonitorlog.cs
Normal file
41
BLW_Log/Models/DevMonitorlog.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLW_Log.Models;
|
||||
|
||||
public partial class DevMonitorlog
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public int? HotelId { get; set; }
|
||||
|
||||
public string? HotelCode { get; set; }
|
||||
|
||||
public string? HostNumber { get; set; }
|
||||
|
||||
public int? HostId { get; set; }
|
||||
|
||||
public string? RoomNo { get; set; }
|
||||
|
||||
public string? LanIp { get; set; }
|
||||
|
||||
public int? LanPort { get; set; }
|
||||
|
||||
public string? Mac { get; set; }
|
||||
|
||||
public int? WwwPort { get; set; }
|
||||
|
||||
public string? WwwIp { get; set; }
|
||||
|
||||
public string? CommandType { get; set; }
|
||||
|
||||
public string? SendOrReceive { get; set; }
|
||||
|
||||
public string? Data { get; set; }
|
||||
|
||||
public string? CreateTime { get; set; }
|
||||
|
||||
public long? CreateTimeToUnixTime { get; set; }
|
||||
|
||||
public string? AnalysisData { get; set; }
|
||||
}
|
||||
9
BLW_Log/Models/ErrorViewModel.cs
Normal file
9
BLW_Log/Models/ErrorViewModel.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
||||
15
BLW_Log/Models/Excelgenerater.cs
Normal file
15
BLW_Log/Models/Excelgenerater.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLW_Log.Models;
|
||||
|
||||
public partial class Excelgenerater
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public string? StepInfo { get; set; }
|
||||
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
public long? CreateTimeUnix { get; set; }
|
||||
}
|
||||
27
BLW_Log/Models/IotMonitorlog.cs
Normal file
27
BLW_Log/Models/IotMonitorlog.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLW_Log.Models;
|
||||
|
||||
public partial class IotMonitorlog
|
||||
{
|
||||
public ulong Id { get; set; }
|
||||
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public string? TriggerTime { get; set; }
|
||||
|
||||
public double? Step { get; set; }
|
||||
|
||||
public int? HotelId { get; set; }
|
||||
|
||||
public string? HotelName { get; set; }
|
||||
|
||||
public string? HotelCode { get; set; }
|
||||
|
||||
public string? RoomNumber { get; set; }
|
||||
|
||||
public string? CommandDescription { get; set; }
|
||||
|
||||
public string? Platform { get; set; }
|
||||
}
|
||||
10
BLW_Log/Models/LiteDB_Monitor_Host.cs
Normal file
10
BLW_Log/Models/LiteDB_Monitor_Host.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Commonlib;
|
||||
using LiteDB;
|
||||
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class LiteDB_Monitor_Host: Monitor_Host_EX_Cache
|
||||
{
|
||||
public ObjectId Id { get; set; }
|
||||
}
|
||||
}
|
||||
170
BLW_Log/Models/LowmachinelogContext.cs
Normal file
170
BLW_Log/Models/LowmachinelogContext.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;
|
||||
|
||||
namespace BLW_Log.Models;
|
||||
|
||||
public partial class LowmachinelogContext : DbContext
|
||||
{
|
||||
public LowmachinelogContext()
|
||||
{
|
||||
}
|
||||
|
||||
public LowmachinelogContext(DbContextOptions<LowmachinelogContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<DevMonitorlog> DevMonitorlogs { get; set; }
|
||||
|
||||
public virtual DbSet<Excelgenerater> Excelgeneraters { get; set; }
|
||||
|
||||
public virtual DbSet<IotMonitorlog> IotMonitorlogs { get; set; }
|
||||
|
||||
public virtual DbSet<Recordhotel> Recordhotels { get; set; }
|
||||
|
||||
public virtual DbSet<StatisticsTotal> StatisticsTotals { get; set; }
|
||||
|
||||
public virtual DbSet<WebapiMonitorlog> WebapiMonitorlogs { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseMySql("server=10.8.8.212;database=lowmachinelog;charset=utf8;uid=BLWlog;pwd=Blw@1234;port=16036", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.40-mysql"));
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.UseCollation("utf8mb4_0900_ai_ci")
|
||||
.HasCharSet("utf8mb4");
|
||||
|
||||
modelBuilder.Entity<DevMonitorlog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("dev_monitorlog");
|
||||
|
||||
entity.HasIndex(e => e.CommandType, "CommandType");
|
||||
|
||||
entity.HasIndex(e => e.CreateTimeToUnixTime, "CreateTIme");
|
||||
|
||||
entity.HasIndex(e => new { e.HotelCode, e.HostNumber, e.HostId, e.RoomNo }, "MAC");
|
||||
|
||||
entity.HasIndex(e => e.Mac, "MM");
|
||||
|
||||
entity.HasIndex(e => e.CreateTime, "T");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.AnalysisData).HasColumnType("text");
|
||||
entity.Property(e => e.CommandType).HasMaxLength(128);
|
||||
entity.Property(e => e.CreateTime).HasMaxLength(64);
|
||||
entity.Property(e => e.Data).HasColumnType("text");
|
||||
entity.Property(e => e.HostId).HasColumnName("HostID");
|
||||
entity.Property(e => e.HostNumber).HasMaxLength(64);
|
||||
entity.Property(e => e.HotelCode).HasMaxLength(64);
|
||||
entity.Property(e => e.HotelId).HasColumnName("HotelID");
|
||||
entity.Property(e => e.LanIp)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("LanIP");
|
||||
entity.Property(e => e.Mac)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("MAC");
|
||||
entity.Property(e => e.RoomNo).HasMaxLength(64);
|
||||
entity.Property(e => e.SendOrReceive).HasMaxLength(64);
|
||||
entity.Property(e => e.WwwIp)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("WWW_IP");
|
||||
entity.Property(e => e.WwwPort).HasColumnName("WWW_Port");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Excelgenerater>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("excelgenerater");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnName("ID");
|
||||
entity.Property(e => e.CreateTime).HasColumnType("datetime");
|
||||
entity.Property(e => e.CreateTimeUnix).HasColumnName("CreateTime_UNIX");
|
||||
entity.Property(e => e.StepInfo).HasColumnType("text");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<IotMonitorlog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("iot_monitorlog");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.CommandDescription).HasColumnType("text");
|
||||
entity.Property(e => e.HotelCode).HasMaxLength(255);
|
||||
entity.Property(e => e.HotelName).HasMaxLength(255);
|
||||
entity.Property(e => e.Platform).HasMaxLength(128);
|
||||
entity.Property(e => e.RequestId).HasMaxLength(512);
|
||||
entity.Property(e => e.RoomNumber).HasMaxLength(255);
|
||||
entity.Property(e => e.TriggerTime).HasMaxLength(64);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Recordhotel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("recordhotel");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.CreateTime).HasMaxLength(64);
|
||||
entity.Property(e => e.HotelId).HasColumnName("HotelID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<StatisticsTotal>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("statistics_total");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.HostNumber).HasMaxLength(64);
|
||||
entity.Property(e => e.HotelCode).HasMaxLength(64);
|
||||
entity.Property(e => e.Mac)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("MAC");
|
||||
entity.Property(e => e.RxCount).HasColumnName("RX_Count");
|
||||
entity.Property(e => e.TxCount).HasColumnName("TX_Count");
|
||||
entity.Property(e => e.UpdateTime)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("Update_Time");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebapiMonitorlog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("webapi_monitorlog");
|
||||
|
||||
entity.HasIndex(e => e.MethodName, "MethodName");
|
||||
|
||||
entity.HasIndex(e => new { e.InvokStartTime, e.InvokEndTime }, "Time");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("ID");
|
||||
entity.Property(e => e.HotelCode).HasMaxLength(64);
|
||||
entity.Property(e => e.InvokEndTime)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("InvokEnd_Time");
|
||||
entity.Property(e => e.InvokStartTime)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("InvokStart_Time");
|
||||
entity.Property(e => e.MethodName).HasMaxLength(128);
|
||||
entity.Property(e => e.Parameters).HasColumnType("text");
|
||||
entity.Property(e => e.RemoteIp)
|
||||
.HasMaxLength(64)
|
||||
.HasColumnName("RemoteIP");
|
||||
entity.Property(e => e.RoomNumber).HasMaxLength(64);
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
13
BLW_Log/Models/MyMemoryCache.cs
Normal file
13
BLW_Log/Models/MyMemoryCache.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class MyMemoryCache
|
||||
{
|
||||
public MemoryCache Cache { get; } = new MemoryCache(
|
||||
new MemoryCacheOptions
|
||||
{
|
||||
SizeLimit = 1024
|
||||
});
|
||||
}
|
||||
}
|
||||
393
BLW_Log/Models/PanelSelectionClass.cs
Normal file
393
BLW_Log/Models/PanelSelectionClass.cs
Normal file
@@ -0,0 +1,393 @@
|
||||
using Common;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using static Google.Protobuf.Reflection.SourceCodeInfo.Types;
|
||||
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class PanelSelectionClass : BackgroundService
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
public static ConcurrentBag<Dictionary<string, string>> PicNumList = new();
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
await Task.Factory.StartNew(async () =>
|
||||
{
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Dictionary<string, string> PicNum = CSRedisCacheHelper.BRPop<Dictionary<string, string>>("PicNumList");
|
||||
|
||||
_logger.Info("开始执行Redis轮询");
|
||||
if(PicNum != null)
|
||||
{
|
||||
var pair = PicNum.ElementAt(0);
|
||||
_logger.Info($"开始处理{pair.Key}");
|
||||
var RS = CSRedisCacheHelper.Get<string>(pair.Key);
|
||||
if (RS != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 反序列化Redis返回的数据
|
||||
var redisResult = JsonConvert.DeserializeObject<RedisSendNode>(RS);
|
||||
|
||||
if (redisResult != null)
|
||||
{
|
||||
bool isUnitPanel = pair.Key.StartsWith("Unit");
|
||||
bool updateSuccess = false;
|
||||
|
||||
if (redisResult.Process == 0)
|
||||
{
|
||||
// Process=0: 预览小图
|
||||
updateSuccess = UpdatePanelThumbnail(
|
||||
pair.Value,
|
||||
redisResult.ImagePath,
|
||||
isUnitPanel,
|
||||
0
|
||||
);
|
||||
|
||||
if (updateSuccess)
|
||||
{
|
||||
_logger.Info($"成功更新{pair.Value}的thumbnail_large");
|
||||
}
|
||||
}
|
||||
else if (redisResult.Process == 1)
|
||||
{
|
||||
// Process=1: 生成文件
|
||||
updateSuccess = UpdatePanelThumbnail(
|
||||
pair.Value,
|
||||
redisResult.CdrPath,
|
||||
isUnitPanel,
|
||||
1
|
||||
);
|
||||
|
||||
if (updateSuccess)
|
||||
{
|
||||
_logger.Info($"成功更新{pair.Value}的cdr_filename");
|
||||
}
|
||||
}
|
||||
|
||||
// 无论成功与否,都从Redis中删除该键
|
||||
CSRedisCacheHelper.Del(pair.Key);
|
||||
|
||||
// 如果更新bu成功,可以从PicNumList中移除该项
|
||||
if (!updateSuccess)
|
||||
{
|
||||
Dictionary<string, string> newDic = new()
|
||||
{
|
||||
{ pair.Key, pair.Value }
|
||||
};
|
||||
CSRedisCacheHelper.LPush("PicNumList", newDic);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error($"处理Redis消息失败: {ex.Message}");
|
||||
// 发生异常时也删除Redis键,避免重复处理
|
||||
CSRedisCacheHelper.Del(pair.Key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, string> newDic = new()
|
||||
{
|
||||
{ pair.Key, pair.Value }
|
||||
};
|
||||
CSRedisCacheHelper.LPush("PicNumList", newDic);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Info("Redis轮询err:" + ex.StackTrace + " | " + ex.Message);
|
||||
}
|
||||
}
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
}
|
||||
|
||||
private bool UpdatePanelThumbnail(string guid, string imagePath, bool isUnitPanel, int process)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var conn = new MySqlConnection(ReadConfig.Instance.MySQLConnectionString);
|
||||
conn.Open();
|
||||
|
||||
string sql;
|
||||
if (isUnitPanel)
|
||||
{
|
||||
if (process == 0)
|
||||
{
|
||||
// Process=0: 更新thumbnail_large,设置design_status为空
|
||||
sql = $@"UPDATE `cdr_library`.`tbl_web_panel_unit`
|
||||
SET thumbnail_large = @ImagePath, design_status = ''
|
||||
WHERE guid = @Guid";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process=1: 更新cdr_filename,设置thumbnail_small为空
|
||||
sql = $@"UPDATE `cdr_library`.`tbl_web_panel_unit`
|
||||
SET cdr_filename = @ImagePath, thumbnail_small = ''
|
||||
WHERE guid = @Guid";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (process == 0)
|
||||
{
|
||||
// Process=0: 更新thumbnail_large,设置thumbnail_small为空
|
||||
sql = $@"UPDATE `cdr_library`.`tbl_web_panel_list`
|
||||
SET thumbnail_large = @ImagePath, thumbnail_small = ''
|
||||
WHERE guid = @Guid";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process=1: 更新cdr_filename,设置thumbnail_small为空
|
||||
sql = $@"UPDATE `cdr_library`.`tbl_web_panel_list`
|
||||
SET cdr_filename = @ImagePath, thumbnail_small = ''
|
||||
WHERE guid = @Guid";
|
||||
}
|
||||
}
|
||||
|
||||
using var cmd = new MySqlCommand(sql, conn);
|
||||
cmd.Parameters.AddWithValue("@ImagePath", imagePath);
|
||||
cmd.Parameters.AddWithValue("@Guid", guid);
|
||||
|
||||
int affectedRows = cmd.ExecuteNonQuery();
|
||||
return affectedRows > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录日志
|
||||
_logger.Error($"更新面板数据失败: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RedisInfoNode
|
||||
{
|
||||
/// <summary>
|
||||
/// GUID
|
||||
/// </summary>
|
||||
public string Guid { get; set; }
|
||||
/// <summary>
|
||||
/// 用户
|
||||
/// </summary>
|
||||
public string User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程 0-预览小图 1-生成文件
|
||||
/// </summary>
|
||||
public int Process { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图号
|
||||
/// </summary>
|
||||
public string PictureNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
public string ProjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public string ProjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 素材库名称(返回时代表生成图片路径)默认为空即可
|
||||
/// </summary>
|
||||
public string MaterialLibraryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板名称(返回时代表生成CDR路径)
|
||||
/// </summary>
|
||||
public string TemplateName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// logo位置
|
||||
/// </summary>
|
||||
public string LogoPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 替换的logo所在文件
|
||||
/// </summary>
|
||||
public string LogoFileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 替换logo的相对位置
|
||||
/// </summary>
|
||||
public string LogoIndexNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板名称索引
|
||||
/// PageNumber_LayerNumber_Shapenumber =1_2_2
|
||||
/// </summary>
|
||||
public string TemplateNameIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 素材集合
|
||||
/// <位置名称, 替换的图像名称>
|
||||
/// <Locationnumber, PageNumber_LayerNumber_Shapenumber>
|
||||
/// <1, 1_1_1>
|
||||
/// </summary>
|
||||
public List<Pattern> PatternList { get; set; }
|
||||
}
|
||||
|
||||
public class Pattern
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相对位置
|
||||
/// </summary>
|
||||
public string IndexNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
public string ShapeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置列表
|
||||
/// </summary>
|
||||
public List<LocationList> LocationList { get; set; }
|
||||
}
|
||||
|
||||
public class LocationList
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件名称
|
||||
/// </summary>
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 素材类型 0自定义 1:图片 2:文字
|
||||
/// </summary>
|
||||
public int ShapeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相对位置
|
||||
/// </summary>
|
||||
public string IndexNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 素材绝对位置
|
||||
/// </summary>
|
||||
public string ShapeNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颜色
|
||||
/// </summary>
|
||||
public string ShapeColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
public string ShapeFont { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字号
|
||||
/// </summary>
|
||||
public float ShapeFontSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对齐行号
|
||||
/// </summary>
|
||||
public string LineNumber { get; set; }
|
||||
}
|
||||
|
||||
public class RedisSendNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态枚举值
|
||||
/// </summary>
|
||||
public enum StatusType
|
||||
{
|
||||
// 成功
|
||||
Success = 1,
|
||||
// 失败 素材库不存在
|
||||
MaterialLibraryNotExist = 2,
|
||||
// 失败 模板不存在
|
||||
TemplateNotExist = 3,
|
||||
// 失败 素材不存在
|
||||
MaterialNotExist = 4,
|
||||
// 失败 未找到素材放置位置
|
||||
MaterialPositionNotExist = 5,
|
||||
// 失败 获取数据库素材失败
|
||||
GetMaterialFromDBFail = 6,
|
||||
// 失败 构建图像失败
|
||||
BuildImageFail = 7,
|
||||
// 失败 生成文件失败
|
||||
SaveFileFail = 8,
|
||||
// 失败 未知操作失败
|
||||
UnknownFail = 9,
|
||||
// 失败 序列化数据错误
|
||||
SerializeFail = 10
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户
|
||||
/// </summary>
|
||||
public string? User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程
|
||||
/// 0-预览小图 1-生成文件
|
||||
/// </summary>
|
||||
public int Process { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图号
|
||||
/// </summary>
|
||||
public string PictureNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
public string? ProjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public string? ProjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(使用枚举类型)
|
||||
/// </summary>
|
||||
public StatusType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片路径
|
||||
/// </summary>
|
||||
public string? ImagePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CDR路径
|
||||
/// </summary>
|
||||
public string? CdrPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回信息
|
||||
/// </summary>
|
||||
public string Msg { get; set; }
|
||||
}
|
||||
}
|
||||
25
BLW_Log/Models/ReadConfig.cs
Normal file
25
BLW_Log/Models/ReadConfig.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class ReadConfig
|
||||
{
|
||||
public static ReadConfig Instance = new ReadConfig();
|
||||
public IConfiguration Configuration { get; set; }
|
||||
public string MySQLConnectionString { get; set; }
|
||||
public string ProductionlineSQLConnectionString { get; set; }
|
||||
|
||||
public string MQTTAgentUrl { get; set; }
|
||||
public ReadConfig()
|
||||
{
|
||||
Configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("blwappsettings.json").Build();
|
||||
MySQLConnectionString = Configuration.GetConnectionString("MysqlConnStr");
|
||||
ProductionlineSQLConnectionString = Configuration.GetConnectionString("ProductionlineSQLConString");
|
||||
|
||||
MQTTAgentUrl = Configuration.GetSection("MQTT_Agent_Url").Value;
|
||||
}
|
||||
public string GetCRICS_URL()
|
||||
{
|
||||
string? str = Configuration.GetSection("CRICSUrl").Value;
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
BLW_Log/Models/StaticData.cs
Normal file
21
BLW_Log/Models/StaticData.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
|
||||
namespace BLW_Log.Models
|
||||
{
|
||||
public class StaticData
|
||||
{
|
||||
public static ScriptEngine eng = Python.CreateEngine();
|
||||
public static ScriptScope scope = eng.CreateScope();
|
||||
public static ScriptScope scope1 = eng.CreateScope();
|
||||
public static void GetWebAPIMethod()
|
||||
{
|
||||
eng.ExecuteFile("script\\webapi.py", scope);
|
||||
}
|
||||
|
||||
public static void GetGetLoginData()
|
||||
{
|
||||
eng.ExecuteFile("script\\bom.py", scope1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user