db 타입 변경에 따른 데이터 수정

This commit is contained in:
김민서 2024-04-01 15:55:18 +09:00
parent a14181e2e5
commit 08b7edb0cb
19 changed files with 113 additions and 82 deletions

View File

@ -85,7 +85,7 @@ namespace Server.Manager
}
}
public void addUnit(long unitDataId)
public void addUnit(int unitDataId)
{
DeckUnitInfo deckUnitInfo = new DeckUnitInfo();
deckUnitInfo.user_id = user.id;

View File

@ -7,10 +7,10 @@ namespace Server.SQL
[Table("consumable_item", Schema = "gamedb")]
public class ConsumableItem
{
public long id { get; set; }
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long consumable_item_data_id { get; set; }
public int user_id { get; set; }
public int consumable_item_data_id { get; set; }
public int count { get; set; }
}
@ -24,12 +24,12 @@ namespace Server.SQL
table.Update(consumableItem);
}
public override List<ConsumableItem> SelectUid(long user_id)
public override List<ConsumableItem> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public ConsumableItem SelectItem(long user_id, long consumable_item_id)
public ConsumableItem SelectItem(int user_id, int consumable_item_id)
{
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == consumable_item_id));
}

View File

@ -7,26 +7,26 @@ namespace Server.SQL
[Table("deck_info", Schema = "gamedb")]
public class DeckInfo
{
public long id { get; set; }
public int deck_type { get; set; }
public long deck_unit0_id { get; set; }
public long deck_unit1_id { get; set; }
public long deck_unit2_id { get; set; }
public long deck_unit3_id { get; set; }
public long deck_unit4_id { get; set; }
public long deck_unit5_id { get; set; }
public long deck_unit6_id { get; set; }
public long deck_unit7_id { get; set; }
public long deck_unit8_id { get; set; }
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public int user_id { get; set; }
public int deck_type { get; set; }
public int deck_unit0_id { get; set; }
public int deck_unit1_id { get; set; }
public int deck_unit2_id { get; set; }
public int deck_unit3_id { get; set; }
public int deck_unit4_id { get; set; }
public int deck_unit5_id { get; set; }
public int deck_unit6_id { get; set; }
public int deck_unit7_id { get; set; }
public int deck_unit8_id { get; set; }
}
public class DeckInfoSQL : SQL<DeckInfo>
{
public override DbSet<DeckInfo> table { get; set; }
public override List<DeckInfo> SelectUid(long user_id)
public override List<DeckInfo> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}

View File

@ -7,28 +7,28 @@ namespace Server.SQL
[Table("deck_unit_info", Schema = "gamedb")]
public class DeckUnitInfo
{
public long id { get; set; }
public long unit_data_id { get; set; }
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long equip0_id { get; set; }
public long equip1_id { get; set; }
public long equip2_id { get; set; }
public long equip3_id { get; set; }
public long equip4_id { get; set; }
public long equip5_id { get; set; }
public long exp { get; set; }
public int user_id { get; set; }
public int unit_data_id { get; set; }
public int equip0_id { get; set; }
public int equip1_id { get; set; }
public int equip2_id { get; set; }
public int equip3_id { get; set; }
public int equip4_id { get; set; }
public int equip5_id { get; set; }
public int exp { get; set; }
}
public class DeckUnitInfoSQL : SQL<DeckUnitInfo>
{
public override DbSet<DeckUnitInfo> table { get; set; }
public override List<DeckUnitInfo> SelectUid(long user_id)
public override List<DeckUnitInfo> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public DeckUnitInfo SelectItem(long user_id, long unit_id)
public DeckUnitInfo SelectItem(int user_id, int unit_id)
{
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == unit_id));
}

View File

@ -38,7 +38,7 @@ namespace Server.SQL
}
}
public override List<DynamicData> SelectUid(long user_id)
public override List<DynamicData> SelectUid(int user_id)
{
return null;//table.Where(data => data.id == user_id).ToList();
}

View File

