/// <summary> /// 带实体类检查的调用 /// </summary> public async Task <ApiResponseJson> InvokeCheck(string param) { try { #if !DEBUG // 网关效验 var gatewayResult = GatewayValidate(); if (!gatewayResult.Status) { return(gatewayResult); } #endif // DTO参数效验 var dto = ToObject <T>(param); var result = EntityValidator.Check(dto); if (!result.Status) { return(result); } return(await Invoke(dto)); } catch (AggregateException exp) { var err = string.Empty; var statusCode = 500; foreach (var inner in exp.InnerExceptions) { err += inner.Message; var exception = inner as FaultException; if (exception != null) { statusCode = exception.Code.Name.ConvertType(0); } } return(ApiResponseJson.Error(err, null, statusCode)); } catch (FaultException exp) { return(ApiResponseJson.Error(exp.Message, exp.Action, exp.Code.Name.ConvertType(0))); } catch (System.Exception exp) { return(ApiResponseJson.Error(exp.GetType().FullName, null, 500)); } }