38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Fantasy;
|
|
using Fantasy.Async;
|
|
using NB.Game;
|
|
|
|
namespace NB.Chat;
|
|
|
|
public static class MailConversationHelper
|
|
{
|
|
/// <summary>
|
|
/// 从数据库中读取GameAccount
|
|
/// </summary>
|
|
/// <param name="scene"></param>
|
|
/// <param name="firstId"></param>
|
|
/// <param name="secondId"></param>
|
|
/// <returns></returns>
|
|
public static async FTask<MailConversation> LoadDataBase(Scene scene, long firstId, long secondId)
|
|
{
|
|
var conversation =
|
|
await scene.World.DataBase.First<MailConversation>(d => d.FirstId == firstId && d.SecondId == secondId);
|
|
if (conversation == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
conversation.Deserialize(scene);
|
|
return conversation;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 从数据库中移除
|
|
/// </summary>
|
|
/// <param name="scene"></param>
|
|
/// <param name="id"></param>
|
|
public static async FTask DeleteDataBase(Scene scene,long id)
|
|
{
|
|
await scene.World.DataBase.Remove<MailConversation>(id);
|
|
}
|
|
} |