联通内网-法治在沃,自动刷积分

在UI界面点击开始以自动刷积分。通过联通OA进入法治在沃首页,点击开始即可。

  1. // ==UserScript==
  2. // @name 联通内网-法治在沃,自动刷积分
  3. // @namespace https://gitee.com/zouyongs/js-liantongdangxiao
  4. // @version 2.2
  5. // @description 在UI界面点击开始以自动刷积分。通过联通OA进入法治在沃首页,点击开始即可。
  6. // @author Zouys
  7. // @match http://lawplatform.unicom.local/unitework/pf/*.do
  8. // @icon http://aiportal.unicom.local/portal/v1/assets/images/icon/favicon.ico
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // Your code here...
  16. //http://lawplatform.unicom.local/law/tpfLike/toLike.do
  17. window.onload = function () {
  18. let show = 0
  19. let showWindow = document.createElement('button')
  20. showWindow.style.width = '60px'
  21. showWindow.style.height = '40px'
  22. showWindow.innerText = '开刷!'
  23. showWindow.style.position = 'fixed'
  24. showWindow.style.left = '0px'
  25. showWindow.style.top = '150px'
  26. showWindow.style.zIndex = '111'
  27. showWindow.addEventListener('click', ()=>{
  28. fuc_show()
  29. })
  30. function fuc_show() {
  31. let myWindow=document.getElementById('mywin')
  32. // let is_show=document.querySelector('#myWindow')
  33. show++
  34. if (show == 1) {
  35. myWindow.style.display = 'block'
  36. }
  37. else {
  38. show = 0
  39. myWindow.style.display = 'none'
  40. }
  41. }
  42. document.body.appendChild(showWindow)
  43. let myWindow = document.createElement('div')
  44. myWindow.id = 'mywin'
  45. myWindow.style.width = '300px'
  46. myWindow.style.height = '400px'
  47. myWindow.style.backgroundColor = '#efefef'
  48. myWindow.style.position = 'fixed'
  49. myWindow.style.left = '50px'
  50. myWindow.style.top = '150px'
  51. myWindow.style.zIndex = '111'
  52. myWindow.style.display = 'none'
  53. myWindow.innerHTML = `<button id="btn-begining">开始</button>
  54. 睡眠时间:<input id="sleeptime" value="3" style="display: inline-block;width: 40px;">
  55. <br>捕获条数:<div id="c-total" style="display: inline-block;width: 20px;color: #f5083f;">36</div>
  56. <br><div>日志信息:</div>
  57. <div style="width:90%;margin: auto auto;border-radius: 10px;position: relative;border: 1px solid grey;height: 200px;margin-top: 0px;">
  58.  
  59. <ul id="ul" style=" overflow-x: auto;white-space: nowrap;margin:0px 0px 0px 0px; overflow: auto;height:100%;">
  60. </ul>
  61. 当前进度:
  62. <div id="myProgress" style="width: 0%; height: 20px; background-color: green; position: relative; bottom: 0;">
  63. </div>
  64. <div id="progrssNum" style="display: flex;justify-content: center;position: relative; top: -20px;">0%</div>
  65. </div>`
  66. document.body.appendChild(myWindow)
  67. var readyCheck=true
  68. var arrAll = getID();
  69. document.getElementById('c-total').innerText=arrAll.length || 0
  70. var myUl=document.getElementById('ul')
  71. //进度条
  72. var myProgress=document.getElementById('myProgress')
  73. var myProgressNum=document.getElementById('progrssNum')
  74.  
  75. var list=document.createElement('li')
  76. list.innerHTML=`等待开始...`
  77. myUl.appendChild(list)
  78. document.getElementById('btn-begining').addEventListener('click', () => {
  79. if(readyCheck==true)
  80. {
  81. readyCheck=false
  82. myProgress.style.width=`0%`
  83. myProgressNum.innerText=`0%`
  84. doMain(document.getElementById('sleeptime').value * 1000 || 3000).then(v=>{
  85. readyCheck=true
  86. })
  87. }
  88. else{
  89. alert('请等待本次操作完成~')
  90. }
  91. })
  92.  
  93. // 设置全局cookie
  94. $.ajaxSetup({
  95. xhrFields: {
  96. withCredentials: true
  97. }
  98. });
  99.  
  100. //签到
  101. $.ajax({
  102. url: 'http://lawplatform.unicom.local/law/TpfAttendance/sgin.do', // 请求的URL地址
  103. type: 'POST', // 请求的方式(GET、POST等)
  104. dataType: 'json', // 响应的数据类型(json、xml等)
  105. success: function (data) {
  106. // 请求成功时的回调函数,data参数包含相应的数据
  107. console.log(data.msg)
  108. let mylist=document.createElement('li')
  109. mylist.innerHTML= data.msg==='积分+10'?`签到成功~积分+10`:`${data.msg}` || ``
  110. myUl.appendChild(mylist)
  111. },
  112. error: function (xhr, status, error) {
  113. // 请求失败时的回调函数,xhr参数包含XMLHttpRequest对象,status参数包含错误状态,error参数包含错误信息
  114. console.log('请求失败:' + status + ' - ' + error);
  115. }
  116. });
  117. async function sleep(time) {
  118. return await new Promise((resolve) => {
  119. console.log('睡眠'+time/1000+'s')
  120. var list=document.createElement('li')
  121. list.innerHTML=`睡眠${time/1000}s...`
  122. myUl.appendChild(list)
  123. setTimeout(resolve, time)
  124. });
  125. }
  126. var index = 0;
  127. //获取首页30个文章id
  128. function getID() {
  129. var arr;
  130. var as = document.querySelectorAll('li');
  131. var ps = document.querySelectorAll('p');
  132. var needArr=[];
  133. arr = Array.from(as);
  134. for(var i of arr){if(i && i.innerHTML && i.innerHTML.split('opendetail')[1] ){
  135. // console.log(i.innerHTML.split('opendetail')[1].split('(\'')[1].split('\')')[0])
  136. needArr.push(i.innerHTML.split('opendetail')[1].split('(\'')[1].split('\')')[0])
  137. }}
  138. var arrp = Array.from(ps);
  139. for(var j of arrp){if(j && j.outerHTML && j.outerHTML.split('opendetail')[1] ){
  140. // console.log(j.outerHTML.split('opendetail')[1].split('(\'')[1].split('\')')[0])
  141. needArr.push(j.outerHTML.split('opendetail')[1].split('(\'')[1].split('\')')[0])
  142. }}
  143. //去重
  144. return [...new Set(needArr)];
  145. }
  146. //每3s发送一次点赞请求v
  147. async function sendResPre3s(id) {
  148. let mylist=document.createElement('li')
  149. let listring
  150. await $.ajax({
  151. url: 'http://lawplatform.unicom.local/law/tpfLike/toLike.do', // 请求的URL地址
  152. type: 'POST', // 请求的方式(GET、POST等)
  153. dataType: 'json', // 响应的数据类型(json、xml等)
  154. data: {
  155. infoId: id
  156. },
  157. success: function (data) {
  158. // 请求成功时的回调函数,data参数包含相应的数据
  159. console.log(++index + ' 点赞-- ' + data.status + ' id=', id)
  160. listring=`第${index} 点赞=>${data.status} `
  161. },
  162. error: function (xhr, status, error) {
  163. // 请求失败时的回调函数,xhr参数包含XMLHttpRequest对象,status参数包含错误状态,error参数包含错误信息
  164. console.log('请求失败:' + status + ' - ' + error);
  165. listring=`点赞请求失败`
  166. }
  167. });
  168. //完整浏览文章
  169. //浏览积分
  170. // var url = "http://lawplatform.unicom.local/law/tpfIntegralDetail/addBrowseIntegral.do"
  171. var url="http://lawplatform.unicom.local/law/tpfIntegralDetail/addBrowseIntegralDetail.do"
  172. await $.ajax({
  173. url: url,
  174. type: "POST",
  175. data: {
  176. infoId: id
  177. },
  178. success: function (data) {
  179. console.log('浏览--' + data.massege + ' id=', id)
  180. listring+=` 浏览=>${data.massege} id=${id}`
  181. }
  182. });
  183. mylist.innerHTML=listring
  184. myUl.appendChild(mylist)
  185. let pgr=Math.round(index/arrAll.length *100)
  186. console.log('pgr:'+pgr)
  187. myProgress.style.width=`${pgr}%`
  188. myProgressNum.innerText=`${pgr}%`
  189. }
  190. async function doMain(ms) {
  191. index=0
  192. //主运行代码
  193. for (var i of arrAll) {
  194. await sendResPre3s(i);
  195. await sleep(ms);
  196. }
  197. }
  198. }
  199. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址