private void MyBind() { if (Mid > 0) { M_WX_RedPacket redMod = redBll.SelReturnModel(Mid); Name_T.Text = redMod.Name; Flow_T.Text = redMod.Flow; AmountRange_T.Text = redMod.AmountRange; RedNum_T.Text = redMod.RedNum.ToString(); CodeFormat_T.Text = redMod.CodeFormat; SDate_T.Text = redMod.SDate.ToString("yyyy-MM-dd"); EDate_T.Text = redMod.EDate.ToString("yyyy-MM-dd"); Wishing_T.Text = redMod.Wishing; Remind_T.Text = redMod.Remind; Save_Btn.Text = "保存信息"; CodeFormat_T.Attributes["disabled"] = "disabled"; RedNum_T.Attributes["disabled"] = "disabled"; AmountRange_T.Attributes["disabled"] = "disabled"; } else { Flow_T.Text = function.GetRandomString(10).ToUpper(); SDate_T.Text = DateTime.Now.ToString("yyyy-MM-dd"); EDate_T.Text = DateTime.Now.AddYears(1).ToString("yyyy-MM-dd"); } M_WX_APPID appMod = appBll.SelReturnModel(AppID); Alias_L.Text = appMod.Alias; Call.SetBreadCrumb(Master, "<li><a href='Home.aspx'>移动微信</a></li><li class='active'><a href='RedPacket.aspx'>红包列表</a></li><li><a href='" + Request.RawUrl + "'>红包管理</a>[公众号:" + appMod.Alias + "]</li>"); }
protected void Share_Btn_Click(object sender, EventArgs e) { appMod = appBll.SelReturnModel(1); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=http%3a%2f%2fv.wodian8.com%2fwxshare.aspx%3fappid%3d1&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; Response.Redirect(url); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); timestr = Convert.ToInt64(ts.TotalSeconds).ToString(); WxAPI wxapi = WxAPI.Code_Get(1); appMod = appBll.SelReturnModel(1); string result = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appMod.APPID + "&secret=" + appMod.Secret); if (result.Contains("errcode")) { wxapi.ErroMsg(result); } //{"access_token":"7EHneznPapbfKYIQISQGVw4comvbkxIWe5e7JmTkp2Y5P93aIO5FjjEeyvk65L4lcPeL6VuMOMZ7CKel95L_ljZnjZrdi-MGPK9mZZOuSN8","expires_in":7200} JObject obj = JsonConvert.DeserializeObject <JObject>(result); appMod.Token = obj["access_token"].ToString(); appMod.TokenDate = DateTime.Now; appBll.UpdateByID(appMod); string jsapi_ticket = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + appMod.Token + "&type=jsapi"); JObject jsapi_obj = (JObject)JsonConvert.DeserializeObject(jsapi_ticket); string stringA = "jsapi_ticket=" + jsapi_obj["ticket"].ToString() + "&noncestr=" + nonceStr + "×tamp=" + timestr + "&url=" + Request.Url.AbsoluteUri; paySign = EncryptHelper.SHA1(stringA).ToLower(); } catch (Exception ex) { } } }
protected void Page_Load(object sender, EventArgs e) { if (AppId <= 0) { function.WriteErrMsg("请先配置公众号信息,再进入该页面,[<a href='WxAppManage.aspx'>前往配置</a>]"); } if (!IsPostBack) { M_WX_APPID appmod = appBll.SelReturnModel(AppId); string alias = " [公众号:" + appmod.Alias + "]"; if (Mid > 0) { M_WX_ReplyMsg rpMod = rpBll.SelReturnModel(Mid); filter_T.Text = rpMod.fiter; M_WXImgItem item = JsonConvert.DeserializeObject <M_WXImgItem>(rpMod.Content); Title_T.Text = item.Title; Content_T.Text = item.Description; PicUrl_T.Text = item.PicUrl; Url_T.Text = item.Url; function.Script(this, "SetRadVal('msgtype_rad','" + rpMod.MsgType + "');"); IsDefault_Chk.Checked = rpMod.IsDefault == 1; } Call.SetBreadCrumb(Master, "<li><a href='Home.aspx'>移动微信</a></li><li class='active'><a href='ReplyList.aspx'>回复管理</a></li></li><li class='active'>添加回复" + alias + "</li>"); } }
public void MyBind() { if (Mid > 0) { M_WX_APPID wxmod = wxbll.SelReturnModel(Mid); Alias_T.Text = wxmod.Alias; AppID_T.Text = wxmod.APPID; Secret_T.Text = wxmod.Secret; Token_L.Text = wxmod.Token; WxNo_T.Text = wxmod.WxNo; OrginID_T.Text = wxmod.OrginID; } if (string.IsNullOrEmpty(Token_L.Text)) { Token_L.Text = "<span style='color:#999'>系统自动获取</span>"; } }
public void MyBind() { DataTable dt = wxuserBll.SelByAppId(AppId, Key_T.Text); EGV.DataSource = dt; EGV.DataBind(); M_WX_APPID appmod = appBll.SelReturnModel(AppId); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string alias = ""; M_WX_APPID appmod = appBll.SelReturnModel(AppID); if (!string.IsNullOrEmpty(appmod.WelStr)) { msgMod = JsonConvert.DeserializeObject <M_WxImgMsg>(appmod.WelStr); Title_T.Text = msgMod.Articles[0].Title; Content_T.Text = msgMod.Articles[0].Description; PicUrl_T.Text = msgMod.Articles[0].PicUrl; Url_T.Text = msgMod.Articles[0].Url; } alias = " [公众号:" + appmod.Alias + "]"; Call.SetBreadCrumb(Master, "<li><a href='/Admin/Main.aspx'>工作台</a></li><li><a href='WxAppManage.aspx'>公众号管理</a></li><li class='active'>欢迎语" + alias + "</li>"); } }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { M_APIResult result = new M_APIResult(); result.retcode = M_APIResult.Failed; WxAPI api = WxAPI.Code_Get(AppId); string action = Request["action"]; //result.result = api.AccessToken; //RepToClient(result); try { switch (action) { case "create": string jsondata = "{\"button\":" + Request.Form["menus"] + "}"; result.result = api.CreateWxMenu(jsondata); if (!result.result.Contains("errmsg")) { result.retcode = M_APIResult.Success; } else { result.retmsg = result.result; } break; case "get": result.result = api.GetWxMenu(); if (!result.result.Contains("errmsg")) { result.retcode = M_APIResult.Success; } else { result.retmsg = result.result; } break; default: result.retmsg = "接口[" + action + "]不存在"; break; } } catch (Exception ex) { result.retmsg = ex.Message; } RepToClient(result); } if (!IsPostBack) { M_WX_APPID appmod = appbll.SelReturnModel(AppId); string alias = " [公众号:" + appmod.Alias + "]"; Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/WxAppManage.aspx'>公众号管理</a></li><li class='active'>自定义菜单" + alias + "</li>"); } }
private void MyBind() { if (AppId <= 0) { function.WriteErrMsg("没有指定公众号ID"); } M_WX_APPID appmod = appbll.SelReturnModel(AppId); if (appmod == null) { function.WriteErrMsg("公众号不存在"); } APPID_T.Text = appmod.Pay_APPID; Secret_T.Text = appmod.Pay_Secret; AccountID_T.Text = appmod.Pay_AccountID; Key_T.Text = appmod.Pay_Key; string alias = " [公众号:" + appmod.Alias + "]"; Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/WxAppManage.aspx'>公众号管理</a></li><li class='active'>自定义菜单" + alias + "</li>"); }
private void MyBind() { M_WX_RedDetail detMod = detBll.SelReturnModel(Mid); M_WX_RedPacket redMod = redBll.SelReturnModel(detMod.MainID); M_WX_APPID appMod = appBll.SelReturnModel(redMod.AppID); Alias_L.Text = "[" + appMod.Alias + "]的红包[" + redMod.Name + "]"; RedCode_L.Text = detMod.RedCode; UserName_L.Text = detMod.UserName; function.Script(this, "SetRadVal('zstatus_rad','" + detMod.ZStatus + "');"); Call.SetBreadCrumb(Master, "<li><a href='Home.aspx'>移动微信</a></li><li class='active'><a href='RedPacketFlow.aspx?mainid=" + detMod.MainID + "'>红包列表</a></li><li>红包详情</li>"); }
public void MyBind() { M_WX_APPID appmod = new M_WX_APPID(); appmod = appBll.SelReturnModel(AppId); string alias = " [公众号:" + appmod.Alias + "]"; Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/WxAppManage.aspx'>公众号管理</a></li><li class='active'>回复管理<a href='AddReply.aspx?appid=" + appmod.ID + "'>[添加回复]</a>" + alias + "</li>"); DataTable dt = rpBll.SelByAppID(appmod.ID); EGV.DataSource = dt; EGV.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string alias = ""; if (Mid > 0) { M_WX_APPID model = wxBll.SelReturnModel(Mid); alias = " [公众号:" + model.Alias + "]"; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/Home.aspx'>移动微信</a></li><li class='active'>微信应用" + alias + "</li>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(); int appid = DataConverter.CLng(Request.QueryString["appid"]); if (appid == 1) { footer_div1.Visible = true; } else if (appid == 2) { footer_div2.Visible = true; } else { footer_div1.Visible = true; } try { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); timestr = Convert.ToInt64(ts.TotalSeconds).ToString(); WxAPI wxapi = WxAPI.Code_Get(appid); appMod = appBll.SelReturnModel(appid); string result = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appMod.APPID + "&secret=" + appMod.Secret); if (result.Contains("errcode")) { wxapi.ErroMsg(result); } //{"access_token":"7EHneznPapbfKYIQISQGVw4comvbkxIWe5e7JmTkp2Y5P93aIO5FjjEeyvk65L4lcPeL6VuMOMZ7CKel95L_ljZnjZrdi-MGPK9mZZOuSN8","expires_in":7200} JObject obj = JsonConvert.DeserializeObject <JObject>(result); appMod.Token = obj["access_token"].ToString(); appMod.TokenDate = DateTime.Now; appBll.UpdateByID(appMod); string jsapi_ticket = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + appMod.Token + "&type=jsapi"); JObject jsapi_obj = (JObject)JsonConvert.DeserializeObject(jsapi_ticket); string stringA = "jsapi_ticket=" + jsapi_obj["ticket"].ToString() + "&noncestr=" + nonceStr + "×tamp=" + timestr + "&url=" + Request.Url.AbsoluteUri; paySign = EncryptHelper.SHA1(stringA).ToLower(); string jsapi_ticket1 = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxapi.AccessToken + "&type=jsapi", "POST", "{\"action_name\":\"QR_LIMIT_STR_SCENE\",\"action_info\":{\"scene\":{\"scene_str\":\"" + mu.UserID + "\"}}}"); if (jsapi_ticket1 != "") { JObject jsapi_obj1 = (JObject)JsonConvert.DeserializeObject(jsapi_ticket1); Image1.ImageUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + jsapi_obj1["ticket"]; } } catch (Exception ex) { } } }
public static M_WX_APPID WX_SelMyModel() { B_WX_APPID appBll = new B_WX_APPID(); M_UserInfo mu = new B_User().GetLogin(); int appid = DataConvert.CLng(DBCenter.ExecuteScala("ZL_CommonModel", "SpecialID", "GeneralID=" + mu.SiteID)); if (appid < 1) { return(null); } M_WX_APPID appMod = appBll.SelReturnModel(appid); return(appMod); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(); int appid = DataConverter.CLng(Request.QueryString["appid"]); if (mu != null && mu.UserID > 0) { try { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); timestr = Convert.ToInt64(ts.TotalSeconds).ToString(); if (appid == 0) { appid = 1; } WxAPI wxapi = WxAPI.Code_Get(appid); appMod = appBll.SelReturnModel(appid); uappMod = uappBll.SelModelByUid(mu.UserID, "wechat"); wuserMod = wxapi.GetWxUserModel(uappMod.OpenID); userface.Src = wuserMod.HeadImgUrl; userface.Alt = wuserMod.Name; NickName.Text = wuserMod.Name; string jsapi_ticket = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + wxapi.AccessToken + "&type=jsapi"); JObject jsapi_obj = (JObject)JsonConvert.DeserializeObject(jsapi_ticket); string stringA = "jsapi_ticket=" + jsapi_obj["ticket"].ToString() + "&noncestr=" + nonceStr + "×tamp=" + timestr + "&url=" + Request.Url.AbsoluteUri; paySign = EncryptHelper.SHA1(stringA).ToLower(); string jsapi_ticket1 = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxapi.AccessToken + "&type=jsapi", "POST", "{\"action_name\":\"QR_LIMIT_STR_SCENE\",\"action_info\":{\"scene\":{\"scene_str\":\"" + mu.UserID + "\"}}}"); if (jsapi_ticket1 != "") { JObject jsapi_obj1 = (JObject)JsonConvert.DeserializeObject(jsapi_ticket1); Image1.ImageUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + jsapi_obj1["ticket"]; } } catch (Exception ex) { } } else { Response.Redirect("/wxpromo.aspx?r=/User"); } } }
protected void Page_Load(object sender, EventArgs e) { ExHelper.CheckUserAuth("wechat"); if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(); M_CommonData storeMod = ExHelper.Store2_User(); M_WX_APPID appMod = new M_WX_APPID(); if (DataConvert.CLng(storeMod.SpecialID) > 0) { appMod = appBll.SelReturnModel(DataConvert.CLng(storeMod.SpecialID)); } if (appMod != null) { WXNo_T.Text = appMod.WxNo; AppID_T.Text = appMod.APPID; Secret_T.Text = appMod.Secret; QCode_UP.FileUrl = function.GetImgUrl(appMod.QRCode); OrginID.Text = appMod.OrginID; Pay_Account.Text = appMod.Pay_AccountID; Pay_Key.Text = appMod.Pay_Key; } } }
public IActionResult WelPage() { //if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.portable, "wechat")) {return WriteErr } M_WX_APPID appmod = appBll.SelReturnModel(AppId); M_WxImgMsg msgMod = new M_WxImgMsg(); msgMod.Articles.Add(new M_WXImgItem()); if (!string.IsNullOrEmpty(appmod.WelStr)) { msgMod = JsonConvert.DeserializeObject <M_WxImgMsg>(appmod.WelStr); //try //{ // Title_T.Text = msgMod.Articles[0].Title; // Content_T.Text = msgMod.Articles[0].Description; // PicUrl_T.Text = msgMod.Articles[0].PicUrl; // Url_T.Text = msgMod.Articles[0].Url; //} //catch { Content_T.Text = "数据格式错误:" + appmod.WelStr; } } return(View(viewDir + "WelPage.cshtml", msgMod.Articles[0])); }
protected void Page_Load(object sender, EventArgs e) { try { api = WxAPI.Code_Get(AppId); } catch (Exception ex) { function.WriteErrMsg("微信公众号配置不正确," + ex.Message); } if (function.isAjax()) { M_APIResult result = new M_APIResult(); result.retcode = M_APIResult.Failed; WxAPI api = WxAPI.Code_Get(AppId); string action = Request["action"]; //result.result = api.AccessToken; //RepToClient(result); try { switch (action) { case "create": string jsondata = "{\"button\":" + Request.Form["menus"] + "}"; result.result = api.CreateWxMenu(jsondata); if (!result.result.Contains("errmsg")) { result.retcode = M_APIResult.Success; } else { result.retmsg = result.result; } break; case "get": result.result = api.GetWxMenu(); if (!result.result.Contains("errmsg")) { result.retcode = M_APIResult.Success; } else { result.retmsg = result.result; } break; default: result.retmsg = "接口[" + action + "]不存在"; break; } } catch (Exception ex) { result.retmsg = ex.Message; } RepToClient(result); } if (!IsPostBack) { B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.portable, "wechat"); M_WX_APPID appmod = appbll.SelReturnModel(AppId); string alias = " [公众号:" + appmod.Alias + "]"; string bread = ""; //检测是否关联了店铺 DataTable dt = DBCenter.Sel("ZL_CommonModel", "SpecialID IS NOT NULL AND SpecialID='" + appmod.ID + "'"); if (dt.Rows.Count < 1) { bread += "<span style='color:orange;'>(尚未绑定店铺)</span>"; } else if (dt.Rows.Count == 1) { StoreId = DataConvert.CLng(dt.Rows[0]["GeneralID"]); bread += "<span><a href='javascript:;' onclick='wxmenu.initMenu();' class='btn btn-info btn-xs'>初始化菜单(" + dt.Rows[0]["Title"] + ")</a></span>"; } else if (dt.Rows.Count > 1) { StoreId = DataConvert.CLng(dt.Rows[0]["GeneralID"]); bread += "<span><a href='javascript:;' onclick='wxmenu.initMenu();' class='btn btn-info btn-xs'>初始化菜单<span class='color:orange;'>(绑定了多个店铺)</span></a></span>"; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='" + CustomerPageAction.customPath2 + "WeiXin/WxAppManage.aspx'>公众号管理</a></li><li class='active'>自定义菜单" + alias + " " + bread + "</li>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { B_WX_APPID wxBll = new B_WX_APPID(); B_Content conBll = new B_Content(); M_Payment payMod = payBll.SelModelByPayNo(PayNo); if (payMod == null) { function.WriteErrMsg("支付单不存在"); } if (payMod.Status != (int)M_Payment.PayStatus.NoPay) { function.WriteErrMsg("该订单不可付款"); } M_OrderList orderMod = orderBll.SelModelByOrderNo(payMod.PaymentNum.Trim(',')); if (orderMod.StoreID < 1) { function.WriteErrMsg("订单未绑定店铺"); } M_CommonData storeMod = conBll.SelReturnModel(orderMod.StoreID); if (storeMod == null) { function.WriteErrMsg("店铺信息不存在"); } appMod = wxBll.SelReturnModel(DataConverter.CLng(storeMod.SpecialID)); if (appMod == null) { function.WriteErrMsg("店铺未绑定微信"); } //appMod = WxPayApi.Pay_GetByID(AppID); if (string.IsNullOrEmpty(appMod.APPID)) { throw new Exception("未设置APPID"); } if (string.IsNullOrEmpty(appMod.Secret)) { throw new Exception("未指定Secret"); } if (string.IsNullOrEmpty(appMod.Pay_AccountID)) { throw new Exception("未设置商户号"); } if (string.IsNullOrEmpty(appMod.Pay_Key)) { throw new Exception("未设置支付Key"); } //首次进入自动跳转获取支付code if (!State.Equals("redirect")) { string siteurl = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/PayOnline/wxpay_mp.aspx?payno=" + PayNo + "&appid=" + appMod.ID + "&SuccessUrl=" + SuccessUrl); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=" + siteurl + "&response_type=code&scope=snsapi_userinfo&state=redirect#wechat_redirect"; Response.Redirect(url); } WeiXinPay();//统一下单,并填充预付单号 timestr = WxAPI.HP_GetTimeStamp(); string stringA = "appId=" + appMod.APPID + "&nonceStr=" + WxAPI.nonce + "&package=prepay_id=" + prepay_id + "&signType=MD5&timeStamp=" + timestr; string stringSignTemp = stringA + "&key=" + appMod.Pay_Key; paySign = StringHelper.MD5(stringSignTemp).ToUpper(); } }