public ActionResult savepwd_one(string Code, string LoginPwd, string smscode) { if (DB.XmlConfig.XmlSite.IsJiHuo) { string code = Session["smscode"] as string; if (string.IsNullOrEmpty(code)) { throw new Exception("验证码过期"); } if (code != ReqHelper.GetString("smscode")) { throw new Exception("验证码不正确"); } } var m = DB.Member_Info.FindEntity(a => a.Mobile == Code); if (m != null) { m.LoginPwd = LoginPwd.ToEncrypt(); DB.Member_Info.Update(m); return(Success("修改成功")); } else { return(Success("手机号不存在")); } return(Success("修改成功")); }
/// <summary> /// 第二步,通过code换取网页授权access_token /// </summary> public void GetAccess_Token() { try { //1.处理跳转 this.Code = ReqHelper.GetString("code"); if (string.IsNullOrEmpty(this.Code)) { throw new Exception("获取code参数失败或用户禁止授权获取基本信息"); } //1.发送获取access_token请求 string url = GetAccess_TokenUrl(); string result = NetHelper.Get(url); //2.解析相应结果 TokenData = JsonConvert.DeserializeObject <OAuthAccess_Token>(result); if (TokenData == null) { throw new Exception("反序列化结果失败,返回内容为:" + result); } //3.获取成功 if (OnGetTokenSuccess != null) { OnGetTokenSuccess(TokenData); } } catch (Exception ex) { Error("第二步,通过code换取网页授权access_token异常", ex); } }
/// <summary> /// 保存用户信息--非供应商 /// </summary> /// <param name="target"></param> /// <returns></returns> public ActionResult Save_One(string Code, string NickName, string LoginPwd, string Pwd2, string RecommendCode, string smscode) { try { LogOperate.Write("注册开始:" + CookieHelper.GetCookieValue("headimgurl")); //判断手机验证码 if (!DB.XmlConfig.XmlSite.IsJiHuo) { string code = Session["smscode"] as string; if (string.IsNullOrEmpty(code)) { throw new Exception("验证码过期"); } if (code != ReqHelper.GetString("smscode")) { throw new Exception("验证码不正确"); } } //if (DB.XmlConfig.XmlSite.IsJiHuo) //{ //var code = Tools.getCookie("gif"); //if (string.IsNullOrEmpty(code)) // throw new Exception("验证码过期"); //if (code != smscode) // throw new Exception("验证码不正确"); //} var DataBase = new Member_Info(); DataBase.Code = Code; DataBase.NickName = NickName; DataBase.LoginPwd = LoginPwd; DataBase.Pwd2 = Pwd2; DataBase.RecommendCode = RecommendCode; DataBase.CreateMemberId = "00"; DataBase.CreateMemberName = "admin"; DataBase.CreateTime = DateTime.Now; //赋值省市区 if (DataBase.ProvId != null) { DataBase.ProvName = DB.Area_Province.FindEntity(DataBase.ProvId).name; } if (DataBase.CityId != null) { DataBase.CityName = DB.Area_City.FindEntity(DataBase.CityId).name; } if (DataBase.CountyId != null) { DataBase.CountyName = DB.Area_County.FindEntity(DataBase.CountyId).name; } DataBase.Code = DataBase.Code.Trim(); DataBase.Mobile = DataBase.Mobile; var json = DB.Member_Info.Save(DataBase, Enums.LoginType.nologin, "", "", 0, 0, 0, 0); if (json.Status == "n") { return(Error(json.Msg)); } else { //重新保存cookie User_Shop.SetUser(DataBase); return(Success("注册成功")); } } catch (Exception ex) { LogOperate.Write(ex); return(Error(ex)); } }