Views/UserCenter/ModulePerms.ashx

(开头部分) 5KB

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

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

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

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

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

        string flag = MicroPublic.GetMsg("SaveFailedTry"),
                Action = context.Server.UrlDecode(context.Request.Form["action"]),
                MID = context.Server.UrlDecode(context.Request.Form["mid"]),
                Type = context.Server.UrlDecode(context.Request.Form["type"]),
                Fields = context.Server.UrlDecode(context.Request.Form["fields"]);
        //测试数据
        //Fields = "{\"ckPerm11\":\"1,1\",\"ckPerm12\":\"1,2\"}";

        if (Type == "recovery")
            flag = GetDefault();
        else
            flag = SetModify(Type.toStringTrim(), Fields.toStringTrim());

        context.Response.Write(flag);
    }

    protected string SetModify(string Type, string Fields)
    {
        string flag = MicroPublic.GetMsg("SaveFailedTry");
        Boolean DefaultPerm = false;
        if (Type == "default")
            DefaultPerm = true;

        try
        {
            DataTable ModulePermDT = MicroDataTable.GetDataTable("MPerm"); //得到模权限表的记录
            DataTable NewModulePermDT = ModulePermDT.Clone();  //克隆相同结构的新表,把符合条件的记录插入到该表,最后再统一写入数据库

            //创建sb用于存放已选中的权限的MPID,构造成逗号分隔的字符串,最后用 MPID not in进行删除数据数已有而选中的权限不包含的记录 
            StringBuilder SB = new StringBuilder();

            string strMID = string.Empty;
            string strPID = string.Empty;

            JObject Array = JObject.Parse(Fields);

            foreach (var Item in Array)
            {
                int intMID = MicroPublic.GetSplitStr(Item.Value.ToString(), ',', 0).toInt();
后面还有 89 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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