投后结案(定时生成报告)

云图扩展工具

  1. // ==UserScript==
  2. // @name 投后结案(定时生成报告)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 云图扩展工具
  6. // @author siji-Xian
  7. // @match *://yuntu.oceanengine.com/yuntu_ng/evaluation_brand/task_list?*
  8. // @icon https://lf3-static.bytednsdoc.com/obj/eden-cn/prhaeh7pxvhn/yuntu/yuntu-logo_default.svg
  9. // @grant none
  10. // @license MIT
  11. // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.2.1/jquery.min.js
  12. // @require https://gf.qytechs.cn/scripts/404478-jsonexportexcel-min/code/JsonExportExcelmin.js?version=811266
  13. // @require https://gf.qytechs.cn/scripts/463728-lodash-js/code/lodashjs.js?version=1174104
  14. // @require https://gf.qytechs.cn/scripts/455576-qmsg/code/Qmsg.js?version=1122361
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. "use strict";
  19. var new_element = document.createElement('link');
  20. new_element.setAttribute('rel', 'stylesheet');
  21. new_element.setAttribute('href', 'https://qmsg.refrain.xyz/message.min.css');
  22. document.body.appendChild(new_element);
  23.  
  24. const button = document.createElement("div");
  25. button.textContent = "生成报告";
  26. Object.assign(button.style, {
  27. height: "34px",
  28. lineHeight: "var(--line-height, 34px)",
  29. alignItems: "center",
  30. color: "white",
  31. background: "linear-gradient(90deg, rgba(0, 239, 253), rgba(64, 166, 254))",
  32. borderRadius: "5px",
  33. marginLeft: "10px",
  34. fontSize: "13px",
  35. padding: "0 10px",
  36. cursor: "pointer",
  37. fontWeight: "500",
  38. });
  39. button.addEventListener("click", urlClick); //监听按钮点击事件
  40. const getRequestOptions = {
  41. method: 'GET',
  42. redirect: 'follow'
  43. };
  44.  
  45. //message.js
  46. let loadingMsg = null
  47.  
  48. function appendDoc() {
  49. setTimeout(() => {
  50. var like_comment = document.querySelector('.index__btnWrapper--gvaIn');
  51. if (like_comment) {
  52. like_comment.append(button); //把按钮加入到 x 的子节点中
  53. return
  54. }
  55. appendDoc()
  56. }, 1000);
  57. }
  58. appendDoc()
  59.  
  60. function getQueryVariable(variable) {
  61. var query = window.location.search.substring(1);
  62. var vars = query.split("&");
  63. for (var i = 0; i < vars.length; i++) {
  64. var pair = vars[i].split("=");
  65. if (pair[0] == variable) {
  66. return pair[1];
  67. }
  68. }
  69. return false;
  70. }
  71. //获取aadvid
  72. const aadvid = getQueryVariable("aadvid");
  73. async function fetchFun(url, data, requestOptions = getRequestOptions()) {
  74. const params = new URLSearchParams(data).toString();
  75. try {
  76. const response = await fetch(`${url}?${params}`, requestOptions);
  77. if (response.ok) {
  78. const result = await response.json();
  79. return result;
  80. } else {
  81. throw new Error(`Fetch failed: ${response.status}`);
  82. }
  83. } catch (error) {
  84. loadingMsg.close();
  85. Qmsg.error({
  86. content: `网络请求错误: ${error.message}`,
  87. timeout: 5000
  88. });
  89. throw error;
  90. }
  91. }
  92.  
  93. let myHeaders = new Headers();
  94. myHeaders.append("authority", "yuntu.oceanengine.com");
  95. myHeaders.append("accept", "application/json, text/plain, */*");
  96. myHeaders.append("accept-language", "zh-CN,zh;q=0.9");
  97. myHeaders.append("content-type", "application/json");
  98. myHeaders.append("origin", "https://yuntu.oceanengine.com");
  99. myHeaders.append("referer", "https://yuntu.oceanengine.com/yuntu_ng/evaluation_brand/task_create?task_id=677363&mode=2&aadvid=1672744301182989");
  100.  
  101. async function getList(){
  102. let raw = JSON.stringify({
  103. "main_brand_id": "1094484",
  104. "level_1_industry_id": 13,
  105. "offset": 0,
  106. "count": 10,
  107. "order_type": 1,
  108. "task_statuses": [
  109. 2,
  110. 1
  111. ]
  112. });
  113. let data = {
  114. aadvid
  115. }
  116. const postRequestOptions = {
  117. method: "POST",
  118. headers: myHeaders,
  119. body: raw,
  120. redirect: "follow",
  121. };
  122. let total = await fetchFun(
  123. "https://yuntu.oceanengine.com/measurement/api/eva/get_evaluation_task_list_v2",
  124. data,
  125. postRequestOptions
  126. );
  127.  
  128. return total
  129. }
  130.  
  131. async function getNotList(){
  132. let raw = JSON.stringify({
  133. "main_brand_id": "1094484",
  134. "level_1_industry_id": 13,
  135. "offset": 0,
  136. "count": 10,
  137. "order_type": 1,
  138. "task_statuses": [
  139. 0
  140. ]
  141. });
  142. let data = {
  143. aadvid
  144. }
  145. const postRequestOptions = {
  146. method: "POST",
  147. headers: myHeaders,
  148. body: raw,
  149. redirect: "follow",
  150. };
  151. let total = await fetchFun(
  152. "https://yuntu.oceanengine.com/measurement/api/eva/get_evaluation_task_list_v2",
  153. data,
  154. postRequestOptions
  155. );
  156.  
  157. return total
  158. }
  159.  
  160. async function createdTask(task_id){
  161. let raw = JSON.stringify({
  162. "main_brand_id": "1094484",
  163. "level_1_industry_id": 13,
  164. "user_id": "99406591190",
  165. "staff_id": "",
  166. "task_id": task_id
  167. });
  168. let data = {
  169. aadvid
  170. }
  171. const postRequestOptions = {
  172. method: "POST",
  173. headers: myHeaders,
  174. body: raw,
  175. redirect: "follow",
  176. };
  177. let total = await fetchFun(
  178. "https://yuntu.oceanengine.com/measurement/api/eva/start_calculate_evaluation_task",
  179. data,
  180. postRequestOptions
  181. );
  182.  
  183. return total
  184. }
  185.  
  186. async function urlClick() {
  187. loadingMsg = Qmsg.loading("任务开启成功~");
  188. let interval = setInterval(async () => {
  189. let notList = await getNotList()
  190. if (notList?.data?.task_list?.length > 1) {
  191. let res = await getList()
  192. if (res?.code===0 && res?.data?.task_list?.length<=5) {
  193. createdTask(notList?.data?.task_list[1]?.task_id)
  194. }
  195. }else{
  196. clearInterval(interval)
  197. }
  198. }, 60000);
  199. }
  200. })();

QingJ © 2025

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