상점 구매시 남은 구매횟수 확인 추가
This commit is contained in:
parent
4b77dea709
commit
3fc1e5a870
|
|
@ -27,5 +27,10 @@ namespace Server.SQL
|
|||
{
|
||||
return table.Where(data => data.user_id == user_id).ToList();
|
||||
}
|
||||
|
||||
public List<ShopItem> SelectUid(long user_id, long shop_item_data_id)
|
||||
{
|
||||
return table.Where(data => data.user_id == user_id && data.shop_item_data_id == shop_item_data_id).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Server.SQL
|
|||
public eBuyType buy_type { get; set; }
|
||||
public int buy { get; set; }
|
||||
public long reward { get; set; }
|
||||
public int buy_count { get; set; }
|
||||
}
|
||||
|
||||
public enum eBuyType
|
||||
|
|
@ -44,6 +45,7 @@ namespace Server.SQL
|
|||
shopItemData.buy_type = (eBuyType)item.Value["buy_type"];
|
||||
shopItemData.buy = (int)item.Value["buy"];
|
||||
shopItemData.reward = (int)item.Value["reward"];
|
||||
shopItemData.buy_count = (int)item.Value["buy_count"];
|
||||
this.shopItemData.Add(item.Key, shopItemData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ namespace Server.Service
|
|||
if (req.reset_id == -1)
|
||||
{
|
||||
ShopItemData shopItemData = Statics.shopItemExcel.getShopItemData(req.shopItemIndex);
|
||||
|
||||
//구매 가능한지 검사
|
||||
if(shopItemData.buy_count != -1)
|
||||
{
|
||||
List<ShopItem> shopItems = Statics.shopItemSQL.SelectUid(user.id, shopItemData.index);
|
||||
Console.WriteLine(shopItems.Count);
|
||||
if(shopItems.Count >= shopItemData.buy_count)
|
||||
{
|
||||
throw new RuntimeException("Not Buy Count", Error.ErrorData);
|
||||
}
|
||||
}
|
||||
buy_type = shopItemData.buy_type;
|
||||
buy = shopItemData.buy;
|
||||
reward = shopItemData.reward;
|
||||
|
|
@ -39,6 +50,11 @@ namespace Server.Service
|
|||
else
|
||||
{
|
||||
resetShopItem = Statics.resetShopItemSQL.SelectUid(user.id).Find(n => n.id == req.reset_id);
|
||||
//구매 가능한지 검사
|
||||
if (resetShopItem.count == 0)
|
||||
{
|
||||
throw new RuntimeException("Not Buy Count", Error.ErrorData);
|
||||
}
|
||||
buy_type = resetShopItem.buy_type;
|
||||
buy = resetShopItem.buy;
|
||||
reward = resetShopItem.reward;
|
||||
|
|
|
|||
Loading…
Reference in New Issue