133 lines
5.1 KiB
C#
133 lines
5.1 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 LandAuctionRegistryAttrib : 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("auction_reservation_notice_start_time")]
|
|
public DateTime AuctionReservationNoticeStartTime { get; set; } = DateTimeHelper.MinTime; // 경매 예약 공지 시작 시간
|
|
|
|
[JsonProperty("bid_currency_type")]
|
|
public CurrencyType BidCurrencyType { get; set; } = 0; // 입찰 재화의 종류
|
|
|
|
[JsonProperty("auction_start_time")]
|
|
public DateTime AuctionStartTime { get; set; } = DateTimeHelper.MinTime; // 경매 시작 시간
|
|
|
|
[JsonProperty("auction_end_time")]
|
|
public DateTime AuctionEndTime { get; set; } = DateTimeHelper.MinTime; // 경매 종료 시간
|
|
|
|
[JsonProperty("bid_start_price")]
|
|
public double BidStartPrice { get; set; } = 0; // 입찰 시작가
|
|
|
|
[JsonProperty("is_cancel_auction")]
|
|
public bool IsCancelAuction { get; set; } = false; // 경매 취소 여부 (취소:true, 미취소:false)
|
|
|
|
[JsonProperty("registered_version_time")]
|
|
public DateTime RegisteredVersionTime { get; set; } = DateTimeHelper.MinTime; // 경매 등록 버전 정보 (시간), 랜드 경매 등록 정보가 변경되면 등록 버전 정보도 갱신 되어야 한다. !!!
|
|
|
|
|
|
//=============================================================================================
|
|
// 랜드 경매 진행 정보
|
|
//=============================================================================================
|
|
[JsonProperty("auction_state")]
|
|
public LandAuctionState LandAuctionState { get; set; } = LandAuctionState.None; // 경매 상태
|
|
|
|
[JsonProperty("auction_result")]
|
|
public LandAuctionResult LandAuctionResult { get; set; } = LandAuctionResult.None; // 경매 결과
|
|
|
|
[JsonProperty("process_version_time")]
|
|
public DateTime ProcessVersionTime { get; set; } = DateTimeHelper.MinTime; // 경매 진행 버전 정보 (시간), 랜드 경매 진행 정보가 변경되면 진행 버전 정보도 갱신되어야 한다. !!!
|
|
|
|
public LandAuctionRegistryAttrib()
|
|
: base(nameof(LandAuctionRegistryAttrib), false)
|
|
{
|
|
}
|
|
}
|
|
|
|
//=============================================================================================
|
|
// Desc : 등록된 랜드 경매별 등록 정보
|
|
// Primary Key
|
|
// PK(Partition Key) : land_auction_registry#global
|
|
// SK(Sort Key) : "{land_meta_id}#{auction_number}"
|
|
// DocType : LandAuctionRegistryDoc
|
|
// Attrib : LandAuctionRegistryAttrib
|
|
// ...
|
|
//=============================================================================================
|
|
public class LandAuctionRegistryDoc : DynamoDbDocBase
|
|
{
|
|
private static string getPrefixOfPK() => "land_auction_registry#";
|
|
|
|
public LandAuctionRegistryDoc()
|
|
: base(nameof(LandAuctionRegistryDoc))
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public LandAuctionRegistryDoc(META_ID landMetaId, LAND_AUCTION_NUMBER landAuctionNumber, DateTime registeredVersionTime)
|
|
: base(nameof(LandAuctionRegistryDoc))
|
|
{
|
|
setCombinationKeyForPK(DynamoDbClient.PK_GLOBAL);
|
|
setCombinationKeyForSK(makeCombinationKeyForSK(landMetaId, landAuctionNumber));
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
var land_auction_registry_attrib = getAttrib<LandAuctionRegistryAttrib>();
|
|
NullReferenceCheckHelper.throwIfNull(land_auction_registry_attrib, () => $"land_auction_registry_attrib is null !!!");
|
|
|
|
land_auction_registry_attrib.LandMetaId = landMetaId;
|
|
land_auction_registry_attrib.AuctionNumber = landAuctionNumber;
|
|
|
|
land_auction_registry_attrib.RegisteredVersionTime = registeredVersionTime;
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<LandAuctionRegistryAttrib>());
|
|
}
|
|
|
|
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}";
|
|
}
|
|
} |