10 namespace ~.sverIterface 11 { 12 13 public class EventPlayerInfo 14 { 15 public string name { get; set; } 16 public string grade { get; set; } 17 } 18 /// <summary> 19 /// 排名 20 /// </summary> 21 public class IWebscmjRank : IHttpHandler 22 { 23 24 public void ProcessRequest(HttpContext context) 25 { 26 context.Response.ContentType = "text/plain";
40 UserDataMO umo = new UserDataMO("数据库字段"); 41 DataSet ds = DbHelperMySQL.Query("sql语句"); 42 43 List<EventPlayerInfo> dslist = new List<EventPlayerInfo>(); 44 45 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 46 { 47 EventPlayerInfo user = new EventPlayerInfo(); 48 user.name = ds.Tables[0].Rows[i]["rolename"].ToString(); 49 user.grade = ds.Tables[0].Rows[i]["grade"].ToString(); 50 dslist.Add(user); 51 }
52 string datas = TinyFx.SerializerUtil.SerializeJson(dslist); 53 context.Response.Write("{\"result\":" + "\"" + 1 + "\"" + ",\"data\":" + datas + "}"); 54 55 } 56 57 public bool IsReusable 58 { 59 get 60 { 61 return false; 62 } 63 } 64 } 65 }