/// <summary> /// 恢复代理 /// </summary> public void RecoveryAgent(string userId) { //开启事务 using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); var manager = new UserBalanceManager(); var register = manager.LoadUserRegister(userId); if (register == null) { throw new Exception("用户不存在"); } var agent = new OCAgentManager().QueryOCAgent(userId); if (agent == null) { throw new Exception("代理关系不存在"); } register.IsAgent = true; manager.UpdateUserRegister(register); biz.CommitTran(); } }
public void LogOffUserAgent(string userId) { //开启事务 using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); var manager = new UserBalanceManager(); var reg = manager.GetUserRegister(userId); if (reg == null) { throw new Exception("不存在此用户:" + userId); } reg.IsAgent = false; manager.UpdateUserRegister(reg); var userManager = new UserManager(); var user = userManager.LoadUser(userId); if (user == null) { throw new Exception("不存在此用户:" + userId); } var role = user.RoleList.FirstOrDefault(p => p.RoleId == "Agent"); if (role != null) { user.RoleList.Remove(role); } biz.CommitTran(); } }
public void UpdateUserVipLevel(string userId, int vipLevel) { using (var manager = new UserBalanceManager()) { var user = manager.GetUserRegister(userId); user.VipLevel = vipLevel; manager.UpdateUserRegister(user); } }
public void ChangeUserHideDisplayNameCount(string userId, int hideDisplayNameCount) { using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); using (var manager = new UserBalanceManager()) { var user = manager.GetUserRegister(userId); user.HideDisplayNameCount = hideDisplayNameCount; manager.UpdateUserRegister(user); } biz.CommitTran(); } }
public void UpdateDisplayName(string userId, string newDisplayName) { using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); using (var manager = new UserBalanceManager()) { var user = manager.GetUserRegister(userId); user.DisplayName = newDisplayName; manager.UpdateUserRegister(user); } biz.CommitTran(); } }
/// <summary> /// 禁用用户 /// </summary> public void DisableUser(string userId) { //开启事务 using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); var manager = new UserBalanceManager(); var register = manager.LoadUserRegister(userId); if (register == null) { throw new Exception("用户不存在"); } register.IsEnable = false; manager.UpdateUserRegister(register); biz.CommitTran(); } }
public void UpdateUserAgentId(string userId, string agentId) { //开启事务 using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); var manager = new UserBalanceManager(); var reg = manager.GetUserRegister(userId); if (reg == null) { throw new Exception("不存在此用户:" + userId); } reg.AgentId = agentId; manager.UpdateUserRegister(reg); biz.CommitTran(); } }
public void BatchSetInnerUser(string userIds) { if (string.IsNullOrEmpty(userIds)) { throw new Exception("用户编号不能为空"); } var arrUserIds = userIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); using (var biz = new GameBizAuthBusinessManagement()) { var manager = new UserBalanceManager(); biz.BeginTran(); foreach (var item in arrUserIds) { var entity = manager.LoadUserRegister(item); entity.UserType = 1; manager.UpdateUserRegister(entity); } biz.CommitTran(); } }
public void ChangeUserStatus(string userId, EnableStatus status) { if (status == EnableStatus.Unknown) { throw new ArgumentException("要修改的用户状态不正确,不能为未知状态"); } using (var biz = new GameBizBusinessManagement()) { biz.BeginTran(); using (var userManager = new UserBalanceManager()) { var user = userManager.GetUserRegister(userId); if (user == null) { throw new ArgumentException("指定的用户不存在。"); } user.IsEnable = (status == EnableStatus.Enable); userManager.UpdateUserRegister(user); } biz.CommitTran(); } }
public void AddAuthenticationRealName(string authFrom, string userId, string realName, string cardType, string idCardNumber, string createBy, bool checkRepet) { using (var manager = new UserRealNameManager()) { if (checkRepet) { var other = manager.QueryUserRealName(idCardNumber); if (other != null) { throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber)); } //var other2 = manager.QueryUserRealNameByName(realName); //if (other2 != null) // throw new ArgumentException("对不起,由于系统检测到您的姓名已被绑定,请联系在线客服为您人工绑定,给您带来的不便敬请谅解,此绑定不影响您的正常购彩和提现。"); } var entity = manager.GetUserRealName(userId); if (entity != null) { entity.RealName = realName; entity.IdCardNumber = idCardNumber; entity.IsSettedRealName = true; manager.UpdateUserRealName(entity); //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); } else { if (entity == null) { entity = new UserRealName { UserId = userId, User = manager.LoadUser(userId), AuthFrom = authFrom, RealName = realName, CardType = cardType, IdCardNumber = idCardNumber, IsSettedRealName = true, CreateBy = createBy, UpdateBy = createBy, }; manager.AddUserRealName(entity); } else { throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); } } //修改vip等级 var balanceManager = new UserBalanceManager(); var user = balanceManager.QueryUserRegister(userId); user.VipLevel = 1; balanceManager.UpdateUserRegister(user); var gv = new TaskListManager(); var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName); if (old == null) { var orderId = Guid.NewGuid().ToString("N"); //增加成长值 BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值"); gv.AddUserTaskRecord(new UserTaskRecord { OrderId = orderId, CurrentTime = DateTime.Now.ToString("yyyyMMdd"), CreateTime = DateTime.Now, TaskName = "实名认证", TaskCategory = TaskCategory.RealName, UserId = userId, }); //赠送成长值记录 gv.AddTaskList(new TaskList { UserId = userId, OrderId = Guid.NewGuid().ToString("N"), Content = "完成实名认证获得200点成长值", ValueGrowth = 200, CurrentTime = DateTime.Now.ToString("yyyyMMdd"), TaskCategory = TaskCategory.RealName, VipLevel = 0, IsGive = true, TaskName = "实名认证", CreateTime = DateTime.Now, }); } } }
//首页活动 绑定实名 public void AddAuthenticationRealName_Index(string authFrom, string userId, string realName, string cardType, string idCardNumber, string createBy) { #region //using (var manager = new UserRealNameManager()) //{ // var other = manager.GetOtherUserCard(cardType, idCardNumber, userId); // if (other != null && other.IsSettedRealName)//判断证件号的唯一性 // { // throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber)); // } // var entity = manager.GetUserRealName(userId); // if (entity != null && !entity.IsSettedRealName && !string.IsNullOrEmpty(entity.IdCardNumber))//判断真实姓名的唯一性 // { // entity.RealName = realName; // entity.IdCardNumber = idCardNumber; // entity.IsSettedRealName = true; // manager.UpdateUserRealName(entity); // //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); // } // else // { // if (entity == null) // { // entity = new UserRealName // { // UserId = userId, // User = manager.LoadUser(userId), // AuthFrom = authFrom, // RealName = realName, // CardType = cardType, // IdCardNumber = idCardNumber, // IsSettedRealName = true, // CreateBy = createBy, // UpdateBy = createBy, // }; // manager.AddUserRealName(entity); // } // else // throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); // } // //修改vip等级 // var balanceManager = new UserBalanceManager(); // var user = balanceManager.QueryUserRegister(userId); // user.VipLevel = 1; // balanceManager.UpdateUserRegister(user); // var gv = new TaskListManager(); // var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName); // if (old == null) // { // var orderId = Guid.NewGuid().ToString("N"); // //增加成长值 // BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值"); // gv.AddUserTaskRecord(new UserTaskRecord // { // OrderId = orderId, // CurrentTime = DateTime.Now.ToString("yyyyMMdd"), // CreateTime = DateTime.Now, // TaskName = "实名认证", // TaskCategory = TaskCategory.RealName, // UserId = userId, // }); // //赠送成长值记录 // gv.AddTaskList(new TaskList // { // UserId = userId, // OrderId = Guid.NewGuid().ToString("N"), // Content = "完成实名认证获得200点成长值", // ValueGrowth = 200, // CurrentTime = DateTime.Now.ToString("yyyyMMdd"), // TaskCategory = TaskCategory.RealName, // VipLevel = 0, // IsGive = true, // TaskName = "实名认证", // CreateTime = DateTime.Now, // }); // } //} #endregion //注意:一个身份证号码可以被绑定多次 using (var manager = new UserRealNameManager()) { //var entity = manager.GetRealNameInfoByName(realName, idCardNumber); //if (entity != null && entity.IsSettedRealName)//判断证件号的唯一性 //{ // throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber)); //} var entity = manager.GetUserRealName(userId); //if (entity != null && !entity.IsSettedRealName && !string.IsNullOrEmpty(entity.IdCardNumber))//判断真实姓名的唯一性 if (entity != null) { entity.RealName = realName; entity.IdCardNumber = idCardNumber; entity.IsSettedRealName = true; manager.UpdateUserRealName(entity); //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); } else { if (entity == null) { entity = new UserRealName { UserId = userId, User = manager.LoadUser(userId), AuthFrom = authFrom, RealName = realName, CardType = cardType, IdCardNumber = idCardNumber, IsSettedRealName = true, CreateBy = createBy, UpdateBy = createBy, }; manager.AddUserRealName(entity); } else { throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime)); } } //修改vip等级 var balanceManager = new UserBalanceManager(); var user = balanceManager.QueryUserRegister(userId); user.VipLevel = 1; balanceManager.UpdateUserRegister(user); var gv = new TaskListManager(); var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName); if (old == null) { var orderId = Guid.NewGuid().ToString("N"); //增加成长值 BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值"); gv.AddUserTaskRecord(new UserTaskRecord { OrderId = orderId, CurrentTime = DateTime.Now.ToString("yyyyMMdd"), CreateTime = DateTime.Now, TaskName = "实名认证", TaskCategory = TaskCategory.RealName, UserId = userId, }); //赠送成长值记录 gv.AddTaskList(new TaskList { UserId = userId, OrderId = Guid.NewGuid().ToString("N"), Content = "完成实名认证获得200点成长值", ValueGrowth = 200, CurrentTime = DateTime.Now.ToString("yyyyMMdd"), TaskCategory = TaskCategory.RealName, VipLevel = 0, IsGive = true, TaskName = "实名认证", CreateTime = DateTime.Now, }); } } }