Hidistro.UI.Web/Admin/promotion/GetCouponDataHandler.cs
(完整代码) 1KBnamespace Hidistro.UI.Web.Admin.promotion
{
using Hidistro.ControlPanel.Promotions;
using Hidistro.Entities.Promotions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Web;
public class GetCouponDataHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
try
{
CouponInfo coupon = CouponHelper.GetCoupon(int.Parse(context.Request["id"].ToString()));
var type = new {
type = "success",
time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
data = coupon
};
IsoDateTimeConverter converter = new IsoDateTimeConverter {
DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
};
string s = JsonConvert.SerializeObject(type, Formatting.Indented, new JsonConverter[] { converter });
context.Response.Write(s);
}
catch (Exception exception)
{
context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
