//已经关注的用户扫描二维码参数 public void DoSubCode(Dictionary <string, string> model) { SText mT = new SText(); mT.Content = ReadXml.Menu(); mT.FromUserName = ReadXml.ReadModel("ToUserName", model); mT.ToUserName = ReadXml.ReadModel("FromUserName", model); mT.MsgType = "text"; mT.CreateTime = long.Parse(ReadXml.ReadModel("CreateTime", model)); ReadXml.ResponseToEnd(DALWei.SendText(mT)); }
//--------------------------------------------------------------------------------- #region 接收普通消息 //接收到文本消息 处理 public void DoText(Dictionary <string, string> model) { SText mT = new SText(); string text = ReadXml.ReadModel("Content", model).Trim(); mT.FromUserName = ReadXml.ReadModel("ToUserName", model); mT.ToUserName = ReadXml.ReadModel("FromUserName", model); mT.CreateTime = long.Parse(ReadXml.ReadModel("CreateTime", model)); if (text == "?" || text == "?" || text == "帮助") { mT.Content = mT.Content = ReadXml.Menu(); mT.MsgType = "text"; ReadXml.ResponseToEnd(DALWei.SendText(mT)); } else { SNews mN = new SNews(); mN.FromUserName = ReadXml.ReadModel("ToUserName", model); mN.ToUserName = ReadXml.ReadModel("FromUserName", model); mN.CreateTime = long.Parse(ReadXml.ReadModel("CreateTime", model)); mN.MsgType = "news"; // 以下为文章内容, 实际使用时,此处应该是一个跟数据库交互的方法,查询出文章 //文章条数, 文章内容等 都应该由数据库查询出来的数据决定 这里测试,就模拟几条 mN.ArticleCount = 5; List <ArticlesModel> listNews = new List <ArticlesModel>(); for (int i = 0; i < 5; i++) { ArticlesModel ma = new ArticlesModel(); ma.Title = "这是第" + (i + 1).ToString() + "篇文章"; ma.Description = "-描述-" + i.ToString() + "-描述-"; ma.PicUrl = "http://image6.tuku.cn/pic/wallpaper/dongwu/taipingniaogaoqingbizhi/s00" + (i + 1).ToString() + ".jpg"; ma.Url = "http://www.cnblogs.com/mochen/"; listNews.Add(ma); } mN.Articles = listNews; ReadXml.ResponseToEnd(DALWei.SendNews(mN)); } }