Skip to content

Commit 5ab50b2

Browse files
committed
update 4.2.1
1 parent 102e93b commit 5ab50b2

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/parses/ParseApiDetail.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,33 @@ protected function mergeGlobalOrAppEvents($events,$eventType='after'){
153153
*/
154154
protected function handleApiResponseSuccess($apiInfo,$textAnnotations){
155155
$returned = $apiInfo['returned'];
156-
if (
157-
in_array("NotResponses", $textAnnotations) ||
158-
in_array("NotResponseSuccess", $textAnnotations)
159-
) {
160-
return $returned;
161-
}
156+
162157
$config = $this->config;
163158
$mergeParams = [];
164159
$paramType='success';
165-
if (!empty($apiInfo['responseSuccess']) && count($apiInfo['responseSuccess'])){
166-
$mergeParams = $apiInfo['responseSuccess'];
167-
}else if (!empty($this->currentApp['responses']) && !empty($this->currentApp['responses'][$paramType])){
160+
161+
if (!empty($this->currentApp['responses']) && !empty($this->currentApp['responses'][$paramType])){
168162
$mergeParams = $this->currentApp['params'][$paramType];
169163
}else if(!empty($config['responses']) && !empty($config['responses'][$paramType])){
170164
$mergeParams = $config['responses'][$paramType];
171165
}
166+
167+
if (
168+
(
169+
in_array("NotResponses", $textAnnotations) ||
170+
in_array("NotResponseSuccess", $textAnnotations)
171+
) &&
172+
count($mergeParams)>0
173+
) {
174+
// 注解了不使用全局响应
175+
$mergeParams = [];
176+
}
177+
178+
if (!empty($apiInfo['responseSuccess']) && count($apiInfo['responseSuccess'])){
179+
180+
$mergeParams = Helper::arrayMergeAndUnique("name", $mergeParams,$apiInfo['responseSuccess']);
181+
}
182+
172183
if (!empty($mergeParams) && count($mergeParams)){
173184
$resData = [];
174185
foreach ($mergeParams as $item) {

0 commit comments

Comments
 (0)