mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Fixed rule like 10-12/1,14-15/1
does not works for crontab. (#3667)
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
67948a0455
commit
0e5d09e0d6
@ -3,6 +3,7 @@
|
||||
## Fixed
|
||||
|
||||
- [#3663](https://github.com/hyperf/hyperf/pull/3663) Fixed undefined index: Port for `AbstractServiceClient::getNodesFromConsul()`.
|
||||
- [#3667](https://github.com/hyperf/hyperf/pull/3667) Fixed rule like `10-12/1,14-15/1` does not works for crontab.
|
||||
|
||||
# v2.1.19 - 2021-05-31
|
||||
|
||||
|
@ -12,7 +12,7 @@ composer require xxtime/flysystem-aliyun-oss
|
||||
# 使用 S3 适配器时执行
|
||||
composer require league/flysystem-aws-s3-v3
|
||||
composer require hyperf/guzzle
|
||||
# 使用七牛云(测试)适配器时执行
|
||||
# 使用七牛云适配器时执行
|
||||
composer require overtrue/flysystem-qiniu
|
||||
# 使用内存适配器时执行
|
||||
composer require league/flysystem-memory
|
||||
|
@ -12,7 +12,7 @@ composer require xxtime/flysystem-aliyun-oss
|
||||
# 使用 S3 適配器時執行
|
||||
composer require league/flysystem-aws-s3-v3
|
||||
composer require hyperf/guzzle
|
||||
# 使用七牛雲(測試)適配器時執行
|
||||
# 使用七牛雲適配器時執行
|
||||
composer require overtrue/flysystem-qiniu
|
||||
# 使用內存適配器時執行
|
||||
composer require league/flysystem-memory
|
||||
|
@ -12,7 +12,7 @@ composer require xxtime/flysystem-aliyun-oss
|
||||
# 使用 S3 介面卡時執行
|
||||
composer require league/flysystem-aws-s3-v3
|
||||
composer require hyperf/guzzle
|
||||
# 使用七牛雲(測試)介面卡時執行
|
||||
# 使用七牛雲介面卡時執行
|
||||
composer require overtrue/flysystem-qiniu
|
||||
# 使用記憶體介面卡時執行
|
||||
composer require league/flysystem-memory
|
||||
|
@ -81,6 +81,11 @@ class Parser
|
||||
} elseif (strpos($string, ',') !== false) {
|
||||
$exploded = explode(',', $string);
|
||||
foreach ($exploded as $value) {
|
||||
if (strpos($value, '/') !== false) {
|
||||
$result = array_merge($result, $this->parseSegment($value, $min, $max, $start));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $this->between((int) $value, (int) ($min > $start ? $min : $start), (int) $max)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -74,6 +74,21 @@ class ParserTest extends TestCase
|
||||
], $this->toDatatime($result));
|
||||
}
|
||||
|
||||
public function testParseSecondLevelForComma(): void
|
||||
{
|
||||
$crontabString = '10-12/1,14-15/1 * * * * *';
|
||||
$parser = new Parser();
|
||||
$startTime = Carbon::createFromTimestamp(1591754280)->startOfMinute();
|
||||
$result = $parser->parse($crontabString, $startTime->getTimestamp());
|
||||
$this->assertSame([
|
||||
'2020-06-10 09:58:10',
|
||||
'2020-06-10 09:58:11',
|
||||
'2020-06-10 09:58:12',
|
||||
'2020-06-10 09:58:14',
|
||||
'2020-06-10 09:58:15',
|
||||
], $this->toDatatime($result));
|
||||
}
|
||||
|
||||
public function testParseMinuteLevelBetween(): void
|
||||
{
|
||||
$crontabString = '10-15/1 10-12/1 10 * * *';
|
||||
|
Loading…
Reference in New Issue
Block a user