// ==UserScript== // @icon https://vip.kingdee.com/favicon.ico // @name 金蝶云社区自动签到抽奖_免打扰 // @namespace https://55gy.cn/ // @version 1.2 // @description 自动签到,抽奖 // @author 55gY // @match *://vip.kingdee.com/* // @exclude *://vip.kingdee.com/api/checkins* // @run-at document-idle // @grant GM_xmlhttpRequest // @grant GM_addStyle // @connect * // @require https://www.55gy.cn/message.js // ==/UserScript== //通知插件message.min.js //https://whitesevs.github.io/Message.js/src/message.js /** * ///签到 POST * ///https://vip.kingdee.com/api/checkins/ * ////正常 * ///{"coins":40} * ////已签到 * ///{"errorCode":409,"errors":null,"message":"今天已签到"} * /////////////////////////////////////////////////////////////////////// * ///签到状态 GET * ///https://vip.kingdee.com/api/checkins/status * ///{"checkIn":true,"coins":10} /////////////////////////////////////////////////////////////////////// * ///签到抽奖 POST * ///https://vip.kingdee.com/activityapi/activities/731/lottery/604602279601212672/draw * ////返回 抽奖结果 * ///{"createdAt":1724748234599,"deliverInfo":null,"id":"616312013727201024","prizeId":"462640073654295808","prizePoolId":"604602279601212672"} * ////返回 已抽奖 * ///{"errorCode":409,"errors":null,"message":"您今天还没签到或者已抽奖了"} * /////////////////////////////////////////////////////////////////////// * ///抽奖结果明细 GET * ///https://vip.kingdee.com/activityapi/me/activities/731/lottery-draw-records?page=1&pageSize=1 * ///{"content":[{"createdAt":1724827818000,"deliverInfo":null,"id":"616645810649822976","prize":{"amount":8,"checkInCardNum":0,"coins":8,"createdAt":1688110048000,"credits":0,"description":"13:8","extractionCode":null,"id":"462640322560713984","image":"/download/010059fbd986b8ea4b62a269013f94c3fc44.png","lotteryTimes":0,"name":"8社区金币","new":false,"prizePoolId":null,"type":1,"updatedAt":null,"url":null},"prizePool":{"allowLotteryTime":null,"id":"604602279601212672","openStatus":null,"prizeList":null,"taskId":null},"winner":{"avatar":"/download/0101c39bc0d221a748af9720a075a8cde325.png","id":"333201710350846208","isCurrentUser":null,"name":"55gY","nameSpell":"name","phone":null}}],"empty":false,"first":true,"last":false,"number":0,"numberOfElements":1,"pageable":{"offset":0,"pageNumber":0,"pageSize":1,"paged":true,"sort":{"empty":false,"sorted":true,"unsorted":false},"unpaged":false},"size":1,"sort":{"empty":false,"sorted":true,"unsorted":false},"totalElements":26,"totalPages":26} * /////////////////////////////////////////////////////////////////////// */ (function() { 'use strict'; //通知插件CSS message.min.css //GM_addStyle('.qmsg.qmsg-wrapper{box-sizing:border-box;margin:0;padding:0;color:rgba(0,0,0,.55);font-size:13px;font-variant:tabular-nums;line-height:1;list-style:none;font-feature-settings:"tnum";position:fixed;top:16px;left:0;z-index:1010;width:100%;pointer-events:none;}.qmsg .qmsg-item{padding:8px;text-align:center;-webkit-animation-duration:.3s;animation-duration:.3s;position:relative;}.qmsg .qmsg-item .qmsg-count{text-align:center;position:absolute;left:-4px;top:-4px;background-color:red;color:#fff;font-size:12px;line-height:16px;border-radius:2px;display:inline-block;min-width:16px;height:16px;-webkit-animation-duration:.3s;animation-duration:.3s;}.qmsg .qmsg-item:first-child{margin-top:-8px;}.qmsg .qmsg-content{text-align:left;position:relative;display:inline-block;padding:10px 16px;background:#fff;border-radius:4px;box-shadow:0 4px 12px rgba(0,0,0,.15);pointer-events:all;max-width:80%;min-width:80px;}.qmsg .qmsg-content [class^="qmsg-content-"]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.qmsg .qmsg-content .qmsg-content-with-close{padding-right:20px;}.qmsg .qmsg-icon{display:inline-block;color:inherit;font-style:normal;line-height:0;text-align:center;text-transform:none;vertical-align:-.125em;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;top:1px;margin-right:8px;font-size:16px;}.qmsg .qmsg-icon svg{display:inline-block;}.qmsg .qmsg-content-info .qmsg-icon{color:#1890ff;user-select:none;}.qmsg .qmsg-icon-close{position:absolute;top:11px;right:5px;padding:0;overflow:hidden;font-size:12px;line-height:22px;background-color:transparent;border:none;outline:none;cursor:pointer;color:rgba(0,0,0,.45);transition:color .3s}.qmsg .qmsg-icon-close:hover>svg path{stroke:#555;}.qmsg .animate-turn{animation:MessageTurn 1s linear infinite;-webkit-animation:MessageTurn 1s linear infinite;}@keyframes MessageTurn{0%{-webkit-transform:rotate(0deg);}25%{-webkit-transform:rotate(90deg);}50%{-webkit-transform:rotate(180deg);}75%{-webkit-transform:rotate(270deg);}100%{-webkit-transform:rotate(360deg);}}@-webkit-keyframes MessageTurn{0%{-webkit-transform:rotate(0deg);}25%{-webkit-transform:rotate(90deg);}50%{-webkit-transform:rotate(180deg);}75%{-webkit-transform:rotate(270deg);}100%{-webkit-transform:rotate(360deg);}}@-webkit-keyframes MessageMoveOut{0%{max-height:150px;padding:8px;opacity:1}to{max-height:0;padding:0;opacity:0}}@keyframes MessageMoveOut{0%{max-height:150px;padding:8px;opacity:1}to{max-height:0;padding:0;opacity:0}}@-webkit-keyframes MessageMoveIn{0%{transform:translateY(-100%);transform-origin:0 0;opacity:0}to{transform:translateY(0);transform-origin:0 0;opacity:1}}@keyframes MessageMoveIn{0%{transform:translateY(-100%);transform-origin:0 0;opacity:0}to{transform:translateY(0);transform-origin:0 0;opacity:1}}@-webkit-keyframes MessageShake{0%,100%{transform:translateX(0px);opacity:1;}25%,75%{transform:translateX(-4px);opacity:0.75;}50%{transform:translateX(4px);opacity:0.25;}}@keyframes MessageShake{0%,100%{transform:translateX(0px);opacity:1;}25%,75%{transform:translateX(-4px);opacity:0.75;}50%{transform:translateX(4px);opacity:0.25;}}'); /** * 防止require引入js失败 * JS已集成css */ //日期 var today = new Date(); var DD = String(today.getDate()).padStart(2, '0'); // 获取日 var MM = String(today.getMonth() + 1).padStart(2, '0'); //获取月份,1 月为 0 var yyyy = today.getFullYear(); // 获取年 today = yyyy + '-' + MM + '-' + DD; let s = { a: "正在自动签到...", c: "您已经签到了!", f: "签到成功!", g: "签到失败!", i: "自动签到中..", // j: "#header-inner > .lang-switch > img ", status_link: 'api/checkins/status', checkins: 'api/checkins/', draw: 'activityapi/activities/731/lottery/604602279601212672/draw', draw_list: 'activityapi/me/activities/731/lottery-draw-records?page=1&pageSize=1', } let header = { "Host": "vip.kingdee.com", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0", "Accept": "application/json, text/plain, */*", "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2", "Accept-Encoding": "gzip, deflate, br, zstd", "currentProductLineId": "1", "page-url": "https://vip.kingdee.com/", "pre-page": "https%3A%2F%2Fvip.kingdee.com%2F%", "lang": "zh-CN", "X-CSRF-TOKEN": getCookie('V-CSRF-TOKEN') , "DNT": "1", "Sec-GPC": "1", "Connection": "keep-alive", "Referer": "https://vip.kingdee.com/", "Cookie": document.cookie, "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "Pragma": "no-cache", "Cache-Control": "no-cache" } /** * 通知插件 */ function js() { var script = document.createElement("script"); script.type = 'text/javascript'; script.src = 'https://www.55gy.cn/message.js'; document.body.appendChild(script); }; /** * 签到后保存cookies * * autoSign: {date:时间,coins:签到金币} */ function saveDate({time="",coins="",coins_draw=""}){ var obj = JSON.parse(localStorage.getItem('autoSign')); if(time){ obj.date = today; } if(coins){ obj.coins = coins; Qmsg.success('签到成功,获得金币:'+coins,{timeout:5000,autoClose:true}); } if(coins_draw){ obj.coins_draw = coins_draw; Qmsg.success("抽奖成功,获得金币:"+coins_draw,{timeout:5000,autoClose:true}); } //document.querySelector('.tool-item-sign.tool-item' ).style.height='80px'; //document.querySelector('.tool-item-sign.tool-item > .item-title').innerHTML=`签到:${coins}<br>抽奖:${coins_draw}`; localStorage.setItem('autoSign',JSON.stringify(obj)); } /** * 判断当天是否已签到 * * 通过获取本地cookies {autoSign.date} */ function isTody(){ var aas = localStorage.getItem('autoSign'); if(aas !== null){ var obj = JSON.parse(aas); if(obj){ //判断签到日期 var time=new Date(obj.date); var time1=new Date(today); if(time.getTime() != time1.getTime()){ return false; } if(obj.coins==''){ return false; } //document.querySelector('.tool-item-sign.tool-item' ).style.height='80px'; //document.querySelector('.tool-item-sign.tool-item > .item-title').innerHTML=`签到:${obj.coins}<br>抽奖:${obj.coins_draw}`; return true; } }else{ localStorage.setItem('autoSign',JSON.stringify({"date":"1970-01-01","coins":"","coins_draw":""})); return false; } //本地cookies不存在 return false; } /** * 抽奖,并获取最新一条的抽奖明细 */ function draw(){ //抽奖 Qmsg.info("正在进行抽奖",{timeout:2000,autoClose:true}); GM_xmlhttpRequest({ method: "post", url: s.draw, data: '', headers: header, onload: function(r) { //抽奖后获取抽奖明细 Qmsg.info("获取抽奖明细",{timeout:2000,autoClose:true}); GM_xmlhttpRequest({ method: "get", url: s.draw_list, data: '', headers: header, onload: function(r) { var obj=JSON.parse(r.responseText); saveDate({'coins_draw':obj.content[0].prize.coins}); } }); } }); } /** * 获取指定cookie名称的值 * @name {string} cookie名称 */ function getCookie(name) { let matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } /** * 签到主程序 */ function autoSign() { if (!isTody()){ Qmsg.info(s.a,{timeout:2000,autoClose:true}); // 获取签到状态 GM_xmlhttpRequest({ method: "get", url: s.status_link, data: '', headers: header, onload: function(r) { var res=r.responseText; if(res.indexOf('"checkIn":false')>0){ // 未签到,执行签到 GM_xmlhttpRequest({ method: "post", url: s.checkins, data: '', headers: header, onload: function(r) { if(r.responseText.indexOf("coins")>0){ // 签到成功 // console.log(s.f); Qmsg.info(s.f,{timeout:2000,autoClose:true}); var obj=JSON.parse(r.responseText); saveDate({'time':today,'coins':obj.coins}); }else{ // 签到失败 // console.log(s.g); Qmsg.error(s.g,{timeout:2000,autoClose:true}); } } }); }else if(res.indexOf('"checkIn":true')>0){ Qmsg.error(s.c,{timeout:2000,autoClose:true}); var obj=JSON.parse(res); saveDate({'time':today,'coins': obj.coins}); } //签到后,执行抽奖 draw(); } }); } } js(); autoSign(); })();
本文作者为55gY,转载请注明。
本站资源来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。敬请谅解!