App_Handler/GetParSubTextValue.ashx

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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

using System;
using System.Web;
using System.Text;
using System.Data;
using MicroDBHelper;
using Newtonsoft.Json.Linq;
using MicroAuthHelper;

public class GetParSubTextValue : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        MicroAuth.CheckLogin();

        string flag = "False",
           Action = context.Server.UrlDecode(context.Request.Form["action"]),
           MID = context.Server.UrlDecode(context.Request.Form["mid"]),
           Fields = context.Server.UrlDecode(context.Request.Form["fields"]);

        if (Action.toStringTrim().ToLower() == "get")
            flag = GetMain(Fields.toStringTrim());

        context.Response.Write(flag);
    }

    private string GetStrTpl()
    {
        string strTpl = "\"text\":\"{0}\",\"value\":\"{1}\",\"numLevel\":\"{2}\",\"ParentID\":\"{3}\"";
        return strTpl;
    }

    private string GetMain(string Fields)
    {
        string flag = "false", strTpl = GetStrTpl();
        try
        {
            string Text = string.Empty, Value = string.Empty, Level = string.Empty, TableName = string.Empty, ShortTableName = string.Empty, Where = string.Empty, OrderBy = string.Empty, Note = string.Empty, _Note = string.Empty;
            StringBuilder sb = new StringBuilder();
            dynamic json = JToken.Parse(Fields) as dynamic;

            Text = json["txt"]; Value = json["val"]; Level = json["lv"]; ShortTableName = json["stn"]; OrderBy = json["ob"]; Note = json["note"];

            //测试数据
            // Text = "TabColName"; Value = "TID"; Level = "False"; ShortTableName = "mTabs"; OrderBy = "ParentID,Sort"; Note = "Title";  

            TableName = MicroPublicHelper.MicroPublic.GetTableName(ShortTableName);  //得到完整表名
            Where = " del=0 "; //获得表主键,构造where参数
            if (!string.IsNullOrEmpty(OrderBy))
                OrderBy = " order by " + OrderBy;
            else
                OrderBy = "";

            string __Note = string.IsNullOrEmpty(Note) == true ? Note : "," + Note; //为值加上逗号分隔

            string _sql = "select " + Text + "," + Value + __Note + " ,* " + " from " + TableName + " where " + Where + OrderBy + " ";
            DataTable _dt = MsSQLDbHelper.Query(_sql).Tables[0];
后面还有 81 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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