Skip to content

Commit 1949c8e

Browse files
committed
修复当a端点引用b端点, a端点的url替换规则不生效的问题
1 parent d7c60d5 commit 1949c8e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

service/endpoint_service.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,13 @@ func (s *EndpointService) getRandomURLRealtime(endpoint *model.APIEndpoint) (str
228228
}
229229

230230
// 递归调用获取目标端点的随机URL
231-
return s.GetRandomURL(targetEndpoint.URL)
231+
targetURL, err := s.GetRandomURL(targetEndpoint.URL)
232+
if err != nil {
233+
return "", err
234+
}
235+
236+
// 对从目标端点获取的URL应用当前端点的替换规则
237+
return s.applyURLReplaceRules(targetURL, endpoint.URL), nil
232238
}
233239

234240
return s.applyURLReplaceRules(randomURL, endpoint.URL), nil
@@ -280,7 +286,13 @@ func (s *EndpointService) getRandomURLWithCache(endpoint *model.APIEndpoint) (st
280286
}
281287

282288
// 递归调用获取目标端点的随机URL
283-
return s.GetRandomURL(targetEndpoint.URL)
289+
targetURL, err := s.GetRandomURL(targetEndpoint.URL)
290+
if err != nil {
291+
return "", err
292+
}
293+
294+
// 对从目标端点获取的URL应用当前端点的替换规则
295+
return s.applyURLReplaceRules(targetURL, endpoint.URL), nil
284296
}
285297

286298
return s.applyURLReplaceRules(randomURL, endpoint.URL), nil

0 commit comments

Comments
 (0)