コード例 #1
0
ファイル: PayCore.cs プロジェクト: cool8868/H5Nball
        public static void ChargeAfter(string account, int point, int needPoint, DateTime curTime, decimal cash,
                                       int vipExp)
        {
            try
            {
                PayContinuingMgr.UpdateContinueday(account, point, needPoint, curTime.Date.AddDays(-1), curTime.Date,
                                                   curTime);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpContinue", ex);
            }
            var  payUser  = PayUserMgr.GetById(account);
            bool isInsert = false;

            if (payUser == null)
            {
                isInsert = true;
                payUser  = new PayUserEntity(account, 0, 0, cash, DateTime.Now, new byte[0], point, 0);
            }
            else
            {
                payUser.TotalCash  += cash;
                payUser.ChargePoint = point;
            }
            try
            {
                if (isInsert)
                {
                    if (!PayUserMgr.Insert(payUser))
                    {
                        SystemlogMgr.Error("charetUpPayUser", "统计钱失败", "Account:" + account + "_Cash" + cash);
                    }
                }
                else
                {
                    if (!PayUserMgr.Update(payUser))
                    {
                        SystemlogMgr.Error("charetUpPayUser", "统计钱失败", "Account:" + account + "_Cash" + cash);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("charetUpPayUser" + cash, ex);
            }
            var manager = ManagerCore.Instance.GetManager(account);

            try
            {
                if (manager != null)
                {
                    var curScore   = vipExp;
                    var vipManager = VipManagerMgr.GetById(manager.Idx);
                    if (vipManager != null)
                    {
                        curScore         += vipManager.VipExp;
                        vipManager.VipExp = curScore;
                        VipManagerMgr.Update(vipManager);
                    }
                    else
                    {
                        vipManager = new VipManagerEntity(manager.Idx, curScore, DateTime.Now, DateTime.Now,
                                                          DateTime.Now);
                        VipManagerMgr.Insert(vipManager);
                    }

                    var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore);
                    if (newlevel > manager.VipLevel)
                    {
                        manager.VipLevel = newlevel;
                        ManagerUtil.SaveManagerData(manager);
                        ManagerCore.Instance.DeleteCache(manager.Idx);
                    }
                    // ChatHelper.SendUpdateManagerInfoPop(manager.Idx, payUser.TotalPoint, true, manager.VipLevel);

                    ActivityExThread.Instance.Charge(manager.Idx, account, vipExp);
                    ActivityExThread.Instance.Charge(manager.Idx, vipExp);
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpVip", ex);
            }
        }
コード例 #2
0
ファイル: PayCore.cs プロジェクト: cool8868/H5Nball
        void GmVip(string account, int point, int needPoint, DateTime curTime)
        {
            try
            {
                PayContinuingMgr.UpdateContinueday(account, point, needPoint, curTime.Date.AddDays(-1), curTime.Date, curTime);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpContinue", ex);
            }
            var manager = ManagerCore.Instance.GetManager(account);

            try
            {
                if (manager != null)
                {
                    int totalPoint = 0;
                    PayUserMgr.GetGmChargePoint(account, ref totalPoint);
                    var payUser    = PayUserMgr.GetById(account);
                    var curScore   = totalPoint;
                    var vipManager = VipManagerMgr.GetById(manager.Idx);
                    if (vipManager != null && vipManager.VipExp > 0)
                    {
                        curScore += vipManager.VipExp;
                    }

                    var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore);
                    if (newlevel > manager.VipLevel)
                    {
                        manager.VipLevel = newlevel;
                        ManagerUtil.SaveManagerData(manager);
                        ManagerCore.Instance.DeleteCache(manager.Idx);
                    }
                    //ChatHelper.SendUpdateManagerInfoPop(manager.Idx, payUser.TotalPoint, true, manager.VipLevel);
                    if (point > 0)
                    {
                        ActivityExThread.Instance.Charge(manager.Idx, account, point);
                        ActivityExThread.Instance.Charge(manager.Idx, point);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpVip", ex);
            }
            try
            {
                if (manager != null)
                {
                    int returnPoint = point;

                    //BuffPlusHelper.ChargeReturn50(ref returnPoint);
                    if (returnPoint > 0)
                    {
                        //var mail = new MailBuilder(manager.Idx, EnumMailType.ChargeReturn50, returnPoint);
                        //mail.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeReturnDouble", ex);
            }
        }