Exemplo n.º 1
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null || res["Mobile"].ToString().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号码为空"));
            }
            else
            {
                string          mobie = res["Mobile"].ToString().Trim();
                SmsInfoManager  sim   = new SmsInfoManager();
                UserInfoManager uim   = new UserInfoManager();
                //判断用户是否禁用状态
                DataTable user = uim.GetUserInfoByBindPhone(mobie);
                if (user != null)
                {
                    if (user.Rows.Count > 0)
                    {
                        Hashtable hashuser = DataTableHelper.DataRowToHashTable(user.Rows[0]);
                        if (SiteHelper.GetHashTableValueByKey(hashuser, "UserState").Trim() == UserState.Disable.GetHashCode().ToString())
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户被禁用,无法收取验证码"));
                        }
                    }
                }

                ICache Cache          = CacheFactory.GetCache();
                string keyid          = "sms_send_times@" + mobie;
                int    sms_send_times = 0;
                if (string.IsNullOrEmpty(Cache.Get <string>(keyid)))
                {
                    DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                    Cache.Set(keyid, sms_send_times, dt - DateTime.Now);
                }
                if (sms_send_times >= MaxSendTimes)
                {
                    Cache.Dispose();
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败,短信发送已超过当天最大次数"));
                }

                bool sendResult = sim.SendVerificationCode(mobie);
                if (sendResult)
                {
                    sms_send_times += 1;
                    DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                    Cache.Set(keyid, sms_send_times, dt - DateTime.Now);
                    Cache.Dispose();
                    return(SiteHelper.GetJsonFromHashTable(null, "success", "短信发送成功"));
                }
                else
                {
                    Cache.Dispose();
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败"));
                }
            }
        }
Exemplo n.º 2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["RealName"] == null || res["RealName"].ToString().Trim().Length <= 0 ||
                res["IDCard"] == null || res["IDCard"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                try
                {
                    uid = res["UID"].ToString().Trim();
                    if (res["RealName"] != null)
                    {
                        realName = res["RealName"].ToString().Trim();
                    }
                    if (res["IDCard"] != null)
                    {
                        idCard = res["IDCard"].ToString().Trim().ToLower();
                    }
                }
                catch
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "数据格式不正确"));
                }

                if (!CheckIDCard18(idCard))
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "身份证号错误"));
                }

                UserInfoManager uim = new UserInfoManager();

                Hashtable user = uim.GetUserInfoByUserID(uid);
                int       realNameCertification = 1;
                int.TryParse(SiteHelper.GetHashTableValueByKey(user, "RealNameCertification"), out realNameCertification);
                if (realNameCertification == 4)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "您已经通过实名认证"));
                }

                //验证身份证号,判断是否注册人员已满16岁或超过80岁
                if (idCard.Length == 18)
                {
                    string   birth = idCard.Substring(6, 8).Insert(6, "-").Insert(4, "-");
                    DateTime dt    = new DateTime();
                    DateTime.TryParse(birth, out dt);
                    if (DateTime.Now.AddYears(-16) < dt)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "实名认证失败,认证用户未满16岁"));
                    }
                    if (DateTime.Now.AddYears(-60) >= dt)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "实名认证失败,认证用户已满60岁"));
                    }
                }

                ICache Cache          = CacheFactory.GetCache();
                string keyid          = "id_verfy_times@" + uid;
                int    id_verfy_times = 0;
                if (string.IsNullOrEmpty(Cache.Get <string>(keyid)))
                {
                    DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                    Cache.Set(keyid, id_verfy_times, dt - DateTime.Now);
                }
                if (id_verfy_times >= MaxVerfyTimes)
                {
                    Cache.Dispose();
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "实名认证失败,认证已超过当天最大次数"));
                }

                IDCardVerify  verify = new IDCardVerify();
                ObjectApiResp result = new ObjectApiResp();
                result.Code = "0";
                result.Data = "1";

                result = verify.VerifyCard(realName, idCard);
                //result.Code = "1";
                //code:0,访问正常,-1,访问异常,data:1,验证一致,2,不一致,message:文本消息
                if (result.Code == "-1")
                {
                    Cache.Dispose();
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", result.Message));
                }
                else
                {
                    id_verfy_times += 1;
                    DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                    Cache.Set(keyid, id_verfy_times, dt - DateTime.Now);
                    Cache.Dispose();

                    if (result.Data.ToString() == "1")
                    {
                        bool isUpdate = uim.UpdateRealNameCertification(uid, realName, idCard);
                        if (isUpdate)
                        {
                            DataTable userInfo  = uim.GetUserInfoByBindPhone(SiteHelper.GetHashTableValueByKey(user, "BindPhone"));
                            Hashtable result_ht = DataTableHelper.DataRowToHashTable(userInfo.Rows[0]);
                            return(SiteHelper.GetJsonFromHashTable(result_ht, "success", "实名认证成功", "UserInfo"));
                        }
                        else
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "实名认证状态保存失败"));
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "实名认证没通过,请重试"));
                    }
                }
            }
        }
