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>"); }
//进入该页即开始推广,自动创建用户,关联APPID protected void Page_Load(object sender, EventArgs e) { int AppID = DataConverter.CLng(Request.QueryString["appid"]); B_User buser = new B_User(); B_UserAPP appBll = new B_UserAPP(); int bindid = DataConverter.CLng(Session["WX_BindID"]); int puid = DataConverter.CLng(Session["WX_PUserID"]); string rurl = Request["r"]; Session["WX_OpenID"] = ""; buser.CheckLogin(); //if (puid < 1) { function.WriteErrMsg("推荐用户不存在"); } M_WX_APPID appMod = new M_WX_APPID();//自行置入缓存,使用时取出 appMod = WxPayApi.Pay_GetByID(AppID); string code = Request["code"]; string access_token = APIHelper.GetWebResult("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appMod.APPID + "&secret=" + appMod.Secret + "&code=" + code + "&grant_type=authorization_code"); JObject obj = (JObject)JsonConvert.DeserializeObject(access_token); JObject userobj = (JObject)JsonConvert.DeserializeObject(APIHelper.GetWebResult("https://api.weixin.qq.com/sns/userinfo?access_token=" + obj["access_token"] + "&openid=" + obj["openid"] + "&lang=zh_CN")); string openID = obj["openid"].ToString(); Session["WX_OpenID"] = openID; Response.Redirect(rurl); }
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) { } } }
/// <summary> /// [main]获取目标微信的缓存,如果不存在则插入缓存 /// 根据需要对其中的数据进行局部更新: WxAPI.Code_Get(appmod).AppId.WelStr = appmod.WelStr; /// </summary> public static WxAPI Code_Get(M_WX_APPID appMod) { if (appMod == null || appMod.ID < 1) { return(null); } if (string.IsNullOrEmpty(appMod.APPID) || string.IsNullOrEmpty(appMod.Secret)) { return(null); } WxAPI m_api = WXCodeList.FirstOrDefault(p => p.AppId.APPID.Equals(appMod.APPID) && p.AppId.Secret.Equals(appMod.Secret)); if (m_api == null) { m_api = new WxAPI(appMod); string token = m_api.AccessToken; Code_Add(m_api); } else if (m_api.AppId.ID == 0) { WXCodeList.Remove(m_api); return(Code_Get(appMod)); } return(m_api); }
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>"); } }
/// <summary> /// 发送红包(1-200),其他金额需要与微信联系 /// </summary> public static WxPayData Pay_RedPacket(WxPayData wxdata, M_WX_APPID appMod) { //wxdata.SetValue("mch_billno", api.AppId.Pay_AccountID + DateTime.Now.ToString("yyyyMMdd") + function.GetRandomString(10, 2)); //wxdata.SetValue("send_name", SiteConfig.SiteInfo.SiteName); ////接受红包的用户用户在wxappid下的openid //wxdata.SetValue("re_openid", uaMod.OpenID);//oDTTbwLa7WuySP0WcJJzYJmErCQ4 //wxdata.SetValue("total_amount", (int)(detMod.Amount * 100));//总金额 //wxdata.SetValue("total_num", 1);//要发给多少人 //wxdata.SetValue("wishing", redMod.Wishing);//红包祝福语 //wxdata.SetValue("act_name", redMod.Name);//活动名称 //wxdata.SetValue("remark", redMod.Remind);//红包备注 //wxdata.SetValue("client_ip", "58.215.75.11");//调用接口的机器IP地址 string url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack"; wxdata.SetValue("mch_id", appMod.Pay_AccountID); //商户号 wxdata.SetValue("wxappid", appMod.Pay_APPID); //公众帐号ID wxdata.SetValue("nonce_str", WxAPI.nonce); wxdata.SetValue("sign", wxdata.MakeSign()); string xml = wxdata.ToXml(); string response = HttpService.Post(xml, url, true, 20, appMod); WxPayData result = new WxPayData(); result.FromXml(response); return(result); }
/** * * 查询订单 * @param WxPayData inputObj 提交给查询订单API的参数 * @param int timeOut 超时时间 * @throws WxPayException * @return 成功时返回订单查询结果,其他抛异常 */ public static WxPayData OrderQuery(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 20) { string url = "https://api.mch.weixin.qq.com/pay/orderquery"; //检测必填参数 if (!inputObj.IsSet("out_trade_no") && !inputObj.IsSet("transaction_id")) { throw new WxPayException("订单查询接口中,out_trade_no、transaction_id至少填一个!"); } inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 inputObj.SetValue("nonce_str", WxPayApi.GenerateNonceStr()); //随机字符串 inputObj.SetValue("sign", inputObj.MakeSign()); //签名 string xml = inputObj.ToXml(); var start = DateTime.Now; string response = HttpService.Post(xml, url, false, timeOut, appMod); //调用HTTP通信接口提交数据 var end = DateTime.Now; int timeCost = (int)((end - start).TotalMilliseconds); //获得接口耗时 //将xml格式的数据转化为对象以返回 WxPayData result = new WxPayData(); result.FromXml(response); ReportCostTime(url, timeCost, result, appMod);//测速上报 return(result); }
/// <summary> /// 统一下单 /// </summary> /// <param name="inputObj">提交给统一下单API的参数</param> /// <param name="appMod">发起支付的公众号|服务商与信息</param> /// <param name="timeOut">超时时间</param> /// <returns>成功时返回,其他抛异常</returns> public static WxPayData UnifiedOrder(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 20) { string url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; //检测必填参数 if (!inputObj.IsSet("out_trade_no")) { throw new WxPayException("缺少统一支付接口必填参数out_trade_no!"); } else if (!inputObj.IsSet("body") || string.IsNullOrEmpty(inputObj.GetValue("body").ToString())) { throw new WxPayException("缺少统一支付接口必填参数body或body的值为空!"); } else if (!inputObj.IsSet("total_fee")) { throw new WxPayException("缺少统一支付接口必填参数total_fee!"); } else if (!inputObj.IsSet("trade_type")) { throw new WxPayException("缺少统一支付接口必填参数trade_type!"); } //异步通知url未设置,必须在上层指定 if (!inputObj.IsSet("notify_url")) { throw new Exception("未指定异步回调notify_url"); } //关联参数 //if (inputObj.GetValue("trade_type").ToString() == "JSAPI" && !inputObj.IsSet("openid")) //{ // throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!"); //} //if (inputObj.GetValue("trade_type").ToString() == "NATIVE" && !inputObj.IsSet("product_id")) //{ // throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!"); //} //-------------设置配置的值 inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 inputObj.SetValue("spbill_create_ip", ""); //终端ip if (!inputObj.IsSet("nonce_str")) //必须指定 { inputObj.SetValue("nonce_str", WxAPI.nonce); //随机字符串 } //签名 inputObj.SetValue("sign", inputObj.MakeSign()); string xml = inputObj.ToXml(); //var start = DateTime.Now; string response = HttpService.Post(xml, url, false, timeOut, appMod); //var end = DateTime.Now; //int timeCost = (int)((end - start).TotalMilliseconds); WxPayData result = new WxPayData(); result.FromXml(response); //ReportCostTime(url, timeCost, result, appMod);//测速上报 return(result); }
/** * * 关闭订单 * @param WxPayData inputObj 提交给关闭订单API的参数 * @param int timeOut 接口超时时间 * @throws WxPayException * @return 成功时返回,其他抛异常 */ public static WxPayData CloseOrder(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 20) { string url = "https://api.mch.weixin.qq.com/pay/closeorder"; //检测必填参数 if (!inputObj.IsSet("out_trade_no")) { throw new WxPayException("关闭订单接口中,out_trade_no必填!"); } inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 //inputObj.SetValue("nonce_str",GenerateNonceStr());//随机字符串 inputObj.SetValue("sign", inputObj.MakeSign()); //签名 string xml = inputObj.ToXml(); var start = DateTime.Now;//请求开始时间 string response = HttpService.Post(xml, url, false, timeOut, appMod); var end = DateTime.Now; int timeCost = (int)((end - start).TotalMilliseconds); WxPayData result = new WxPayData(); result.FromXml(response); ReportCostTime(url, timeCost, result, appMod);//测速上报 return(result); }
/** * * 转换短链接 * 该接口主要用于扫码原生支付模式一中的二维码链接转成短链接(weixin://wxpay/s/XXXXXX), * 减小二维码数据量,提升扫描速度和精确度。 * @param WxPayData inputObj 提交给转换短连接API的参数 * @param int timeOut 接口超时时间 * @throws WxPayException * @return 成功时返回,其他抛异常 */ public static WxPayData ShortUrl(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 20) { string url = "https://api.mch.weixin.qq.com/tools/shorturl"; //检测必填参数 if (!inputObj.IsSet("long_url")) { throw new WxPayException("需要转换的URL,签名用原串,传输需URL encode!"); } inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 inputObj.SetValue("nonce_str", GenerateNonceStr()); //随机字符串 inputObj.SetValue("sign", inputObj.MakeSign()); //签名 string xml = inputObj.ToXml(); var start = DateTime.Now;//请求开始时间 string response = HttpService.Post(xml, url, false, timeOut, appMod); var end = DateTime.Now; int timeCost = (int)((end - start).TotalMilliseconds); WxPayData result = new WxPayData(); result.FromXml(response); ReportCostTime(url, timeCost, result, appMod);//测速上报 return(result); }
/** * 下载对账单 * @param WxPayData inputObj 提交给下载对账单API的参数 * @param int timeOut 接口超时时间 * @throws WxPayException * @return 成功时返回,其他抛异常 */ public static WxPayData DownloadBill(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 20) { string url = "https://api.mch.weixin.qq.com/pay/downloadbill"; //检测必填参数 if (!inputObj.IsSet("bill_date")) { throw new WxPayException("对账单接口中,缺少必填参数bill_date!"); } inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 inputObj.SetValue("nonce_str", GenerateNonceStr()); //随机字符串 inputObj.SetValue("sign", inputObj.MakeSign()); //签名 string xml = inputObj.ToXml(); string response = HttpService.Post(xml, url, false, timeOut, appMod);//调用HTTP通信接口以提交数据到API WxPayData result = new WxPayData(); //若接口调用失败会返回xml格式的结果 if (response.Substring(0, 5) == "<xml>") { result.FromXml(response); } //接口调用成功则返回非xml格式的数据 else { result.SetValue("result", response); } return(result); }
/** * * 撤销订单API接口 * @param WxPayData inputObj 提交给撤销订单API接口的参数,out_trade_no和transaction_id必填一个 * @param int timeOut 接口超时时间 * @throws WxPayException * @return 成功时返回API调用结果,其他抛异常 */ public static WxPayData Reverse(WxPayData inputObj, M_WX_APPID appMod, int timeOut = 6) { string url = "https://api.mch.weixin.qq.com/secapi/pay/reverse"; //检测必填参数 if (!inputObj.IsSet("out_trade_no") && !inputObj.IsSet("transaction_id")) { throw new WxPayException("撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!"); } inputObj.SetValue("appid", appMod.Pay_APPID); //公众帐号ID inputObj.SetValue("mch_id", appMod.Pay_AccountID); //商户号 inputObj.SetValue("nonce_str", GenerateNonceStr()); //随机字符串 inputObj.SetValue("sign", inputObj.MakeSign()); //签名 string xml = inputObj.ToXml(); var start = DateTime.Now;//请求开始时间 string response = HttpService.Post(xml, url, true, timeOut, appMod); var end = DateTime.Now; int timeCost = (int)((end - start).TotalMilliseconds); WxPayData result = new WxPayData(); result.FromXml(response); ReportCostTime(url, timeCost, result, appMod);//测速上报 return(result); }
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); }
public IActionResult WXConfig_Submit(M_WX_APPID model) { M_WX_APPID wxmod = new M_WX_APPID(); if (Mid > 0) { wxmod = appBll.SelReturnModel(Mid); } wxmod.Alias = model.Alias; wxmod.APPID = model.APPID.Trim(); wxmod.Secret = model.Secret.Trim(); wxmod.WxNo = model.WxNo.Trim(); wxmod.Status = 1; wxmod.OrginID = model.OrginID.Trim(); wxmod.QRCode = GetParam("qrcode_t"); if (Mid > 0) { appBll.UpdateByID(wxmod); } else { wxmod.ID = appBll.Insert(wxmod); } return(WriteOK("保存成功!", "WxAppManage")); }
protected void Save_B_Click(object sender, EventArgs e) { M_WX_APPID appMod = ExHelper.WX_SelMyModel(); M_WX_ReplyMsg rpMod = new M_WX_ReplyMsg(); if (Mid > 0) { rpMod = rpBll.SelReturnModel(Mid); } M_WXImgItem item = new M_WXImgItem() { Title = Title_T.Text, Description = Content_T.Text, PicUrl = PicUrl_T.Text, Url = Url_T.Text }; rpMod.fiter = filter_T.Text.Trim(); rpMod.Content = JsonConvert.SerializeObject(item); rpMod.MsgType = item.IsText ? "0" : "1"; rpMod.AppId = appMod.ID; rpMod.MsgType = Request.Form["msgtype_rad"]; rpMod.IsDefault = IsDefault_Chk.Checked ? 1 : 0; if (Mid > 0) { rpBll.UpdateByID(rpMod); } else { rpBll.Insert(rpMod); } Response.Redirect("AutoReply.aspx?appid="); }
protected void Save_Btn_Click(object sender, EventArgs e) { 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)); } appMod.Alias = storeMod.Title; appMod.APPID = AppID_T.Text.Trim(); if (QCode_UP.HasFile) { QCode_UP.SaveFile(); appMod.QRCode = QCode_UP.FileUrl.Replace("/UploadFiles/", "");; } appMod.WxNo = WXNo_T.Text.Trim(); appMod.Secret = Secret_T.Text.Trim(); appMod.OrginID = OrginID.Text.Trim(); appMod.Pay_AccountID = Pay_Account.Text.Trim(); appMod.Pay_Key = Pay_Key.Text.Trim(); if (appMod.ID > 0) { appBll.UpdateByID(appMod); } else { appMod.ID = appBll.Insert(appMod); storeMod.SpecialID = appMod.ID.ToString(); DBCenter.UpdateSQL("ZL_Store_Reg", "StoreStyleID=" + appMod.ID, "ID=" + storeMod.ItemID); } function.WriteSuccessMsg("操作成功"); }
public string ProcessNotify() { //如果有多个公众号支付,此处要取返回中的公众号ID,再取Key验证 WxPayData notifyData = wxnotify.GetNotifyData(); WxPayData res = GetWxDataMod(); //检查支付结果中transaction_id是否存在 if (!notifyData.IsSet("out_trade_no")) { //若transaction_id不存在,则立即返回结果给微信支付后台 res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中订单号不存在"); ZLLog.L(ZLEnum.Log.pay, new M_Log() { Action = "支付平台异常", Message = PayPlat + ",原因:支付结果中订单号不存在!XML:" + notifyData.ToXml() }); return(res.ToXml()); } string transaction_id = notifyData.GetValue("out_trade_no").ToString(); //查询订单,判断订单真实性 //if (!QueryOrder(transaction_id)) //{ // //若订单查询失败,则立即返回结果给微信支付后台 // WxPayData res = GetWxDataMod(); // res.SetValue("return_code", "FAIL"); // res.SetValue("return_msg", "订单查询失败"); // ZLLog.L(ZLEnum.Log.pay, new M_Log() // { // Action = "支付平台异常", // Message = PayPlat + ",支付单:" + transaction_id + ",原因:订单查询失败!XML:" + notifyData.ToXml() // }); // return res.ToXml(); //} //查询订单成功 //else //{ //} //未指定,则默认加载PC扫码配置 M_Payment pinfo = payBll.SelModelByPayNo(notifyData.GetValue("out_trade_no").ToString()); M_WX_APPID appMod = WxPayApi.Pay_GetByID(DataConvert.CLng(pinfo.PlatformInfo)); notifyData.PayKey = appMod.Pay_Key; try { notifyData.CheckSign(); PayOrder_Success(pinfo, notifyData); } catch (Exception ex) { ZLLog.L(ZLEnum.Log.pay, new M_Log() { Action = PayPlat + "报错,支付单:" + transaction_id, Message = ex.Message + "||XML:" + notifyData.ToXml() }); } res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); return(res.ToXml()); }
protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod == "GET") { Auth(); return; } try { buser = new B_User(HttpContext.Current); requesdata = GetXml(); //requesdata = "<xml><ToUserName><![CDATA[gh_33273dafc0e4]]></ToUserName> <FromUserName><![CDATA[olwfpsvje_OHogJ8rOANahcqSijk]]></FromUserName> <CreateTime>1434081760</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[pic]]></Content> <MsgId>6159334259197323209</MsgId> </xml>"; if (string.IsNullOrEmpty(requesdata)) { return; } M_WxTextMsg reqMod = new M_WxTextMsg(requesdata); //获取需要返回的公众号 M_WX_APPID appmod = appBll.GetAppByWxNo(reqMod.ToUserName); if (appmod == null) { throw new Exception("目标公众号[" + reqMod.ToUserName + "]不存在"); } api = WxAPI.Code_Get(appmod); errmsg += "动作:" + reqMod.MsgType; switch (reqMod.MsgType) { case "event": //事件--关注处理,后期扩展单击等 { //M_WxImgMsg msgMod = JsonConvert.DeserializeObject<M_WxImgMsg>(appmod.WelStr); M_WxImgMsg msgMod = new M_WxImgMsg(); msgMod.ToUserName = reqMod.FromUserName; msgMod.FromUserName = reqMod.ToUserName; WxEventHandler(reqMod); //系统事件处理 //登录检测,可按需取消或修改位置 M_UserInfo mu = UserBindCheck(reqMod); //if (mu.IsNull) //{ // msgMod.Articles.Add(new M_WXImgItem() // { // Title = "请先关联用户", // Description = "你尚未关联用户,点击登录关联用户", // Url = baseUrl + "/User/Login.aspx?WXOpenID=" + reqMod.FromUserName // }); // RepToClient(msgMod.ToXML()); //} WxMenuBtnHandler(reqMod, msgMod, mu); } break; case "text": //接收文本消息 { string xml = UserTextDeal(reqMod); RepToClient(xml); } break; } } catch (Exception ex) { ZLLog.L("微信报错," + errmsg + ",数据:" + requesdata + ",原因:" + ex.Message); } }
public void MyBind() { DataTable dt = wxuserBll.SelByAppId(AppId, Key_T.Text); EGV.DataSource = dt; EGV.DataBind(); M_WX_APPID appmod = appBll.SelReturnModel(AppId); }
public bool UpdateByID(M_WX_APPID model) { DataRow dr = GetReaderFromModel(model); //return Sql.UpdateByIDs(TbName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters(model)); codeBll.UpdateByID(GetReaderFromModel(model)); return(true); }
public void MyBind() { M_WX_APPID appmod = ExHelper.WX_SelMyModel(); DataTable dt = rpBll.SelByAppID(appmod.ID); EGV.DataSource = dt; EGV.DataBind(); }
public IActionResult WxConfig() { M_WX_APPID wxmod = appBll.SelReturnModel(Mid); if (wxmod == null) { wxmod = new M_WX_APPID(); } return(View(viewDir + "WxConfig.cshtml", wxmod)); }
protected void Page_Load(object sender, EventArgs e) { //if (UserID < 1) { function.WriteErrMsg("推广链接错误,用户不存在"); } Session["WX_PUserID"] = UserID; Session["WX_R"] = Request["r"]; int appid = DataConvert.CLng(Request.QueryString["appid"]); M_WX_APPID appMod = WxPayApi.Pay_GetByID(appid); Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=http%3a%2f%2fv.wodian8.com%2fwxback.aspx%3fappid%3d" + appid + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"); }
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>"); } }
protected void Save_B_Click(object sender, EventArgs e) { M_WX_APPID appmod = appbll.SelReturnModel(AppId); appmod.Pay_APPID = APPID_T.Text; appmod.Pay_Secret = Secret_T.Text; appmod.Pay_AccountID = AccountID_T.Text; appmod.Pay_Key = Key_T.Text; appbll.UpdateByID(appmod); function.WriteSuccessMsg("操作成功", "WxAppManage.aspx"); }
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 IActionResult WxPayConfig_Submit(M_WX_APPID model) { M_WX_APPID appmod = appBll.SelReturnModel(AppId); appmod.Pay_APPID = model.Pay_APPID.Trim(); appmod.Pay_AccountID = model.Pay_AccountID.Trim(); appmod.Pay_Key = model.Pay_Key.Trim(); appmod.Pay_SSLPath = model.Pay_SSLPath.Trim(); appmod.Pay_SSLPassword = model.Pay_SSLPassword.Trim(); appBll.UpdateByID(appmod); return(WriteOK("操作成功", "WxPayConfig")); }
protected void Page_Load(object sender, EventArgs e) { //if (UserID < 1) { function.WriteErrMsg("推广链接错误,用户不存在"); } Session["WX_PUserID"] = UserID; Session["WX_BindID"] = BindID; Session["WX_R"] = Request["r"]; int appid = DataConvert.CLng(Request.QueryString["appid"]); M_WX_APPID appMod = WxPayApi.Pay_GetByID(appid); string url = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/wxback.aspx?appid=" + appid); Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=" + url + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"); }
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>"); } }
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(); }