parent
248c5f643f
commit
8f8b7cbf8a
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
'''
|
||||
@Date:2022/08/10 16:53:41
|
||||
'''
|
||||
from dataclasses import dataclass
|
||||
import sys
|
||||
|
||||
from db_logic.humiture_record import BllHumitureRecord
|
||||
sys.path.append('.')
|
||||
|
||||
from sqlalchemy import and_, or_
|
||||
|
||||
from Common.auth import token_auth
|
||||
from flask import Blueprint, jsonify, request, g
|
||||
from Common.Utils import PageParam, Utils
|
||||
|
||||
|
||||
monitor_router = Blueprint('monitor', __name__)
|
||||
|
||||
|
||||
|
||||
# 每日温度记录
|
||||
@monitor_router.route("/day_monitor", methods=["POST"])
|
||||
@token_auth.login_required
|
||||
def get_day_monitor():
|
||||
client_id = request.values.get("client_id")
|
||||
start_time = request.values.get("start_time")
|
||||
end_time = request.values.get("end_time")
|
||||
page = request.values.get("page", 1)
|
||||
page_size = request.values.get("page_size", 10)
|
||||
page_param = PageParam(int(page), int(page_size))
|
||||
data_list = BllHumitureRecord().get_client_day_log(
|
||||
client_id=client_id, start_time=start_time,
|
||||
end_time=end_time, page_param=page_param
|
||||
)
|
||||
data_list = Utils.msyql_table_model(data_list)
|
||||
return jsonify(Utils.true_return(data={"data_list": Utils.data_float_type_convent(data_list), "total_count": page_param.totalRecords}))
|
||||
|
||||
|
||||
# 获取每日记录详情
|
||||
@monitor_router.route("/day_monitor_info", methods=["POST"])
|
||||
@token_auth.login_required
|
||||
def get_day_monitor_info():
|
||||
client_id = request.values.get("client_id")
|
||||
start_time = request.values.get("start_time")
|
||||
end_time = request.values.get("end_time")
|
||||
page = request.values.get("page", 1)
|
||||
page_size = request.values.get("page_size", 10)
|
||||
page_param = PageParam(int(page), int(page_size))
|
||||
data_list = BllHumitureRecord().get_client_day_log_info(
|
||||
client_id=client_id,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
page_param=page_param
|
||||
)
|
||||
data_list = Utils.msyql_table_model(data_list)
|
||||
return jsonify(Utils.true_return(data={"data_list": Utils.data_float_type_convent(data_list), "total_count": page_param.totalRecords}))
|
Loading…
Reference in new issue