1.实现刷新机器人状态接口
This commit is contained in:
parent
777206862b
commit
a42403c49a
@ -103,6 +103,16 @@ async def query_detail_system_info(request: Request, robot_id: int, query_db: As
|
||||
|
||||
return ResponseUtil.success(data=info_detail_result)
|
||||
|
||||
# 根据机器人id刷新机器人信息
|
||||
@infoController.get('/refresh_robot/{robot_ids}'
|
||||
# , dependencies=[Depends(CheckUserInterfaceAuth('system:info:add'))]
|
||||
)
|
||||
async def refresh_robot(request: Request,robot_ids: str , query_db: AsyncSession = Depends(get_db)):
|
||||
refresh_result = await InfoService.refresh_robot_services(query_db, robot_ids)
|
||||
logger.info(f'刷新机器人信息成功')
|
||||
|
||||
return ResponseUtil.success(data=refresh_result)
|
||||
|
||||
|
||||
@infoController.post('/export'
|
||||
# , dependencies=[Depends(CheckUserInterfaceAuth('system:info:export'))]
|
||||
|
||||
@ -11,6 +11,22 @@ class InfoDao:
|
||||
"""
|
||||
机器人信息模块数据库操作层
|
||||
"""
|
||||
@classmethod
|
||||
async def refresh_robot_by_ids(cls, db: AsyncSession, robot_ids: str):
|
||||
id_list = map(int, robot_ids.strip(" ").split(','))
|
||||
refresh_result = (
|
||||
(
|
||||
await db.execute(
|
||||
select(RobotInfo)
|
||||
.where(RobotInfo.robot_id.in_(id_list))
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
.scalars()
|
||||
.all()
|
||||
)
|
||||
return refresh_result
|
||||
|
||||
@classmethod
|
||||
async def get_info_detail_by_id(cls, db: AsyncSession, robot_id: int):
|
||||
|
||||
@ -14,6 +14,11 @@ class InfoService:
|
||||
机器人信息模块服务层
|
||||
"""
|
||||
|
||||
|
||||
@classmethod
|
||||
async def refresh_robot_services(cls, query_db: AsyncSession, robot_ids: str):
|
||||
return await InfoDao.refresh_robot_by_ids(query_db, robot_ids)
|
||||
|
||||
@classmethod
|
||||
async def get_info_list_services(
|
||||
cls, query_db: AsyncSession, query_object: InfoPageQueryModel, is_page: bool = False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user