excel 시스템 변경
This commit is contained in:
parent
2ff4d4b2a9
commit
e346f99dc9
|
|
@ -1,4 +1,4 @@
|
||||||
using Aspose.Cells;
|
using ClosedXML.Excel;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace Server.Git
|
namespace Server.Git
|
||||||
|
|
@ -57,62 +57,80 @@ namespace Server.Git
|
||||||
{
|
{
|
||||||
return ExcelLoad(_pathFile);
|
return ExcelLoad(_pathFile);
|
||||||
}
|
}
|
||||||
public bool ExcelLoad(string path)//엑셀 로드
|
public bool ExcelLoad(string pathFile)
|
||||||
{
|
{
|
||||||
// 엑셀 파일 불러오기
|
// 엑셀 파일을 엽니다.
|
||||||
Workbook wb = new Workbook(_pathFile);
|
|
||||||
|
|
||||||
// 모든 워크시트 가져오기
|
|
||||||
WorksheetCollection collection = wb.Worksheets;
|
|
||||||
|
|
||||||
_sheets = new List<Sheet>();
|
|
||||||
|
|
||||||
// 모든 워크시트 반복
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int worksheetIndex = 0; worksheetIndex < collection.Count; worksheetIndex++)
|
using (var workbook = new XLWorkbook(pathFile))
|
||||||
{
|
{
|
||||||
//변수이름
|
_sheets = new List<Sheet>();
|
||||||
List<string> variable = new List<string>();
|
|
||||||
//서버용인지 클라용인지 나뉘는 타입
|
|
||||||
List<string> dataEnum = new List<string>();
|
|
||||||
//변수 타입
|
|
||||||
List<string> type = new List<string>();
|
|
||||||
Dictionary<long, Dictionary<string, object>> dicViewer = new Dictionary<long, Dictionary<string, object>>();
|
|
||||||
|
|
||||||
// 인덱스를 사용하여 워크시트 가져오기
|
// 모든 워크시트를 반복합니다.
|
||||||
Worksheet worksheet = collection[worksheetIndex];
|
foreach (var worksheet in workbook.Worksheets)
|
||||||
|
|
||||||
// 행과 열의 수 얻기
|
|
||||||
int vertical = worksheet.Cells.MaxDataRow;
|
|
||||||
int horizontal = worksheet.Cells.MaxDataColumn;
|
|
||||||
|
|
||||||
//변수 이름과 타입 삽입
|
|
||||||
for (int n = 0; n <= horizontal; n++)
|
|
||||||
{
|
{
|
||||||
variable.Add((string)worksheet.Cells[0, n].Value);
|
// 변수 이름, 데이터 타입, 데이터 열거형, 딕셔너리 초기화
|
||||||
type.Add(((string)worksheet.Cells[3, n].Value).ToLower());
|
var variable = new List<string>();
|
||||||
dataEnum.Add(((string)worksheet.Cells[2, n].Value).ToLower());
|
var dataEnum = new List<string>();
|
||||||
}
|
var type = new List<string>();
|
||||||
|
var dicViewer = new Dictionary<long, Dictionary<string, object>>();
|
||||||
|
|
||||||
bool isIndex = variable[0] == "index";
|
// 행과 열의 수 얻기
|
||||||
|
var vertical = worksheet.RangeUsed().RowCount() - 1; // 데이터가 있는 행의 수
|
||||||
|
var horizontal = worksheet.RangeUsed().ColumnCount() - 1; // 데이터가 있는 열의 수
|
||||||
|
|
||||||
for (int n = 4; n <= vertical; n++)
|
// 변수 이름과 타입을 삽입
|
||||||
{
|
for (int n = 0; n <= horizontal; n++)
|
||||||
Dictionary<string, object> dataList = new Dictionary<string, object>();
|
|
||||||
for (int m = 0; m <= horizontal; m++)
|
|
||||||
{
|
{
|
||||||
dataList.Add(variable[m], worksheet.Cells[n, m].Value);
|
variable.Add(worksheet.Cell(1, n + 1).GetValue<string>());
|
||||||
|
type.Add(worksheet.Cell(4, n + 1).GetValue<string>().ToLower());
|
||||||
|
dataEnum.Add(worksheet.Cell(3, n + 1).GetValue<string>().ToLower());
|
||||||
}
|
}
|
||||||
dicViewer.Add((int)(isIndex ? worksheet.Cells[n, 0].Value : n - 4), dataList);
|
|
||||||
|
bool isIndex = variable[0] == "index";
|
||||||
|
|
||||||
|
for (int n = 5; n <= vertical + 1; n++)
|
||||||
|
{
|
||||||
|
var dataList = new Dictionary<string, object>();
|
||||||
|
for (int m = 0; m <= horizontal; m++)
|
||||||
|
{
|
||||||
|
object getData;
|
||||||
|
switch (type[m])
|
||||||
|
{
|
||||||
|
case "bool":
|
||||||
|
getData = (worksheet.Cell(n, m + 1).Value.ToString() == "true");
|
||||||
|
break;
|
||||||
|
case "int":
|
||||||
|
case "enum":
|
||||||
|
getData = (int)worksheet.Cell(n, m + 1).Value;
|
||||||
|
break;
|
||||||
|
case "long":
|
||||||
|
getData = (long)worksheet.Cell(n, m + 1).Value;
|
||||||
|
break;
|
||||||
|
case "float":
|
||||||
|
getData = (float)worksheet.Cell(n, m + 1).Value;
|
||||||
|
break;
|
||||||
|
case "time":
|
||||||
|
getData = (DateTime)worksheet.Cell(n, m + 1).Value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
getData = worksheet.Cell(n, m + 1).Value.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dataList.Add(variable[m], getData);
|
||||||
|
}
|
||||||
|
dicViewer.Add((long)(isIndex ? dataList["index"] : n - 4), dataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
var sheet = new Sheet(worksheet.Name, variable, dataEnum, type, dicViewer);
|
||||||
|
_sheets.Add(sheet);
|
||||||
}
|
}
|
||||||
Sheet sheet = new Sheet(worksheet.Name, variable, dataEnum, type, dicViewer);
|
|
||||||
_sheets.Add(sheet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
// 로그 또는 예외 처리
|
||||||
|
Console.WriteLine($"Error loading Excel file: {ex.Message}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.SQL
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int user_id { get; set; }
|
public int user_id { get; set; }
|
||||||
public int consumable_item_data_id { get; set; }
|
public long consumable_item_data_id { get; set; }
|
||||||
|
|
||||||
public int count { get; set; }
|
public int count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.SQL
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int user_id { get; set; }
|
public int user_id { get; set; }
|
||||||
public int unit_data_id { get; set; }
|
public long unit_data_id { get; set; }
|
||||||
public int equip0_id { get; set; }
|
public int equip0_id { get; set; }
|
||||||
public int equip1_id { get; set; }
|
public int equip1_id { get; set; }
|
||||||
public int equip2_id { get; set; }
|
public int equip2_id { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.SQL
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int user_id { get; set; }
|
public int user_id { get; set; }
|
||||||
public int equipment_data_id { get; set; }
|
public long equipment_data_id { get; set; }
|
||||||
public int equip_unit { get; set; }
|
public int equip_unit { get; set; }
|
||||||
public int rand_stats { get; set; }
|
public int rand_stats { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.SQL
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int user_id { get; set; }
|
public int user_id { get; set; }
|
||||||
public int etc_item_data_id { get; set; }
|
public long etc_item_data_id { get; set; }
|
||||||
|
|
||||||
public int count { get; set; }
|
public int count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace Server.SQL.Excel
|
||||||
[Key]
|
[Key]
|
||||||
public int index { get; set; }
|
public int index { get; set; }
|
||||||
public int group { get; set; }
|
public int group { get; set; }
|
||||||
public int reward { get; set; }
|
public long reward { get; set; }
|
||||||
public int prob { get; set; }
|
public int prob { get; set; }
|
||||||
public eRewardItemType reward_item_type { get; set; }
|
public eRewardItemType reward_item_type { get; set; }
|
||||||
public int return_count { get; set; }
|
public int return_count { get; set; }
|
||||||
|
|
@ -52,7 +52,7 @@ namespace Server.SQL.Excel
|
||||||
RandomRewardData randomRewardData = new RandomRewardData();
|
RandomRewardData randomRewardData = new RandomRewardData();
|
||||||
randomRewardData.index = (int)item.Key;
|
randomRewardData.index = (int)item.Key;
|
||||||
randomRewardData.group = (int)item.Value["group"];
|
randomRewardData.group = (int)item.Value["group"];
|
||||||
randomRewardData.reward = (int)item.Value["reward"];
|
randomRewardData.reward = (long)item.Value["reward"];
|
||||||
randomRewardData.prob = (int)item.Value["prob"];
|
randomRewardData.prob = (int)item.Value["prob"];
|
||||||
randomRewardData.reward_item_type = (eRewardItemType)item.Value["reward_item_type"];
|
randomRewardData.reward_item_type = (eRewardItemType)item.Value["reward_item_type"];
|
||||||
randomRewardData.return_count = (int)item.Value["return_count"];
|
randomRewardData.return_count = (int)item.Value["return_count"];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SkiaSharp;
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Server.Scheduler
|
||||||
|
|
||||||
for (int n = users.Count - 1; n >= 0; n--)
|
for (int n = users.Count - 1; n >= 0; n--)
|
||||||
{
|
{
|
||||||
if ((now - DateTime.Parse(Statics.redis.GetHash("end_login", "UserInfo", users[n]))).TotalMinutes >= 10)
|
if ((now - (DateTime)Statics.redis.GetHash("end_login", "UserInfo", users[n])).TotalMinutes >= 10)
|
||||||
{
|
{
|
||||||
Statics.redis.RemoveList(n, users[n], "LoginUser");
|
Statics.redis.RemoveList(n, users[n], "LoginUser");
|
||||||
Statics.redis.RemoveKey("UserSession", users[n]);
|
Statics.redis.RemoveKey("UserSession", users[n]);
|
||||||
|
|
@ -28,30 +28,30 @@ namespace Server.Scheduler
|
||||||
{
|
{
|
||||||
//기존 세션 확인
|
//기존 세션 확인
|
||||||
string loginUUID = Guid.NewGuid().ToString();
|
string loginUUID = Guid.NewGuid().ToString();
|
||||||
Dictionary<string, string> users = Statics.redis.GetAllHash("LoginUsers");
|
Dictionary<string, object> users = Statics.redis.GetAllHash("LoginUsers");
|
||||||
logger.Info($"New User : {user.nickname}, session : {loginUUID}");
|
logger.Info($"New User : {user.nickname}, session : {loginUUID}");
|
||||||
foreach (var item in users)
|
foreach (var item in users)
|
||||||
{
|
{
|
||||||
if(int.Parse(item.Value) == user.id)
|
if(item.Value == (object)(StackExchange.Redis.RedisValue)user.id)
|
||||||
{
|
{
|
||||||
Statics.redis.RemoveHash(item.Key);
|
Statics.redis.RemoveHash(item.Key);
|
||||||
Statics.redis.SetHash(loginUUID, user.id.ToString(), "LoginUsers");
|
Statics.redis.SetHash(loginUUID, user.id, "LoginUsers");
|
||||||
updateSession(loginUUID);
|
updateSession(loginUUID);
|
||||||
return loginUUID;
|
return loginUUID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Statics.redis.SetHash(loginUUID, user.id.ToString(), "LoginUsers");
|
Statics.redis.SetHash(loginUUID, user.id, "LoginUsers");
|
||||||
Dictionary<string, string> userInfo = new Dictionary<string, string>();
|
Dictionary<string, object> userInfo = new Dictionary<string, object>();
|
||||||
userInfo.Add("id", user.id.ToString());
|
userInfo.Add("id", user.id);
|
||||||
userInfo.Add("uuid", user.uuid);
|
userInfo.Add("uuid", user.uuid);
|
||||||
userInfo.Add("mail", user.mail);
|
userInfo.Add("mail", user.mail);
|
||||||
userInfo.Add("nickname", user.nickname);
|
userInfo.Add("nickname", user.nickname);
|
||||||
userInfo.Add("gold", user.gold.ToString());
|
userInfo.Add("gold", user.gold);
|
||||||
userInfo.Add("free_cash", user.free_cash.ToString());
|
userInfo.Add("free_cash", user.free_cash);
|
||||||
userInfo.Add("pay_cash", user.pay_cash.ToString());
|
userInfo.Add("pay_cash", user.pay_cash);
|
||||||
userInfo.Add("end_login", DateTime.Now.ToString());
|
userInfo.Add("end_login", DateTime.Now);
|
||||||
Statics.redis.SetHash(userInfo, "UserInfo", user.id.ToString());
|
Statics.redis.SetHash(userInfo, "UserInfo", user.id);
|
||||||
|
|
||||||
return loginUUID;
|
return loginUUID;
|
||||||
}
|
}
|
||||||
|
|
@ -59,24 +59,24 @@ namespace Server.Scheduler
|
||||||
//세션 업데이트
|
//세션 업데이트
|
||||||
public static void updateSession(string UUID)
|
public static void updateSession(string UUID)
|
||||||
{
|
{
|
||||||
int id = int.Parse(Statics.redis.GetHash(UUID, "LoginUsers"));
|
int id = (int)Statics.redis.GetHash(UUID, "LoginUsers");
|
||||||
Statics.redis.SetHash("end_login", DateTime.Now.ToString(), "UserInfo", id.ToString());
|
Statics.redis.SetHash("end_login", DateTime.Now.ToString(), "UserInfo", id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User GetUser(string UUID)
|
public static User GetUser(string UUID)
|
||||||
{
|
{
|
||||||
User user = new User();
|
User user = new User();
|
||||||
int id = int.Parse(Statics.redis.GetHash(UUID, "LoginUsers"));
|
int id = (int)Statics.redis.GetHash(UUID, "LoginUsers");
|
||||||
Dictionary<string, string> userHash= Statics.redis.GetAllHash("UserInfo", id.ToString());
|
Dictionary<string, object> userHash= Statics.redis.GetAllHash("UserInfo", id.ToString());
|
||||||
|
|
||||||
|
|
||||||
user.id = int.Parse(userHash["id"]);
|
user.id = (int)userHash["id"];
|
||||||
user.uuid = userHash["uuid"];
|
user.uuid = (string)userHash["uuid"];
|
||||||
user.mail = userHash["mail"];
|
user.mail = (string)userHash["mail"];
|
||||||
user.nickname = userHash["nickname"];
|
user.nickname = (string)userHash["nickname"];
|
||||||
user.gold = int.Parse(userHash["gold"]);
|
user.gold = (int)userHash["gold"];
|
||||||
user.free_cash = int.Parse(userHash["free_cash"]);
|
user.free_cash = (int)userHash["free_cash"];
|
||||||
user.pay_cash = int.Parse(userHash["pay_cash"]);
|
user.pay_cash = (int)userHash["pay_cash"];
|
||||||
Statics.redis.SetHash("end_login", DateTime.Now.ToString(), "UserInfo", id.ToString());
|
Statics.redis.SetHash("end_login", DateTime.Now.ToString(), "UserInfo", id.ToString());
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,20 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspose.Cells" Version="24.3.0" />
|
<PackageReference Include="ClosedXML" Version="0.102.3" />
|
||||||
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
|
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Office.Interop.Excel" Version="15.0.4795.1001" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="NLog" Version="5.2.8" />
|
<PackageReference Include="NLog" Version="5.3.3" />
|
||||||
<PackageReference Include="Npgsql" Version="8.0.2" />
|
<PackageReference Include="Npgsql" Version="8.0.3" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
|
||||||
<PackageReference Include="NRedisStack" Version="0.12.0" />
|
<PackageReference Include="NRedisStack" Version="0.12.0" />
|
||||||
<PackageReference Include="Quartz" Version="3.8.1" />
|
<PackageReference Include="Quartz" Version="3.13.0" />
|
||||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Server.Service
|
||||||
{
|
{
|
||||||
Statics.userSQL.Update(req.user);
|
Statics.userSQL.Update(req.user);
|
||||||
|
|
||||||
Dictionary<string, string> saveUser = new Dictionary<string, string>();
|
Dictionary<string, object> saveUser = new Dictionary<string, object>();
|
||||||
saveUser.Add("nickname", req.user.nickname);
|
saveUser.Add("nickname", req.user.nickname);
|
||||||
saveUser.Add("gold", req.user.gold.ToString());
|
saveUser.Add("gold", req.user.gold.ToString());
|
||||||
saveUser.Add("free_cash", req.user.free_cash.ToString());
|
saveUser.Add("free_cash", req.user.free_cash.ToString());
|
||||||
|
|
@ -47,7 +47,6 @@ namespace Server.Service
|
||||||
if(shopItemData.buy_count != -1)
|
if(shopItemData.buy_count != -1)
|
||||||
{
|
{
|
||||||
List<ShopItem> shopItems = Statics.shopItemSQL.SelectUid(user.id, shopItemData.index);
|
List<ShopItem> shopItems = Statics.shopItemSQL.SelectUid(user.id, shopItemData.index);
|
||||||
Console.WriteLine(shopItems.Count);
|
|
||||||
if(shopItems.Count >= shopItemData.buy_count)
|
if(shopItems.Count >= shopItemData.buy_count)
|
||||||
{
|
{
|
||||||
throw new RuntimeException("Not Buy Count", Error.ErrorData);
|
throw new RuntimeException("Not Buy Count", Error.ErrorData);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Server.Service
|
||||||
{
|
{
|
||||||
Statics.userSQL.Update(req.user);
|
Statics.userSQL.Update(req.user);
|
||||||
|
|
||||||
Dictionary<string, string> saveUser = new Dictionary<string, string>();
|
Dictionary<string, object> saveUser = new Dictionary<string, object>();
|
||||||
saveUser.Add("nickname", req.user.nickname);
|
saveUser.Add("nickname", req.user.nickname);
|
||||||
saveUser.Add("gold", req.user.gold.ToString());
|
saveUser.Add("gold", req.user.gold.ToString());
|
||||||
saveUser.Add("free_cash", req.user.free_cash.ToString());
|
saveUser.Add("free_cash", req.user.free_cash.ToString());
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ namespace Server.System
|
||||||
Dictionary<string, string> stringType;
|
Dictionary<string, string> stringType;
|
||||||
Dictionary<string, List<string>> listType;
|
Dictionary<string, List<string>> listType;
|
||||||
Dictionary<string, List<Rank>> zType;
|
Dictionary<string, List<Rank>> zType;
|
||||||
Dictionary<string, Dictionary<string, string>> hashType;
|
Dictionary<string, Dictionary<string, object>> hashType;
|
||||||
|
|
||||||
|
//일반적인 사용에는 문제가 없지만 값을 비교해야 할때는 다음과 같이 변환이필요
|
||||||
|
//if(redis에서 가져온값 == (object)(StackExchange.Redis.RedisValue)비교하고 싶은 값)
|
||||||
|
|
||||||
public Redis(string host = "127.0.0.1", int port = 6379, int db = 0, string password = "")
|
public Redis(string host = "127.0.0.1", int port = 6379, int db = 0, string password = "")
|
||||||
{
|
{
|
||||||
if (host == "localhost")
|
if (host == "localhost")
|
||||||
|
|
@ -22,19 +26,17 @@ namespace Server.System
|
||||||
stringType = new Dictionary<string, string>();
|
stringType = new Dictionary<string, string>();
|
||||||
listType = new Dictionary<string, List<string>>();
|
listType = new Dictionary<string, List<string>>();
|
||||||
zType = new Dictionary<string, List<Rank>>();
|
zType = new Dictionary<string, List<Rank>>();
|
||||||
hashType = new Dictionary<string, Dictionary<string, string>>();
|
hashType = new Dictionary<string, Dictionary<string, object>>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (password.Equals(string.Empty))
|
if (password.Equals(string.Empty))
|
||||||
{
|
{
|
||||||
Console.WriteLine("false");
|
|
||||||
redis = ConnectionMultiplexer.Connect($"{host}:{port}");
|
redis = ConnectionMultiplexer.Connect($"{host}:{port}");
|
||||||
this.db = redis.GetDatabase(db);
|
this.db = redis.GetDatabase(db);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("true");
|
|
||||||
ConfigurationOptions options = new ConfigurationOptions
|
ConfigurationOptions options = new ConfigurationOptions
|
||||||
{
|
{
|
||||||
EndPoints = { $"{host}:{port}" },
|
EndPoints = { $"{host}:{port}" },
|
||||||
|
|
@ -46,13 +48,6 @@ namespace Server.System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test()
|
|
||||||
{
|
|
||||||
Console.WriteLine("--------------------");
|
|
||||||
|
|
||||||
Console.WriteLine("--------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetString(string value, params string[] keys)
|
public void SetString(string value, params string[] keys)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
|
|
@ -199,13 +194,13 @@ namespace Server.System
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHash(string field, string value, params string[] keys)
|
public void SetHash(string field, object value, params object[] keys)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
{
|
{
|
||||||
if (hashType.ContainsKey(KeySet(keys)))
|
if (hashType.ContainsKey(KeySet(keys)))
|
||||||
{
|
{
|
||||||
Dictionary<string, string> userHash = hashType[KeySet(keys)];
|
Dictionary<string, object> userHash = hashType[KeySet(keys)];
|
||||||
if (userHash.ContainsKey(field))
|
if (userHash.ContainsKey(field))
|
||||||
userHash[field] = value;
|
userHash[field] = value;
|
||||||
else
|
else
|
||||||
|
|
@ -213,7 +208,7 @@ namespace Server.System
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hashType.Add(KeySet(keys), new Dictionary<string, string> { { field, value } });
|
hashType.Add(KeySet(keys), new Dictionary<string, object> { { field, value } });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -221,18 +216,18 @@ namespace Server.System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHash(Dictionary<string, string> hash, params string[] keys)
|
public void SetHash(Dictionary<string, object> hash, params object[] keys)
|
||||||
{
|
{
|
||||||
foreach (var item in hash)
|
foreach (var item in hash)
|
||||||
SetHash(item.Key, item.Value, keys);
|
SetHash(item.Key, item.Value, keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> GetAllHash(params string[] keys)
|
public Dictionary<string, object> GetAllHash(params string[] keys)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> hash = new Dictionary<string, string>();
|
Dictionary<string, object> hash = new Dictionary<string, object>();
|
||||||
if (local)
|
if (local)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> hashs;
|
Dictionary<string, object> hashs;
|
||||||
if (hashType.ContainsKey(KeySet(keys)))
|
if (hashType.ContainsKey(KeySet(keys)))
|
||||||
{
|
{
|
||||||
hashs = hashType[KeySet(keys)];
|
hashs = hashType[KeySet(keys)];
|
||||||
|
|
@ -241,7 +236,7 @@ namespace Server.System
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hashs = new Dictionary<string, string>();
|
hashs = new Dictionary<string, object>();
|
||||||
foreach (var entry in hashs)
|
foreach (var entry in hashs)
|
||||||
hash.Add(entry.Key, entry.Value);
|
hash.Add(entry.Key, entry.Value);
|
||||||
hashType.Add(KeySet(keys), hashs);
|
hashType.Add(KeySet(keys), hashs);
|
||||||
|
|
@ -257,11 +252,11 @@ namespace Server.System
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetHash(string field ,params string[] keys)
|
public object GetHash(string field ,params string[] keys)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> hashs = new Dictionary<string, string>(hashType[KeySet(keys)]);
|
Dictionary<string, object> hashs = new Dictionary<string, object>(hashType[KeySet(keys)]);
|
||||||
return hashs[field];
|
return hashs[field];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -289,7 +284,7 @@ namespace Server.System
|
||||||
db.KeyDelete(KeySet(keys));
|
db.KeyDelete(KeySet(keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string KeySet(string[] keys)
|
private string KeySet(object[] keys)
|
||||||
{
|
{
|
||||||
return string.Join(":", keys);
|
return string.Join(":", keys);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@ namespace Server.System
|
||||||
public static class Statics
|
public static class Statics
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static readonly string SQL_URL = "Host=192.168.1.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string SQL_URL = "Host=192.168.1.3;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string EXCEL_SQL_URL = "Host=192.168.1.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string EXCEL_SQL_URL = "Host=192.168.1.3;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
||||||
public static readonly Redis redis = new Redis("localhost", 6379, 1, "xPEz3x08xQ8G1Fa");
|
public static readonly Redis redis = new Redis("192.168.1.3", 6379, 1, "mwAG28D5y0MAOOokMCnn");
|
||||||
#elif LIVE
|
#elif LIVE
|
||||||
public static readonly string SQL_URL = "Host=192.168.1.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string SQL_URL = "Host=192.168.1.3;Port=5432;Username=manager;Password=:q+Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string EXCEL_SQL_URL = "Host=192.168.1.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
public static readonly string EXCEL_SQL_URL = "Host=192.168.1.3;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;";
|
||||||
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git";
|
||||||
public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1, "xPEz3x08xQ8G1Fa");
|
public static readonly Redis redis = new Redis("192.168.1.3", 6379, 1, "mwAG28D5y0MAOOokMCnn");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static readonly string URL = "https://0.0.0.0:4860";
|
public static readonly string URL = "https://0.0.0.0:4860";
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Server.System {
|
||||||
|
|
||||||
public static string Process(HttpContext context) {
|
public static string Process(HttpContext context) {
|
||||||
AbstractService abstractService;
|
AbstractService abstractService;
|
||||||
|
//TODO 좀더 딥한곳에 status를 수정하게 만들기.
|
||||||
string Response = "";
|
string Response = "";
|
||||||
try {
|
try {
|
||||||
Protocol cmd = (Protocol)int.Parse(context.Request.Headers["cmd"]);
|
Protocol cmd = (Protocol)int.Parse(context.Request.Headers["cmd"]);
|
||||||
|
|
@ -69,8 +69,8 @@ namespace Server.System {
|
||||||
Response = error.ToJson();
|
Response = error.ToJson();
|
||||||
logger.Error("GetErrorResponse : " + ex.ToString());
|
logger.Error("GetErrorResponse : " + ex.ToString());
|
||||||
}
|
}
|
||||||
|
finally{}
|
||||||
return Response;
|
return Response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<string> Request(HttpRequest request) {
|
private static async Task<string> Request(HttpRequest request) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue