Beispiel #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         mobile      = res["Mobile"].ToString().Trim();
                SmsInfoManager sim         = new SmsInfoManager();
                OPUserManager  userManager = new OPUserManager();
                DataTable      user        = userManager.GetUserInfoByMobile(mobile);
                //判断用户是否在系统中进行过注册
                if (user == null || user.Rows.Count == 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户未在系统注册,无法收取验证码"));
                }
                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", "用户被禁用,无法收取验证码"));
                        }
                    }
                }

                bool sendResult = sim.SendVerificationCode(mobile);
                if (sendResult)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "success", "短信发送成功"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败"));
                }
            }
        }
Beispiel #2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null ||
                res["VerificationCode"] == null ||
                res["Client"] == null ||
                res["Mobile"].ToString().Trim().Length <= 0 ||
                res["VerificationCode"].ToString().Trim().Length <= 0 || res["Client"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录数据不完整"));
            }
            else
            {
                OPUserManager  userManager  = new OPUserManager();
                SmsInfoManager sim          = new SmsInfoManager();
                bool           isAllowLogin = false;
                //获取参数
                mobile           = res["Mobile"].ToString().Trim();
                verificationCode = res["VerificationCode"].ToString().Trim();
                client           = res["Client"].ToString().Trim();
                DataTable user = userManager.GetUserInfoByMobile(mobile);
                //判断用户是否在系统中进行过注册
                if (user == null || user.Rows.Count == 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户未在系统注册,登录失败"));
                }
                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", "验证码不正确"));
                    }
                }
                if (isAllowLogin)
                {
                    //更新最后登录时间
                    Hashtable userh = new Hashtable();
                    userh["LastloginTime"] = SiteHelper.GetWebServerCurrentTime();
                    userManager.AddOrEditUserInfo(userh, user.Rows[0]["UserID"].ToString());

                    //响应数据到客户端
                    Hashtable huser      = DataTableHelper.DataTableToHashtable(user);
                    DataTable dt_parking = userManager.GetUserParkingList(huser["USERID"].ToString());
                    DataRow   dr         = dt_parking.NewRow();
                    dr["ID"]       = System.Guid.Empty.ToString();
                    dr["ThisName"] = "停车点外";
                    dt_parking.Rows.InsertAt(dr, 0);
                    huser["PARKLIST"] = dt_parking;
                    //huser["PARKLIST"] = userManager.GetUserParkingList(huser["USERID"].ToString());
                    return(SiteHelper.GetJsonFromHashTable2(huser, "success", "登录成功", "UserInfo"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录失败,请稍后重试"));
                }
            }
        }
Beispiel #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
            {
                OPUserManager userManager = new OPUserManager();
                //1:头像,2:昵称,3:性别,4:电子邮箱
                uid     = res["UID"].ToString().Trim();
                setType = res["SetType"].ToString().Trim();
                content = res["Content"].ToString().Trim();
                Hashtable user = userManager.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 = userManager.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 == "2")
                    {
                        //修改姓名
                        Hashtable modifyUser = new Hashtable();
                        modifyUser["NickName"] = content;
                        bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid);
                        if (!issuccess)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "昵称保存失败"));
                        }
                        else
                        {
                            user["NickName"] = content;
                        }
                    }
                    else if (setType == "3")
                    {
                        //修改昵称
                        Hashtable modifyUser = new Hashtable();
                        modifyUser["UserSex"] = content;
                        bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid);
                        if (!issuccess)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "性别保存失败"));
                        }
                        else
                        {
                            user["UserSex"] = content;
                        }
                    }
                    else if (setType == "4")
                    {
                        //修改邮箱
                        Hashtable modifyUser = new Hashtable();
                        modifyUser["Email"] = content;
                        bool issuccess = userManager.AddOrEditUserInfo(modifyUser, uid);
                        if (!issuccess)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "电子邮箱保存失败"));
                        }
                        else
                        {
                            user["Email"] = content;
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "修改项不合法"));
                    }
                }
                DataTable dt = userManager.GetUserInfoByMobile(SiteHelper.GetHashTableValueByKey(user, "Tel"));
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "网络异常"));
                }
                else
                {
                    Hashtable huser = DataTableHelper.DataRowToHashTable(dt.Rows[0]);
                    return(SiteHelper.GetJsonFromHashTable(huser, "success", "操作成功", "UserInfo"));
                }
            }
        }