Hidistro.UI.Web/Admin/promotion/GetVoteItemsHandler.cs

(完整代码) 1KB

using System;
using System.Web;
using ControlPanel.Promotions;
using Hidistro.Entities.Promotions;
using Newtonsoft.Json;

namespace Hidistro.UI.Web.Admin.promotion
{
    public class GetVoteItemsHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            long result = 0L;
            long.TryParse(context.Request.QueryString["id"], out result);
            if (result > 0L)
            {
                VoteInfo vote = VoteHelper.GetVote(result);
                if (vote != null)
                {
                    var type = new
                    {
                        type = "success",
                        VoteName = vote.VoteName,
                        data = vote.VoteItems
                    };
                    string s = JsonConvert.SerializeObject(type);
                    context.Response.Write(s);
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"该投票调查不存在!\"}");
                }
            }
            else
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"参数错误!\"}");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。