Browse Source

no message

libushang 10 months ago
parent
commit
f093d90ef9
2 changed files with 31 additions and 2 deletions
  1. 29 1
      routers/api/eventManagement/event.py
  2. 2 1
      utils/hk_video_api.py

+ 29 - 1
routers/api/eventManagement/event.py

@@ -394,4 +394,32 @@ async def download_file(
 ):
     row = db.query(EventFile).filter(and_(EventFile.del_flag == '0', EventFile.id == file_id, EventFile.event_id == event_id)).first()
     if row is not None:
-        return FileResponse(row.file_path)
+        return FileResponse(row.file_path)
+
+# 小屏通知栏显示的最新时间   
+@router.get("/notice_bar")
+async def notice_bar(
+    request: Request,  
+    db: Session = Depends(get_db)
+):
+    try:
+        # row = db.query(EventBase).filter(and_(EventBase.del_flag == '0', EventBase.event_status.in_[0, 1])).order_by(EventBase.event_time.desc()).first()
+        row = db.query(EventBase).filter(and_(EventBase.del_flag == '0', EventBase.event_status.in_([0, 1]))).order_by(EventBase.event_time.desc()).first()
+        if row is not None:
+            return {
+                'code': 200,
+                'msg': '查询成功',
+                'data': {
+                    'event_id': row.event_code,
+                    'event_title': row.event_title
+                }
+            }
+        else:
+            return {
+                'code': 500,
+                'msg': '查询失败'
+            }
+    except Exception as e:
+        traceback.print_exc()
+        # 处理异常
+        raise HTTPException(status_code=500, detail=str(e))

+ 2 - 1
utils/hk_video_api.py

@@ -4,7 +4,8 @@ import requests
     
 def get_video_url(id: str, protocol: str):
     video_url = ""
-    api_url = "http://10.181.7.217:8081/previewURLs"
+    # api_url = "http://10.181.7.217:8081/previewURLs"
+    api_url = "http://127.0.0.1:8081/previewURLs"
     params = {
         "cameraIndexCode": id,
         "protocol": protocol