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.
 
 
 
 
 
 

54 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
namespace Operation
{
class MailOp
{
public static void OnGetMailWithRuleReq(uint remoteAppID, StructPacket packet, DBOperator dbOperator)
{
ref var req = ref packet.GetMessage<SSGetMailWithRuleReq>();
TraceLog.Debug("MailOp.OnGetMailWithRuleReq - BeginSeq:{0}, IsDiscard:{1}", req.BeginSeq, req.IsDiscard);
SSGetMailWithRuleRes res = new SSGetMailWithRuleRes();
res.IsDiscard = req.IsDiscard;
if (!dbOperator.DBSelectMailWithRule(req.BeginSeq, req.IsDiscard, ref res))
{
TraceLog.Debug("MailOp.OnGetMailWithRuleReq no - BeginSeq:{0}, IsDiscard:{1}", req.BeginSeq, req.IsDiscard);
return;
}
OperationServerUtils.GetPacketSender().SendToServerByID(remoteAppID,
(int)SSGameMsgID.GetMailWithRuleRes, ref res, packet.ObjectID, 0);
}
public static void OnSendMailWithRuleRes(uint remoteAppID, StructPacket packet, DBOperator dbOperator)
{
ref var res = ref packet.GetMessage<SSSendMailWithRuleRes>();
int id = res.Seq;
TraceLog.Trace("MailOp.OnSendMailWithRuleRes send mail id {0} ", id);
if (res.Ret == 0)
{
if (id <= 0)
{
return;
}
if(!dbOperator.DBUpdateMailStatus((int)MailStatus.Success, id, res.Mail.Uuid.GetString()))
{
TraceLog.Error("MailOp.OnSendMailWithRuleRes send mail id {0} failed", id);
return;
}
}
}
}
}