完成离线消息发送和上线获取离线消息

This commit is contained in:
2025-08-13 23:44:59 +08:00
parent f8b876ca2f
commit 022cc1ac3e
39 changed files with 499 additions and 85 deletions

View File

@@ -9,7 +9,7 @@ namespace NB.Gate;
public static class GateUnitManageComponentSystem
{
public static GateUnit Add(this GateUnitManageComponent self, Session session, long accountId)
public static GateUnit Online(this GateUnitManageComponent self, Session session, long accountId)
{
if (self.Units.TryGetValue(accountId, out var unit))
{
@@ -34,11 +34,12 @@ public static class GateUnitManageComponentSystem
return self.Units.TryGetValue(accountId, out unit);
}
public static async FTask Remove(this GateUnitManageComponent self, long accountId, bool isDispose = true)
public static async FTask Offline(this GateUnitManageComponent self, long accountId, long sessionId,
bool isDispose = true)
{
if (!self.Units.TryGetValue(accountId, out var unit)) return;
//通知其他服务器下线
var result = await GateLoginHelper.Offline(unit);
var result = await GateLoginHelper.Offline(unit, sessionId);
if (result != 0)
{
Log.Error($"通知其他服务器下线失败,错误码:{result}");
@@ -52,9 +53,10 @@ public static class GateUnitManageComponentSystem
unit.Dispose();
}
}
/// <summary>
/// 话迭代器
/// 话迭代器
/// </summary>
/// <param name="self"></param>
/// <returns></returns>