From bf07d7c4700c4f6d909c83bf2978c7f90721d571 Mon Sep 17 00:00:00 2001
From: 3136352472 <3136352472>
Date: Tue, 28 Apr 2020 17:36:07 +0800
Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=B9=E5=87=BA=E6=B5=81?=
=?UTF-8?q?=E7=A8=8B=E7=94=B3=E8=AF=B7=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/data.js | 20 +++++++++++++++++++-
lib/tray.js | 2 +-
lib/web/main.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/lib/data.js b/lib/data.js
index 58b4dcc..d4dbe40 100644
--- a/lib/data.js
+++ b/lib/data.js
@@ -72,4 +72,22 @@ exports.PopCommitByQueue = function () {
var data = all.pop();
fs.writeFileSync(pathJoin("data/commit-queue.json"), JSON.stringify(all))
return data;
-}
\ No newline at end of file
+}
+
+exports.ignoreDaibMap = {}
+
+
+
+if (!fs.existsSync(pathJoin("data/ignore-daib-map.json"))) {
+ fs.writeFileSync(pathJoin("data/ignore-daib-map.json"), JSON.stringify({}));
+}
+
+exports.GetIgnoreDaibMap = function () {
+ return JSON.parse(fs.readFileSync(pathJoin("data/ignore-daib-map.json")))
+}
+
+exports.SyncIgnoreDaibMap = function (result) {
+ if (fs.readFileSync(pathJoin("data/ignore-daib-map.json")) + "" != JSON.stringify(result) + "") {
+ fs.writeFileSync(pathJoin("data/ignore-daib-map.json"), JSON.stringify(result))
+ }
+}
diff --git a/lib/tray.js b/lib/tray.js
index b63177c..f67710d 100644
--- a/lib/tray.js
+++ b/lib/tray.js
@@ -190,7 +190,7 @@ ipcMain.on('put-in-tray', (event) => {
tray.popUpContextMenu(Menu.buildFromTemplate(result.concat({
type: "separator"
- }, {
+ },{
label: "添加任务",
click: function (menuItem, browserWindow, event) {
mainwin.MainWindow.loadURL(`http://oa.ouxuan.net/index.php?a=lum&m=input&d=flow&num=work&show=we`)
diff --git a/lib/web/main.js b/lib/web/main.js
index 6109d78..570cb88 100644
--- a/lib/web/main.js
+++ b/lib/web/main.js
@@ -3,6 +3,7 @@ const path = require('path')
const libdata = require(path.join(__dirname, "data.js"));
const libdata2 = require(path.join(__dirname, "../data.js"));
const ipc = require('electron').ipcRenderer
+const dialog = require('electron').remote.dialog
function get(name) {
@@ -98,6 +99,62 @@ window.addEventListener('DOMContentLoaded', () => {
CommitByQueue();
+ function doDaib() {
+ let igdbmap = libdata2.GetIgnoreDaibMap()
+ let url = `http://oa.ouxuan.net/api.php?m=index&a=getyydata&page=1&event=daib&num=daiban`;
+ $.get(url, function (data) {
+ data = JSON.parse(data);
+ if (data.code == 200) {
+
+ data = data["data"]["rows"]
+ for (var i in data) {
+ if (data[i]["modenum"] != "work" && !igdbmap[data[i]["id"]]) {
+ console.log(data[i]["cont"].replace("
", "\n", -1))
+ let index = dialog.showMessageBoxSync({
+ type: "info",
+ buttons: ["通过", "拒绝", "忽略"],
+ defaultId: 2,
+ cancelId: 2,
+ title: data[i]["modename"],
+ message: data[i]["cont"].replace(/
/g, "\n")
+ });
+ switch (index) {
+ case 0:
+ $.post("http://oa.ouxuan.net/index.php?a=check&m=flowopt&d=flow&ajaxbool=true", {
+ tuiid: 0,
+ mid: data[i]["id"],
+ modenum: data[i]["modenum"],
+ zt: 1,
+ }, function (raw) {
+ console.log("通过")
+ console.log(raw)
+ })
+
+ break;
+ case 1:
+
+ break;
+ case 2:
+ igdbmap = libdata2.GetIgnoreDaibMap();
+ igdbmap[data[i]["id"]] = true;
+ libdata2.SyncIgnoreDaibMap();
+ break;
+ default:
+
+ }
+ console.log(index);
+
+ }
+ }
+ setTimeout(() => {
+ doDaib()
+ }, 10 * 1000);
+ }
+ });
+
+ }
+ doDaib()
+
let m = get("m");
if (PageJs[m]) {
PageJs[m]()