PUGE 5 месяцев назад
Родитель
Сommit
754da7b86e

+ 4 - 3
config.json

@@ -1,7 +1,7 @@
 {
-    "enterURL": "https://m.youtube.com/",
-    "width": 376,
-    "height": 667,
+    "enterURL": "https://mms.pinduoduo.com/chat-service/status?msfrom=mms_sidenav",
+    "width": 800,
+    "height": 600,
     "webPreferences": {
         "webSecurity": false,
         "nodeIntegration": false,
@@ -18,6 +18,7 @@
     "proxy":"",
     "noCache": false,
     "interceptor":[
+        "https://mms.pinduoduo.com/desert/mallCsChatStat"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

+ 24 - 0
dist/拼多多客服提醒/config.json

@@ -0,0 +1,24 @@
+{
+    "enterURL": "https://mms.pinduoduo.com/chat-service/status?msfrom=mms_sidenav",
+    "width": 800,
+    "height": 600,
+    "webPreferences": {
+        "webSecurity": false,
+        "nodeIntegration": false,
+        "nativeWindowOpen": false,
+        "preload": "<dir>/preload.js",
+        "worldSafeExecuteJavaScript": true,
+        "enableRemoteModule": false,
+        "safeDialogs": false
+    },
+    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
+    "autoHideMenuBar": true,
+    "redirect":[],
+    "redirectURL":"",
+    "proxy":"",
+    "noCache": false,
+    "interceptor":[
+        "https://mms.pinduoduo.com/desert/mallCsChatStat"
+    ],
+    "preLoadFile": "<dir>/preLoadFile.js"
+}

+ 46 - 0
dist/拼多多客服提醒/preLoadFile.js

@@ -0,0 +1,46 @@
+window.sendTemp = ''
+window.onInterceptedData = function (data) {
+  window.systemInfo = data
+  if (data.url.includes('https://mms.pinduoduo.com/desert/mallCsChatStat')) {
+    const dataTemp = JSON.parse(data.responseBody)
+    console.log(dataTemp)
+    let temp = ``
+    dataTemp.result.csData.forEach(element => {
+      temp += `${element.csname} mobile:${element.mobile} pc:${element.pc}\r\n`
+    });
+    if (temp != window.sendTemp) {
+      window.sendTemp = temp
+      sendMessage(window.sendTemp)
+    }
+  }
+
+};
+
+function sendMessage (text) {
+  const myHeaders = new Headers();
+  myHeaders.append("Content-Type", "application/json");
+
+  const raw = JSON.stringify({
+    "text": text,
+    "touser": [
+      "puge"
+    ]
+  });
+
+  const requestOptions = {
+    method: "POST",
+    headers: myHeaders,
+    body: raw,
+    redirect: "follow"
+  };
+
+  fetch("https://msg.lamp.run/workWeixin?type=message&corpsecret=KcwQ0WksW0C_yodUQtYQArav5DBKWLnSCkh-5k3_nr8&agentid=1000003&corpID=ww5eabd902d66609f5", requestOptions)
+    .then((response) => response.text())
+    .then((result) => console.log(result))
+    .catch((error) => console.error(error));
+}
+
+
+setInterval(() => {
+  if(document.querySelector('.update')) document.querySelector('.update').click()
+}, 10000);

+ 33 - 0
dist/拼多多客服提醒/preload.js

@@ -0,0 +1,33 @@
+const { contextBridge, ipcRenderer } = require('electron');
+
+
+
+// window.open = (url)=>{console.log(url)}
+window.lastText = ''
+window.lastText2 = ''
+
+
+
+contextBridge.exposeInMainWorld('electronAPI', {
+  openWindow: (msg) => ipcRenderer.invoke('openWindow', msg),
+  closeAllWindow: (msg) => ipcRenderer.send('closeAllWindow', msg),
+  getData: (msg) => ipcRenderer.send('getData', msg),
+  postData: (msg) => ipcRenderer.send('postData', msg),
+  setProxy: (msg) => ipcRenderer.send('setProxy', msg),
+  addPreLoadCode: (msg) => ipcRenderer.send('addPreLoadCode', msg),
+  setStoData: (msg) => ipcRenderer.send('setStoData', msg),
+  getStoData: (msg) => ipcRenderer.send('getStoData', msg),
+  closeWindow: (msg) => ipcRenderer.send('closeWindow', msg),
+  changeProxy: (msg) => ipcRenderer.send('changeProxy', msg),
+  readConfig: (msg) => ipcRenderer.send('readConfig', msg),
+  saveConfig: (msg) => ipcRenderer.send('saveConfig', msg),
+  setMaxWindowOpenNum: (msg) => ipcRenderer.send('setMaxWindowOpenNum', msg),
+  readdir: (msg) => ipcRenderer.send('readdir', msg),
+  download: (msg) => ipcRenderer.send('download', msg),
+  broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
+  saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
+  readFile: (msg) => ipcRenderer.invoke('readFile', msg),
+  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
+});
+
+

+ 35 - 206
preLoadFile.js

@@ -1,217 +1,46 @@
-function getDaysAgo(n) {
-  const timestamp = Date.now() - (n * 24 * 60 * 60 * 1000);
-  const date = new Date(timestamp);
-  
-  const year = date.getFullYear();
-  const month = String(date.getMonth() + 1).padStart(2, '0');
-  const day = String(date.getDate()).padStart(2, '0');
-  
-  return `${year}-${month}-${day}`;
-}
-
-function csvToArray(csvString) {
-  const lines = csvString.split('\n');
-  const result = [];
-  
-  for (let line of lines) {
-    // 跳过空行
-    if (line.trim() === '') continue;
-    
-    // 按逗号分割,并去除每个字段的空白
-    const row = line.split(',').map(field => field.trim());
-    result.push(row);
+window.sendTemp = ''
+window.onInterceptedData = function (data) {
+  window.systemInfo = data
+  if (data.url.includes('https://mms.pinduoduo.com/desert/mallCsChatStat')) {
+    const dataTemp = JSON.parse(data.responseBody)
+    console.log(dataTemp)
+    let temp = ``
+    dataTemp.result.csData.forEach(element => {
+      temp += `${element.csname} mobile:${element.mobile} pc:${element.pc}\r\n`
+    });
+    if (temp != window.sendTemp) {
+      window.sendTemp = temp
+      sendMessage(window.sendTemp)
+    }
   }
-  
-  return result;
-}
-
-function arrayToCSV(array) {
-  return array.map(row => 
-    row.map(field => String(field)).join(',')
-  ).join('\n');
-}
 
+};
 
-function creatToday(fileList) {
-  for (let index = 1; index < fileList.length - 1; index++) {
-    fileList[index][2] = fileList[index][5]
-    fileList[index][3] = fileList[index][6]
-    fileList[index][4] = fileList[index][7]
-    fileList[index][5] = ""
-    fileList[index][6] = ""
-    fileList[index][7] = ""
-    fileList[index][8] = ""
-    fileList[index][9] = ""
-    fileList[index][10] = ""
-  }
-  const fileData = {
-    filename: getDaysAgo(0) + '.csv',
-    content: arrayToCSV(fileList),
-    encoding: "gb2312"
-  };
+function sendMessage (text) {
+  const myHeaders = new Headers();
+  myHeaders.append("Content-Type", "application/json");
 
-  // 调用保存方法
-  window.electronAPI.saveFile(fileData).then(result => {
-    if (result.success) {
-      console.log('文件保存成功:', result.path);
-    } else {
-      console.error('文件保存失败:', result.error);
-    }
+  const raw = JSON.stringify({
+    "text": text,
+    "touser": [
+      "puge"
+    ]
   });
-}
 
-
-function saveFile(adtaArr, next) {
-  // 保存数据
-  const fileData = {
-    filename: getDaysAgo(0) + '.csv',
-    content: arrayToCSV(adtaArr),
-    encoding: "gb2312"
+  const requestOptions = {
+    method: "POST",
+    headers: myHeaders,
+    body: raw,
+    redirect: "follow"
   };
 
-  // 调用保存方法
-  window.electronAPI.saveFile(fileData).then(result => {
-    if (result.success) {
-      console.log('文件保存成功:', result.path);
-      setTimeout(() => {
-        if (next) checkData(adtaArr, next)
-      }, 1000);
-    } else {
-      console.error('文件保存失败:', result.error);
-    }
-  });
+  fetch("https://msg.lamp.run/workWeixin?type=message&corpsecret=KcwQ0WksW0C_yodUQtYQArav5DBKWLnSCkh-5k3_nr8&agentid=1000003&corpID=ww5eabd902d66609f5", requestOptions)
+    .then((response) => response.text())
+    .then((result) => console.log(result))
+    .catch((error) => console.error(error));
 }
 
-function cutString (original, before, after, index) {
-  index = index || 0;
-  if (typeof index === "number") {
-    const P = original.indexOf(before, index);
-    if (P > -1) {
-      if (after) {
-        const f = original.indexOf(after, P + before.length);
-        return (f>-1)? original.slice(P + before.toString().length, f):console.error("Tool [在文本中找不到 参数三 "+after+"]");
-      } else {
-        return original.slice(P + before.toString().length);
-      }
-    } else {
-      console.error("Tool [在文本中找不到 参数一 " + before + "]");
-      return
-    }
-  } else {
-    console.error("Tool [sizeTransition:" + index + "不是一个整数!]");
-  }
-}
-
-function checkText () {
-  if (window.noRun) return
-  if (document.querySelector('.style-scope.ytd-about-channel-renderer') || document.querySelector('ytm-about-channel-renderer').innerText) {
-    window.noRun = true
-    let pdInfo = document.querySelector('.style-scope.ytd-about-channel-renderer').innerText
-    if (!pdInfo) {
-      pdInfo = document.querySelector('ytm-about-channel-renderer').innerText
-    }
-    let bfsl = parseInt(cutString(pdInfo,'视频\n\n\t', '次观看'))
-    let spsl = parseInt(cutString(pdInfo,'订阅者\n\n\t', '个视频'))
-    let dyrs = parseInt(cutString(pdInfo,'注册\n\n\t', '位订阅者'))
-    if (!spsl) {
-      spsl = parseInt(cutString(pdInfo,'注册\n', '个视频'))
-    }
-    bfsl = bfsl ? bfsl : 0
-    spsl = spsl ? spsl : 0
-    dyrs = dyrs ? dyrs : 0
-    console.log(bfsl, spsl, dyrs)
-    adtaArr[index][5] = bfsl
-    adtaArr[index][6] = spsl
-    adtaArr[index][7] = dyrs
-    adtaArr[index][8] = bfsl - parseInt(adtaArr[index][2])
-    adtaArr[index][9] = spsl - parseInt(adtaArr[index][3])
-    adtaArr[index][10] = dyrs - parseInt(adtaArr[index][4])
-    saveFile(adtaArr, true)
-  }
-}
-
-function checkData (adtaArr) {
-  for (let index = 0; index < adtaArr.length; index++) {
-    const element = adtaArr[index];
-    console.log(element)
-    if (element[1].includes('https://') && element[5] === '') {
-      console.log(element[1])
-      if (location.href.slice(0, 40) == element[1].slice(0, 40)) {
-        setTimeout(() => {
-          document.querySelector('.yt-truncated-text__absolute-button').click()
-          setTimeout(() => {
-            checkText()
-          }, 3000);
-          setTimeout(() => {
-            checkText()
-          }, 8000);
-          setTimeout(() => {
-            location.reload()
-          }, 14000);
-        }, 2000);
-      } else {
-        location.href = element[1]
-      }
-      
-      return
-    }
-  }
-  // 汇总计算
-  adtaArr[adtaArr.length - 1][2] = 0
-  adtaArr[adtaArr.length - 1][3] = 0
-  adtaArr[adtaArr.length - 1][4] = 0
-  adtaArr[adtaArr.length - 1][5] = 0
-  adtaArr[adtaArr.length - 1][6] = 0
-  adtaArr[adtaArr.length - 1][7] = 0
-  adtaArr[adtaArr.length - 1][8] = 0
-  adtaArr[adtaArr.length - 1][9] = 0
-  adtaArr[adtaArr.length - 1][10] = 0
-  for (let index = 1; index < adtaArr.length - 1; index++) {
-    const element = adtaArr[index];
-    adtaArr[adtaArr.length - 1][2] += parseInt(element[2])
-    adtaArr[adtaArr.length - 1][3] += parseInt(element[3])
-    adtaArr[adtaArr.length - 1][4] += parseInt(element[4])
-    adtaArr[adtaArr.length - 1][5] += parseInt(element[5])
-    adtaArr[adtaArr.length - 1][6] += parseInt(element[6])
-    adtaArr[adtaArr.length - 1][7] += parseInt(element[7])
-    adtaArr[adtaArr.length - 1][8] += parseInt(element[8])
-    adtaArr[adtaArr.length - 1][9] += parseInt(element[9])
-    adtaArr[adtaArr.length - 1][10] += parseInt(element[10])
-  }
-  saveFile(adtaArr, false)
-  alert('所有项目已经检查完!')
-}
 
-
-// 调用保存方法
-window.electronAPI.readFile({filename: getDaysAgo(0) + '.csv', encoding: "gb2312"}).then(result => {
-  if (result.success) {
-    console.log(result.content);
-    // 如果内容是空的,则读取昨天的
-    if (result.content == '') {
-      window.electronAPI.readFile({filename: getDaysAgo(1) + '.csv', encoding: "gb2312"}).then(result2 => {
-        if (result2.success) {
-          console.log(result2.content);
-          // 如果内容是空的,则读取昨天的
-          if (result2.content == '') {
-            alert('缺少昨天的数据!')
-          } else {
-            let fileData = csvToArray(result2.content)
-            creatToday(fileData)
-            console.log(fileData)
-            checkData(fileData)
-          }
-        } else {
-          console.error('文件读取失败:', result2.error);
-        }
-      });
-    } else {
-      // 读取加载文件
-      let fileData = csvToArray(result.content)
-      console.log(fileData)
-      checkData(fileData)
-    }
-  } else {
-    console.error('文件读取失败:', result.error);
-  }
-});
+setInterval(() => {
+  if(document.querySelector('.update')) document.querySelector('.update').click()
+}, 10000);