diff --git a/Server/Git/AbstractGit.cs b/Server/Git/AbstractGit.cs index ab8d3e3..e17ee6d 100644 --- a/Server/Git/AbstractGit.cs +++ b/Server/Git/AbstractGit.cs @@ -194,6 +194,12 @@ namespace Server.Git Statics.consumableItemExcel.init(sheets[index]); } + index = sheets.FindIndex(n => n.name == Statics.resetShopItemExcel.sheetName); + if (index != 0) + { + Statics.resetShopItemExcel.init(sheets[index]); + } + } } } diff --git a/Server/SQL/ResetShopItem.cs b/Server/SQL/ResetShopItem.cs new file mode 100644 index 0000000..69b5093 --- /dev/null +++ b/Server/SQL/ResetShopItem.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Server.SQL +{ + [Table("reset_shop_item", Schema = "gamedb")] + public class ResetShopItem + { + [JsonIgnore] + public long user_id { get; set; } + public long id { get; set; } + public long reset_shop_item_data_id { get; set; } + public string name { get; set; } + public long shop_index { get; set; } + public eBuyType buy_type { get; set; } + public int buy { get; set; } + public long reward { get; set; } + public int buy_count { get; set; } + public int count { get; set; } + public DateTime end_date { get; set; } + } + + public class ResetShopItemSQL : SQL + { + public override DbSet table { get; set; } + + public void Update(ResetShopItem ResetShopItem) + { + table.Update(ResetShopItem); + } + + public override List SelectUid(long user_id) + { + //현재 시간도 비교해서 이전날자가 들어가지 않게 하기 + return table.Where(data => data.user_id == user_id).ToList(); + } + } +} diff --git a/Server/SQL/ResetShopItemData.cs b/Server/SQL/ResetShopItemData.cs new file mode 100644 index 0000000..044d3f2 --- /dev/null +++ b/Server/SQL/ResetShopItemData.cs @@ -0,0 +1,50 @@ +using Server.Git; +using System.ComponentModel.DataAnnotations; + +namespace Server.SQL +{ + public class ResetShopItemData + { + [Key] + public long index { get; set; } + public string name { get; set; } + public long shop_index { get; set; } + public eBuyType buy_type { get; set; } + public int buy { get; set; } + public long reward { get; set; } + public int buy_count { get; set; } + } + + public class ResetShopItemDataExcel + { + private Dictionary resetShopItemData; + + public string sheetName = "ResetShopItemData"; + + public ResetShopItemData getResetShopItemData(long key) + { + return resetShopItemData[key]; + } + + public List getResetShopItemData() + { + return resetShopItemData.Values.ToList(); + } + public void init(Sheet data) + { + this.resetShopItemData = new Dictionary(); + foreach (var item in data.dicViewer) + { + ResetShopItemData resetShopItemData = new ResetShopItemData(); + resetShopItemData.index = item.Key; + resetShopItemData.name = (string)item.Value["name"]; + resetShopItemData.shop_index = (int)item.Value["shop_index"]; + resetShopItemData.buy_type = (eBuyType)item.Value["buy_type"]; + resetShopItemData.buy = (int)item.Value["buy"]; + resetShopItemData.reward = (int)item.Value["reward"]; + resetShopItemData.buy_count = (int)item.Value["buy_count"]; + this.resetShopItemData.Add(item.Key, resetShopItemData); + } + } + } +} diff --git a/Server/Service/Login.cs b/Server/Service/Login.cs index fd2e1ea..f9a0a45 100644 --- a/Server/Service/Login.cs +++ b/Server/Service/Login.cs @@ -57,6 +57,7 @@ namespace Server.Service user.uuid = Guid.NewGuid().ToString(); user.nickname = Statics.dynamicDataSQL.SelectName("defaultNick").value; Statics.userSQL.Insert(user); //저장하고 유닛의 id를 얻어오기 위함. + Statics.userSQL.SaveChanges(); itemManager = new ItemManager(user); #endregion #region 초기 유닛 지급 diff --git a/Server/System/Statics.cs b/Server/System/Statics.cs index 126a2a1..43fa693 100644 --- a/Server/System/Statics.cs +++ b/Server/System/Statics.cs @@ -34,5 +34,6 @@ namespace Server.System public static RewardDataExcel rewardExcel = new RewardDataExcel(); public static ShopItemDataExcel shopItemExcel = new ShopItemDataExcel(); public static ConsumableItemDataExcel consumableItemExcel = new ConsumableItemDataExcel(); + public static ResetShopItemDataExcel resetShopItemExcel = new ResetShopItemDataExcel(); } }