Ejemplo n.º 1
0
 //ThreadMethod如下:
 private void ThreadMethod(object obj)
 {
     ArrayList arr = (ArrayList)obj;
     WX_RespImgTxt art = (WX_RespImgTxt)arr[0];
     Guid sid = (Guid)arr[1];
     string oid = arr[2].ToString();
     string ip = arr[3].ToString();
     DateTime dtime = DateTime.Now.AddMinutes(-2);
     int total = WMFactory.WXArticleLog.GetCount(f => f.OptType == 1 && f.AccountId == sid && f.ArticleId == art.Id && f.IPAddress == ip && f.CreateTime >= dtime);
     if (total <= 0)
     {
         //更新访问量
         art.Hits += 1;
         art.ModifyUser = "******";
         WMFactory.WXRespImgTxt.Update(art);
         WX_ArticleLog alog = new WX_ArticleLog();
         alog.AccountId = sid;
         alog.ArticleId = art.Id;
         alog.OpenId = oid;
         alog.OptType = 1;
         alog.IPAddress = ip;
         alog.CreateUser = "******";
         WMFactory.WXArticleLog.Insert(alog);
     }
 }
Ejemplo n.º 2
0
 public JsonResult Post(WX_ArticleLog _t)
 {
     if (WMFactory.WXArticleLog.Insert(_t))
         return Json(ResultMsg.Success("新增成功!"));
     else
         return Json(ResultMsg.Failure("新增失败,请您重试!"));
 }
Ejemplo n.º 3
0
 public JsonResult Delete(WX_ArticleLog _t)
 {
     if (WMFactory.WXArticleLog.Delete(s => s.Id == _t.Id ))
         return Json(ResultMsg.Success("删除成功!"));
     else
         return Json(ResultMsg.Failure("删除失败,请您重试!"));
 }
Ejemplo n.º 4
0
 public JsonResult Put(WX_ArticleLog _t)
 {
     IWXArticleLogService service = WMFactory.WXArticleLog;
     WX_ArticleLog entity = service.GetById(_t.Id.ToString());
     entity = AutoMapper<WX_ArticleLog, WX_ArticleLog>.Convert(_t, entity);
     if (service.Update(entity))
         return Json(ResultMsg.Success("更新成功!"));
     else
         return Json(ResultMsg.Failure("更新失败,请您重试!"));
 }
Ejemplo n.º 5
0
 public JsonResult Praise(Guid id, Guid sid, string oid)
 {
     if (WMFactory.WXArticleLog.GetCount(f => f.IPAddress == Request.UserHostAddress && f.AccountId == sid && f.ArticleId == id && f.OptType == 2) > 0)
     {
         return Json(ResultMsg.Failure("您已经点过赞了!"));
     }
     WX_RespImgTxt art = WMFactory.WXRespImgTxt.GetById(id.ToString());
     art.Praise += 1;
     art.ModifyUser = "******";
     WMFactory.WXRespImgTxt.Update(art);
     WX_ArticleLog alog = new WX_ArticleLog();
     alog.AccountId = sid;
     alog.ArticleId = id;
     alog.OpenId = oid;
     alog.OptType = 2;
     alog.IPAddress = Request.UserHostAddress;
     alog.CreateUser = "******";
     WMFactory.WXArticleLog.Insert(alog);
     return Json(ResultMsg.Success("谢谢支持!"));
 }