초기커밋
This commit is contained in:
81
ServerCommon/Doc/Global/UgcNpcRankDoc.cs
Normal file
81
ServerCommon/Doc/Global/UgcNpcRankDoc.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerBase;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class UgcNpcRankAttrib : AttribBase
|
||||
{
|
||||
/// <summary>
|
||||
/// rank 정보
|
||||
/// key: {ownerGuid}_{ugcnpcMetaGuid}
|
||||
/// value: score
|
||||
/// </summary>
|
||||
/// <remarks> UgcNpcRankHelper.makeRankKey() </remarks>
|
||||
[JsonProperty("data")] public Dictionary<string, long> ranks { get; set; } = new();
|
||||
|
||||
public UgcNpcRankAttrib() : base(nameof(UgcNpcRankAttrib), false)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Primary Key
|
||||
// PK(Partition Key) : ugcnpcrank#{state}
|
||||
// SK(Sort Key) : ""
|
||||
// DocType : UgcNpcRankDoc
|
||||
// Attrib : UgcNpcRankAttrib
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class UgcNpcRankDoc : DynamoDbDocBase
|
||||
{
|
||||
public static string getPrefixOfPK() => "ugcnpcrank#";
|
||||
|
||||
public UgcNpcRankDoc() : base(nameof(UgcNpcRankDoc))
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public UgcNpcRankDoc(UgcNpcRankState state, UgcNpcRankType type, string? rankDate) : base(nameof(UgcNpcRankDoc))
|
||||
{
|
||||
setCombinationKeyForPK(state.ToString());
|
||||
|
||||
var sk = null == rankDate ? type.ToString() : $"{type}#{rankDate}";
|
||||
setCombinationKeyForSK(sk);
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public UgcNpcRankDoc(UgcNpcRankState state, UgcNpcRankType type, string? rankDate, Int64 ttlSeconds) : base(nameof(UgcNpcRankDoc), ttlSeconds)
|
||||
{
|
||||
setCombinationKeyForPK(state.ToString());
|
||||
|
||||
var sk = null == rankDate ? type.ToString() : $"{type}#{rankDate}";
|
||||
setCombinationKeyForSK(sk);
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<UgcNpcRankAttrib>());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user