public object Getmonitorhistory(string id) { try { var ret = from n in Monitorcurrent.Query(t => t.Mac == id).Result group n by n.Monitor_Time into s select new { Ip_Address = s.Select(t => t.Ip_Address).Take(1), Mac = s.Select(p => p.Mac).Take(1), Monitor_Name = s.Select(t => t.Monitor_Name), Monitor_Value = s.Select(t => t.Monitor_Value), Monitor_Time = s.Select(t => t.Monitor_Time).Take(1) }; Console.WriteLine(ret.ToJson()); return(ret.ToJson()); } catch (Exception) { return("数据错误"); } }
public object Getmonitorcurrent(int page, int limit) { try { var lsq = from n in Monitorcurrent.Query().Result group n by n.Mac into s select new { Ip_Address = s.Select(p => p.Ip_Address).Take(1), Mac = s.Select(p => p.Mac).Take(1), Monitor_Name = s.Select(p => p.Monitor_Name), Monitor_Value = s.Select(p => p.Monitor_Value), Monitor_Time = s.Select(p => p.Monitor_Time).Take(1) }; var ret = new{ code = 0, msg = "", data = lsq, count = lsq.Count() }; return(ret.ToJson()); } catch (Exception) { return("数据错误"); } }