private string SaveBuyPointShipmentsTx(NbManagerEntity manager, int point, int bonus, PayChargehistoryEntity payEntity, ManagerMonthcardEntity monthcardEntity, MailBuilder mail, ManagerChargenumberEntity buyRecord, DicMallitemEntity mallConfig, string zoneId) { if (point > 0 || bonus > 0) { var messCode1 = PayCore.Instance.AddPoint(payEntity.Account, point, bonus, EnumChargeSourceType.GmCharge, payEntity.BillingId, null, zoneId); if (messCode1 != MessageCode.Success) { return("增加钻石失败" + point + "," + bonus + "," + (int)messCode1); } PayChargehistoryMgr.Insert(payEntity, null, zoneId); } if (monthcardEntity != null) { if (monthcardEntity.BuyNumber == 1) { if (!ManagerMonthcardMgr.Insert(monthcardEntity, null, zoneId)) { return("月卡发送失败"); } } else { if (!ManagerMonthcardMgr.Update(monthcardEntity, null, zoneId)) { return("月卡发送失败"); } } } if (!mail.Save(zoneId)) { return("邮件发送失败"); } if (buyRecord.Idx == 0) { ManagerChargenumberMgr.Insert(buyRecord, null, zoneId); } else { ManagerChargenumberMgr.Update(buyRecord, null, zoneId); } try { if (manager != null) { var curScore = mallConfig.EffectValue * 10; var vipManager = VipManagerMgr.GetById(manager.Idx, zoneId); if (vipManager != null) { curScore += vipManager.VipExp; vipManager.VipExp = curScore; VipManagerMgr.Update(vipManager, null, zoneId); } else { vipManager = new VipManagerEntity(manager.Idx, curScore, DateTime.Now, DateTime.Now, DateTime.Now); VipManagerMgr.Insert(vipManager, null, zoneId); } var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore); if (newlevel > manager.VipLevel) { manager.VipLevel = newlevel; ManagerUtil.SaveManagerData(manager, null, null, zoneId); } } } catch (Exception ex) { SystemlogMgr.Error("ChargeUpVip", ex); return(ex.Message); } return(""); }
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); } }