초기커밋
This commit is contained in:
243
ServerCommon/Doc/OwnerContents/MailDoc.cs
Normal file
243
ServerCommon/Doc/OwnerContents/MailDoc.cs
Normal file
@@ -0,0 +1,243 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
using MAIL_GUID = System.String;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class MailItem
|
||||
{
|
||||
[JsonProperty]
|
||||
public META_ID ItemId { get; set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
public double Count { get; set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
public META_ID ProductId { get; set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
public bool isRepeatProduct { get; set; } = false;
|
||||
}
|
||||
|
||||
public class MailAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("mail_guid")]
|
||||
public MAIL_GUID MailGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("is_read")]
|
||||
public bool IsRead { get; set; } = false;
|
||||
|
||||
[JsonProperty("is_get_item")]
|
||||
public bool IsGetItem { get; set; } = false;
|
||||
|
||||
[JsonProperty("is_system_mail")]
|
||||
public bool IsSystemMail { get; set; } = false;
|
||||
|
||||
[JsonProperty("sender_nickname")]
|
||||
public string SenderNickName { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("sender_guid")]
|
||||
public string SenderGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("receiver_nickname")]
|
||||
public string ReceiverNickName { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("receiver_guid")]
|
||||
public string ReceiverGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("text")]
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("create_time")]
|
||||
public DateTime CreateTime { get; set; } = DateTimeHelper.MinTime;
|
||||
|
||||
[JsonProperty("expire_time")]
|
||||
public DateTime ExpireTime { get; set; } = DateTimeHelper.MinTime;
|
||||
|
||||
[JsonProperty("is_text_by_meta_data")]
|
||||
public bool IsTextByMetaData { get; set; } = false;
|
||||
|
||||
[JsonProperty("item_list")]
|
||||
public List<MailItem> ItemList { get; set; } = new();
|
||||
|
||||
[JsonProperty("package_order_id")]
|
||||
public string packageOrderId { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("contents_arguments")]
|
||||
public List<string> ContentsArguments { get; set; } = new();
|
||||
|
||||
public MailAttrib()
|
||||
: base(typeof(MailAttrib).Name, false)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : ""
|
||||
// SK(Sort Key) : ""
|
||||
// DocType : MailDoc
|
||||
// MailAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
|
||||
public abstract class MailDoc : DynamoDbDocBase
|
||||
{
|
||||
public MailDoc()
|
||||
: base(typeof(MailDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public MailDoc(OWNER_GUID ownerGuid)
|
||||
: base(typeof(MailDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(ownerGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.MailDocException));
|
||||
}
|
||||
|
||||
public MailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid)
|
||||
: base(typeof(MailDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPKSK(ownerGuid, mailGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.MailDocException));
|
||||
}
|
||||
|
||||
public MailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid, Int64 ttlSeconds)
|
||||
: base(typeof(MailDoc).Name, ttlSeconds)
|
||||
{
|
||||
setCombinationKeyForPKSK(ownerGuid, mailGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.MailDocException));
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<MailAttrib>());
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "recv_mail#user_guid"
|
||||
// SK(Sort Key) : "mail_guid"
|
||||
// DocType : ReceivedMailDoc
|
||||
// Attrib : MailAttrib
|
||||
// ...
|
||||
//=============================================================================================
|
||||
|
||||
public class ReceivedMailDoc : MailDoc
|
||||
{
|
||||
public ReceivedMailDoc()
|
||||
: base()
|
||||
{
|
||||
|
||||
}
|
||||
public ReceivedMailDoc(OWNER_GUID ownerGuid)
|
||||
: base(ownerGuid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ReceivedMailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid)
|
||||
: base(ownerGuid, mailGuid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ReceivedMailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid, Int64 ttlSeconds)
|
||||
: base(ownerGuid, mailGuid, ttlSeconds)
|
||||
{
|
||||
|
||||
}
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return "recv_mail#";
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "sent_mail#user_guid"
|
||||
// SK(Sort Key) : "mail_guid"
|
||||
// DocType : SentMailDoc
|
||||
// Attrib : MailAttrib
|
||||
// ...
|
||||
//=============================================================================================
|
||||
|
||||
public class SentMailDoc : MailDoc
|
||||
{
|
||||
public SentMailDoc()
|
||||
: base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SentMailDoc(OWNER_GUID ownerGuid)
|
||||
: base(ownerGuid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SentMailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid)
|
||||
: base(ownerGuid, mailGuid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SentMailDoc(OWNER_GUID ownerGuid, MAIL_GUID mailGuid, Int64 ttlSeconds)
|
||||
: base(ownerGuid, mailGuid, ttlSeconds)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return "sent_mail#";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user