fix(manage): 修改结束任务接口返回类型为dynamic
- 将EndHandFlyTask方法的返回类型从Response<bool>改为Response<dynamic> - 当任务状态为3时,直接返回包含错误信息的Response对象而非抛出异常 - 成功结束任务后,返回包含完整任务信息的Response对象main
parent
f574964a36
commit
fbec9b215b
|
|
@ -2659,15 +2659,18 @@ namespace OpenAuth.App.ServiceApp
|
|||
};
|
||||
}
|
||||
|
||||
public async Task<Response<bool>> EndHandFlyTask(string taskid)
|
||||
public async Task<Response<dynamic>> EndHandFlyTask(string taskid)
|
||||
{
|
||||
// todo
|
||||
var savedTask = await Repository.ChangeRepository<SugarRepositiry<LasaTask>>().AsQueryable()
|
||||
.Where(x => x.Id == taskid)
|
||||
.FirstAsync();
|
||||
if (savedTask.Status == 3)
|
||||
{
|
||||
throw new Exception("智能巡检未关闭");
|
||||
return new Response<dynamic>()
|
||||
{
|
||||
Result = false,
|
||||
Message = "智能巡检未关闭"
|
||||
};
|
||||
}
|
||||
|
||||
var task = new LasaTask()
|
||||
|
|
@ -2695,9 +2698,11 @@ namespace OpenAuth.App.ServiceApp
|
|||
throw new Exception("结束任务失败");
|
||||
}
|
||||
|
||||
return new Response<bool>()
|
||||
return new Response<dynamic>()
|
||||
{
|
||||
Result = true
|
||||
Result = await Repository.ChangeRepository<SugarRepositiry<LasaTask>>().AsQueryable()
|
||||
.Where(x => x.Id == taskid)
|
||||
.FirstAsync()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -927,7 +927,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
/// <param name="taskid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> EndHandFlyTask(string taskid)
|
||||
public async Task<Response<dynamic>> EndHandFlyTask(string taskid)
|
||||
{
|
||||
return await _app.EndHandFlyTask(taskid);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue