fix: get_alldata_with_batch_and_store时保存json数据采用DjangoJSONEncoder以处理decimal

This commit is contained in:
caoqianming 2025-04-03 08:34:57 +08:00
parent 04daccb733
commit b5514afa2b
1 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,8 @@ from apps.qm.models import FtestWork
from django.utils import timezone
from datetime import datetime
from server.conf import BASE_PROJECT_CODE
import json
from django.core.serializers.json import DjangoJSONEncoder
def get_alldata_with_batch_and_store(batch: str):
"""
@ -24,7 +26,7 @@ def get_alldata_with_batch_and_store(batch: str):
"last_time": last_time
})
bobj.last_time = last_time
bobj.data = data
bobj.data = json.loads(json.dumps(data, cls=DjangoJSONEncoder))
bobj.save()
def get_alldata_with_batch_gx(batch: str):