public WeiXinUsers GetWeiXinUser(string weixinID) { WeiXinUsers weixinuser = null; StringBuilder sql = new StringBuilder(); sql.Append("select CardNo,SchoolID,WeiXinID from WeiXin_Reader "); sql.Append("where WeiXinID =@weixinID"); SqlParameter[] parameter = { new SqlParameter("@weixinID", SqlDbType.VarChar) }; parameter[0].Value = weixinID; DataSet ds = DbHelperSQL.Query(sql.ToString(), parameter); if (ds.Tables[0].Rows.Count > 0) { weixinuser = new WeiXinUsers(); weixinuser.SchoolInfo = new AMS.Model.AMS_School(); if (ds.Tables[0].Rows[0]["CardNo"] != null && ds.Tables[0].Rows[0]["CardNo"].ToString() != "") { weixinuser.CardNo = ds.Tables[0].Rows[0]["CardNo"].ToString(); } if (ds.Tables[0].Rows[0]["WeiXinID"] != null && ds.Tables[0].Rows[0]["WeiXinID"].ToString() != "") { weixinuser.WeixinID = ds.Tables[0].Rows[0]["WeiXinID"].ToString(); } if (ds.Tables[0].Rows[0]["SchoolID"] != null && ds.Tables[0].Rows[0]["SchoolID"].ToString() != "") { weixinuser.SchoolInfo = schoolDal.GetModel(int.Parse(ds.Tables[0].Rows[0]["SchoolID"].ToString())); } return(weixinuser); } return(null); }
public void GetOpenId(string state, string code) { if (code == null) { Response.Write("Null"); return; } string AppId = ConfigurationManager.AppSettings["wxAppId"].ToString(); string AppSecret = ConfigurationManager.AppSettings["wxAppSecret"].ToString(); string reg = string.Empty; wxLogin wxLogin = new wxLogin(); ACCESST ACCESST = wxLogin.GetWeiXinAccess(code, AppId, AppSecret, out reg); if (ACCESST.openid.IsNullOrEmpty()) { Response.Redirect("/Mobile/WeiXinErr.html?msg=您未授权,暂时不能参与活动"); return; } Response.Cookies.SetWXOpenId(ACCESST.openid); WeiXinUsers WeiXinUsers = Entity.WeiXinUsers.FirstOrNew(n => n.OpenId == ACCESST.openid); string BackUrl = ""; if (Request.QueryString["BackUrl"] != null) { if (!Request.QueryString["BackUrl"].ToString().IsNullOrEmpty()) { BackUrl = Request.QueryString["BackUrl"].ToString(); } } if (WeiXinUsers.Id == 0) { if (state == "Base") { string burl = "http://" + Utils.GetHostName() + "/Mobile/Weixin/GetOpenId.html?BackUrl=" + BackUrl + ""; burl = System.Web.HttpUtility.UrlEncode(burl); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + AppId + "&redirect_uri=" + burl + "&response_type=code&scope=snsapi_userinfo&state=UserInfo#wechat_redirect"; Response.Redirect(url); } if (state == "UserInfo") { WeiXinUser WeiXinUser = wxLogin.GetWeiXinUser(ACCESST.access_token, ACCESST.openid, out reg); WeiXinUsers = new WeiXinUsers(); WeiXinUsers.UId = 0; WeiXinUsers.OpenId = WeiXinUser.openid; WeiXinUsers.ComeId = 0; WeiXinUsers.AddTime = DateTime.Now; WeiXinUsers.State = 1; WeiXinUsers.NickName = WeiXinUser.nickname; WeiXinUsers.Sex = WeiXinUser.sex; WeiXinUsers.Province = WeiXinUser.province; WeiXinUsers.City = WeiXinUser.city; WeiXinUsers.Country = WeiXinUser.country; WeiXinUsers.HeadImgUrl = WeiXinUser.headimgurl; WeiXinUsers.Privilege = WeiXinUser.privilege; Entity.WeiXinUsers.AddObject(WeiXinUsers); Entity.SaveChanges(); } } Response.Redirect(BackUrl); }
protected void Page_Load(object sender, EventArgs e) { this.UserSchoolInfo = null; if (!IsPostBack) { BindSelSchool(); if (Request.QueryString["WXID"] != null) { BindStuData(Request.QueryString["WXID"]); } } if (Request.QueryString["WXID"] == null) { divcontent.Style.Add("display", "block"); divstuInfo.Style.Add("display", "none"); divSuccess.Style.Add("display", "none"); return; } cmd = Request.Form["subCmd"]; //通过页面验证,执行登录操作 if (cmd == "Login") { WeiXinUsers user = new WeiXinUsers(); UserInfo users = new UserInfo(); string schoolId = selSchool.Items[selSchool.SelectedIndex].Value; if (schoolId == "-1") { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = string.Format("请选择学校"); } users.LoginId = txt_LoginID.Value; users.Password = txt_Password.Value; if (loginHandle(users, schoolId)) { user.WeixinID = Request.QueryString["WXID"].ToString(); user.CardNo = txt_LoginID.Value; user.SchoolInfo = new AMS.Model.AMS_School() { Id = Convert.ToInt32(schoolId) }; spanWarmInfo.Visible = true; spanWarmInfo.InnerText = WeiXinProxy.BindUserInfo(user); AMS.Model.AMS_School school = handler.GetSingleSchoolInfo(schoolId); SeatManage.SeatManageComm.CookiesManager.SetCookies(user.CardNo, txt_Password.Value, schoolId); } else { //spanWarmInfo.Visible = true; //spanWarmInfo.InnerText = "账号或密码不正确"; } } else { } }
/// <summary> /// 更新绑定 /// </summary> /// <param name="userinfo"></param> /// <returns></returns> public bool UpdateBind(WeiXinUsers userinfo) { string weixinID = userinfo.WeixinID; string schoolID = userinfo.SchoolInfo.Id.ToString(); string CardNo = userinfo.CardNo; string sql = string.Format("update WeiXin_Reader set CardNo='{0}',SchoolID='{1}',WeiXinID='{2}' where WeiXinID='{2}' or (SchoolID='{1}' and CardNo='{0}')", CardNo, schoolID, weixinID); if (DbHelperSQL.ExecuteSql(sql) > 0) { return(true); } return(false); }
/// <summary> /// 添加绑定 /// </summary> /// <param name="userinfo"></param> /// <returns></returns> public bool InsertUserInfo(WeiXinUsers userinfo) { string weixinID = userinfo.WeixinID; string schoolID = userinfo.SchoolInfo.Id.ToString(); string CardNo = userinfo.CardNo; string sql = string.Format("insert into WeiXin_Reader (CardNo,SchoolID,WeiXinID) values('{0}',{1},'{2}')", CardNo, schoolID, weixinID); if (DbHelperSQL.ExecuteSql(sql) > 0) { return(true); } return(false); }
private void BindStuData(string uid) { try { WeiXinUsers user = WeiXinProxy.GetWeiXinUser(uid); if (user != null) { tcpHandler = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); this.LoginUserInfo = (tcpHandler as TcpClient_BespeakSeatAllMethod).GetReaderInfoByCardNofalse(user.CardNo, user.SchoolInfo); this.lblMyName.InnerText = LoginUserInfo.Name; this.lblMyStuCode.InnerText = LoginUserInfo.CardNo; this.lblmySchool.InnerText = user.SchoolInfo.Name; this.txt_LoginID.Value = LoginUserInfo.CardNo; foreach (ListItem li in selSchool.Items) { if (li.Value == user.SchoolInfo.Id.ToString()) { li.Selected = true; break; } } divcontent.Style.Add("display", "none"); divstuInfo.Style.Add("display", "block"); divSuccess.Style.Add("display", "none"); } else { divcontent.Style.Add("display", "block"); divstuInfo.Style.Add("display", "none"); divSuccess.Style.Add("display", "none"); } } catch (Exception EX) { divcontent.Style.Add("display", "block"); divstuInfo.Style.Add("display", "none"); divSuccess.Style.Add("display", "none"); spanWarmInfo.Visible = true; spanWarmInfo.InnerText = string.Format(EX.Message); } }
private void BindStuData(string uid) { try { WeiXinUsers user = WeiXinProxy.GetWeiXinUser(uid); if (user != null) { LoginUserInfo = weiXinSercive.GetReaderInfo(user.CardNo, user.SchoolInfo.Number); lblMyName.InnerText = LoginUserInfo.Name; lblMyStuCode.InnerText = LoginUserInfo.StudentNo; lblmySchool.InnerText = user.SchoolInfo.Name; txt_LoginID.Value = LoginUserInfo.StudentNo; foreach (ListItem li in selSchool.Items) { if (li.Value == user.SchoolInfo.Id.ToString()) { li.Selected = true; break; } } divcontent.Style.Add("display", "none"); divstuInfo.Style.Add("display", "block"); divSuccess.Style.Add("display", "none"); } else { divcontent.Style.Add("display", "block"); divstuInfo.Style.Add("display", "none"); divSuccess.Style.Add("display", "none"); } } catch (Exception EX) { divcontent.Style.Add("display", "block"); divstuInfo.Style.Add("display", "none"); divSuccess.Style.Add("display", "none"); spanWarmInfo.Visible = true; spanWarmInfo.InnerText = string.Format(EX.Message); } }
public WeiXinUsers GetWeiXinUserByUserInfo(string cardNo, string schoolNum) { WeiXinUsers weixinuser = null; StringBuilder sql = new StringBuilder(); sql.Append("select [CardNo],[SchoolID] ,[WeiXinID] ,[SchoolNum] ,[SchoolName] ,[ConnectionString] ,[Describe] from [View_WeiXinReader]"); sql.Append(" where CardNo=@CardNo and SchoolNum=@SchoolNum"); SqlParameter[] parameter = { new SqlParameter("@SchoolNum", SqlDbType.NVarChar), new SqlParameter("@CardNo", SqlDbType.NVarChar) }; parameter[0].Value = schoolNum; parameter[1].Value = cardNo; DataSet ds = DbHelperSQL.Query(sql.ToString(), parameter); if (ds.Tables[0].Rows.Count > 0) { weixinuser = new WeiXinUsers(); weixinuser.SchoolInfo = new Model.AMS_School(); if (ds.Tables[0].Rows[0]["CardNo"] != null && ds.Tables[0].Rows[0]["CardNo"].ToString() != "") { weixinuser.CardNo = ds.Tables[0].Rows[0]["CardNo"].ToString(); } if (ds.Tables[0].Rows[0]["WeiXinID"] != null && ds.Tables[0].Rows[0]["WeiXinID"].ToString() != "") { weixinuser.WeixinID = ds.Tables[0].Rows[0]["WeiXinID"].ToString(); } if (ds.Tables[0].Rows[0]["SchoolID"] != null && ds.Tables[0].Rows[0]["SchoolID"].ToString() != "") { weixinuser.SchoolInfo.Id = (int)ds.Tables[0].Rows[0]["SchoolID"]; } weixinuser.SchoolInfo.Name = ds.Tables[0].Rows[0]["SchoolName"].ToString(); weixinuser.SchoolInfo.Number = ds.Tables[0].Rows[0]["SchoolNum"].ToString(); weixinuser.SchoolInfo.ConnectionString = ds.Tables[0].Rows[0]["ConnectionString"].ToString(); return(weixinuser); } return(null); }
public WeiXinBaseController() { AppId = ConfigurationManager.AppSettings["wxAppId"].ToString(); AppSecret = ConfigurationManager.AppSettings["wxAppSecret"].ToString(); IsWeiXinBrowser = System.Web.HttpContext.Current.Request.UserAgent.ToLower().Contains("micromessenger"); if (IsWeiXinBrowser) { //System.Web.HttpContext.Current.Response.Cookies.SetWXOpenId("orL8iwlAz9nORcOb4Gq0PNeCedqY"); string openid = System.Web.HttpContext.Current.Request.Cookies.GetWXOpenId(); if (!openid.IsNullOrEmpty()) { WeiXinUsers = Entity.WeiXinUsers.FirstOrNew(n => n.OpenId == openid); } else { WeiXinUsers = new WeiXinUsers(); } if (WeiXinUsers.Id.IsNullOrEmpty()) { string str = ""; if (System.Web.HttpContext.Current.Request.Url != null) { str = System.Web.HttpContext.Current.Request.Url.ToString(); } string burl = "http://" + Utils.GetHostName() + "/Mobile/Weixin/GetOpenId.html?BackUrl=" + str + ""; burl = System.Web.HttpUtility.UrlEncode(burl); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + AppId + "&redirect_uri=" + burl + "&response_type=code&scope=snsapi_base&state=Base#wechat_redirect"; System.Web.HttpContext.Current.Response.Redirect(url); return; } } BasicSet = Entity.SysSet.FirstOrNew(); ViewBag.BasicSet = BasicSet; ViewBag.WeiXinUsers = WeiXinUsers; ViewBag.AppId = AppId; ViewBag.AppSecret = AppSecret; }
//菜单点击 void service_MenuClickEvent(object sender, WeixinEventMsg arge) { WeiXinUsers user = WeiXinProxy.GetWeiXinUser(arge.FromUserName); //获取用户信息 WeiXinTextMsg responseTxt = new WeiXinTextMsg(); //要回复的信息 responseTxt.MsgType = EnumWeiXinMsgType.Text; responseTxt.FromUserName = arge.ToUserName; responseTxt.ToUserName = arge.FromUserName; string domain = ConfigurationManager.AppSettings["Domain"]; string pocketdomain = ConfigurationManager.AppSettings["PocketDomain"]; IMainFunctionPageBll mainFunctionBll = null; if (user == null)//连接地址未填写 { context.Response.Flush(); context.Response.Close(); WeiXinAdvertse ad = new WeiXinAdvertse(); ad.Title = "绑定学号"; ad.Image = domain + "/Images/Bd.jpg"; ad.Url = domain + "/BindUsers.aspx? WXID=" + arge.FromUserName; ad.Description = "请先绑定学号"; //------------------------------------------------- ad.ContentXML = WeiXinJsonArticle.AdvertiseToJson(ad); //------------------------------------------------- List <WeiXinAdvertse> lw = new List <WeiXinAdvertse>(); lw.Add(ad); ads.SendArticleMessage(arge.FromUserName, lw); return; } WeiXinJK.Model.WexinEventClickMenu click = (WeiXinJK.Model.WexinEventClickMenu)arge; string resultValue = ""; switch (click.EventKey) { case EnumMenuKey.GetMyInfo: break; case WeiXinJK.Model.EnumMenuKey.BindWeiXinId: //修改绑定*******修改绑定连接未实现 #region 修改绑定 context.Response.Flush(); context.Response.Close(); WeiXinAdvertse ad = new WeiXinAdvertse(); ad.Title = "我的资料"; ad.Image = domain + "/Images/Bd.jpg"; ad.Url = domain + "/BindUsers.aspx?WXID=" + click.FromUserName; ad.Description = "点击查看我的资料"; //--------------------------------------------------- ad.ContentXML = WeiXinJsonArticle.AdvertiseToJson(ad); //--------------------------------------------------- List <WeiXinAdvertse> lw = new List <WeiXinAdvertse>(); lw.Add(ad); ads.SendArticleMessage(arge.FromUserName, lw); #endregion break; case WeiXinJK.Model.EnumMenuKey.FreeSeat: //释放座位 #region 释放座位 lock (lockObject) { mainFunctionBll = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); try { resultValue = mainFunctionBll.FreeSeat(user.SchoolInfo, new ReaderInfo() { CardNo = user.CardNo }); } catch (Exception ex) { resultValue = ex.Message; } finally { (mainFunctionBll as TcpClient_BespeakSeatAllMethod).Dispose(); } } responseTxt.Content = resultValue; context.Response.Write(responseTxt.ToXML()); #endregion break; case WeiXinJK.Model.EnumMenuKey.GetBespeakLog: //获取预约记录预留接口 #region 查看预约信息 List <BespeakLogInfo> li = new List <BespeakLogInfo>(); lock (lockObject) { try { Loghandler = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); li = Loghandler.GetBookLogs(user.SchoolInfo, user.CardNo, null, 7); (Loghandler as TcpClient_BespeakSeatAllMethod).Dispose(); } catch (Exception ex) { responseTxt.Content = "执行出错误,请再次尝试"; context.Response.Write(responseTxt.ToXML()); SeatManage.SeatManageComm.WriteLog.Write(string.Format("获取预约信息失败:{0},异常来自:{1}", ex.Message, ex.Source)); return; } } string content = ""; if (li.Count == 0) { content = "您暂无预约记录!"; } else { content += "以下是您7天内的预约记录:" + Environment.NewLine; //content += "地点".PadRight(5, ' ') + "座位号".PadRight(8, ' ') + "时间".PadRight(5, ' ') + Environment.NewLine; foreach (BespeakLogInfo log in li) { content += "地点:" + Environment.NewLine; content += log.ReadingRoomName + Environment.NewLine; content += "座位号:" + log.ShortSeatNum + Environment.NewLine; content += "时间:" + log.BsepeakTime.ToString("yy/MM/dd") + Environment.NewLine; } } responseTxt.Content = content; context.Response.Write(responseTxt.ToXML()); #endregion break; case WeiXinJK.Model.EnumMenuKey.GetRoomUsedState: //获取阅览室剩余座位 #region 获取阅览室剩余座位 context.Response.Flush(); context.Response.Close(); Dictionary <string, ReadingRoomSeatUsedState_Ex> dic = new Dictionary <string, ReadingRoomSeatUsedState_Ex>(); lock (lockObject) { mainFunctionBll = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); try { dic = mainFunctionBll.GetAllRoomSeatUsedState(user.SchoolInfo); } catch (Exception ex) { ads.SendTxtMessage(responseTxt.ToUserName, "执行出错误,请再次尝试。"); SeatManage.SeatManageComm.WriteLog.Write(string.Format("获取可用座位数失败:{0},异常来自:{1}", ex.Message, ex.Source)); } finally { (mainFunctionBll as TcpClient_BespeakSeatAllMethod).Dispose(); } } StringBuilder strtxt = new StringBuilder(); foreach (ReadingRoomSeatUsedState_Ex seatUsedState in dic.Values) { strtxt.Append(string.Format("{0}:{1}/{2}(已用/总共)", seatUsedState.ReadingRoom.Name, seatUsedState.SeatAmountUsed.ToString(), seatUsedState.SeatAmountAll.ToString()) + Environment.NewLine); } ads.SendTxtMessage(responseTxt.ToUserName, strtxt.ToString()); #endregion break; case WeiXinJK.Model.EnumMenuKey.ShortLeave: //设置暂离 #region 设置暂离 lock (lockObject) { mainFunctionBll = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); try { resultValue = mainFunctionBll.SetShortLeave(user.SchoolInfo, new ReaderInfo() { CardNo = user.CardNo }); responseTxt.Content = resultValue; } catch (Exception ex) { responseTxt.Content = ex.Message; } finally { (mainFunctionBll as TcpClient_BespeakSeatAllMethod).Dispose(); } } context.Response.Write(responseTxt.ToXML()); #endregion break; case WeiXinJK.Model.EnumMenuKey.ReserveSeat: #region 预约座位 #endregion break; case EnumMenuKey.BlackList: #region 黑名单 #endregion break; case EnumMenuKey.GetReaderState: #region 读者状态 ReaderInfo readerIn = new ReaderInfo(); lock (lockObject) { try { mainFunctionBll = new TcpClient_BespeakSeatAllMethod(user.SchoolInfo); readerIn = mainFunctionBll.GetReaderInfo(user.SchoolInfo, user.CardNo); } catch { responseTxt.Content = "执行出错误,请再次尝试"; context.Response.Write(responseTxt.ToXML()); } finally { (mainFunctionBll as TcpClient_BespeakSeatAllMethod).Dispose(); } } string state = ""; if (readerIn.EnterOutLog == null) { state = "Leave"; } else { state = readerIn.EnterOutLog.EnterOutState.ToString(); } if (readerIn.BespeakLog.Count > 0) { state = "Booking"; } string message = ""; switch (state) { case "SelectSeat": case "ComeBack": case "ContinuedTime": case "WaitingSuccess": case "BookingConfirmation": case "ReselectSeat": message = "当前状态:在座"; break; case "Leave": message = ""; break; case "Booking": message = "今天有预约未确认"; break; case "Waiting": message = "您正在等待座位"; break; case "ShortLeave": message = "当前状态:暂离"; break; default: message = ""; SeatManage.SeatManageComm.WriteLog.Write(string.Format("获取到读者信息,读者状态为:", state)); break; } if (readerIn.EnterOutLog != null && readerIn.EnterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave) { string nowMessage = ""; //座位号 readerIn.EnterOutLog.ShortSeatNo; if (message != "") { string seatNo = readerIn.EnterOutLog.ShortSeatNo; nowMessage += string.Format("阅览室:{0}\n座位号:{1}\n学号:{2}\n{3}", readerIn.AtReadingRoom.Name, seatNo, readerIn.CardNo, message); responseTxt.Content = nowMessage; context.Response.Write(responseTxt.ToXML()); } } else { responseTxt.Content = "您当前还没有座位!"; context.Response.Write(responseTxt.ToXML()); } #endregion break; case EnumMenuKey.GetRules: #region 查看规则 #endregion break; case EnumMenuKey.ReservationService: #region 预约多图文 context.Response.Flush(); context.Response.Close(); List <WeiXinAdvertse> ListWeiXin = new List <WeiXinAdvertse>(); WeiXinAdvertse adv = new WeiXinAdvertse(); adv.Title = "更多资讯"; //标题 adv.Image = domain + "/Images/ysgg.jpg"; //图片地址 adv.Url = "http://shanghai.longre.com/"; //访问地址 //------------------------------------------------- adv.ContentXML = WeiXinJsonArticle.AdvertiseToJson(adv); ListWeiXin.Add(adv); //--------------------------------------------------- adv = new WeiXinAdvertse(); adv.Title = "预约座位"; adv.Image = domain + "/Images/yyzw.jpg"; string para = SeatManage.SeatManageComm.AESAlgorithm.DESEncode(string.Format("cardNo={0}&schoolId={1}&operateKey={2}", user.CardNo, user.SchoolInfo.Id, Convert.ToInt32(EnumMenuKey.ReserveSeat))); para = HttpUtility.UrlEncode(para); adv.Url = pocketdomain + "/AutoLogin.aspx?parameters=" + para; adv.ContentXML = WeiXinJsonArticle.AdvertiseToJson(adv); ListWeiXin.Add(adv); //------------------------------------------------------ adv = new WeiXinAdvertse(); adv.Title = "预约记录"; adv.Image = domain + "/Images/yyjl.jpg"; string par = SeatManage.SeatManageComm.AESAlgorithm.DESEncode(string.Format("cardNo={0}&schoolId={1}&operateKey={2}", user.CardNo, user.SchoolInfo.Id, Convert.ToInt32(EnumMenuKey.GetBespeakLog))); par = HttpUtility.UrlEncode(par); adv.Url = pocketdomain + "/AutoLogin.aspx?parameters=" + par; adv.ContentXML = WeiXinJsonArticle.AdvertiseToJson(adv); ListWeiXin.Add(adv); ads.SendArticleMessage(arge.FromUserName, ListWeiXin); break; #endregion case EnumMenuKey.Weather: context.Response.Flush(); context.Response.Close(); WeiXinAdvertse Weathers = new WeiXinAdvertse(); Weathers.Title = "回复城市+天气名可获取输入城市的实况天气\t如:南京天气"; Weathers.Image = domain + "/Images/Bd.jpg"; Weathers.Url = ""; //------------------------------------------------- Weathers.ContentXML = WeiXinJsonArticle.AdvertiseToJson(Weathers); //------------------------------------------------- List <WeiXinAdvertse> ListWeather = new List <WeiXinAdvertse>(); ListWeather.Add(Weathers); ads.SendArticleMessage(arge.FromUserName, ListWeather); break; case EnumMenuKey.Service: WeixinTransfer WXXml = new WeixinTransfer(); WXXml.ToUserName = arge.FromUserName; WXXml.FromUserName = arge.ToUserName; WXXml.MsgType = EnumWeiXinMsgType.transfer_customer_service; context.Response.Write(WXXml.ToXML()); break; case EnumMenuKey.Press: context.Response.Flush(); context.Response.Close(); List <WeiXinAdvertse> ListPress = new List <WeiXinAdvertse>(); WeiXinAdvertse press = new WeiXinAdvertse(); press.Title = "0"; //标题 press.Image = domain + ""; //图片地址 press.Url = ""; //访问地址 //------------------------------------------------- press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //--------------------------------------------------- press = new WeiXinAdvertse(); press.Title = "1"; press.Image = domain + ""; press.Url = ""; press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //------------------------------------------------------ press = new WeiXinAdvertse(); press.Title = "2"; press.Image = domain + ""; press.Url = ""; press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //------------------------------------------------------ press = new WeiXinAdvertse(); press.Title = "3"; press.Image = domain + ""; press.Url = ""; press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //------------------------------------------------------ press = new WeiXinAdvertse(); press.Title = "4"; press.Image = domain + ""; press.Url = ""; press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //------------------------------------------------------ press = new WeiXinAdvertse(); press.Title = "4"; press.Image = domain + ""; press.Url = ""; press.ContentXML = WeiXinJsonArticle.AdvertiseToJson(press); ListPress.Add(press); //------------------------------------------------------ ads.SendArticleMessage(arge.FromUserName, ListPress); break; } }