1. 优化更新规则逻辑,日志中打印规则更新记录

This commit is contained in:
ngfchl
2022-08-30 13:54:00 +08:00
parent 70a40841a1
commit 40a8b0d020
2 changed files with 8 additions and 10 deletions

View File

@@ -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)

View File

@@ -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