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({