2023-12-07 16:49:28 +08:00
|
|
|
from src.db.models.base import BaseResponse
|
|
|
|
from src.db.models.log_data_model import LOT_DATA
|
|
|
|
from src.db.repository import add_kb_to_db, get_kb_detail, delete_kb_detail_by_time
|
2023-12-02 10:53:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
def add(data: LOT_DATA):
|
|
|
|
try:
|
|
|
|
add_kb_to_db(data)
|
|
|
|
return BaseResponse()
|
|
|
|
except Exception as e:
|
|
|
|
return BaseResponse(code=500, msg=e)
|
|
|
|
|
|
|
|
|
|
|
|
def delete(start_time, end_time):
|
|
|
|
try:
|
|
|
|
delete_kb_detail_by_time(start_time, end_time)
|
|
|
|
return BaseResponse()
|
|
|
|
except Exception as e:
|
|
|
|
return BaseResponse(code=500, msg=e)
|
|
|
|
|
|
|
|
|
|
|
|
def get_data():
|
|
|
|
try:
|
|
|
|
data = get_kb_detail()
|
|
|
|
return BaseResponse(data=data)
|
|
|
|
except Exception as e:
|
|
|
|
return BaseResponse(code=404, msg=e)
|