88 lines
2.7 KiB
PHP
88 lines
2.7 KiB
PHP
|
<?php
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
|||
|
// | 开源版本可自由商用,可去除界面版权logo
|
|||
|
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
|||
|
// | github下载:https://github.com/likeshop-github/likeadmin
|
|||
|
// | 访问官网:https://www.likeadmin.cn
|
|||
|
// | likeadmin团队 版权所有 拥有最终解释权
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | author: likeadminTeam
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
|
|||
|
namespace app\adminapi\lists\task_template;
|
|||
|
|
|||
|
|
|||
|
use app\adminapi\lists\BaseAdminDataLists;
|
|||
|
use app\common\model\task_template\TaskTemplate;
|
|||
|
use app\common\lists\ListsSearchInterface;
|
|||
|
use app\common\model\task_scheduling\TaskScheduling;
|
|||
|
use app\common\model\user\User;
|
|||
|
|
|||
|
/**
|
|||
|
* 任务模板列表
|
|||
|
* Class TaskTemplateLists
|
|||
|
* @package app\adminapi\liststask_template
|
|||
|
*/
|
|||
|
class TaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @notes 设置搜索条件
|
|||
|
* @return \string[][]
|
|||
|
* @author likeadmin
|
|||
|
* @date 2023/08/06 17:30
|
|||
|
*/
|
|||
|
public function setSearch(): array
|
|||
|
{
|
|||
|
return [
|
|||
|
'=' => ['title', 'admin_id', 'money', 'type', 'status', 'content','company_id'],
|
|||
|
];
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @notes 获取任务模板列表
|
|||
|
* @return array
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
* @author likeadmin
|
|||
|
* @date 2023/08/06 17:30
|
|||
|
*/
|
|||
|
public function lists(): array
|
|||
|
{
|
|||
|
return TaskTemplate::where($this->searchWhere)
|
|||
|
->with(['admin','data_type'])
|
|||
|
->limit($this->limitOffset, $this->limitLength)
|
|||
|
->order(['id' => 'desc'])
|
|||
|
->select()
|
|||
|
->append(['task_admin_name'])
|
|||
|
->withAttr("task_admin_name", function ($value,$data) {
|
|||
|
if ($data['type'] == 35) {
|
|||
|
$extend = json_decode($data['extend'], true);
|
|||
|
$userName = User::where('id', $extend['shareholder']['user_id'])->value('nickname');
|
|||
|
return $userName;
|
|||
|
} else {
|
|||
|
return '';
|
|||
|
}
|
|||
|
})
|
|||
|
->toArray();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @notes 获取任务模板数量
|
|||
|
* @return int
|
|||
|
* @author likeadmin
|
|||
|
* @date 2023/08/06 17:30
|
|||
|
*/
|
|||
|
public function count(): int
|
|||
|
{
|
|||
|
return TaskTemplate::where($this->searchWhere)->count();
|
|||
|
}
|
|||
|
|
|||
|
}
|