优化工作报告

This commit is contained in:
kuaifan 2022-01-21 23:06:50 +08:00
parent 230ff75c0b
commit cc767b164e
13 changed files with 68 additions and 29 deletions

View File

@ -8,7 +8,9 @@ use App\Models\Report;
use App\Models\ReportReceive; use App\Models\ReportReceive;
use App\Models\User; use App\Models\User;
use App\Module\Base; use App\Module\Base;
use App\Tasks\PushTask;
use Carbon\Carbon; use Carbon\Carbon;
use Hhxsv5\LaravelS\Swoole\Task\Task;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@ -206,6 +208,22 @@ class ReportController extends AbstractController
$report->Receives()->createMany($input["receive_content"]); $report->Receives()->createMany($input["receive_content"]);
} }
// 推送消息
$userids = [];
foreach ($input["receive_content"] as $item) {
$userids[] = $item['userid'];
}
if ($userids) {
$params = [
'ignoreFd' => Request::header('fd'),
'userid' => $userids,
'msg' => [
'type' => 'report',
'action' => 'unreadUpdate',
]
];
Task::deliver(new PushTask($params, false));
}
}); });
return Base::retSuccess('保存成功'); return Base::retSuccess('保存成功');
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.6.65", "version": "0.6.78",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"main": "main.js", "main": "main.js",
"license": "MIT", "license": "MIT",

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.6.65", "version": "0.6.78",
"description": "DooTask is task management system.", "description": "DooTask is task management system.",
"scripts": { "scripts": {
"start": "./cmd dev", "start": "./cmd dev",

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -277,8 +277,8 @@ export default {
natificationReady: false, natificationReady: false,
notificationClass: null, notificationClass: null,
reportTabs: "my",
reportUnreadNumber: 0, reportUnreadNumber: 0,
reportTabs: "my"
} }
}, },
@ -291,9 +291,9 @@ export default {
this.$store.dispatch("getUserInfo").catch(() => {}) this.$store.dispatch("getUserInfo").catch(() => {})
this.$store.dispatch("getTaskPriority").catch(() => {}) this.$store.dispatch("getTaskPriority").catch(() => {})
// //
this.getReportUnread(0);
this.notificationInit(); this.notificationInit();
this.onVisibilityChange(); this.onVisibilityChange();
this.getReportUnread(); //
// //
this.addTaskSubscribe = Store.subscribe('addTask', this.onAddTask); this.addTaskSubscribe = Store.subscribe('addTask', this.onAddTask);
this.dialogMsgSubscribe = Store.subscribe('dialogMsgPush', this.addDialogMsg); this.dialogMsgSubscribe = Store.subscribe('dialogMsgPush', this.addDialogMsg);
@ -336,7 +336,9 @@ export default {
'wsOpenNum', 'wsOpenNum',
'themeMode', 'themeMode',
'themeList' 'themeList',
'wsMsg'
]), ]),
...mapGetters(['taskData', 'dashboardTask']), ...mapGetters(['taskData', 'dashboardTask']),
@ -421,13 +423,19 @@ export default {
msgAllUnread() { msgAllUnread() {
if (this.$Electron) { if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal); this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
} }
}, },
dashboardTotal() { dashboardTotal() {
if (this.$Electron) { if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal); this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
}
},
reportUnreadNumber() {
if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
} }
}, },
@ -456,8 +464,23 @@ export default {
this.wsOpenTimeout && clearTimeout(this.wsOpenTimeout) this.wsOpenTimeout && clearTimeout(this.wsOpenTimeout)
this.wsOpenTimeout = setTimeout(() => { this.wsOpenTimeout = setTimeout(() => {
this.$store.dispatch("getBasicData") this.$store.dispatch("getBasicData")
this.getReportUnread()
}, 5000) }, 5000)
} },
wsMsg: {
handler(info) {
const {type, action} = info;
switch (type) {
case 'report':
if (action == 'unreadUpdate') {
this.getReportUnread()
}
break;
}
},
deep: true,
},
}, },
methods: { methods: {
@ -683,6 +706,17 @@ export default {
} }
}, },
getReportUnread(timeout) {
this.reportUnreadTimeout && clearTimeout(this.reportUnreadTimeout)
this.reportUnreadTimeout = setTimeout(() => {
this.$store.dispatch("call", {
url: 'report/unread',
}).then(({data}) => {
this.reportUnreadNumber = data.total ? data.total : 0;
}).catch(() => {});
}, typeof timeout === "number" ? timeout : 1000)
},
notificationInit() { notificationInit() {
this.notificationClass = new notificationKoro(this.$L("打开通知成功")); this.notificationClass = new notificationKoro(this.$L("打开通知成功"));
if (this.notificationClass.support) { if (this.notificationClass.support) {
@ -743,15 +777,6 @@ export default {
} }
document.addEventListener(visibilityChangeEvent, visibilityChangeListener); document.addEventListener(visibilityChangeEvent, visibilityChangeListener);
}, },
getReportUnread() {
this.$store.dispatch("call", {
url: 'report/unread',
method: 'get',
}).then(({data}) => {
this.reportUnreadNumber = data.total ? data.total : 0;
}).catch(() => {});
},
} }
} }
</script> </script>

View File

@ -70,8 +70,9 @@ export default {
sendRead() { sendRead() {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/read', url: 'report/read',
data: {ids: [this.data.id]}, data: {
method: 'get', ids: [this.data.id]
},
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
// msg // msg

View File

@ -174,7 +174,6 @@ export default {
offset: this.reportData.offset, offset: this.reportData.offset,
id: this.id id: this.id
}, },
method: 'get',
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
if (data.id) { if (data.id) {
@ -217,7 +216,6 @@ export default {
data: { data: {
id: reportId id: reportId
}, },
method: 'get',
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
this.reportData.title = data.title; this.reportData.title = data.title;
@ -257,7 +255,6 @@ export default {
this.userInputShow = false; this.userInputShow = false;
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/last_submitter', url: 'report/last_submitter',
method: 'get',
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
this.reportData.receive = data; this.reportData.receive = data;

View File

@ -167,7 +167,6 @@ export default {
created_at: this.createAt, created_at: this.createAt,
type: this.reportType type: this.reportType
}, },
method: 'get',
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
this.lists = data.data; this.lists = data.data;

View File

@ -191,7 +191,6 @@ export default {
created_at: this.createAt, created_at: this.createAt,
type: this.reportType type: this.reportType
}, },
method: 'get',
}).then(({data, msg}) => { }).then(({data, msg}) => {
// data // data
this.lists = data.data; this.lists = data.data;