baoyubo преди 6 месеца
родител
ревизия
90ed226c5a
променени са 2 файла, в които са добавени 48 реда и са изтрити 0 реда
  1. 47 0
      routers/api/videoResource/videoinfo.py
  2. 1 0
      utils/video_util.py

+ 47 - 0
routers/api/videoResource/videoinfo.py

@@ -269,6 +269,53 @@ async def get_video_tag_info(
         dicts = query.offset((page - 1) * pageSize).limit(pageSize).all()
         tag = []
 
+        for info in dicts:
+            tag.append({
+                        "dict_type":info.dict_type,
+                        "dict_value":info.dict_value,
+                        "dict_label":info.dict_label,
+                        "dict_code":info.dict_code})
+        return {
+            "code": 200,
+            "msg": "成功",
+            "data": tag,
+            "total": total_items,
+            "page": page,
+            "pageSize": pageSize,
+            "totalPages": (total_items + pageSize - 1) // pageSize
+        }
+    except Exception as e:
+        traceback.print_exc()
+        raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
+
+@router.get('/get_lx_hy_video_tag_info')
+async def get_lx_hy_video_tag_info(
+        dict_value:str = Query(None),
+        db: Session = Depends(get_db),
+        body=Depends(remove_xss_json),
+        page: int = Query(1, gt=0, description='页码'),
+        pageSize: int = Query(3, gt=0, description='每页条目数量'),
+        user_id=Depends(valid_access_token)
+):
+    try:
+        if dict_value is None:
+            return {
+                "code": 200,
+                "msg": "成功",
+                "data": []
+            }
+        query = db.query(SysDictData)
+        query = query.filter(SysDictData.del_flag != '2')
+        query = query.filter(SysDictData.dict_type == 'video_type')
+        query = query.filter(SysDictData.remark.like( f'%{dict_value};%'))
+
+        total_items = query.count()
+        # 排序
+        query = query.order_by(SysDictData.create_time.desc())
+        # 执行分页查询
+        dicts = query.offset((page - 1) * pageSize).limit(pageSize).all()
+        tag = []
+
         for info in dicts:
             tag.append({
                         "dict_type":info.dict_type,

+ 1 - 0
utils/video_util.py

@@ -4,4 +4,5 @@ def get_video_tag_list(db,video_code:str):
     query = db.query(TpVideoTag)
     query = query.filter(TpVideoTag.del_flag != '2')
     query = query.filter(TpVideoTag.video_code == video_code)
+    query = query.order_by(TpVideoTag.video_code)
     return query.all()