阶段更新

This commit is contained in:
2023-01-12 14:47:38 +08:00
parent 088dd64b2f
commit 5b8901281c
626 changed files with 39326 additions and 12 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Modules\Task\Models;
use App\Models\Model;
use App\Traits\HasStatus;
use Illuminate\Support\Facades\Cache;
use Modules\Task\Models\Traits\BelongsToTask;
use Modules\User\Traits\BelongsToUser;
class User extends Model
{
use BelongsToUser, BelongsToTask, HasStatus;
protected $table = 'task_users';
const STATUS_INTI = 0;
const STATUS_FINISH = 1;
public array $status_map = [
self::STATUS_INTI => '进行中',
self::STATUS_FINISH => '完成',
];
/**
* Notes: 增加任务数
*
* @Author: 玄尘
* @Date: 2022/10/20 11:10
* @param int $step
*/
public function incrementTotal(int $step = 1)
{
if ($this->task->key == 'steps') {
$this->total = $step;
$this->save();
} else {
$this->increment('total', $step);
}
}
}