no message

This commit is contained in:
kuaifan 2022-06-24 20:42:46 +08:00
parent 0d158d2403
commit dfb6f23b60
8 changed files with 18 additions and 17 deletions

View File

@ -879,41 +879,42 @@ class ProjectTask extends AbstractModel
*/ */
public function refreshLoop($save = false) public function refreshLoop($save = false)
{ {
if (!$this->start_at) {
return false;
}
//
$success = true; $success = true;
$start = Carbon::parse($this->start_at); if ($this->start_at) {
if ($start->lt(Carbon::today())) { $base = Carbon::parse($this->start_at);
// 如果任务开始时间小于今天则重复周期开始时间为今天 if ($base->lt(Carbon::today())) {
$start = Carbon::parse(date("Y-m-d {$start->toTimeString()}")); // 如果任务开始时间小于今天则基数时间为今天
$base = Carbon::parse(date("Y-m-d {$base->toTimeString()}"));
}
} else {
// 未设置任务时间时基数时间为今天
$base = Carbon::today();
} }
switch ($this->loop) { switch ($this->loop) {
case "day": case "day":
$this->loop_at = $start->addDay(); $this->loop_at = $base->addDay();
break; break;
case "weekdays": case "weekdays":
$this->loop_at = $start->addWeekday(); $this->loop_at = $base->addWeekday();
break; break;
case "week": case "week":
$this->loop_at = $start->addWeek(); $this->loop_at = $base->addWeek();
break; break;
case "twoweeks": case "twoweeks":
$this->loop_at = $start->addWeeks(2); $this->loop_at = $base->addWeeks(2);
break; break;
case "month": case "month":
$this->loop_at = $start->addMonth(); $this->loop_at = $base->addMonth();
break; break;
case "year": case "year":
$this->loop_at = $start->addYear(); $this->loop_at = $base->addYear();
break; break;
case "never": case "never":
$this->loop_at = null; $this->loop_at = null;
break; break;
default: default:
if (Base::isNumber($this->loop)) { if (Base::isNumber($this->loop)) {
$this->loop_at = $start->addDays($this->loop); $this->loop_at = $base->addDays($this->loop);
} else { } else {
$success = false; $success = false;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -277,7 +277,7 @@
</FormItem> </FormItem>
<FormItem v-if="(taskDetail.loop && taskDetail.loop != 'never') || loopForce"> <FormItem v-if="(taskDetail.loop && taskDetail.loop != 'never') || loopForce">
<div class="item-label" slot="label"> <div class="item-label" slot="label">
<i class="taskfont">&#xe68c;</i>{{$L('重复周期')}} <i class="taskfont">&#xe93f;</i>{{$L('重复周期')}}
</div> </div>
<ul class="item-content"> <ul class="item-content">
<li> <li>
@ -750,7 +750,7 @@ export default {
if (!taskDetail.loop || taskDetail.loop == 'never') { if (!taskDetail.loop || taskDetail.loop == 'never') {
list.push({ list.push({
command: 'loop', command: 'loop',
icon: '&#xe68c;', icon: '&#xe93f;',
name: '重复周期', name: '重复周期',
}); });
} }