SuLei.Web/admin/tools/download.ashx.cs

(开头部分) 6KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Data;
using System.Web;
using System.Web.SessionState;
using SuLei.UI;
using SuLei.Common;
using SuLei.Web.UI;

namespace SuLei.Web.admin.tools
{
    /// <summary>
    /// download 的摘要说明
    /// </summary>
    public class download : IHttpHandler, IRequiresSessionState
    {
        Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); //系统配置
        public void ProcessRequest(HttpContext context)
        {
            string sitepath = SLRequest.GetQueryString("site");
            int id = SLRequest.GetQueryInt("id");
            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("出错了,站点传输参数不正确!");
                return;
            }
            //获得下载ID
            if (id == 0)
            {
                context.Response.Redirect(new BasePage().getlink(sitepath,
                    new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,文件参数传值不正确!"))));
                return;
            }
            //检查下载记录是否存在
            BLL.sl_article_attach bll = new BLL.sl_article_attach();
            if (!bll.Exists(id))
            {
                context.Response.Redirect(new Web.UI.BasePage().getlink(sitepath, 
                    new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要下载的文件不存在或已经被删除!"))));
                return;
            }
            Model.sl_article_attach model = bll.GetModel(id);
            //检查积分是否足够
            if (model.point > 0)
            {
                //检查用户是否登录
                Model.sl_users userModel = new Web.UI.BasePage().GetUserInfo();
                if (userModel == null)
                {
                    //自动跳转URL
                    HttpContext.Current.Response.Redirect(new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("login")));
                }
                //如果该用户未曾下载过该附件
                if (!bll.ExistsLog(model.id, userModel.id))
                {
                    //检查积分
                    if (model.point > userModel.point)
                    {
后面还有 67 行代码,购买后查看完整代码

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

AI 解读 AI

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

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