클라이언트 데이터 처리방식 수정

This commit is contained in:
김민서 2024-01-30 15:49:02 +09:00
parent fe29e5e249
commit ef25bc6d3b
5 changed files with 53 additions and 49 deletions

View File

@ -32,9 +32,6 @@ namespace Server.Git
Push(excel);
if (isRestart)
goto restart;
//최종 데이터 세팅
DataSet();
}
/// <summary>
@ -100,20 +97,17 @@ namespace Server.Git
//암호화
ProtocolProcessor.cryptoData = crypto.Compress(excel);
using (DynamicDataSQL sql = new DynamicDataSQL())
{
logger.Info("version : " + ProtocolProcessor.version);
if (ProtocolProcessor.version == "")
{
ProtocolProcessor.version = sql.SelectName("version").value;
ProtocolProcessor.version = Statics.dynamicData.SelectName("version").value;
logger.Info("Select version : " + ProtocolProcessor.version);
}
else
{
sql.Update(1, ProtocolProcessor.version);
Statics.dynamicData.Update(1, ProtocolProcessor.version);
logger.Info("Update version : " + ProtocolProcessor.version);
}
}
// 스테이징
RepositorySet("add .", repositoryPath);
@ -165,14 +159,5 @@ namespace Server.Git
return xlsxFileList;
}
/// <summary>
/// 엑셀 데이터 저장
/// </summary>
public void DataSet()
{
EquipmentDataSQL equipmentDataSQL = new EquipmentDataSQL();
equipmentDataSQL.init();
}
}
}

View File

@ -7,12 +7,10 @@ namespace Server.Git
public override string ChangeScript()
{
//저장경로 : repositoryPath
//작업할것
//데이터 db에 업로드
List<string> fileList = GetFiles(repositoryPath, ".xlsx");
Dictionary<string, Dictionary<long, Dictionary<string, object>>> sheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>();
Dictionary<string, Dictionary<long, Dictionary<string, object>>> clientSheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>();
List<sheet> sheets = null;
for (int n = 0; n < fileList.Count; n++)
{
@ -22,9 +20,26 @@ namespace Server.Git
sheets = em.sheets;
for (int m = 0; m < sheets.Count; m++)
{
if (sheets[m].dataEnum[0] == "server")
continue;
sheetList.Add(sheets[m].name, sheets[m].dicViewer);
string name = sheets[m].name;
Dictionary<long, Dictionary<string, object>> sheet = sheets[m].dicViewer;
for(int i = 1; i < sheets[m].dataEnum.Count; i++)
{
if(sheets[m].dataEnum[i] == "server")
{
foreach(var item in sheet)
{
item.Value.Remove(sheets[m].variable[i]);
}
}
}
clientSheetList.Add(name, sheet);
}
}
else
@ -40,7 +55,7 @@ namespace Server.Git
ExcelSQL sql = new ExcelSQL(sheets);
sql.DataUpdate();
}
return JsonConvert.SerializeObject(sheetList);
return JsonConvert.SerializeObject(clientSheetList);
}
}
}

View File

@ -6,15 +6,15 @@ var app = builder.Build();
//웹서버 초기화
//ProtocolProcessor.Init();
ProtocolProcessor.Init();
//깃 웹훅 초기화
//GItWebhook.Init();
GItWebhook.Init();
//http용 데이터
//app.MapPost("/", ProtocolProcessor.Process);
app.MapPost("/", ProtocolProcessor.Process);
//git 접근용 웹훅
//app.MapPost("/git", GItWebhook.Process);
app.MapPost("/git", GItWebhook.Process);
//app.MapPost("/update", GItWebhook.Process);
@ -25,3 +25,7 @@ app.MapPost("/spin/random", Spin.Random);
#endif
app.Run(Statics.URL);
//서버 테이블과 클라이언트 테이블을 찾아 따로두고
//서버 업데이트시 db에서 한번더 받아오는것이 아닌 받은값을 서버에 바로 세팅하는 방식으로 변경

View File

@ -2,34 +2,34 @@
using Server.System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Server.SQL
{
[Table("equipmentdata", Schema = "excel")]
public class EquipmentData
{
[Key]
public long index { get; set; }
public int part { get; set; }
}
public class EquipmentDataSQL : SQL<EquipmentData>
public class EquipmentDataSQL
{
public override DbSet<EquipmentData> table { get; set; }
private Dictionary<long, EquipmentData> equipmentData;
public override List<EquipmentData> SelectUid(long user_id)
public string sheetName = "equipment";
public EquipmentData getEquipmentData(long key)
{
return null;
return equipmentData[key];
}
public List<EquipmentData> getEquipmentData()
{
return equipmentData.Values.ToList();
}
public void init()
{
Statics.equipmentData = new Dictionary<long, EquipmentData>();
List<EquipmentData> equipmentDatas = table.ToList();
for(int n = 0; n < equipmentDatas.Count; n++)
{
Statics.equipmentData.Add(equipmentDatas[n].index, equipmentDatas[n]);
}
}
}
}

View File

@ -19,15 +19,15 @@ namespace Server.System
public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]";
public static Dictionary<long,EquipmentData> equipmentData = new Dictionary<long,EquipmentData>();
//SQL
public static DeckInfoSQL deckInfoSQL = new DeckInfoSQL();
public static DeckUnitInfoSQL deckUnitInfoSQL = new DeckUnitInfoSQL();
public static DynamicDataSQL dynamicDataSQL = new DynamicDataSQL();
public static EquipmentrSQL equipmentrSQL = new EquipmentrSQL();
public static EquipmentDataSQL equipmentDataSQL = new EquipmentDataSQL();
public static UserSQL userSQL = new UserSQL();
//DATA
public static DynamicDataSQL dynamicData = new DynamicDataSQL();
public static EquipmentDataSQL equipmentData = new EquipmentDataSQL();
}
}