Fixed bug that Hyperf\RateLimit\Aspect\RateLimitAnnotationAspect::getWeightingAnnotation() cannot work. (#6374)

Co-authored-by: xiechenghua <chenghua.xie@ehang.com>
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
xiechenghua 2023-12-12 16:00:41 +08:00 committed by GitHub
parent 5f22575ae8
commit d11c018daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,7 @@
## Fixed
- [#6372](https://github.com/hyperf/hyperf/pull/6372) Fixed bug that AOP not working when using variadic parameters.
- [#6374](https://github.com/hyperf/hyperf/pull/6374) Fixed bug that `RateLimitAnnotationAspect::getWeightingAnnotation()` cannot work when using config `rate_limit.storage`.
## Added

View File

@ -86,7 +86,13 @@ class RateLimitAnnotationAspect implements AroundInterface
*/
public function getWeightingAnnotation(array $annotations): RateLimit
{
$property = array_merge($this->annotationProperty, $this->config);
$property = $this->annotationProperty;
foreach ($this->annotationProperty as $key => $value) {
if (! empty($this->config[$key])) {
$property[$key] = $this->config[$key];
}
}
/** @var null|RateLimit $annotation */
foreach ($annotations as $annotation) {
if (! $annotation) {