From 431a1b30e8804e29fa6637cb07a45ff57b72829f Mon Sep 17 00:00:00 2001 From: ngfchl Date: Tue, 30 Aug 2022 13:26:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_pt/views.py | 1 + templates/auto_pt/restart.html | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/auto_pt/views.py b/auto_pt/views.py index 24fab3b..8a4b8b9 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -208,6 +208,7 @@ def do_update(request): print(data[2]) print(data[0].get('url')) for site in data: + del site['pk'] Site.objects.update_or_create(defaults=site, url=site.get('url')) return JsonResponse(data=CommonResponse.success( msg='更新成功!!', diff --git a/templates/auto_pt/restart.html b/templates/auto_pt/restart.html index ab1f522..843431f 100644 --- a/templates/auto_pt/restart.html +++ b/templates/auto_pt/restart.html @@ -142,18 +142,15 @@ message: res.data.msg }); } - this.$router.go(0) + this.reload() }).catch(res => { - this.$router.go(0) this.$message({ type: 'error', message: "重启失败!" }); - }) - }).catch(res => { - console.log(res) + {#console.log(res)#} this.$message({ type: 'info', message: '已取消重启' @@ -185,7 +182,7 @@ message: res.data.msg }); } - this.$router.go(0) + this.reload() }).catch(res => { console.log(res, 3) this.$message({