@ -7,12 +7,12 @@ namespace Server.SQL
[Table("equipment", Schema = "gamedb")]
public class Equipment
{
public long id { get; set; }
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long equip_unit { get; set; }
public int user_id { get; set; }
public int equipment_data_id { get; set; }
public int equip_unit { get; set; }
public int rand_stats { get; set; }
public long equipment_data_id { get; set; }
}
public class EquipmentrSQL : SQL<Equipment>
@ -24,12 +24,12 @@ namespace Server.SQL
table.Update(equipment);
}
public override List<Equipment> SelectUid(long user_id)
public override List<Equipment> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public Equipment SelectItem(long user_id, long equipment_id)
public Equipment SelectItem(int user_id, int equipment_id)
{
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == equipment_id));
}

View File

@ -7,10 +7,10 @@ namespace Server.SQL
[Table("etc_item", Schema = "gamedb")]
public class EtcItem
{
public long id { get; set; }
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long etc_item_data_id { get; set; }
public int user_id { get; set; }
public int etc_item_data_id { get; set; }
public int count { get; set; }
}
@ -24,12 +24,12 @@ namespace Server.SQL
table.Update(etcItem);
}
public override List<EtcItem> SelectUid(long user_id)
public override List<EtcItem> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public EtcItem SelectItem(long user_id, long etc_item_id)
public EtcItem SelectItem(int user_id, int etc_item_id)
{
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == etc_item_id));
}

View File