Exemplo n.º 3
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["SetType"] == null || res["Content"] == null || res["UID"] == null || res["SetType"].ToString().Trim().Length <= 0 || res["Content"].ToString().Trim().Length <= 0 || res["UID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                UserInfoManager uim = new UserInfoManager();
                SmsInfoManager  sim = new SmsInfoManager();
                //头像:1   姓名:2   昵称:3
                uid     = res["UID"].ToString().Trim();
                setType = res["SetType"].ToString().Trim();
                content = res["Content"].ToString().Trim();
                Hashtable user = uim.GetUserInfoByUserID(uid);
                if (user == null || user.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户不存在"));
                }
                else
                {
                    if (setType == "1")
                    {
                        //修改头像
                        try
                        {
                            string    imgPath    = BitmapHelper.toUpload(content);
                            Hashtable modifyUser = new Hashtable();
                            modifyUser["HeadPortrait"] = imgPath;
                            bool issuccess = uim.AddOrEditUserInfo(modifyUser, uid);
                            if (!issuccess)
                            {
                                return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户头像保存失败"));
                            }
                            else
                            {
                                user["HeadPortrait"] = imgPath;
                            }
                        }
                        catch (Exception e1)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户头像保存失败"));
                        }
                    }
                    else if (setType == "3")
                    {
                        //修改昵称
                        Hashtable modifyUser = new Hashtable();
                        modifyUser["NickName"] = content;
                        bool issuccess = uim.AddOrEditUserInfo(modifyUser, uid);
                        if (!issuccess)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "昵称保存失败"));
                        }
                        else
                        {
                            user["NickName"] = content;
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "修改项不合法"));
                    }
                }
                DataTable dt = uim.GetUserInfoByBindPhone(SiteHelper.GetHashTableValueByKey(user, "BindPhone"));
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "网络异常"));
                }
                else
                {
                    decimal balance = 0.00m;
                    decimal.TryParse(dt.Rows[0]["Balance"].ToString(), out balance);
                    decimal balance2 = 0.00m;
                    decimal.TryParse(dt.Rows[0]["Balance2"].ToString(), out balance2);
                    dt.Rows[0]["Balance"] = balance + balance2;
                    Hashtable huser = DataTableHelper.DataRowToHashTable(dt.Rows[0]);
                    return(SiteHelper.GetJsonFromHashTable(huser, "success", "操作成功", "UserInfo"));
                }
            }
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.CacheControl = "no-cache";
            context.Response.AddHeader("Pragma", "no-cache");
            context.Response.ContentType = "text/plain";
            string Action = context.Request["action"];

            switch (Action)
            {
            case "GetDistrict":
                ServiceAreaManager areaManager = new ServiceAreaManager();
                DataTable          dtArea      = areaManager.GetAreaList(int.Parse(context.Request["levelType"]), int.Parse(context.Request["parentId"]));
                context.Response.Write(JsonHelper.DataTableToJson("success", "获取数据成功", dtArea, "ServiceArea"));
                context.Response.End();
                break;

            case "GetServiceAreaByID":
                ServiceAreaManager manager = new ServiceAreaManager();
                DataTable          dt      = manager.GetServiceAreaByID(context.Request["key"]);
                context.Response.Write(JsonHelper.DataTableToJson("success", "获取数据成功", dt, "ServiceArea"));
                context.Response.End();
                break;

            case "UpdateServiceAreaCoordinates":
                ServiceAreaManager sam = new ServiceAreaManager();
                string             key = context.Request["key"];
                Hashtable          ht  = sam.GetInfoByID(key);
                ht["COORDINATES"] = context.Request["Coordinates"];
                ht["LONGITUDE"]   = context.Request["Longitude"];
                ht["LATITUDE"]    = context.Request["Latitude"];
                string areaType   = ht["AREATYPE"].ToString();
                string status     = ht["STATUS"].ToString();
                string deleteMark = ht["DELETEMARK"].ToString();
                //AreaType 区域类型 1服务范围 2停车网点
                //Status 启动状态:0禁用,1启用
                //DeleteMark 0
                if ("1".Equals(areaType) && "1".Equals(status) && "True".Equals(deleteMark))
                {
                    ICache cache = null;
                    try
                    {
                        cache = CacheFactory.GetCache();
                        string   cacheKey = "Service_Area_" + ht["CITYID"].ToString();
                        DateTime timeSpan = DateTime.Now.AddDays(10);
                        cache.Set(cacheKey, context.Request["Coordinates"], timeSpan - DateTime.Now);
                        cache.Dispose();

                        /*List<LatLng> area_pts = new List<LatLng>();
                         * string coordinates = cache.Get<string>(cacheKey);
                         * if(coordinates!=null&& coordinates.Length>0)
                         * foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                         * {
                         *  string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                         *  LatLng pt = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                         *  area_pts.Add(pt);
                         * }*/
                    }
                    catch (Exception e)
                    {
                        if (cache != null)
                        {
                            cache.Dispose();
                        }
                        Logger.Error("更新区域:" + ht["THISNAME"].ToString() + ",报错:" + e);
                    }
                    if (cache != null)
                    {
                        cache.Dispose();
                    }
                }
                if (sam.AddOrEditInfo(ht, key))
                {
                    context.Response.Write(JsonHelper.DataTableToJson("success", "更新成功", null, "UpdateServiceAreaCoordinates"));
                }
                else
                {
                    context.Response.Write(JsonHelper.DataTableToJson("faild", "更新失败", null, "UpdateServiceAreaCoordinates"));
                }
                context.Response.End();
                break;

            case "GetInviteCouponInfo":
                SysSettingManager settingManager = new SysSettingManager();
                int couponNum = 0;
                int.TryParse(settingManager.GetValueByKey("InviteCouponNum"), out couponNum);
                decimal couponMoney = 0.00m;
                decimal.TryParse(settingManager.GetValueByKey("InviteCouponMoney"), out couponMoney);
                double CouponPeriod = 0;
                double.TryParse(settingManager.GetValueByKey("CouponPeriod"), out CouponPeriod);
                Hashtable result_ht = new Hashtable();
                result_ht["CouponNum"]    = couponNum;
                result_ht["CouponMoney"]  = couponMoney;
                result_ht["CouponPeriod"] = DateTime.Now.Date.AddDays(CouponPeriod).ToString("yyyy-MM-dd");
                //响应数据到客户端
                context.Response.Write(SiteHelper.GetJsonFromHashTable2(result_ht, "success", "获取数据成功", "GetInviteCouponInfo"));
                break;

            case "SendVerificationCode":
                string mobie = context.Request["Mobile"].ToString().Trim();
                string code  = "";
                if (context.Request["Code"] != null)
                {
                    code = context.Request["Code"].ToString().Trim();
                }
                else
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "参数错误", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                string session_code = context.Session["dt_session_code"].ToString();
                if (code.ToLower() != session_code.ToLower())
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "图形验证码错误", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                SmsInfoManager  sim  = new SmsInfoManager();
                UserInfoManager uim  = new UserInfoManager();
                DataTable       user = uim.GetUserInfoByBindPhone(mobie);
                if (user != null && user.Rows.Count > 0)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机号已注册", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                bool sendResult = sim.SendVerificationCode(mobie);
                if (sendResult)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "success", "发送验证码成功", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                else
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "发送验证码失败", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }

            case "NewUserRegister":
                sim = new SmsInfoManager();
                UserLoginLogManager ullm = new UserLoginLogManager();
                uim            = new UserInfoManager();
                settingManager = new SysSettingManager();
                string mobile           = context.Request["Mobile"].ToString().Trim();
                string verificationCode = context.Request["VerificationCode"].ToString().Trim();
                string invite_userid    = context.Request["InviteUserID"].ToString().Trim();

                string vcode = sim.GetVerCodeByMobile(mobile);
                if (verificationCode != vcode)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机验证码错误", "NewUserRegister"));
                    context.Response.End();
                    return;
                }

                user = uim.GetUserInfoByBindPhone(mobile);
                if (user != null && user.Rows.Count > 0)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "用户已注册", "NewUserRegister"));
                    context.Response.End();
                    return;
                }
                else
                {
                    Hashtable newuser = new Hashtable();
                    newuser["BindPhone"]             = mobile;
                    newuser["RealNameCertification"] = (int)UserRealNameCertification.Unauthorized;
                    newuser["UserState"]             = (int)UserState.Enable;
                    newuser["Balance"]      = 0;
                    newuser["RaiseBalance"] = 0;
                    newuser["IsRaiseUser"]  = (int)UserIsRaise.NO;
                    newuser["InviteCode"]   = mobile;
                    newuser["InviteUserID"] = invite_userid;
                    int num = uim.AddUserInfo(newuser);
                    if (num > -1)
                    {
                        user = uim.GetUserInfoByBindPhone(mobile);

                        //新注册用户赠送优惠券
                        couponNum = 0;
                        int.TryParse(settingManager.GetValueByKey("RegCouponNum"), out couponNum);
                        couponMoney = 0.00m;
                        decimal.TryParse(settingManager.GetValueByKey("RegCouponMoney"), out couponMoney);
                        UserCouponManager couponManager = new UserCouponManager();
                        if (couponNum > 0 && couponMoney > 0)
                        {
                            couponManager.NewUserGiveCoupons(user.Rows[0]["ID"].ToString());
                        }

                        context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "success", "新用户注册成功", "NewUserRegister"));
                        context.Response.End();
                        return;
                    }
                    else
                    {
                        context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机号错误", "NewUserRegister"));
                        context.Response.End();
                        return;
                    }
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null ||
                res["VerificationCode"] == null ||
                res["Client"] == null ||
                res["Longitude"] == null ||
                res["Latitude"] == null ||
                res["EquipmentID"] == null ||
                res["Mobile"].ToString().Trim().Length <= 0 ||
                res["VerificationCode"].ToString().Trim().Length <= 0 ||
                res["Client"].ToString().Trim().Length <= 0 ||
                res["Longitude"].ToString().Trim().Length <= 0 ||
                res["Latitude"].ToString().Trim().Length <= 0 ||
                res["EquipmentID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录数据不完整"));
            }
            else
            {
                UserInfoManager     uim            = new UserInfoManager();
                SmsInfoManager      sim            = new SmsInfoManager();
                UserLoginLogManager ullm           = new UserLoginLogManager();
                SysSettingManager   settingManager = new SysSettingManager();
                bool isAllowLogin = false;
                //获取参数
                mobile           = res["Mobile"].ToString().Trim();
                verificationCode = res["VerificationCode"].ToString().Trim();
                client           = res["Client"].ToString().Trim();
                longitude        = res["Longitude"].ToString().Trim();
                latitude         = res["Latitude"].ToString().Trim();
                drviceid         = res["EquipmentID"].ToString().Trim();
                DataTable user = uim.GetUserInfoByBindPhone(mobile);
                if (user != null && user.Rows.Count > 0)
                {
                    string vcode = sim.GetVerCodeByMobile(mobile);
                    if (vcode != null && verificationCode.Trim() == vcode.Trim())
                    {
                        isAllowLogin = true;
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "验证码不正确"));
                    }
                }
                else
                {
                    Hashtable newuser = new Hashtable();
                    newuser["BindPhone"]             = mobile;
                    newuser["RealNameCertification"] = (int)UserRealNameCertification.Unauthorized;
                    newuser["UserState"]             = (int)UserState.Enable;
                    newuser["Balance"]      = 0;
                    newuser["RaiseBalance"] = 0;
                    newuser["IsRaiseUser"]  = (int)UserIsRaise.NO;
                    newuser["InviteCode"]   = mobile;
                    int num = uim.AddUserInfo(newuser);
                    if (num > -1)
                    {
                        user = uim.GetUserInfoByBindPhone(mobile);
                        string vcode = sim.GetVerCodeByMobile(mobile);
                        if (vcode != null && verificationCode.Trim() == vcode.Trim())
                        {
                            isAllowLogin = true;
                        }
                        else
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "验证码不正确"));
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号错误"));
                    }

                    //新注册用户赠送优惠券
                    int couponNum = 0;
                    int.TryParse(settingManager.GetValueByKey("RegCouponNum"), out couponNum);
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(settingManager.GetValueByKey("RegCouponMoney"), out couponMoney);
                    UserCouponManager couponManager = new UserCouponManager();
                    if (couponNum > 0 && couponMoney > 0)
                    {
                        couponManager.NewUserGiveCoupons(user.Rows[0]["ID"].ToString());
                    }
                }
                if (isAllowLogin)
                {
                    //记录登录日志
                    Hashtable loginlog = new Hashtable();
                    loginlog["UserID"]    = user.Rows[0]["ID"].ToString();
                    loginlog["Latitude"]  = latitude;
                    loginlog["Longitude"] = longitude;
                    loginlog["Client"]    = client;
                    ullm.AddUserLoginLog(loginlog);
                    //更新最后登录时间
                    Hashtable userh = new Hashtable();
                    userh["LastloginTime"] = SiteHelper.GetWebServerCurrentTime();
                    userh["DeviceID"]      = drviceid;
                    uim.AddOrEditUserInfo(userh, loginlog["UserID"].ToString());

                    decimal balance = 0.00m;
                    decimal.TryParse(user.Rows[0]["Balance"].ToString(), out balance);
                    decimal balance2 = 0.00m;
                    decimal.TryParse(user.Rows[0]["Balance2"].ToString(), out balance2);
                    user.Rows[0]["Balance"] = balance + balance2;
                    if (user.Rows[0]["UserType"].ToString() == UserType.OffDepositUser.GetHashCode().ToString())//免押金用户
                    {
                        string depositMoney = settingManager.GetValueByKey("GoldDepositAmount");
                        user.Rows[0]["Deposit"] = depositMoney;
                    }

                    //响应数据到客户端
                    return(SiteHelper.GetJsonFromHashTable(DataTableHelper.DataRowToHashTable(user.Rows[0]), "success", "登录成功", "UserInfo"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录操作失败"));
                }
            }
        }
