Exemplo n.º 1
0
 public MailAttachmentReceiveResponse AttachmentReceive(Guid managerId, int recordId)
 {
     if (recordId == -1)
     {
         var mailList = MailInfoMgr.GetForAttachmentBatch(managerId);
         return(AttachmentReceive(mailList));
     }
     else
     {
         var mail = MailInfoMgr.GetById(recordId);
         if (mail == null || mail.ManagerId != managerId)
         {
             return(ResponseHelper.InvalidParameter <MailAttachmentReceiveResponse>());
         }
         if (!ShareUtil.CheckBytes(mail.Attachment))
         {
             return(ResponseHelper.Create <MailAttachmentReceiveResponse>(MessageCode.MailNoAttachment));
         }
         if (mail.HasAttach == false)
         {
             return(ResponseHelper.Create <MailAttachmentReceiveResponse>(MessageCode.MailAttachmentReceiveRepeat));
         }
         var mailList = new List <MailInfoEntity>(1);
         mailList.Add(mail);
         return(AttachmentReceive(mailList));
     }
 }
Exemplo n.º 2
0
        public PlayerkillInfoResponse GetInfo(Guid managerId)
        {
            var info    = InnerGetInfo(managerId);
            var manager = ManagerCore.Instance.GetManager(managerId, true);

            if (manager == null)
            {
                return(ResponseHelper.Create <PlayerkillInfoResponse>((int)MessageCode.MissManager));
            }
            if (info.LotteryMatchId != Guid.Empty)
            {
                info.HasLottery = true;
            }

            if (DateTime.Now > info.OpponentRefreshTime)
            {
                RefreshOpponent(info, manager.Kpi);
            }
            else if (ShareUtil.CheckBytes(info.OpponentInfo))
            {
                info.Opponents = SerializationHelper.FromByte <List <PlayerKillOpponentEntity> >(info.OpponentInfo);
                if (info.Opponents == null)
                {
                    RefreshOpponent(info, manager.Kpi);
                }
                else if (!info.Opponents.Exists(d => d.HasWin == false))
                {
                    RefreshOpponent(info, manager.Kpi);
                }
            }
            else
            {
                RefreshOpponent(info, manager.Kpi);
            }
            var response = ResponseHelper.CreateSuccess <PlayerkillInfoResponse>();

            info.RemainTimes = 6;//CacheFactory.PlayerKillCache.GetChallengeTimes(manager.Level) - info.RemainTimes + info.BuyTimes;
            var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId);

            if (managerExtra != null)
            {
                info.ResumeStaminaTimeTick = ShareUtil.GetTimeTick(managerExtra.ResumeStaminaTime.AddSeconds(ManagerCore.Instance.GetResumeStaminaTimeConfig(manager.VipLevel)));
            }

            info.OpponentRefreshTimeTick = ShareUtil.GetTimeTick(info.OpponentRefreshTime);
            info.TotalPoint = CacheFactory.PlayerKillCache.GetTotalPoint(manager.VipLevel);
            response.Data   = info;
            return(response);
        }