// ==UserScript== // @name 博思自动签到与自动抽奖 // @namespace 倚楼听风雨 // @description 博思论坛自动签到与自动抽奖 // @version 6.6.6 // @description 博思平台签到,需要先登录http://learn.iflysse.com/Login.aspx,不用再打开浏览器啦 // @author 倚楼听风雨 // @crontab * 1-23 once * * // @grant GM_xmlhttpRequest // @grant GM_notification // @connect learn.iflysse.com // @connect learn.iflysse.com // @cloudCat // @exportCookie domain=.iflysse.com // ==/UserScript== return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url: 'http://learn.iflysse.com/net-api/excitation/sign/sign', responseType: "json", onload: function (xhr) { console.log("响应信息:" + xhr.response); if (xhr.response.status == 1) { if (xhr.response.msg == '无权操作,身份信息为空!') { GM_notification({ title: '博思平台自动签到 - ScriptCat', text: '网络错误,博思平台签到失败', }); reject('网络错误,博思平台签到失败'); } else { GM_notification({ title: '博思平台', text: xhr.response.msg, image: "https://c-ssl.dtstatic.com/uploads/blog/202201/20/20220120085118_c542f.gif", timeout: 3000, }); resolve('签到完成!' + xhr.response); } } if (xhr.response.status == 1001) { GM_notification({ title: '博思平台', text: xhr.response.msg, timeout: 3000, }); resolve('重复签到' + xhr.response); } LuckDraw(); }, onerror: function () { GM_notification({ title: '博思平台自动签到 - ScriptCat', text: '网络错误,博思平台签到失败', }); reject('网络错误,博思平台签到失败'); } }); //休眠函数 function sleep(d) { for (var t = Date.now(); Date.now() - t <= d;); } function LuckDraw() { GM_xmlhttpRequest({ method: 'POST', url: 'http://learn.iflysse.com/Handler/Shop/LotteryDraw.ashx', data: "Action=4&LuckDrawID=d202331d-c158-4959-bf62-cd221f2300c0", headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" }, responseType: "json", onload: function (xhr) { console.log("抽奖响应信息:" + xhr.response.Msg); console.log("抽奖响应信息:" + xhr.response.Data.PrizeName); if (xhr.response.Result == true) { GM_notification({ title: '抽奖成功', text: xhr.response.Data.PrizeName, image: "https://c-ssl.dtstatic.com/uploads/blog/202211/26/20221126062717_b4a03.gif", timeout: 3000*3, }); resolve('抽奖完成!' + xhr.response); sleep(2000); LuckDraw(); } console.log("暂无抽奖卷,停止抽奖。"); reject('网络错误,博思平台签到失败'); return; }, onerror: function () { GM_notification({ title: '博思平台 - ScriptCat', text: '网络错误', }); reject('网络错误'); } }); } });