초기커밋
This commit is contained in:
77
ServerCommon/Doc/OwnerContents/PackageRepeatDoc.cs
Normal file
77
ServerCommon/Doc/OwnerContents/PackageRepeatDoc.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using META_ID = System.UInt32;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class PackageRepeatAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty]
|
||||
public string OrderGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty]
|
||||
public META_ID ProductMetaId { get; set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
public int LeftCount { get; set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
public DateTime NextGiveTime { get; set; } = new();
|
||||
|
||||
public PackageRepeatAttrib()
|
||||
: base(typeof(PackageRepeatAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "package_repeat#user_guid"
|
||||
// SK(Sort Key) : "order_guid"
|
||||
// DocType : PackageRepeatDoc
|
||||
// Attrib : PackageRepeatAttrib
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class PackageRepeatDoc : DynamoDbDocBase
|
||||
{
|
||||
private static string getPrefixOfPK() { return "package_repeat#"; }
|
||||
|
||||
public PackageRepeatDoc()
|
||||
: base(typeof(PackageRepeatDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public PackageRepeatDoc(string ownerGuid, string orderGuid)
|
||||
: base(typeof(PackageRepeatDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPKSK(ownerGuid, orderGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.PackageRepeatDocException));
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<PackageRepeatAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user