|
@@ -188,6 +188,37 @@ async def add_video_tag(
|
|
|
traceback.print_exc()
|
|
|
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
|
|
|
+@router.post("/add_video_tag_label")
|
|
|
+async def add_video_tag(
|
|
|
+ user_id=Depends(valid_access_token),
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
+ db: Session = Depends(get_db)
|
|
|
+):
|
|
|
+ try:
|
|
|
+ dict_label = body['dict_label']
|
|
|
+ dict_info = dict_label_get_dict_data_info(db,body['dict_type'],dict_label)
|
|
|
+ if dict_info is None:
|
|
|
+ dict_info = SysDictData(
|
|
|
+ dict_label=dict_label,
|
|
|
+ dict_value = new_guid(),
|
|
|
+ dict_type=body['dict_type'],
|
|
|
+ create_by = user_id
|
|
|
+ )
|
|
|
+ db.add(dict_info)
|
|
|
+ new_video_tag = TpVideoTag(
|
|
|
+ id = new_guid(),
|
|
|
+ video_code=body['video_code'],
|
|
|
+ dict_value=dict_info.dict_value,
|
|
|
+ dict_type=body['dict_type'],
|
|
|
+ create_dept = user_id
|
|
|
+ )
|
|
|
+ db.add(new_video_tag)
|
|
|
+ db.commit()
|
|
|
+ return {"code": 200, "msg": "新增成功", "data": None}
|
|
|
+ except Exception as e:
|
|
|
+ traceback.print_exc()
|
|
|
+ raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
+
|
|
|
@router.delete("/delete_video_tag/{video_tag_id}")
|
|
|
async def delete_video_tag(
|
|
|
video_tag_id: str,
|
|
@@ -208,4 +239,5 @@ async def delete_video_tag(
|
|
|
return {"code": 200, "msg": "删除成功"}
|
|
|
except Exception as e:
|
|
|
traceback.print_exc()
|
|
|
- raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
+ raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
|
|
+
|