Web/Tools/Advert_js.ashx.cs

(开头部分) 12KB

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

using System;
using System.Text;
using System.Data;
using System.Web;
using Common;

namespace Web.Tools
{
    public class Advert_js : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            int aid;

            //获得广告位的ID
            if (!int.TryParse(context.Request.Params["id"] as string, out aid))
            {
                context.Response.Write("document.write('错误提示,请勿提交非法字符!');");
                return;
            }

            //检查广告位是否存在
            BLL.Advertising abll = new BLL.Advertising();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('错误提示,该广告位不存在!');");
                return;
            }

            //取得该广告位详细信息
            Model.Advertising aModel = abll.GetModel(aid);

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            BLL.Adbanner bbll = new BLL.Adbanner();
            DataSet ds = bbll.GetList("IsLock=0 and datediff(d,StartTime,getdate())>=0 and datediff(d,EndTime,getdate())<=0 and Aid=" + aid);
            if (ds.Tables[0].Rows.Count < 1)
            {
                context.Response.Write("document.write('该广告位下暂无广告内容');");
                return;
            }

            //=================判断广告位类别,输出广告条======================

            //新增,取得站点配置信息
            Model.WebSet webset = new BLL.WebSet().loadConfig(Utils.GetXmlMapPath("Configpath"));

            switch (aModel.AdType)
            {
                case 1: //文字
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.AdNum)
                            break;
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<a title=\"" + dr["Title"] + "\" target=\"" + aModel.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">" + dr["Title"] + "</a>');");
                        context.Response.Write("document.write('</li>');\n");
后面还有 133 行代码,购买后查看完整代码

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

AI 解读 AI

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

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