修改--同步机器人信息脚本增加错误处理
This commit is contained in:
parent
cfe4e5ac1a
commit
b6dff25c44
@ -160,11 +160,14 @@ class RobotSyncService:
|
||||
|
||||
robot_info.updateTime = datetime.now()
|
||||
# 更新字段
|
||||
for key, value in robot_data.items():
|
||||
if hasattr(robot_info, key):
|
||||
setattr(robot_info, key, value)
|
||||
|
||||
await db.flush()
|
||||
try:
|
||||
for key, value in robot_data.items():
|
||||
if hasattr(robot_info, key):
|
||||
setattr(robot_info, key, value)
|
||||
|
||||
await db.flush()
|
||||
except:
|
||||
print("更新robot_info失败")
|
||||
|
||||
async def _update_group_robot_relation(self, db: AsyncSession, robot_id: str, grouping_id: str):
|
||||
"""更新分组和机器人的关系"""
|
||||
|
||||
@ -336,10 +336,12 @@ class Kangda:
|
||||
|
||||
response = response.json()
|
||||
|
||||
# 返回租户名下的任务列表
|
||||
# 返回租户名下的任务列表, 204==>未安排值班==>data为空字符串
|
||||
if response.get("code") == 204:
|
||||
return None
|
||||
return response.get("data").get("dutyList")
|
||||
|
||||
# print(response)
|
||||
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print("查询分组出错:", e)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user