From 5cdc7d99313840432d931a5005eff21ce15f2f6e Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 8 Sep 2023 14:11:52 +0800 Subject: [PATCH] * Refactor getBeginEnd4CFD method. --- module/execution/model.php | 9 +++++---- module/execution/test/execution.class.php | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 4f5cff3583..b407540037 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3674,16 +3674,17 @@ class executionModel extends model } /** + * 获取累计流图的开始、结束日期。 * Get begin and end for CFD. * * @param object $execution * @access public - * @return void + * @return array */ - public function getBeginEnd4CFD($execution) + public function getBeginEnd4CFD(object $execution): array { - $end = (!helper::isZeroDate($execution->closedDate) and date('Y-m-d', strtotime($execution->closedDate)) < helper::today()) ? date('Y-m-d', strtotime($execution->closedDate)) : helper::today(); - $begin = (!helper::isZeroDate($execution->openedDate) and date('Y-m-d', strtotime($execution->openedDate)) > date('Y-m-d', strtotime('-13 days', strtotime($end)))) ? date('Y-m-d', strtotime($execution->openedDate)) : date('Y-m-d', strtotime('-13 days', strtotime($end))); + $end = (!helper::isZeroDate($execution->closedDate) && date('Y-m-d', strtotime($execution->closedDate)) < helper::today()) ? date('Y-m-d', strtotime($execution->closedDate)) : helper::today(); + $begin = (!helper::isZeroDate($execution->openedDate) && date('Y-m-d', strtotime($execution->openedDate)) > date('Y-m-d', strtotime('-13 days', strtotime($end)))) ? date('Y-m-d', strtotime($execution->openedDate)) : date('Y-m-d', strtotime('-13 days', strtotime($end))); return array($begin, $end); } diff --git a/module/execution/test/execution.class.php b/module/execution/test/execution.class.php index 21974a0509..e875f4249f 100644 --- a/module/execution/test/execution.class.php +++ b/module/execution/test/execution.class.php @@ -2413,13 +2413,14 @@ class executionTest } /** + * 获取累计流图的开始、结束日期。 * Test get begin and end for CFD. * * @param int $executionID * @access public * @return array */ - public function getBeginEnd4CFDTest($executionID) + public function getBeginEnd4CFDTest(int $executionID): array { global $tester;