|
@@ -152,4 +152,129 @@ async def get_start_mini_param(
|
|
"code": 0,
|
|
"code": 0,
|
|
"msg": "success",
|
|
"msg": "success",
|
|
"data": "" + "avcon6://" + base64_str
|
|
"data": "" + "avcon6://" + base64_str
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+# 视频会商
|
|
|
|
+@router.get("/get_device_tree")
|
|
|
|
+async def get_device_tree(
|
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
|
+ db: Session = Depends(get_db),
|
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
|
+):
|
|
|
|
+ try:
|
|
|
|
+ result = []
|
|
|
|
+ data = AvconH5API.get_search_region("指挥终端")
|
|
|
|
+ if data is not None:
|
|
|
|
+ result1 = []
|
|
|
|
+ fomat_device_result(data[0], result1)
|
|
|
|
+ result.append({
|
|
|
|
+ "id": data[0]["group_id"],
|
|
|
|
+ "label": data[0]["group_name"],
|
|
|
|
+ "children": result1
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ data = AvconH5API.get_search_region("H323会议视频")
|
|
|
|
+ if data is not None:
|
|
|
|
+ result1 = []
|
|
|
|
+ fomat_device_result(data[0], result1)
|
|
|
|
+ result.append({
|
|
|
|
+ "id": data[0]["group_id"],
|
|
|
|
+ "label": data[0]["group_name"],
|
|
|
|
+ "children": result1
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ data = AvconH5API.get_search_region("手机App")
|
|
|
|
+ if data is not None:
|
|
|
|
+ result1 = []
|
|
|
|
+ fomat_device_result(data[0], result1)
|
|
|
|
+ result.append({
|
|
|
|
+ "id": data[0]["group_id"],
|
|
|
|
+ "label": data[0]["group_name"],
|
|
|
|
+ "children": result1
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ "code": 0,
|
|
|
|
+ "msg": "success",
|
|
|
|
+ "data": result
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ traceback.print_exc()
|
|
|
|
+ return {
|
|
|
|
+ "code": 500,
|
|
|
|
+ "msg": "无法获取视频终端"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+def fomat_device_result(data: dict, result: dict) -> dict:
|
|
|
|
+ if "child_group" in data:
|
|
|
|
+ for n in data["child_group"]:
|
|
|
|
+ new_item = {
|
|
|
|
+ "id": n['group_id'],
|
|
|
|
+ "label": n['group_name'],
|
|
|
|
+ "order_id": n['order_id']
|
|
|
|
+ }
|
|
|
|
+ result1 = []
|
|
|
|
+ fomat_device_result(n, result1)
|
|
|
|
+ new_item["children"] = result1
|
|
|
|
+ result.append(new_item)
|
|
|
|
+
|
|
|
|
+ print('\r\n', n)
|
|
|
|
+
|
|
|
|
+ '''
|
|
|
|
+ if "child_device" in data:
|
|
|
|
+ for n in data["child_device"]:
|
|
|
|
+ new_item = {
|
|
|
|
+ "id": n['dev_id'],
|
|
|
|
+ "label": n['dev_name'],
|
|
|
|
+ "dev_type": n['dev_type'],
|
|
|
|
+ # "order_id": n['order_id'],
|
|
|
|
+ "isLeaf": True
|
|
|
|
+ }
|
|
|
|
+ result.append(new_item)
|
|
|
|
+ print('\r\n', n)
|
|
|
|
+ '''
|
|
|
|
+
|
|
|
|
+@router.get("/get_device_list/{group_id}")
|
|
|
|
+async def get_device_list(
|
|
|
|
+ group_id: str,
|
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
|
+ db: Session = Depends(get_db),
|
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
|
+):
|
|
|
|
+ try:
|
|
|
|
+ result = []
|
|
|
|
+ data = AvconH5API.get_group_device(group_id=group_id)
|
|
|
|
+ for n in data:
|
|
|
|
+ new_item = {
|
|
|
|
+ "id": n['dev_id'],
|
|
|
|
+ "name": n['dev_name'],
|
|
|
|
+ "dept": get_avcon_type_text(n['dev_type']),
|
|
|
|
+ "mobile": n['dev_id']
|
|
|
|
+ }
|
|
|
|
+ result.append(new_item)
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ "code": 0,
|
|
|
|
+ "msg": "success",
|
|
|
|
+ "data": result
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ traceback.print_exc()
|
|
|
|
+ return {
|
|
|
|
+ "code": 500,
|
|
|
|
+ "msg": "无法获取视频终端"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+def get_avcon_type_text(type: str) -> str:
|
|
|
|
+ if type == '001':
|
|
|
|
+ return '指挥视频终端'
|
|
|
|
+ elif type == '060':
|
|
|
|
+ return '营区监控'
|
|
|
|
+ elif type == '085':
|
|
|
|
+ return '监控网关服务器'
|
|
|
|
+ elif type == '100':
|
|
|
|
+ return 'H.323终端'
|
|
|
|
+
|
|
|
|
+ return "未知终端"
|