Пример #1
0
 /// <summary>
 /// 从微信平台获取信息
 /// </summary>
 /// <returns></returns>
 public ActionResult GetInfo()
 {
     MongoUtil mongo = new MongoUtil();
     var colloction = mongo.getCollection("message");
     var res = colloction.FindAll().ToList();
     foreach (var item in res)
     {
         if (!IsExitImage(item.fakeid))
         {
             DownImage(item.fakeid);
         }
     }
     return View(res);
 }
Пример #2
0
 /// <summary>
 /// 上墙
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Sq(string id)
 {
     var hubContext = GlobalHost.ConnectionManager.GetHubContext<WeChatHub>();
     if (hubContext != null)
     {
         ObjectId objid = new ObjectId(id);
         MongoUtil mongo = new MongoUtil();
         var colloction = mongo.getCollection("message");
         var msg = colloction.AsQueryable<Msg>().FirstOrDefault(a => a.Id == objid);
         if (msg!=null)
         {
             hubContext.Clients.All.addData(msg);
         }             
     }
     return RedirectToAction("GetInfo");
 }