fix: 任务重复周期

This commit is contained in:
kuaifan 2022-06-27 10:17:23 +08:00
parent c6402c72f9
commit ad2b456f07
2 changed files with 8 additions and 1 deletions

View File

@ -770,6 +770,7 @@ class ProjectTask extends AbstractModel
// 以下紧顶级任务可修改
if ($this->parent_id === 0) {
// 重复周期
$loopAt = $this->loop_at;
if (Arr::exists($data, 'loop')) {
$this->loop = $data['loop'];
if (!$this->refreshLoop()) {
@ -779,6 +780,11 @@ class ProjectTask extends AbstractModel
// 更新任务时间也要更新重复周期
$this->refreshLoop();
}
if ($loopAt !== $this->loop_at) {
$this->addLog("修改{任务}重复周期", [
'change' => [$loopAt, $this->loop_at]
]);
}
// 协助人员
if (Arr::exists($data, 'assist')) {
$array = [];
@ -916,6 +922,7 @@ class ProjectTask extends AbstractModel
if (Base::isNumber($this->loop)) {
$this->loop_at = $base->addDays($this->loop);
} else {
$this->loop_at = null;
$success = false;
}
break;

View File

@ -1011,7 +1011,7 @@ class Base
*/
public static function isNumber($str)
{
if (preg_match("/^\d*$/", $str)) {
if (preg_match("/^\d+$/", $str)) {
return true;
} else {
return false;