12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace LYFZ.WeixinServers.WeiXinAPP
- {
- public partial class BondingUser : System.Web.UI.Page
- {
- public string openid = "";
- public string cusid = "";
- public string appid = "";
- public string jsInfo = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- if(!IsPostBack)
- {
- cusid = Request.QueryString["cusid"];
- openid = Request.QueryString["openid"];
- appid = Request.QueryString["appid"];
- }
- else
- {
- cusid = Request["cusid"];
- openid = Request["openid"];
- appid = Request["appid"];
- }
- }
- public void WriteLog(HttpContext context, string content, string filename = "")
- {
- if (string.IsNullOrEmpty(filename))
- {
- filename = DateTime.Now.ToString("yyyyMMddHHmmssffff");
- }
- string dirPath = context.Server.MapPath("/") + "/WeiXinDir/";
- if (!System.IO.Directory.Exists(dirPath))
- {
- System.IO.Directory.CreateDirectory(dirPath);
- }
- System.IO.File.AppendAllText(dirPath + "/" + filename + ".txt", content + "\r\n");
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- LYFZ.WeixinServiceDate.Model.Model_CustomerInterfaces cusModel = Global.GetCustomerModelById(Request.Form["cusid"]);
- string openid = Request.Form["openid"];
- string account = Request.Form["mobilenumber"];
- string password = Request.Form["ordernumber"];
- string appid = Request.Form["appid"];
- string paramStr = "openid=" + openid + "&account=" + account + "&password=" + password + "&appid=" + appid;
- string getText = LYFZ.WinAPI.HttpClientHelper.GetResponse(cusModel.GetRequestUrl()
- + "/api/WXApi.ashx/BindErpAccount?" + paramStr);
- if (getText != null)
- {
- Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(getText);
- if (jobject.GetValue("code").ToString().Equals("200"))
- {
- Response.Redirect("BindOK.html");
- }
- else
- {
- jsInfo = "<script>alert('" + jobject.GetValue("info").ToString() + "-" + jobject.GetValue("data").ToString() + "')</script>";
- }
- }
- else
- {
- jsInfo = "<script>alert('绑定反馈返回未空,可能无法和客户服务器通讯" + cusModel.GetRequestUrl() + "通讯引起的!')</script>";
- }
- WriteLog(HttpContext.Current, getText);
- }
- }
- }
|