wzp
2023-03-02 adee7a71ba7ab1b63cab63381dfe1846437853d6
web/web/GwClient.ashx
@@ -22,7 +22,7 @@
    private List<SysUser> _SysUserList;
    private int _userId = -1;
    private int _userType = -1;
    private string _userType = "";
    private string _account = "";
    private string initPwd = ConfigurationManager.AppSettings["initPwd"];
@@ -117,11 +117,13 @@
        string serverIp = ConfigurationManager.AppSettings["serverIp"];
        string clientPort = ConfigurationManager.AppSettings["clientPort"];
        int isSub = context.GetInt("isSub",0);
        string str = "";
        using (GwClientDao dao = new GwClientDao())
        {
            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);
            var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, SupportStaff, ProductId, IsEnable,isSub, permissionsSQL);
            if (list != null && list.Count > 0)
            {
@@ -132,20 +134,18 @@
                    {
                        Certification_StatusResult = "已认证";
                    }
                    //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>" + item.ProductIds + "</td>"
                            + "<td>"+ (item.Is_Enable == 1 ? "<span class='label label-primary'>启用</span>" : "<span class='label label-default'>停用</span>") + "</td>";
                    str += @"<td>";
                    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 ;
                        string token = DESEncrypt.Encrypt(item.Password);//对称加密
                        string loginStr = "http://" + serverIp + ":" + clientPort + "/Attachedlogin.aspx?action=Attachedlogin&account=" + item.Account+"&token="+token ;
                        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 += "&nbsp;登录</a>&nbsp;";
@@ -157,9 +157,9 @@
                        str += @"白名单";
                        str += @"</a>&nbsp;";
                        str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
                        str += @"黑名单";
                        str += @"</a>&nbsp;";
                        //str += string.Format(@"<a class=""action-modal-black btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
                        //str += @"黑名单";
                        //str += @"</a>&nbsp;";
                        //str += string.Format(@"<a class=""action-modal-resetPwd btn btn-xs btn-primary"" href=""javascript:;"" data-id=""{0}"">", item.ClientID);
                        //str += @"重置密码";
@@ -323,8 +323,10 @@
        {
            throw new ArgumentException("登录密码不能为空,且必须为4-10位英文或数字字符组合!");
        }
        GwClient gwClient = _Dao.Get(clientID);
        //密码MD5加密,
        newPwd += gwClient.Salt;
        newPwd = DataHelper.MD5Hex(newPwd);
        _Dao.UpdatePassword(clientID, newPwd);
@@ -404,7 +406,7 @@
        int id = Int32.Parse(context.GetString("id"));
        string clientID = context.GetString("clientID");
        string company = context.GetString("company");
        string password = context.GetString("password");
        //string password = context.GetString("password");
        string clientName = context.GetString("clientName");
        string address = context.GetString("address");
        string telephone = context.GetString("telephone");
@@ -414,31 +416,25 @@
        string customerManager = context.GetString("customerManager");
        string supportStaff = context.GetString("supportStaff");
        string financialStaff = context.GetString("financialStaff");
        string chargeType = context.GetString("chargeType");
        string smsBillType = context.GetString("smsBillType");
        string smsStatusReport = context.GetString("smsStatusReport");
        string mmsStatusReport = context.GetString("mmsStatusReport");
        string isEnableSub = context.GetString("isEnableSub");
        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"))
        {
            data += ",sp.aspx,GwTaskSmssend,SpPrePattern.aspx";
        }
        if(data.Contains("2"))
        {
            data += ",molog.aspx,mtlog.aspx#stat,mtlog.aspx,statis.aspx";
        }
        string permissionData = Newtonsoft.Json.JsonConvert.SerializeObject(data.Split(','));
        //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");
        if (string.IsNullOrEmpty(clientID))
        {
@@ -456,11 +452,6 @@
            throw new ArgumentException("联系人/联系电话,不能为空!");
        }
        if (string.IsNullOrEmpty(customerManager))
        {
            throw new ArgumentException("归属客户经理不能为空,请选择!");
        }
        if (string.IsNullOrEmpty(salesman))
        {
            throw new ArgumentException("归属业务员不能为空,请选择!");
@@ -469,11 +460,6 @@
        if (string.IsNullOrEmpty(supportStaff))
        {
            throw new ArgumentException("归属客服人员不能为空,请选择!");
        }
        if (string.IsNullOrEmpty(financialStaff))
        {
            throw new ArgumentException("归属财务人员不能为空,请选择!");
        }
        if (string.IsNullOrEmpty(chargeType))
@@ -485,27 +471,6 @@
        {
            throw new ArgumentException("短信是否支持显示状态报告不能为空,请选择!");
        }
        /**
        if (string.IsNullOrEmpty(mmsStatusReport))
        {
            throw new ArgumentException("彩信是否支持显示状态报告不能为空,请选择!");
        }**/
        /**
        //编辑时不支持个性密码
        string savePassword = "";
        if (!string.IsNullOrEmpty(clientID))
        {
            GwClient gwClient = this._Dao.Get(clientID);
            savePassword = (gwClient.Password == password ? gwClient.Password : DataHelper.MD5Hex(password) );
        }
        else
        {
            savePassword = DataHelper.MD5Hex(password);
        }
        **/
        var client = new Model.GwClient();
@@ -526,21 +491,23 @@
        client.SupportStaff = supportStaff;
        client.FinancialStaff = financialStaff;
        client.ChargeType = string.IsNullOrEmpty(chargeType) ? 0 : int.Parse(chargeType);
        client.IsEnableSub = string.IsNullOrEmpty(isEnableSub) ? 0 : int.Parse(isEnableSub);
        client.SmsBillType = string.IsNullOrEmpty(smsBillType) ? 0 : int.Parse(smsBillType);
        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;
        //下面暂时用不到
        //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.Update(client);
@@ -550,6 +517,8 @@
    ///创建新客户
    private JsonPageResult Save(PageContext<Model.SysUser> context)
    {
        //测试
        string clientID = context.GetString("clientID");
        string password = context.GetString("password");
        string clientName = context.GetString("clientName");
@@ -564,8 +533,8 @@
        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");
@@ -591,6 +560,16 @@
        if (string.IsNullOrEmpty(clientID))
        {
            throw new ArgumentException("客户账号不能为空,且必须为公司名称!");
        }
        if (address.Length >= 150)
        {
            throw new ArgumentException("地址长度超出限制!");
        }
        if (string.IsNullOrEmpty(company))
        {
            throw new AggregateException("公司名称不能为空,且必须是全称");
        }
        if (string.IsNullOrEmpty(password) || !System.Text.RegularExpressions.Regex.IsMatch(password, @"[a-zA-Z0-9]{4,10}"))
@@ -691,12 +670,15 @@
            }
        }
        string salt = DataConverter.getRandom(6);
        password += salt;
        //密码加密
        password = DataHelper.MD5Hex(password);
        var client = new Model.GwClient();
        client.ClientID = clientID;
        client.Password = password;
        client.Salt = salt;
        client.ClientName = clientName;
        client.Address = address;
@@ -704,7 +686,7 @@
        client.Telephone = telephone;
        client.Agent = agent;
        client.PermissionData = permissionData;
        client.ParentId = context.OperatorID;
        client.Client_Parentid = context.OperatorID;
        client.Certification_Status = 1;
        client.Company = company;
        client.CustomerManager = customerManager;
@@ -713,8 +695,8 @@
        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);