You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
3.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
namespace GameDB
{
public static class FriendDBOp
{
public static void OnQueryFriendListReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSQueryFriendListReq req = ref packet.GetMessage<SSQueryFriendListReq>();
SSQueryFriendListRes res = new SSQueryFriendListRes();
ref DBFriendSelf self = ref res.Self;
ref DBFriendList list = ref res.List;
ref DBFriendOpData opData = ref res.OpData;
bool bSuccess = dbOperator.QueryFriendList(req.Uid, ref self, ref list, ref opData);
if (bSuccess == false)
{
TraceLog.Error("FriendOp.OnQueryFriendListReq failed uid {0}", req.Uid);
return;
}
res.Uid = req.Uid;
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID,
(int)SSGameMsgID.QueryFriendListRes, ref res, packet.ObjectID);
}
public static void OnQueryFriendInfoCacheReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSQueryFriendInfoCacheReq req = ref packet.GetMessage<SSQueryFriendInfoCacheReq>();
SSQueryFriendInfoCacheRes res = new SSQueryFriendInfoCacheRes();
ref DBFriendSelf self = ref res.Self;
ref DBFriendList list = ref res.List;
ref DBFriendOpData opData = ref res.OpData;
bool bSuccess = dbOperator.QueryFriendList(req.Uid, ref self, ref list, ref opData);
if (bSuccess == false)
{
TraceLog.Error("FriendOp.OnQueryFriendInfoCacheReq failed uid {0}", req.Uid);
return;
}
res.Uid = req.Uid;
res.FromUid = req.FromUid;
res.Reason = req.Reason;
res.OpCallback = req.OpCallback;
res.ChatRes = req.ChatRes;
res.ChatSeq = req.ChatSeq;
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID,
(int)SSGameMsgID.QueryFriendInfoCacheRes, ref res, packet.ObjectID);
}
public static void OnSaveFriendListReq(uint remoteAppID, StructPacket packet, GameDBOperator dbOperator)
{
ref SSSaveFriendListReq req = ref packet.GetMessage<SSSaveFriendListReq>();
bool bSuccess = dbOperator.UpdateFriendList(req.Uid, ref req.Self, ref req.List, ref req.OpData, req.NewInsert);
if (bSuccess == false)
{
TraceLog.Error("FriendOp.OnSaveFriendListReq failed uid {0}", req.Uid);
return;
}
SSSaveFriendListRes res = new SSSaveFriendListRes();
res.Uid = req.Uid;
res.NewInsert = req.NewInsert;
res.DataSeq = req.DataSeq;
GameDBServerUtils.GetPacketSender().SendToServerByID(remoteAppID,
(int)SSGameMsgID.SaveFriendListRes, ref res, packet.ObjectID);
}
}
}