From 40a8b0d020f1f5ace3f3fd12514e0da1a5d82903 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Tue, 30 Aug 2022 13:54:00 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=80=BB=E8=BE=91=EF=BC=8C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=B8=AD=E6=89=93=E5=8D=B0=E8=A7=84=E5=88=99=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_pt/views.py | 13 ++++++------- templates/auto_pt/restart.html | 5 ++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/auto_pt/views.py b/auto_pt/views.py index c5011c9..144941c 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -209,20 +209,19 @@ def do_update(request): data = json.load(f) print(data[2]) print(data[0].get('url')) + xpath_update = [] for site in data: - print(site) if site.get('pk'): del site['pk'] - print(site) site_obj = Site.objects.update_or_create(defaults=site, url=site.get('url')) + xpath_update.append(site_obj) print(site_obj) return JsonResponse(data=CommonResponse.success( msg='更新成功!!', - data=result - # data={ - # # 'p': str(p.stdout.readlines()).strip("'").strip('[').strip(']').strip() - # } - ).to_dict(), safe=False) + data={ + 'result': result, + # 'xpath_update': xpath_update + }).to_dict(), safe=False) except Exception as e: return JsonResponse(data=CommonResponse.error( msg='更新指令发送失败!' + str(e) diff --git a/templates/auto_pt/restart.html b/templates/auto_pt/restart.html index 7cbfb14..b610b0a 100644 --- a/templates/auto_pt/restart.html +++ b/templates/auto_pt/restart.html @@ -107,10 +107,8 @@ local_log_width: 24, }, created() { - if (this.update) { this.local_log_width = 12 - } this.$message({ showClose: true, @@ -171,7 +169,8 @@ ).then(res => { if (res.data.code === 0) { console.log(res, 1) - this.update_log = res.data.data + this.update_log = res.data.data.result + {#console.log('规则更新记录', res.data.data.xpath_update)#} this.$message({ type: 'success', message: res.data.msg