42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
<%@ WebHandler Language="C#" Class="checkbd" %>
|
|
|
|
using System;
|
|
using System.Web;
|
|
using System.Web.SessionState;
|
|
|
|
public class checkbd : IHttpHandler,IRequiresSessionState {
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
string id = ZWL.Common.PublicMethod.GetSessionValue("UserID");
|
|
ZWL.BLL.ERPUser bll = new ZWL.BLL.ERPUser();
|
|
string openidtime = bll.Getopenidtime(id);
|
|
if (string.IsNullOrEmpty(openidtime))
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "" }));
|
|
context.Response.End();
|
|
}
|
|
|
|
string result = "";
|
|
TimeSpan ts = DateTime.Now.Subtract(DateTime.Parse(openidtime)).Duration();
|
|
if (ts.TotalSeconds < 10)
|
|
{
|
|
result = Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "" });
|
|
}
|
|
else
|
|
{
|
|
result = Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "" });
|
|
}
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
context.Response.Write(result);
|
|
}
|
|
|
|
public bool IsReusable {
|
|
get {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |