学 赵
4 years ago
3 changed files with 0 additions and 114 deletions
@ -1 +0,0 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="ReceiveHandler.ashx.cs" Class="SCP.Handlers.ReceiveHandler" %> |
@ -1,73 +0,0 @@ |
|||
using Newtonsoft.Json.Linq; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace SCP.Handlers |
|||
{ |
|||
/// <summary>
|
|||
/// ReceiveHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class ReceiveHandler : IHttpHandler |
|||
{ |
|||
|
|||
public void ProcessRequest(HttpContext context) |
|||
{ |
|||
string rowId = context.Request.QueryString["id"]; |
|||
int rowIdInt = Convert.ToInt32(rowId); |
|||
|
|||
JObject jo = new JObject(); |
|||
|
|||
JArray ja = new JArray(); |
|||
|
|||
Random rd = new Random(); |
|||
for (int i = 0; i < 3; i++) |
|||
{ |
|||
JObject joItem = new JObject(); |
|||
|
|||
if (i == 0) |
|||
{ |
|||
joItem.Add("type", "入学"); |
|||
} |
|||
else if (i == 1) |
|||
{ |
|||
joItem.Add("type", "期中"); |
|||
} |
|||
else if (i == 2) |
|||
{ |
|||
joItem.Add("type", "期末"); |
|||
} |
|||
|
|||
int randomMinValue = 80; |
|||
int randomMaxValue = 100; |
|||
if (rowIdInt % 2 == 0) |
|||
{ |
|||
randomMinValue = 40; |
|||
randomMaxValue = 80; |
|||
} |
|||
joItem.Add("yuwen", rd.Next(randomMinValue, randomMaxValue)); |
|||
joItem.Add("shuxue", rd.Next(randomMinValue, randomMaxValue)); |
|||
joItem.Add("yingwen", rd.Next(randomMinValue, randomMaxValue)); |
|||
joItem.Add("wuli", rd.Next(randomMinValue, randomMaxValue)); |
|||
joItem.Add("huaxue", rd.Next(randomMinValue, randomMaxValue)); |
|||
|
|||
ja.Add(joItem); |
|||
} |
|||
|
|||
jo.Add("data", ja); |
|||
jo.Add("total", ja.Count); |
|||
|
|||
context.Response.ContentType = "text/plain"; |
|||
context.Response.Write(jo.ToString(Newtonsoft.Json.Formatting.None)); |
|||
} |
|||
|
|||
public bool IsReusable |
|||
{ |
|||
get |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue