| | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _account = ""; |
| | | private string initPwd = ConfigurationManager.AppSettings["initPwd"]; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) |
| | | { |
| | | string action = context.GetString("action"); |
| | | |
| | | |
| | | _userId = context.SessionObject.UserID; |
| | | _userType = context.SessionObject.UserType; |
| | | _account = context.SessionObject.Account; |
| | |
| | | //批量分配客户的个性产品 |
| | | case "batchUpdateClientProduct": |
| | | return BatchUpdateClientProduct(context); |
| | | //重置密码 |
| | | case "resetPwd": |
| | | return ResetPwd(context); |
| | | //修改密码 |
| | | case "updatePwd": |
| | | return UpdatePwd(context); |
| | | //获取客户分配个性产品 |
| | | case "getPersonalityProduct": |
| | | return GetPersonalityProduct(context); |
| | | //修改分配个性产品 |
| | | case "updateProduct": |
| | | return UpdateProduct(context); |
| | | //启用或停用 |
| | | case "updateStatus": |
| | | return UpdateStatus(context); |
| | | //获取Token:未实现生成Token |
| | | case "getToken": |
| | | return GetToken(context); |
| | | |
| | | default: |
| | | throw new Exception("Invalid Action=" + action); |
| | |
| | | string ClientName = context.GetString("ClientName"); |
| | | string Telephone = context.GetString("Telephone"); |
| | | string Salesman = context.GetString("Salesman"); |
| | | string SupportStaff = context.GetString("SupportStaff"); |
| | | string ProductId = context.GetString("ProductId"); |
| | | int IsEnable = context.GetInt("IsEnable", -1); |
| | | int pageIndex = context.GetInt("pageIndex", 1); |
| | | |
| | | string Agent = context.GetString("Agent"); |
| | |
| | | string str = ""; |
| | | using (GwClientDao dao = new GwClientDao()) |
| | | { |
| | | string permissionsSQL = dao.GetClientPermissions(_userId, _userType, null); |
| | | var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, ProductId, permissionsSQL); |
| | | string permissionsSQL = dao.GetClientPermissions(_userId, _userType, "gwc"); |
| | | var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, SupportStaff, ProductId, IsEnable, permissionsSQL); |
| | | |
| | | if (list != null && list.Count > 0) |
| | | { |
| | |
| | | //edit:yangzh by 20220511 |
| | | //str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Top_up_Amount_Total + "元</td><td>" + item.Agent + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | //str += @"<tr ><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + item.Agent + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | |
| | | //str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "元</td><td>" + item.Top_up_Amount_Total/1000 + "元</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td><td>" + Certification_StatusResult + "</td>"; |
| | | str += @"<tr ><td rowspan='1' ><input type='checkbox' name='checkbox' value='" + item.ClientID + "'/></td><td>" + item.ClientID + "</td><td>" + item.Company + "</td><td>" + item.ClientName + "</td><td>" + item.Telephone + "</td><td>" + item.Balance/1000 + "</td><td>" + item.Top_up_Amount_Total/1000 + "</td><td>" + SysUserName(string.IsNullOrEmpty(item.Salesman)? 0: int.Parse(item.Salesman) ) + "</td>" |
| | | + "<td>" + item.ProductIds + "</td>" |
| | | + "<td>"+ (item.Is_Enable == 1 ? "<span class='label label-primary'>启用</span>" : "<span class='label label-default'>停用</span>") + "</td>"; |
| | | |
| | | str += @"<td>"; |
| | | string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password; |
| | | str += string.Format("<a class=\"action-modal-login btn btn-success btn-xs \" href=\"{0}\" data-id=\"{1}\" target=\"_blank\">", (object)loginStr, (object)item.ClientID); |
| | | str += " 登录</a> "; |
| | | |
| | | if (item.Is_Enable == 1) |
| | | { |
| | | //string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account + "&password=" + item.Password; |
| | | string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account ; |
| | | str += string.Format("<a class=\"action-modal-login btn btn-success btn-xs \" href=\"javascript:;\" data-url=\"{0}\" data-id=\"{1}\" target=\"_blank\">", (object)loginStr, (object)item.ClientID); |
| | | str += " 登录</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-edit btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"编辑"; |
| | | str += string.Format(@"<a class=""action-modal-edit btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"编辑"; |
| | | str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-white btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"白名单"; |
| | | str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"黑名单"; |
| | | str += @"</a> "; |
| | | |
| | | //str += string.Format(@"<a class=""action-modal-resetPwd btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | //str += @"重置密码"; |
| | | //str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-updatePwd btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"修改密码"; |
| | | str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-updateProduct btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"修改产品"; |
| | | str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-orderCreate btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"充值"; |
| | | str += @"</a> "; |
| | | } |
| | | |
| | | str += string.Format(@"<a class=""action-modal-orderLog btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"充值日志"; |
| | | str += @"</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-white btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"白名单"; |
| | | str += @"</a> "; |
| | | if(item.Is_Enable == 1) |
| | | { |
| | | str += string.Format(@"<a class=""action-modal-updateStatus btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"" data-status=0 >", item.ClientID); |
| | | str += @"<i class='fa fa-toggle-on'></i>停用</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"黑名单"; |
| | | str += @"</a> "; |
| | | } |
| | | else |
| | | { |
| | | str += string.Format(@"<a class=""action-modal-updateStatus btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"" data-status=1 >", item.ClientID); |
| | | str += @"<i class='fa fa-toggle-off'></i>启用</a> "; |
| | | |
| | | str += string.Format(@"<a class=""action-delete btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"删除"; |
| | | str += @"</a>"; |
| | | } |
| | | |
| | | if (item.Is_Enable == 0) |
| | | { |
| | | str += string.Format(@"<a class=""action-delete btn btn-xs btn-default"" href=""javascript:;"" data-id=""{0}"">", item.ClientID); |
| | | str += @"删除"; |
| | | str += @"</a>"; |
| | | } |
| | | |
| | | str += @"</td>"; |
| | | str += @"</tr>"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | str += @"<tr><td colspan=""10"">暂无信息</td></tr>"; |
| | | str += @"<tr><td colspan=""11"">暂无信息</td></tr>"; |
| | | } |
| | | |
| | | } |
| | |
| | | return new JsonPageResult(true, _Dao.GetBlackList(clientID)); |
| | | } |
| | | |
| | | //根据客户账号生成Token |
| | | private JsonPageResult GetToken(PageContext<Model.SysUser> context) |
| | | { |
| | | string clientID = context.GetString("clientID"); |
| | | if (string.IsNullOrEmpty(clientID) ) |
| | | { |
| | | throw new ArgumentException("客户账号参数异常!"); |
| | | } |
| | | |
| | | //生成Token |
| | | string token = clientID; |
| | | |
| | | return new JsonPageResult(true, token); |
| | | } |
| | | |
| | | |
| | | //重置密码 |
| | | private JsonPageResult ResetPwd(PageContext<Model.SysUser> context) |
| | | { |
| | | string clientID = context.GetString("clientID"); |
| | | string password = string.IsNullOrEmpty(initPwd ) ? "123456" : initPwd; |
| | | |
| | | //密码MD5加密, |
| | | password = DataHelper.MD5Hex(password); |
| | | |
| | | _Dao.UpdatePassword(clientID, password); |
| | | |
| | | return new JsonPageResult(true, "重置密码成功!"); |
| | | } |
| | | |
| | | //修改密码 |
| | | private JsonPageResult UpdatePwd(PageContext<Model.SysUser> context) |
| | | { |
| | | string clientID = context.GetString("clientID"); |
| | | string newPwd = context.GetString("newPwd"); |
| | | |
| | | if (string.IsNullOrEmpty(newPwd) || !System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-zA-Z0-9]{4,10}")) |
| | | { |
| | | throw new ArgumentException("登录密码不能为空,且必须为4-10位英文或数字字符组合!"); |
| | | } |
| | | |
| | | //密码MD5加密, |
| | | newPwd = DataHelper.MD5Hex(newPwd); |
| | | |
| | | _Dao.UpdatePassword(clientID, newPwd); |
| | | |
| | | return new JsonPageResult(true, "修改密码成功!"); |
| | | } |
| | | |
| | | //获取客户个性产品 |
| | | private JsonPageResult GetPersonalityProduct(PageContext<Model.SysUser> context) |
| | | { |
| | | string clientId = context.GetString("clientId"); |
| | | |
| | | return new JsonPageResult(true, _Dao.GetPersonalityProduct(clientId).Keys); |
| | | } |
| | | |
| | | //修改分配个性产品:修改确认 |
| | | private JsonPageResult UpdateProduct(PageContext<SysUser> context) |
| | | { |
| | | //context.CheckRight("1042", FailedOperation.PromptOnly); |
| | | string @string = context.GetString("productIdArray"); |
| | | string clientId = context.GetString("clientId"); |
| | | string[] productIdArray = JsonConvert.DeserializeObject<string[]>(@string); |
| | | if (productIdArray == null) |
| | | throw new ArgumentException("个性分配产品数据异常!"); |
| | | if (string.IsNullOrEmpty(clientId) ) |
| | | throw new ArgumentException("客户账号参数异常!"); |
| | | this._Dao.UpdateProduct(clientId, productIdArray); |
| | | return new JsonPageResult(true, (object) "修改分配个性产品成功!"); |
| | | } |
| | | |
| | | //更新信息启用或停用 |
| | | private JsonPageResult UpdateStatus(PageContext<SysUser> context) |
| | | { |
| | | string clientId = context.GetString("clientId"); |
| | | string isEnable = context.GetString("isEnable"); |
| | | |
| | | this._Dao.UpdateStatus(clientId, isEnable); |
| | | return new JsonPageResult(true, "更新信息状态成功!"); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过账号名获取代理商信息 |
| | | /// </summary> |
| | |
| | | string chargeType = context.GetString("chargeType"); |
| | | string smsStatusReport = context.GetString("smsStatusReport"); |
| | | string mmsStatusReport = context.GetString("mmsStatusReport"); |
| | | |
| | | string isEnableWhite = context.GetString("isEnableWhite"); |
| | | string isEnableBlack = context.GetString("isEnableBlack"); |
| | | string isRemoteLoginNotice = context.GetString("isRemoteLoginNotice"); |
| | | string isMobileCaptcha = context.GetString("isMobileCaptcha"); |
| | | string isHideMobile = context.GetString("isHideMobile"); |
| | | string isDisplayStatus = context.GetString("isDisplayStatus"); |
| | | string isLoginIpRestrict = context.GetString("isLoginIpRestrict"); |
| | | string isLoginIpAllowGather = context.GetString("isLoginIpAllowGather"); |
| | | string isLoginCityRestrict = context.GetString("isLoginCityRestrict"); |
| | | string isLoginCityAllowGather = context.GetString("isLoginCityAllowGather"); |
| | | |
| | | string data = context.GetString("permissionData"); |
| | | if(data.Contains("1")) |
| | | { |
| | |
| | | throw new ArgumentException("客户账号不能为空,且必须为公司名称!"); |
| | | } |
| | | |
| | | /** |
| | | if (string.IsNullOrEmpty(password) || !System.Text.RegularExpressions.Regex.IsMatch(password, @"[a-zA-Z0-9]{4,10}")) |
| | | { |
| | | throw new ArgumentException("客户密码不能为空,且必须为4-10位英文或数字字符组合!"); |
| | | } |
| | | }**/ |
| | | |
| | | if (string.IsNullOrEmpty(clientName) || string.IsNullOrEmpty(telephone)) |
| | | { |
| | |
| | | throw new ArgumentException("短信是否支持显示状态报告不能为空,请选择!"); |
| | | } |
| | | |
| | | /** |
| | | if (string.IsNullOrEmpty(mmsStatusReport)) |
| | | { |
| | | throw new ArgumentException("彩信是否支持显示状态报告不能为空,请选择!"); |
| | | } |
| | | }**/ |
| | | |
| | | /** |
| | | //编辑时不支持个性密码 |
| | | string savePassword = ""; |
| | | if (!string.IsNullOrEmpty(clientID)) |
| | | { |
| | |
| | | savePassword = DataHelper.MD5Hex(password); |
| | | } |
| | | |
| | | **/ |
| | | |
| | | var client = new Model.GwClient(); |
| | | |
| | |
| | | client.ClientID = clientID; |
| | | client.Company = company; |
| | | //client.Password = password; |
| | | client.Password = savePassword; |
| | | //client.Password = savePassword; |
| | | |
| | | client.ClientName = clientName; |
| | | client.Address = address; |
| | |
| | | client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType); |
| | | client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport); |
| | | client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport); |
| | | |
| | | client.IsEnableWhite = string.IsNullOrEmpty(isEnableWhite) ? 0 : int.Parse(isEnableWhite); |
| | | client.IsEnableBlack = string.IsNullOrEmpty(isEnableBlack) ? 0 : int.Parse(isEnableBlack); |
| | | client.IsRemoteLoginNotice = string.IsNullOrEmpty(isRemoteLoginNotice) ? 0 : int.Parse(isRemoteLoginNotice); |
| | | client.IsMobileCaptcha = string.IsNullOrEmpty(isMobileCaptcha) ? 0 : int.Parse(isMobileCaptcha); |
| | | client.IsHideMobile = string.IsNullOrEmpty(isHideMobile) ? 0 : int.Parse(isHideMobile); |
| | | client.IsDisplayStatus = string.IsNullOrEmpty(isDisplayStatus) ? 0 : int.Parse(isDisplayStatus); |
| | | client.IsLoginIpRestrict = string.IsNullOrEmpty(isLoginIpRestrict) ? 0 : int.Parse(isLoginIpRestrict); |
| | | client.IsLoginIpAllowGather = isLoginIpAllowGather; |
| | | client.IsLoginCityRestrict = string.IsNullOrEmpty(isLoginCityRestrict) ? 0 : int.Parse(isLoginCityRestrict); |
| | | client.IsLoginCityAllowGather = isLoginCityAllowGather; |
| | | |
| | | client.PermissionData = permissionData; |
| | | |
| | | _Dao.Update(client); |
| | |
| | | string financialStaff = context.GetString("financialStaff"); |
| | | string chargeType = context.GetString("chargeType"); |
| | | string smsStatusReport = context.GetString("smsStatusReport"); |
| | | string mmsStatusReport = context.GetString("mmsStatusReport"); |
| | | string mmsStatusReport = context.GetString("mmsStatusReport"); |
| | | |
| | | string isEnableWhite = context.GetString("isEnableWhite"); |
| | | string isEnableBlack = context.GetString("isEnableBlack"); |
| | | string isRemoteLoginNotice = context.GetString("isRemoteLoginNotice"); |
| | | string isMobileCaptcha = context.GetString("isMobileCaptcha"); |
| | | string isHideMobile = context.GetString("isHideMobile"); |
| | | string isDisplayStatus = context.GetString("isDisplayStatus"); |
| | | string isLoginIpRestrict = context.GetString("isLoginIpRestrict"); |
| | | string isLoginIpAllowGather = context.GetString("isLoginIpAllowGather"); |
| | | string isLoginCityRestrict = context.GetString("isLoginCityRestrict"); |
| | | string isLoginCityAllowGather = context.GetString("isLoginCityAllowGather"); |
| | | |
| | | string data = context.GetString("permissionData"); |
| | | if(data.Contains("1")) |
| | | { |
| | |
| | | { |
| | | throw new ArgumentException("短信是否支持显示状态报告不能为空,请选择!"); |
| | | } |
| | | |
| | | /** |
| | | if (string.IsNullOrEmpty(mmsStatusReport)) |
| | | { |
| | | throw new ArgumentException("彩信是否支持显示状态报告不能为空,请选择!"); |
| | | } |
| | | }**/ |
| | | |
| | | HttpFileCollection _file = HttpContext.Current.Request.Files; |
| | | if (_file.Count > 0) |
| | |
| | | client.FinancialStaff = financialStaff; |
| | | client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType); |
| | | client.SmsStatusReport = string.IsNullOrEmpty(smsStatusReport) ? 0 : int.Parse(smsStatusReport); |
| | | client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport); |
| | | client.MmsStatusReport = string.IsNullOrEmpty(mmsStatusReport) ? 0 : int.Parse(mmsStatusReport); |
| | | |
| | | client.IsEnableWhite = string.IsNullOrEmpty(isEnableWhite) ? 0 : int.Parse(isEnableWhite); |
| | | client.IsEnableBlack = string.IsNullOrEmpty(isEnableBlack) ? 0 : int.Parse(isEnableBlack); |
| | | client.IsRemoteLoginNotice = string.IsNullOrEmpty(isRemoteLoginNotice) ? 0 : int.Parse(isRemoteLoginNotice); |
| | | client.IsMobileCaptcha = string.IsNullOrEmpty(isMobileCaptcha) ? 0 : int.Parse(isMobileCaptcha); |
| | | client.IsHideMobile = string.IsNullOrEmpty(isHideMobile) ? 0 : int.Parse(isHideMobile); |
| | | client.IsDisplayStatus = string.IsNullOrEmpty(isDisplayStatus) ? 0 : int.Parse(isDisplayStatus); |
| | | client.IsLoginIpRestrict = string.IsNullOrEmpty(isLoginIpRestrict) ? 0 : int.Parse(isLoginIpRestrict); |
| | | client.IsLoginIpAllowGather = isLoginIpAllowGather; |
| | | client.IsLoginCityRestrict = string.IsNullOrEmpty(isLoginCityRestrict) ? 0 : int.Parse(isLoginCityRestrict); |
| | | client.IsLoginCityAllowGather = isLoginCityAllowGather; |
| | | |
| | | _Dao.Add(client);//插入数据库。创建账户 |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //管理端账户名称 |
| | | //管理端用户ID转名称 |
| | | private string SysUserName(int userId) |
| | | { |
| | | if (this.SysUserList == null) |
| | | return string.Empty; |
| | | SysUser sysUser = this._SysUserList.Find((Predicate<SysUser>)(bean => bean.UserID == userId)); |
| | | if (sysUser != null) |
| | | return string.Format("{0}-{1}", (object)sysUser.UserID, (object)sysUser.UserName); |
| | | return string.Format("{0}", (object)sysUser.UserName); |
| | | return string.Empty; |
| | | } |
| | | } |