Web/Ashx/Web_CeShi/Big_Data.ashx

(完整代码) 2KB

<%@ WebHandler Language="C#" Class="Big_Data" %>

using System;
using System.Web;

public class Big_Data : BaseHandler
{

    public new void ProcessRequest(HttpContext context) { }

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

    public override void OnLoad(HttpContext context)
    {
        context.Response.ContentType = "application/json";
        try
        {
            switch (Action)
            {
                case "Get_Search_browse_Big_Data": Get_Search(context); break;//查询信息               
                default:
                    context.Response.Write("{\"msg\":\"没有该请求命令!\",\"success\":false}");
                    break;
            }
        }
        catch (Exception ex)
        {
            context.Response.Write("{\"msg\":\"" + Common.JsonHelper.StringFilter(ex.Message) + "\",\"success\":false}");
        }
    }


    //查找信息
    void Get_Search(HttpContext context)
    {
        string where = "1=1";
        int pageIndex = Convert.ToInt32(context.Request.Params["page"]);//当前页
        int pageSize = Convert.ToInt32(context.Request.Params["pagesize"]);//每页默认页数
        string order = context.Request.Params["sortname"] + " " + context.Request.Params["sortorder"];//排序字段 排序顺序

        //一般很少多字段排序,这个是单字段排序
        if (order == null || order.Trim() == string.Empty)
        {
            order = "name asc";
        }

        order = "c_" + order;


        string text_search = context.Request.Params["text_search"] ?? "";
        if (text_search.Trim() != "" && !Common.SqlInjection.GetString(text_search))   //防止sql注入
        {
                where += string.Format(" and c_name like '%{0}%' or c_text like '%{0}%' ", text_search.Trim());
            //where += string.Format(" and us_id like '%{0}%' or us_name like '%{0}%' or us_tel like '%{0}%' ", text_search.Trim());
        }

        context.Response.Write(new BLL.BLL_CeShi.Big_Data().Get_Search(order, pageSize, pageIndex, where,cookie_user.us_log_login));
    }
}

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

AI 解读

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

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