|
...
|
...
|
@@ -26,16 +26,54 @@ class KeywordVideoController extends BaseController |
|
|
|
*/
|
|
|
|
public function lists(){
|
|
|
|
$keywordModel = new KeywordVideoTask();
|
|
|
|
$lists = $keywordModel->lists($this->map,$this->page,$this->row);
|
|
|
|
if(!empty($lists) && !empty($lists['list'])){
|
|
|
|
$projectModel = new Project();
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
$v['project_name'] = $projectModel->read(['id'=>$v['project_id']],['id','title'])['title'];
|
|
|
|
$lists['list'][$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$query = $keywordModel->leftJoin('gl_project', 'gl_keyword_video_task.project_id', '=', 'gl_project.id');
|
|
|
|
$query = $this->searchParam($query);
|
|
|
|
$query = $this->orderByList($query);
|
|
|
|
$lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 需要查询的字段
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function selectParam(){
|
|
|
|
$select = [
|
|
|
|
'gl_keyword_video_task.project_id AS project_id',
|
|
|
|
'gl_keyword_video_task.number AS number',
|
|
|
|
'gl_keyword_video_task.status AS status',
|
|
|
|
'gl_keyword_video_task.sort AS sort',
|
|
|
|
'gl_keyword_video_task.created_at AS created_at',
|
|
|
|
'gl_keyword_video_task.updated_at AS updated_at',
|
|
|
|
'gl_project.title AS title',
|
|
|
|
'gl_project.company AS company',
|
|
|
|
];
|
|
|
|
return $select;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @remark :搜索参数处理
|
|
|
|
* @name :searchParam
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/18 10:58
|
|
|
|
*/
|
|
|
|
public function searchParam(&$query){
|
|
|
|
if(isset($this->map['project_name']) && is_array($this->map['project_name'])){
|
|
|
|
$query->where('gl_project.title','like','%'.$this->map['project_name'].'%');
|
|
|
|
}
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :排序
|
|
|
|
* @name :orderByList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/29 17:14
|
|
|
|
*/
|
|
|
|
public function orderByList(&$query){
|
|
|
|
$query = $query->orderBy('gl_keyword_video_task.sort', 'desc')->orderBy('gl_keyword_video_task.id', 'desc');
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :创建关键字任务池子
|
...
|
...
|
|