Exemplo n.º 6
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null || res["Mobile"].ToString().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号码为空"));
            }
            if (res["LoginCode"] == null || res["LoginCode"].ToString().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "图形码为空"));
            }
            string          mobile      = res["Mobile"].ToString().Trim();
            UserInfoManager uim         = new UserInfoManager();
            DataTable       blackMobile = uim.GetBlackMobileByMobile(mobile);

            if (blackMobile != null && blackMobile.Rows.Count > 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号被禁用,请联系客服"));
            }
            string code = res["LoginCode"].ToString().Trim();

            code = code.ToLower();
            ICache cache        = CacheFactory.GetCache();
            string loginCodeKey = "login_code_" + mobile;
            string code_value   = cache.Get <string>(loginCodeKey);

            Logger.Debug("mobile:" + mobile + ",code:" + code + ",redis_code_value:" + code_value);

            /*if(string.IsNullOrEmpty(code_value))
             * {
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "图形码超时");
             * }
             * if (!code_value.Equals(code))
             * {
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "图形码错误");
             * }*/

            if (!ValidateUtil.IsMobilePhone(mobile))
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机格式不正确"));
            }

            SmsInfoManager sim = new SmsInfoManager();
            //判断用户是否禁用状态
            DataTable user = uim.GetUserInfoByBindPhone(mobile);

            if (user != null)
            {
                if (user.Rows.Count > 0)
                {
                    Hashtable hashuser = DataTableHelper.DataRowToHashTable(user.Rows[0]);
                    if (SiteHelper.GetHashTableValueByKey(hashuser, "UserState").Trim() == UserState.Disable.GetHashCode().ToString())
                    {
                        if (cache != null)
                        {
                            cache.Dispose();
                        }
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户被禁用,无法收取验证码"));
                    }
                }
            }

            /*string span_key_id = "sms_send_time_span@" + mobile;
             * if (string.IsNullOrEmpty(Cache.Get<string>(span_key_id)))
             * {
             *  DateTime dt = DateTime.Now.AddSeconds(60);
             *  Cache.Set(span_key_id, mobile, dt - DateTime.Now);
             * }
             * else
             * {
             *  Cache.Dispose();
             *  Logger.Error("发送短信,Mobile:" + mobile + "60秒内");
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败,请稍后再试");
             * }*/

            string keyid          = "sms_send_times@" + mobile;
            int    sms_send_times = 0;

            if (string.IsNullOrEmpty(cache.Get <string>(keyid)))
            {
                DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                cache.Set(keyid, sms_send_times, dt - DateTime.Now);
            }
            else
            {
                string tims = cache.Get <string>(keyid);
                int.TryParse(tims, out sms_send_times);
            }
            if (sms_send_times >= MaxSendTimes)
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败,短信发送已超过当天最大次数"));
            }

            bool sendResult = sim.SendVerificationCode(mobile);

            if (sendResult)
            {
                sms_send_times += 1;
                DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                cache.Set(keyid, sms_send_times, dt - DateTime.Now);
                cache.Dispose();
                return(SiteHelper.GetJsonFromHashTable(null, "success", "短信发送成功"));
            }
            else
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败"));
            }
        }