|
@@ -5,6 +5,7 @@ from test_info import TestInfo
|
|
|
from tongce import TongCe
|
|
|
from apscheduler_elab import Config
|
|
|
from flask_apscheduler import APScheduler
|
|
|
+import decimal
|
|
|
from report_push import ReportPush
|
|
|
|
|
|
|
|
@@ -218,11 +219,21 @@ def report_test():
|
|
|
try:
|
|
|
reprt_push = ReportPush('bi_report')
|
|
|
result = reprt_push.report_data_query(2)
|
|
|
- return json.dumps(result, ensure_ascii=False, default=lambda obj: obj.__dict__)
|
|
|
+ return json.dumps(result, ensure_ascii=False, cls=DecimalEncoder)
|
|
|
except Exception as e:
|
|
|
return str(e)
|
|
|
|
|
|
|
|
|
+class DecimalEncoder(json.JSONEncoder):
|
|
|
+
|
|
|
+ def default(self, o):
|
|
|
+
|
|
|
+ if isinstance(o, decimal.Decimal):
|
|
|
+ return float(o)
|
|
|
+
|
|
|
+ super(DecimalEncoder, self).default(o)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
# scheduler = APScheduler()
|
|
|
# scheduler.init_app(app)
|