/// <summary> /// top10 奖金排行榜 /// </summary> /// <returns>top10 奖金排行榜</returns> public GambleRankListResponse GetTop10Rank(Guid managerId) { GambleRankListResponse response = new GambleRankListResponse(); try { List <GambleRankEntity> list = GambleRankMgr.GetRank(10); response.Code = (int)MessageCode.Success; if (list != null && list.Count != 0) { response.Data = list; } GambleRankEntity rank = GambleRankMgr.GetById(managerId); if (rank != null) { response.MyRank = rank.RankIndex; response.MyWinPoints = rank.WinTotalMoney; } } catch (Exception ex) { SystemlogMgr.Error("Gamble.GetTop10Rank", ex); response.Code = (int)MessageCode.Exception; } return(response); }
/// <summary> /// 发奖 /// </summary> private void GiveReward(string zoneId) { try { List <GambleRankEntity> list = GambleRankMgr.GetRank(10, zoneId); for (int i = 0, count = list.Count; i < count; i++) { if (list[i].Status == 1) { continue;//已经发过奖了 } //TODO=======邮件发送奖励 int cardLib = 0; int rank = list[i].RankIndex; if (rank == 1) { cardLib = 9; } else if (rank == 2) { cardLib = 8; } else if (rank >= 3 && rank <= 10) { cardLib = 10; } if (cardLib > 0) { var itemCode = CacheFactory.LotteryCache.LotteryByLib(cardLib); if (itemCode > 0) { MailInfoEntity mailInfo = new MailInfoEntity(); mailInfo.MailType = (int)EnumMailType.AdminSend; mailInfo.ManagerId = list[i].ManagerId; mailInfo.IsRead = false; mailInfo.Status = 0; mailInfo.RowTime = DateTime.Now; mailInfo.ExpiredTime = MailCore.Instance.GetExpiredTime(true, DateTime.Now); mailInfo.ContentString = "竞猜排名奖励|恭喜你竞猜盈利排名第" + rank + ",获得奖励,请查收附件."; mailInfo.MailAttachment = new MailAttachmentEntity(); mailInfo.MailAttachment.AddAttachment(1, itemCode, false, 0); mailInfo.Attachment = SerializationHelper.ToByte(mailInfo.MailAttachment); mailInfo.HasAttach = true; MailInfoMgr.Insert(mailInfo, null, zoneId); } } //======已经发奖,改变status标记============== list[i].Status = 1; GambleRankMgr.Update(list[i], null, zoneId); } } catch (Exception ex) { SystemlogMgr.Error("GambleCore.GiveReward", ex); } }
/// <summary> /// 排名前10的是否都发奖了? /// </summary> /// <returns>是否都发奖了</returns> private bool CheckRewardIsFinished(string zoneId) { try { List <GambleRankEntity> list = GambleRankMgr.GetRank(10, zoneId); for (int i = 0, count = list.Count; i < count; i++) { if (list[i].Status == 0) { return(false); } } return(true); } catch (Exception ex) { SystemlogMgr.Error("GambleCore.GiveReward", ex); } return(false); }