protected void loginBt_Click(object sender, EventArgs e) { string loginUrl = "http://120.27.45.83:8085/api/User/login"; string loginpara = "phone=" + this.username.Text.ToString() + "&password="******"userInfo"] = user; if (Request.QueryString["url"] == null) { Response.Redirect("index.aspx"); } else { Response.Redirect(Request.QueryString["url"].ToString()); } } else { Response.Write("<script>alert('登陆失败')</script>"); } }
private resp GetImages(string albumHash, string clientId) //抓圖片 { resp result = null; try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create($"https://api.imgur.com/3/album/{albumHash}/images"); //設定網址位置 //Add Header WebHeaderCollection webHeaderCollection = request.Headers; webHeaderCollection.Add("Authorization", $"Client-ID {clientId}"); //先前設定imgur有說到 ////////////////////////////////////////////把東西抓到json 不用改 HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); string json = readStream.ReadToEnd(); ///////////////////////////////////////////// result = JsonConvert.DeserializeObject <resp>(json); } catch (Exception exp) //如果錯誤會跳來這邊 { Console.WriteLine(exp.ToString()); //顯示在主控台介面的訊息 要另外開 throw; } return(result); }
private void bindRP() { userInfo uInfo = new userInfo(); uInfo = (userInfo)Session["userInfo"]; string uid = uInfo.id; string url = "http://120.27.45.83:8082/api/Mall/getAddressList"; string para = "user_id=" + uid; resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); if (resp.code == 1000) { List <userAddress> userAddresss = JsonHelper.DeserializeJsonToList <userAddress>(resp.data.ToString()); this.Repeater1.DataSource = userAddresss; this.Repeater1.DataBind(); } }
private void setAddress() { string url = "http://120.27.45.83:8082/api/Mall/getAddressInfo"; string para = "key=" + Request.QueryString["aid"].ToString(); resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); userAddress user = JsonHelper.DeserializeJsonToObject <userAddress>(resp.data.ToString()); this.name.Value = user.name; this.mobile.Value = user.phone; this.area.Value = user.area; this.address.Value = user.address; this.aid.Value = user.id; this.uid.Value = user.user_id; }
protected void AddCar() { string url = "http://120.27.45.83:8085/api/Mall/AddGoodsToCart"; string para = "goods_id=" + Request.Form["id"].ToString() + "&user_id=" + Request.Form["userid"].ToString() + "&goods_num=1"; resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); }
protected void regBt_Click(object sender, EventArgs e) { if (DateTime.Parse(Session["codetime1"].ToString()).AddSeconds(120) > DateTime.Now) { string mobilecode = this.code.Text.ToString().Trim(); string pwd = this.pwd.Text.ToString().Trim(); string repwd = this.repwd.Text.ToString().Trim(); if (mobilecode != Session["code1"].ToString()) { Response.Write("<script>alert('验证码错误')</script>"); return; } userInfo uInfo = new userInfo(); uInfo = (userInfo)Session["userInfo"]; string uid = uInfo.id; string name = this.code.Text; string passwrod = this.pwd.Text; string url = "http://120.27.45.83:8085/api/User/UpdatePwd"; string para = "user_id=" + uid + "&oldpassword="******"&password ="******"<script>alert('修改密码成功');local.href='lsjyWeb/personalCenter.aspx'</script>"); } else { Response.Write("<script>alert('修改密码失败')</script>"); } } else { Response.Write("<script>alert('验证码超时')</script>"); } }
protected List <productList> bindRP2(string cid) { string url = "http://120.27.45.83:8082/api/Mall/GetGoodsListByCategory"; string para = "start=0&limit=100&type=" + cid; resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); return(JsonHelper.DeserializeJsonToList <productList>(JsonHelper.DeserializeJsonToObject <productInfo>(resp.data.ToString()).list.ToString())); }
protected void GetGoodsListByCategory() { string url = "http://120.27.45.83:8085/api/Mall/GetGoodsListByCategory"; string para = "start=0&limit=100&type=" + Request.Form["cid"].ToString(); resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); Response.Write(resp.data.ToString()); }
/// <summary> /// 添加到购物车 /// </summary> /// <param name="goodid"></param> /// <param name="userid"></param> /// <param name="num"></param> private void AddCar(string goodid, string userid, int num) { Util.clearCart(userid); string url = "http://120.27.45.83:8085/api/Mall/AddGoodsToCart"; string para = "goods_id=" + goodid + "&user_id=" + userid + "&goods_num=" + num.ToString(); resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); }
protected void LBSPost() { string url = "http://120.27.45.83:8085/api/Mall/LBSPost"; string para = "longitude=" + Request.Form["x"].ToString(); resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); Response.Write(resp.data.ToString()); }
protected void address_bt_Click(object sender, EventArgs e) { string url = "http://120.27.45.83:8082/api/Mall/EditAddress"; string para = "id=" + this.aid.Value + "&address=" + this.address.Value + "&phone=" + this.mobile.Value + "&name=" + this.name.Value + "&user_id=" + this.uid.Value + "&is_default=1"; resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); if (resp.code == 1000) { Response.Write("<script>alert('修改地址成功');local.href='addressManage.aspx'</script>"); } else { Response.Write("<script>alert('修改地址失败');local.href='addressManage.aspx'</script>"); } }
/// <summary> /// 设置默认地址 /// </summary> private void setAddress() { string url = "http://120.27.45.83:8082/api/Mall/getDefaultAddress"; string para = "user_id=" + uInfo.id; if (Request.QueryString["addr10"] != null) { url = "http://120.27.45.83:8085/api/Mall/getAddressInfo"; para = "key=" + Request.QueryString["addr10"].ToString(); } resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); if (resp.code == 1000) { userAddress user = JsonHelper.DeserializeJsonToObject <userAddress>(resp.data.ToString()); this.name.Text = user.name; this.mobile.Text = user.phone; if (user == null) { this.address.Text = "请选择地址"; this.hf1.Value = "0"; } else { this.address.Text = user.area + user.address; this.hf1.Value = user.id; } } }
protected void reg_send_submit_Click(object sender, EventArgs e) { string mobile = this.cell_txt.Value; resp res = new resp(); res = Util.GetResp("http://120.27.45.83:8085/api/User/ValidatePhone", "Phone=" + mobile); if (res.code == 1000) { //验证码 Session["code"] = DateTime.Now.Millisecond.ToString(); //验证码时间 Session["codetime"] = DateTime.Now.ToString(); CCPRestSDK api = new CCPRestSDK(); bool isInit = api.init("app.cloopen.com", "8883"); api.setAccount("8a48b5514f73ea32014f848582a61f2d", "42d2934251534741ab39067f67645812"); api.setAppId("8a48b5514f73ea32014f84882bd81f2f"); string[] data = { Session["code"].ToString(), "5" }; if (isInit) { api.SendTemplateSMS(mobile, "34439", data); } Response.Redirect("registB.aspx?mobile=" + mobile); } else { Response.Write("<script>alert('您的手机号已被注册过!')</script>"); } }
private void BindRepeater1() { string url = "http://120.27.45.83:8085/api/Mall/GetUserOrderList"; userInfo uInfo = new userInfo(); uInfo = (userInfo)Session["userInfo"]; string uid = uInfo.id; string para = "user_id=" + uid + "&type=0&start=0&limit=100"; resp resp = new resp(); resp = QLWeiXin.Code.Util.GetResp(url, para); this.Repeater1.DataSource = JsonHelper.DeserializeJsonToList <orderInfo>(JsonHelper.DeserializeJsonToObject <orderInfo1> (resp.data.ToString()).list.ToString()); this.Repeater1.DataBind(); }
public resp Getimages(string url) { resp result = null; try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); WebHeaderCollection webHeaderCollection = request.Headers; webHeaderCollection.Add("Authorization", "Client-ID 9f758a622e4f4ff"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); string json = readStream.ReadToEnd(); result = JsonConvert.DeserializeObject <resp>(json); } catch (Exception exp) { Console.WriteLine(exp.ToString()); throw; } return(result); }
private resp GetImages(string albumHash, string clientId) { resp result = null; try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.imgur.com/3/album/0PxBYNN/images"); WebHeaderCollection myWebHeaderCollection = request.Headers; myWebHeaderCollection.Add(albumHash, "Client-ID " + clientId); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); string json = readStream.ReadToEnd(); result = JsonConvert.DeserializeObject <resp>(json); } catch (Exception exp) { Console.WriteLine(exp.ToString()); throw; } return(result); }
protected void regBt_Click(object sender, EventArgs e) { if (DateTime.Parse(Session["codetime"].ToString()).AddSeconds(120) > DateTime.Now) { string mobilecode = this.code.Text.ToString().Trim(); string pwd = this.pwd.Text.ToString().Trim(); string repwd = this.repwd.Text.ToString().Trim(); if (mobilecode != Session["code"].ToString()) { Response.Write("<script>验证码错误</script>"); return; } if (pwd != repwd) { Response.Write("<script>密码不一致</script>"); return; } string url = "http://120.27.45.83:8085/api/User/RegisterOne"; string name = mobile; string paras = "nickname=" + name + "&password="******"&confirm_password="******"&phone=" + mobile; var tempEntity = new { code = string.Empty, msg = string.Empty, time = string.Empty }; JsonHelper.SerializeObject(tempEntity); //json5 : {"ID":0,"Name":""} tempEntity = JsonHelper.DeserializeAnonymousType(publicClass.RequestUrl(url, paras), tempEntity); if (tempEntity.code == "1000") { //登陆 string loginUrl = "http://120.27.45.83:8085/api/User/login"; string loginpara = "phone=" + mobile + "&password="******"userInfo"] = user; Response.Write("<script>alert('注册成功');local.href='lsjyWeb/personalCenter.aspx'</script>"); Response.Redirect("index.aspx"); } else { Response.Write("<script>alert('注册失败')</script>"); } } else { Response.Write("<script>alert('验证码超时')</script>"); } }
public ValidationResponce() { responce = new resp(); }
public ValidationResponce(bool err, int posBegin, int posEnd, String errType) { responce = new resp(); setResponce(err, posBegin, posEnd, errType); }