|
@@ -10,16 +10,16 @@ from app.utils.date import get_time_str
|
|
|
router = APIRouter()
|
|
|
|
|
|
|
|
|
-@router.get('/readjust', response_model=TargetReadjustInResponse, tags=['targets'])
|
|
|
+@router.get('/adjust', response_model=TargetReadjustInResponse, tags=['targets'])
|
|
|
async def readjust_target(
|
|
|
- project_id: str = Query(..., max_length=50, regex='^Pj'),
|
|
|
- space_id: str = Query(..., max_length=50, regex='^Sp'),
|
|
|
- wechat_timestamp: str = Query(None, min_length=14, max_length=14),
|
|
|
+ projectId: str = Query(..., max_length=50, regex='^Pj'),
|
|
|
+ roomId: str = Query(..., max_length=50, regex='^Sp'),
|
|
|
+ time: str = Query(None, min_length=14, max_length=14),
|
|
|
):
|
|
|
try:
|
|
|
- if not wechat_timestamp:
|
|
|
- wechat_timestamp = get_time_str()
|
|
|
- need_run_room_control = await readjust_all_target(project_id, space_id, wechat_timestamp)
|
|
|
+ if not time:
|
|
|
+ time = get_time_str()
|
|
|
+ need_run_room_control = await readjust_all_target(projectId, roomId, time)
|
|
|
except Exception as e:
|
|
|
logger.error(e)
|
|
|
raise HTTPException(
|
|
@@ -28,9 +28,9 @@ async def readjust_target(
|
|
|
)
|
|
|
|
|
|
response = {
|
|
|
- 'projectId': project_id,
|
|
|
- 'roomId': space_id,
|
|
|
+ 'projectId': projectId,
|
|
|
+ 'roomId': roomId,
|
|
|
'flag': 1 if need_run_room_control else 0,
|
|
|
- 'time': wechat_timestamp,
|
|
|
+ 'time': time,
|
|
|
}
|
|
|
return response
|