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