using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Web; using BusinessLogicalLayer; using Common; using Model.DCWeiXin; using SapServerLib; using WeixinMPSdk; using WeixinMPSdk.BaseInfo.JsonResult; namespace DCWXWebProject.WebPage.NewsMessage { public partial class NewsMessage : System.Web.UI.Page { public string jsusercode = ""; public string jsopenid = ""; public string jsweiXinId = ""; public string DCEPLServerUrl = ""; protected void Page_Load(object sender, EventArgs e) { // 微信原始ID string weiXinId = Request.Params["WeiXinId"]; jsweiXinId = weiXinId; //页面名称 string pageName = Request.Params["PageName"] ?? Request.Params["state"]; string usercode = Request.Params["code"]; jsusercode = usercode; string requesterId = Request.Params["RequesterId"]; WeiXinPageBLL pagebll = new WeiXinPageBLL(); WeiXinMemberBLL memberBll = new WeiXinMemberBLL(); WeiXinCfgBLL weiXinCfgBll = new WeiXinCfgBLL(); string pagecontent = ""; string page404 = " 404啦,您访问的网页不存在。。
\"“真的很抱歉,我们搞丢了"
"; if (string.IsNullOrEmpty(weiXinId)) { pagecontent = page404; } else { // WeiXinPage wxpage = pagebll.GetModel(weiXinId, pageName); WeiXinCfg wxcfg = weiXinCfgBll.GetModel(weiXinId); WeiXinSdk wxsdk = new WeiXinSdk(weiXinId, wxcfg.AppID, wxcfg.AppSecret); WeiXinMember wxMember = memberBll.GetModelByWeiXinId(weiXinId); DCEPLServerUrl = wxMember.OASvrAddr; if (!string.IsNullOrEmpty(usercode) || !string.IsNullOrWhiteSpace(usercode)) { OauthJsonResult oauthJson = wxsdk.GetUserOpenId(usercode); if (oauthJson != null) { requesterId = oauthJson.openid; jsopenid = requesterId; } } } } } }