Files
caliverse_server/ServerCommon/Doc/Global/LandAuctionHighestBidUserDoc.cs
2025-05-01 07:20:41 +09:00

122 lines
4.5 KiB
C#

using System;
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
using LAND_AUCTION_NUMBER = System.Int32;
namespace ServerCommon;
public class LandAuctionHighestBidUserAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public META_ID LandMetaId { get; set; } = 0; // 경매 대상 LandData Meta Id
[JsonProperty("auction_number")]
public LAND_AUCTION_NUMBER AuctionNumber { get; set; } = 0; // 경매 번호
[JsonProperty("bid_currency_type")]
public CurrencyType BidCurrencyType { get; set; } = 0; // 입찰 재화의 종류
//=============================================================================================
// 현재 최고 입찰자 정보
//=============================================================================================
[JsonProperty("highest_bid_price")]
public double HighestBidPrice { get; set; } = 0; // 입찰 최고가
[JsonProperty("highest_user_guid")]
public string HighestBidUserGuid { get; set; } = string.Empty; // 입찰 최고가 유저 식별키
[JsonProperty("highest_user_nickname")]
public string HighestBidUserNickname { get; set; } = string.Empty; // 입찰 최고가 유저 닉네임
//=============================================================================================
// 일반 입찰 최고 입찰자 정보
//=============================================================================================
[JsonProperty("normal_highest_bid_price")]
public double NormalHighestBidPrice { get; set; } = 0; // 일반 입찰 최고가
[JsonProperty("normal_highest_user_guid")]
public string NormalHighestBidUserGuid { get; set; } = string.Empty; // 일반 입찰 최고가 유저 식별키
[JsonProperty("normal_highest_user_nickname")]
public string NormalHighestBidUserNickname { get; set; } = string.Empty; // 일반 입찰 최고가 유저 닉네임
[JsonProperty("highest_rank_version_time")]
public DateTime HighestRankVersionTime { get; set; } = DateTimeHelper.MinTime; // 최고 입찰자 순위 버전 정보
public LandAuctionHighestBidUserAttrib()
: base(nameof(LandAuctionHighestBidUserAttrib), false)
{
}
}
//=============================================================================================
// Desc : 랜드 경매별 입찰 최고가 유저
// Primary Key
// PK(Partition Key) : land_auction_highest_bid_user#global
// SK(Sort Key) : {land_meta_id}#{auction_number}"
// DocType : LandAuctionHighestBidUserDoc
// Attrib : LandAuctionHighestBidUserAttrib
// ...
//=============================================================================================
public class LandAuctionHighestBidUserDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() => "land_auction_highest_bid_user#";
public LandAuctionHighestBidUserDoc()
: base(nameof(LandAuctionHighestBidUserDoc))
{
appendAttribWrapperAll();
}
public LandAuctionHighestBidUserDoc(META_ID landMetaId, LAND_AUCTION_NUMBER landAuctionNumber)
: base(nameof(LandAuctionHighestBidUserDoc))
{
setCombinationKeyForPK(DynamoDbClient.PK_GLOBAL);
setCombinationKeyForSK(makeCombinationKeyForSK(landMetaId, landAuctionNumber));
fillUpPrimaryKey(onMakePK(), onMakeSK());
appendAttribWrapperAll();
var land_auction_highest_bid_user_attrib = getAttrib<LandAuctionHighestBidUserAttrib>();
NullReferenceCheckHelper.throwIfNull(land_auction_highest_bid_user_attrib, () => $"land_auction_highest_bid_user_attrib is null !!!");
land_auction_highest_bid_user_attrib.LandMetaId = landMetaId;
land_auction_highest_bid_user_attrib.AuctionNumber = landAuctionNumber;
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<LandAuctionHighestBidUserAttrib>());
}
protected override string onGetPrefixOfPK() => getPrefixOfPK();
protected override string onMakeSK()
{
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
public static string makeCombinationKeyForSK(META_ID landMetaId, LAND_AUCTION_NUMBER landAuctionNumber)
{
return $"{landMetaId}#{landAuctionNumber}";
}
}