You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
<?php
|
|
|
|
namespace app\admin\model;
|
|
|
|
use app\common\model\TimeModel;
|
|
|
|
class Task extends TimeModel
|
|
{
|
|
|
|
protected $deleteTime = 'delete_time';
|
|
|
|
protected $defaultSoftDelete = '0';
|
|
|
|
public static $statusArr = ['停止', '待开始', '进行中', '已完成', '驳回'];
|
|
|
|
public static function getPageList($param = []): array
|
|
{
|
|
$page = $param['page'] ?? 1;
|
|
$limit = $param['limit'] ?? 10;
|
|
$where = [['status', '=', 1]];
|
|
if (isset($param['keyword'])) {
|
|
$where[] = ['uuid', 'like', '%' . $param['keyword'] . '%'];
|
|
}
|
|
$field = 'id, uuid, integral, duration';
|
|
$order = 'id desc';
|
|
$model = new self();
|
|
$count = $model->where($where)->count();
|
|
$list = $model->where($where)->field($field)->order($order)->page($page, $limit)->select();
|
|
return ['data' => $list, 'count' => $count];
|
|
}
|
|
|
|
public static function getDetail($id): array
|
|
{
|
|
$model = new self();
|
|
$withoutField = 'delete_time, update_time';
|
|
$detail = $model->withoutField($withoutField)->find($id)->toArray();
|
|
if ($detail) {
|
|
$detail['add_uname'] = User::getUserValue($detail['add_uid']);
|
|
$detail['assign_uname'] = User::getUserValue($detail['assign_uid']);
|
|
$detail['status_str'] = self::$statusArr[$detail['status']];
|
|
$detail['start_time'] = get_datetime($detail['start_time']);
|
|
$detail['end_time'] = get_datetime($detail['end_time']);
|
|
}
|
|
return $detail ?: [];
|
|
}
|
|
}
|
|
|