/// <summary> /// 加载信息 /// </summary> private void LoadInfo() { if (!IsPostBack) { this.txtBase1.Text = BaseConfigService.GetById(13); this.txtBase2.Text = BaseConfigService.GetById(12); this.txtBase3.Text = BaseConfigService.GetById(13); this.txtBase4.Text = BaseConfigService.GetById(14); this.txtBase5.Text = BaseConfigService.GetById(15); this.txtBase6.Text = BaseConfigService.GetById(16); this.txtBase7.Text = BaseConfigService.GetById(17); this.txtBase8.Text = BaseConfigService.GetById(18); this.txtBase9.Text = BaseConfigService.GetById(19); this.txtBase12.Text = BaseConfigService.GetById(20); this.txtBase13.Text = BaseConfigService.GetById(21); this.txtBase14.Text = BaseConfigService.GetById(22); this.txtBase15.Text = BaseConfigService.GetById(23); this.tb_id.Text = BaseConfigService.GetById(39); this.tb_secret.Text = BaseConfigService.GetById(40); this.tb_URL.Text = BaseConfigService.GetById(41); lblURL1.Text = BaseConfigService.GetById(24); lblURL2.Text = BaseConfigService.GetById(25); lblURL3.Text = BaseConfigService.GetById(26); lblURL4.Text = BaseConfigService.GetById(27); lblURL5.Text = BaseConfigService.GetById(28); txtMonthValue.Text = BaseConfigService.GetById(1); txtYearValue.Text = BaseConfigService.GetById(2); txtVideo.Text = BaseConfigService.GetById(5); } }
public async Task <ActionResult> Post(PostModel postModel) { long id = long.Parse(Request["id"]); var config = await BaseConfigService.GetById(id); if (!CheckSignature.Check(postModel.Signature, postModel.Timestamp, postModel.Nonce, config.Token)) { return(Content("参数错误!")); } postModel.Token = config.Token; //根据自己后台的设置保持一致 postModel.EncodingAESKey = config.EncodingAESKey; //根据自己后台的设置保持一致 postModel.AppId = config.Appid; //wx5d8ab2a66119249e //自定义MessageHandler,对微信请求的详细判断操作都在这里面。 //var messageHandler = new BookMessageHandler(Request.InputStream, postModel, config.DefaultResponse);//接收消息 Assembly assembly = Assembly.Load("Weixin.Core"); Type t = assembly.GetType("Weixin.Core.BookMessageHandler"); Object[] constructParms = new object[] { Request.InputStream, postModel, config.DefaultResponse }; var messageHandler = Activator.CreateInstance(t, constructParms) as MessageHandler <MessageContext <IRequestMessageBase, IResponseMessageBase> >; messageHandler.Execute(); //执行微信处理过程 return(new FixWeixinBugWeixinResult(messageHandler)); //返回结果 }
/// <summary> /// 生成二维码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnErWeiCode_Click(object sender, EventArgs e) { string websiteUrl = BaseConfigService.GetById(12); if (websiteUrl == "") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('请设置网站地址!');", true); return; } DataSet ds = UserInfoService.GetList("infoType in (2,3,4)"); if (ds.Tables[0].Rows.Count > 0) { string userUrl = ""; int id = 0; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { id = Convert.ToInt32(ds.Tables[0].Rows[i]["id"]); userUrl = websiteUrl + "/userDetail_" + id + "_1.html"; string url = create_two(userUrl, id); //更新二维码信息 UserInfoService.UpdateErWeiCode(id, url); } } ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('生成成功!');", true); }
//从控件上传文件 public void fileUpload(int num) { string spic = ""; if (num == 1) { #region 微博上传 if (filepic_weibo.PostedFile != null && filepic_weibo.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.ErWeiImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.ErWeiImgPath)); //创建目录 } spic = DoClass.UploadFile(filepic_weibo.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.ErWeiImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { //ViewState["img1Name"] = spic; spic = Global_Upload.ErWeiImgPath + spic; // ViewState["newsImg1"] = spic; lblImgWeiBo.Text = spic; BaseConfigService.SetValue(11111, spic); } } #endregion } }
/// <summary> /// 获取跳转路径 /// </summary> private void JumpURL() { string weburl = BaseConfigService.GetById(12); string src = CRequest.GetString("src").Replace(weburl, ""); string url = FriendsInfoService.GetUrl(src); Response.Write(url); }
public async Task <ContentResult> Get(PostModel postModel, string echostr) { long id = long.Parse(Request["id"]); var config = await BaseConfigService.GetById(id); if (CheckSignature.Check(postModel.Signature, postModel.Timestamp, postModel.Nonce, config.Token)) { return(Content(echostr)); //返回随机字符串则表示验证通过 } else { return(Content("failed:" + config.Token + "," + config.Appid + "。" + "如果你在浏览器中看到这句话,说明此地址可以被作为微信公众账号后台的Url,请注意保持Token一致。")); } }
/// <summary> /// 页面标题、关键字和描述信息 /// </summary> private void KeyWordBind() { string url = Request.Url.ToString().Replace("aspx", "html"); KeyWordInfo km = KeyWordInfoService.GetModel(url); if (km != null) { ViewState["title"] = km.title; ViewState["keyword"] = km.keyword; ViewState["miaoshu"] = km.description; } else { ViewState["title"] = BaseConfigService.GetById(9); ViewState["keyword"] = BaseConfigService.GetById(23); ViewState["miaoshu"] = BaseConfigService.GetById(13); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { BaseConfigService.SetValue(1, this.txtMonthValue.Text.Trim()); BaseConfigService.SetValue(2, this.txtYearValue.Text.Trim()); BaseConfigService.SetValue(5, this.txtVideo.Text.Trim()); BaseConfigService.SetValue(11, this.txtBase1.Text.Trim()); BaseConfigService.SetValue(12, this.txtBase2.Text.Trim()); BaseConfigService.SetValue(13, this.txtBase3.Text.Trim()); BaseConfigService.SetValue(14, this.txtBase4.Text.Trim()); BaseConfigService.SetValue(15, this.txtBase5.Text.Trim()); BaseConfigService.SetValue(16, this.txtBase6.Text.Trim()); BaseConfigService.SetValue(17, this.txtBase7.Text.Trim()); BaseConfigService.SetValue(18, this.txtBase8.Text.Trim()); BaseConfigService.SetValue(19, this.txtBase9.Text.Trim()); BaseConfigService.SetValue(20, this.txtBase12.Text.Trim()); BaseConfigService.SetValue(21, this.txtBase13.Text.Trim()); BaseConfigService.SetValue(22, this.txtBase14.Text.Trim()); BaseConfigService.SetValue(23, this.txtBase15.Text.Trim()); BaseConfigService.SetValue(39, this.tb_id.Text.Trim()); BaseConfigService.SetValue(40, this.tb_secret.Text.Trim()); BaseConfigService.SetValue(41, this.tb_URL.Text.Trim()); string spic = ""; if (this.FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload1.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { spic = Global_Upload.NewsImgPath + spic; lblURL1.Text = spic; } } if (this.FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload2.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { spic = Global_Upload.NewsImgPath + spic; lblURL2.Text = spic; } } if (this.FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload3.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { spic = Global_Upload.NewsImgPath + spic; lblURL3.Text = spic; } } if (this.FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload4.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { spic = Global_Upload.NewsImgPath + spic; lblURL4.Text = spic; } } if (this.FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload5.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { spic = Global_Upload.NewsImgPath + spic; lblURL5.Text = spic; } } BaseConfigService.SetValue(24, this.lblURL1.Text.Trim()); BaseConfigService.SetValue(25, this.lblURL2.Text.Trim()); BaseConfigService.SetValue(26, this.lblURL3.Text.Trim()); BaseConfigService.SetValue(27, this.lblURL4.Text.Trim()); BaseConfigService.SetValue(28, this.lblURL5.Text.Trim()); ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true); }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { BaseConfigService.SetValue(222222, this.content2.Value.Trim().Replace("'", "\"")); ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true); }
/// <summary> /// 加载信息 /// </summary> private void LoadInfo() { lblImgWeiBo.Text = BaseConfigService.GetById(11111); this.content2.Value = BaseConfigService.GetById(11112); }