Web/Global.asax.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace Web
{
    public class Global : System.Web.HttpApplication
    {
        Model.OnlineNumber model = new Model.OnlineNumber();
        BLL.OnlineNumber bll = new BLL.OnlineNumber();
        protected void Application_Start(object sender, EventArgs e)
        {
            //应用程序启动时运行的代码
            Application["count"] = 0;
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            //对Appliaction加锁以防止并行性
            Application.Lock();
            //增加一个在线人数
            Application["count"] = (int)Application["count"] + 1;
            bll.UpdateField(2, "Count=Count+1");
            model = bll.GetModel(2);
            DateTime dt = model.AddTime.Date;
            DateTime newtime = DateTime.Now.Date;
            TimeSpan ts = newtime.Subtract(dt);
            if (ts.Days == 0)
            {
                bll.UpdateField(2, "DayCount=DayCount+1");
            }
            else
            {
                bll.UpdateField(2, "DayCount=1");
                bll.UpdateField(2, "AddTime='" + DateTime.Now.Date + "'");
            }
            //解锁
            Application.UnLock();
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {
            Application.Lock();
后面还有 11 行代码,购买后查看完整代码

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

AI 解读 AI

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

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