diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs index b9295a1..1d7e683 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs @@ -33,7 +33,7 @@ public class ReportFlowController : BaseController var response = _reportFlowService.GetWorkOrderDetail(workOrder); if (response == null) { - return ToResponse(ResultCode.NO_DATA, "工单不存在"); + return ToResponse(ResultCode.SUCCESS, "工单不存在"); } return SUCCESS(response); } @@ -50,9 +50,9 @@ public class ReportFlowController : BaseController { if (string.IsNullOrEmpty(workorder)) { - throw new CustomException("workorder or process is null"); + throw new CustomException("workorder is null"); } - return SUCCESS(_reportFlowService.GetProcessReportWorkDetail(workorder, processId)); + return ToResponse(ResultCode.SUCCESS,_reportFlowService.GetProcessReportWorkDetail(workorder, processId)); } //TODO 工序报工 diff --git a/Infrastructure/Controllers/BaseController.cs b/Infrastructure/Controllers/BaseController.cs index 9ef8573..34b6775 100644 --- a/Infrastructure/Controllers/BaseController.cs +++ b/Infrastructure/Controllers/BaseController.cs @@ -55,6 +55,10 @@ namespace Infrastructure.Controllers { return ToResponse(new ApiResult((int)resultCode, msg)); } + protected IActionResult ToResponse(ResultCode resultCode, Object data) + { + return ToResponse(new ApiResult((int)resultCode, data)); + } /// /// 导出Excel diff --git a/Infrastructure/Model/ApiResult.cs b/Infrastructure/Model/ApiResult.cs index dd4b675..c6aa98c 100644 --- a/Infrastructure/Model/ApiResult.cs +++ b/Infrastructure/Model/ApiResult.cs @@ -53,6 +53,15 @@ namespace Infrastructure.Model Add(DATA_TAG, data); } } + public ApiResult(int code, object data) + { + Add(CODE_TAG, code); + + if (data != null) + { + Add(DATA_TAG, data); + } + } /// /// 返回成功消息