@ -7,9 +7,9 @@ namespace Server.SQL.Excel
public class RandomRewardData
{
[Key]
public long index { get; set; }
public int index { get; set; }
public int group { get; set; }
public long reward { get; set; }
public int reward { get; set; }
public int prob { get; set; }
public eRewardItemType reward_item_type { get; set; }
public int return_count { get; set; }
@ -50,7 +50,7 @@ namespace Server.SQL.Excel
foreach (var item in data.dicViewer)
{
RandomRewardData randomRewardData = new RandomRewardData();
randomRewardData.index = item.Key;
randomRewardData.index = (int)item.Key;
randomRewardData.group = (int)item.Value["group"];
randomRewardData.reward = (int)item.Value["reward"];
randomRewardData.prob = (int)item.Value["prob"];

View File

@ -6,12 +6,12 @@ namespace Server.SQL.Excel
public class ResetShopItemData
{
[Key]
public long index { get; set; }
public int index { get; set; }
public string name { get; set; }
public long shop_index { get; set; }
public int shop_index { get; set; }
public eBuyType buy_type { get; set; }
public int buy { get; set; }
public long reward { get; set; }
public int reward { get; set; }
public int buy_count { get; set; }
}
@ -36,7 +36,7 @@ namespace Server.SQL.Excel
foreach (var item in data.dicViewer)
{
ResetShopItemData resetShopItemData = new ResetShopItemData();
resetShopItemData.index = item.Key;
resetShopItemData.index = (int)item.Key;
resetShopItemData.name = (string)item.Value["name"];
resetShopItemData.shop_index = (int)item.Value["shop_index"];
resetShopItemData.buy_type = (eBuyType)item.Value["buy_type"];

View File

@ -6,9 +6,9 @@ namespace Server.SQL.Excel
public class RewardData
{
[Key]
public long index { get; set; }
public int index { get; set; }
public eRewardItemType reward_item_type { get; set; }
public long return_item { get; set; }
public int return_item { get; set; }
public int return_count { get; set; }
}
@ -44,7 +44,7 @@ namespace Server.SQL.Excel
foreach (var item in data.dicViewer)
{
RewardData rewardData = new RewardData();
rewardData.index = item.Key;
rewardData.index = (int)item.Key;
rewardData.reward_item_type = (eRewardItemType)item.Value["reward_item_type"];
rewardData.return_item = (int)item.Value["return_item"];
rewardData.return_count = (int)item.Value["return_count"];

View File

@ -6,10 +6,10 @@ namespace Server.SQL.Excel
public class ShopItemData
{
[Key]
public long index { get; set; }
public int index { get; set; }
public eBuyType buy_type { get; set; }
public int buy { get; set; }
public long reward { get; set; }
public int reward { get; set; }
public int buy_count { get; set; }
}
@ -41,7 +41,7 @@ namespace Server.SQL.Excel
foreach (var item in data.dicViewer)
{
ShopItemData shopItemData = new ShopItemData();
shopItemData.index = item.Key;
shopItemData.index = (int)item.Key;
shopItemData.buy_type = (eBuyType)item.Value["buy_type"];
shopItemData.buy = (int)item.Value["buy"];
shopItemData.reward = (int)item.Value["reward"];

View File

@ -8,15 +8,15 @@ namespace Server.SQL
[Table("reset_shop_item", Schema = "gamedb")]
public class ResetShopItem
{
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long id { get; set; }
public long reset_shop_item_data_id { get; set; }
public int user_id { get; set; }
public int reset_shop_item_data_id { get; set; }
public string name { get; set; }
public long shop_index { get; set; }
public int shop_index { get; set; }
public eBuyType buy_type { get; set; }
public int buy { get; set; }
public long reward { get; set; }
public int reward { get; set; }
public int buy_count { get; set; }
public int count { get; set; }
public DateTime end_date { get; set; }
@ -31,7 +31,7 @@ namespace Server.SQL
table.Update(ResetShopItem);
}
public override List<ResetShopItem> SelectUid(long user_id)
public override List<ResetShopItem> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id && data.end_date > DateTime.UtcNow).ToList();
}

View File

@ -46,7 +46,7 @@ namespace Server.SQL
return table.ToList();
}
public abstract List<T> SelectUid(long user_id);
public abstract List<T> SelectUid(int user_id);
// Select 예시
// 각자 상황에 맞게 작성해서 사용할것

View File

@ -7,10 +7,10 @@ namespace Server.SQL
[Table("shop_item", Schema = "gamedb")]
public class ShopItem
{
public int id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long id { get; set; }
public long shop_item_data_id { get; set; }
public int user_id { get; set; }
public int shop_item_data_id { get; set; }
public DateTime buy_date { get; set; }
}
@ -23,12 +23,12 @@ namespace Server.SQL
table.Update(ShopItem);
}
public override List<ShopItem> SelectUid(long user_id)
public override List<ShopItem> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public List<ShopItem> SelectUid(long user_id, long shop_item_data_id)
public List<ShopItem> SelectUid(int user_id, int shop_item_data_id)
{
return table.Where(data => data.user_id == user_id && data.shop_item_data_id == shop_item_data_id).ToList();
}

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
namespace Server.SQL
{
[Table("story_progress", Schema = "gamedb")]
public class StoryProgress
{
public int id { get; set; }
[JsonIgnore]
public int user_id { get; set; }
public int story_data_id { get; set; }
public int chapter_data_id { get; set; }
}
public class StoryProgressSQL : SQL<StoryProgress>
{
public override DbSet<StoryProgress> table { get; set; }
public void Update(StoryProgress etcItem)
{
table.Update(etcItem);
}
public override List<StoryProgress> SelectUid(int user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
}
}

View File

@ -8,20 +8,20 @@ namespace Server.SQL
public class User
{
[JsonIgnore]
public long id { get; set; }
public int id { get; set; }
public string uuid { get; set; }
[JsonIgnore]
public string mail { get; set; }
public string nickname { get; set; }
public long gold { get; set; }
public long free_cash { get; set; }
public long pay_cash { get; set; }
public int gold { get; set; }
public int free_cash { get; set; }
public int pay_cash { get; set; }
public bool buyCash(long buy)
public bool buyCash(int buy)
{
if (buy == 0) { return true; }
long freeCash = free_cash;
long payCash = pay_cash;
int freeCash = free_cash;
int payCash = pay_cash;
freeCash -= buy;
if(freeCash < 0)
{
@ -63,7 +63,7 @@ namespace Server.SQL
/// </summary>
/// <param name="user_id"></param>
/// <returns></returns>
public override List<User> SelectUid(long user_id)
public override List<User> SelectUid(int user_id)
{
return null;
}

View File

@ -26,8 +26,8 @@ namespace Server.Service
User user = Statics.userSQL.SelectUuid(req.uuid);
eBuyType buy_type;
int buy;
long reward;
long id;
int reward;
int id;
ResetShopItem resetShopItem = null;
if (req.reset_id == -1)
{

View File

@ -94,8 +94,8 @@ namespace Server.Service
public class DeckChangeReq : Req
{
public long deck_id;
public long[] deck_unit;
public int deck_id;
public int[] deck_unit;
public override bool IsReceivedAllField()
{
if(uuid == "" || deck_id == 0 || deck_unit.Length != 9)

View File

@ -141,8 +141,8 @@ namespace Server.Service
public class EquipChangeReq : Req
{
public long unit_id;
public long equipment_id;
public int unit_id;
public int equipment_id;
public bool is_equipment;
public override bool IsReceivedAllField()
{