12558网页游戏私服论坛

 找回密码
 立即注册
游戏开服表 申请开服
游戏名称 游戏描述 开服状态 游戏福利 运营商 游戏链接
攻城掠地-仿官 全新玩法,觉醒武将,觉醒技能 每周新区 经典复古版本,长久稳定 进入游戏
巅峰新版攻 攻城掠地公益服 攻城掠地SF 新兵种、新武将(兵种) 进入游戏
攻城掠地公 散人玩家的天堂 新开 进入游戏
改版攻城掠 上线即可国战PK 稳定新区 全新改版,功能强大 进入游戏
少年江山 高福利高爆率 刚开一秒 江湖水落潜蛟龙 进入游戏
太古封魔录 开服送10亿钻石 福利多多 不用充钱也可升级 进入游戏
神魔之道 签到送元宝 稳定开新区 送豪华签到奖励 进入游戏
神奇三国 统帅三军,招揽名将 免费玩新区 激情国战,征战四方 进入游戏
龙符 三日豪礼领到爽 天天开新区 助你征战无双 进入游戏
王者之师 免费领豪华奖励 免费玩新区 6元送6888元宝 进入游戏
查看: 453|回复: 0

新理念外语网络教学平台挂机判定问题

[复制链接]

312

主题

312

帖子

634

积分

实习版主

Rank: 7Rank: 7Rank: 7

积分
634
发表于 2020-2-9 02:09:26 | 显示全部楼层 |阅读模式
学校要求每个学习单元都学习45分钟,一共28个单元——
可是挂机时候发现5分钟没操作,就会弹框提示并且停止累积学习时长。刚刚开始以为是检测点击,毕竟常规思路,用了鼠标连点器,还是不行,于是进行了研究。
[C#] 纯文本查看 复制代码前面的都是整体框架,显示模式,格式控制等等,直接省略。        //check whether the material has been authorized to the student        function CheckAuthorize(material) {  //检测用户信息是否授权使用,需要正版教材附赠的激活码才能使用全部课程            var res = false;            $.ajax({                url: "Student/LogTime.aspx",                async: false,                datatype: "html",                data: "logType=checkneedauthorize&material=" + material + "&nocache=" + Math.random(),                success: function (result) {                    if (result != "false") {                        document.getElementById("spMaterialAuth").style.display = "";                        document.getElementById("spMaterialName").innerText = result;                        var returnvalue = window.showModalDialog("Student/MaterialAuth.aspx?material=" + material, null, "dialogWidth=800px;dialogHeight=300px");                        if (returnvalue && (returnvalue == "passed" || returnvalue == "submited")) {                            res = true;                            document.getElementById("spMaterialAuth").style.display = "none";                        }                    }                    else {                        document.getElementById("spMaterialAuth").style.display = "none";                        res= true;                    }                }            });            return res;        }                //script block for study time stat        //TODO 此方法和StartNewStatTime没区别,仅在服务器端处理有些许区别,应该合并。    function AddStatTime(stattype, url){        var material = "";        var unit = "";        var classno = "";                // is study material        var ret = IsMaterialStudyUrl(url);        if (ret != "false")        {            var info = ret.split('|');            classno = info[0];            material = info[1];            unit = info[2];        }        else        {            ret = IsAssistStudyUrl(url);            if (ret != "false")            {                var info = ret.split('|');                material = info[0];                unit = info[1];             }        }                        $.ajax({            url: "Student/LogTime.aspx",            async: false,            datatype: "html",            data: "logType=addstattime&stattype="+stattype+"&material="+material+"&unit="+unit+"&class="+classno+"&nocache="+Math.random(),            success: function(result) {            }        });    }        function EndStatTime(){  //判定为挂机行为的后续操作,踢出在线状态        $.ajax({            url: "Student/LogTime.aspx",            async: false,            datatype: "html",            data: "logType=endstattime"+"&nocache="+Math.random(),            success: function(result) {            }        });    }    function UpdateStatTime(){ //累积在线时长        $.ajax({            url: "Student/LogTime.aspx",            async: false,            datatype: "html",            data: "logType=updatestattime"+"&nocache="+Math.random(),            success: function(result) {                            }        });    }        function StartNewStatTime(stattype, url){        var material = "";        var unit = "";        var classno = "";                // is study material        var ret = IsMaterialStudyUrl(url);        if (ret != "false")        {            var info = ret.split('|');            classno = info[0];            material = info[1];            unit = info[2];        }        else        {            ret = IsAssistStudyUrl(url);            if (ret != "false")            {                var info = ret.split('|');                material = info[0];                unit = info[1];             }        }        $.ajax({            url: "Student/LogTime.aspx",            async: false,            datatype: "html",            data: "logType=startnewstattime&stattype="+stattype+"&material="+material+"&unit="+unit+"&class="+classno+"&nocache="+Math.random(),            success: function(result) {            }        });    }        //计时,每一分钟累积一次在线时长。    function CountSeconds() {        try{            CheckToken();                  }catch(e){}        if (!isTest){            seconds++;            if (seconds >= 60) {   //one minutes                UpdateStatTime();                seconds = 0;            }        }    }    var secTimerID = window.setInterval("CountSeconds();", 1000);        function GetRandomWord()    {        var res = false;        $.ajax({            url: "Student/LogTime.aspx",            async: false,            datatype: "html",            data: "logType=getrandomword&nocache=" + Math.random(),            success: function (result) {                res = result;            }        });        return res;    }        function Leave()  //判定为挂机行为后,弹出提示    {        var msg = GetRandomWord();        var loadingInfo = '离开了?回来学个单词吧。

'+msg+'
';        TINY.box.show({html:loadingInfo,mask:true,animate:false,close:true,boxid:'frameless',closejs:function(){LeaveBack()}});    }    function LeaveBack()//点击离开提示后,再次开始累积    {        seconds = 0;        AddStatTime("", window.frames['mainFrame'].document.location.href);        GetServerTime("StudyStart");        MoveMouse();        secTimerID = window.setInterval("CountSeconds();", 1000);        actTimerID = window.setInterval("CheckActive();", 5000);    }    function CheckActive() { //检测是否是挂机。如果超过5分钟没有鼠标在网页上移动,就判定为挂机,比如可能最小化了再玩别的游戏                   if (!isMaterialStudy && !isAssistStudy)            return;                    var d = new Date();        if (d.getTime() - latestMoveTime > 300 * 1000)         {                     clearInterval(actTimerID);                   clearInterval(secTimerID);            EndStatTime();                        Leave();        }    }    var actTimerID = window.setInterval("CheckActive();", 5000);    function MainFrameClick(){        MoveMouse();    }    function newResize()    {        var subwindow=window.frames[0];        if(subwindow && subwindow.Resize)            subwindow.Resize();      }
楼主热帖
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|12558网页游戏私服论坛 |网站地图

GMT+8, 2024-4-18 11:20 , Processed in 0.125000 second(s), 30 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表