diff --git a/docs/command-word/usage.md b/docs/command-word/usage.md index c9e4740..4e09802 100644 --- a/docs/command-word/usage.md +++ b/docs/command-word/usage.md @@ -90,18 +90,21 @@ $fresnsResp = \FresnsCmdWord::plugin('FresnsEmail')->sendEmail($wordBody); **Handling abnormal situations** ```php if ($fresnsResp->isErrorResponse()) { - return $fresnsResp->errorResponse(); // When an error is reported, the full amount of parameters is output(code+message+data) + return $fresnsResp->getErrorResponse(); } ``` **Handling normal situations** ```php -$fresnsResp->getOrigin(); // Obtaining raw data +$fresnsResp->getOrigin(); // Obtaining raw data(code+message+data) + $fresnsResp->getCode(); // Get code only $fresnsResp->getMessage(); // Get only the message $fresnsResp->getData(); // Get only the full amount of data $fresnsResp->getData('user.nickname'); // Get only the parameters specified in data, for example: data.user.nickname + $fresnsResp->isSuccessResponse(); // Determine if the request is true $fresnsResp->isErrorResponse(); // Determine if the request is false -$fresnsResp->getErrorResponse(); // Get the error response object + +$fresnsResp->getErrorResponse(); // Internal use returns raw data, API calls return JSON. ``` diff --git a/docs/zh-Hans/command-word/usage.md b/docs/zh-Hans/command-word/usage.md index 3a72c7f..dd8b433 100644 --- a/docs/zh-Hans/command-word/usage.md +++ b/docs/zh-Hans/command-word/usage.md @@ -123,18 +123,21 @@ $fresnsResp = \FresnsCmdWord::plugin('FresnsEmail')->sendEmail($wordBody); **处理异常情况** ```php if ($fresnsResp->isErrorResponse()) { - return $fresnsResp->errorResponse(); //报错时,输出全量参数(code+message+data) + return $fresnsResp->getErrorResponse(); } ``` **处理正常情况** ```php -$fresnsResp->getOrigin(); //获取原始数据 +$fresnsResp->getOrigin(); //获取原始数据(code+message+data) + $fresnsResp->getCode(); //只获取 code $fresnsResp->getMessage(); //只获取 message $fresnsResp->getData(); //只获取 data 全量数据 $fresnsResp->getData('user.nickname'); //只获取 data 中指定参数,比如 data.user.nickname + $fresnsResp->isSuccessResponse(); //判断请求是否为 true $fresnsResp->isErrorResponse(); //判断请求是否为 false -$fresnsResp->getErrorResponse(); //获取错误响应对象 + +$fresnsResp->getErrorResponse(); //内部使用输出原始数据,API 调用输出 JSON ```