Task.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace app\inspection\controller;
use app\common\controller\Frontend;
class Task extends Frontend
{
protected $noNeedLogin = [];
protected $noNeedRight = '*';
protected $layout = '';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\inspection\Task;
}
public function list()
{
$list = $this->model
->alias('t')
->field('t.*,sta.staff_name')
->join('inspection_staff sta','t.user_id=sta.user_id','LEFT')
->paginate(10,'',['query'=>$this->request->param()]);
$this->view->assign('list',$list);
return $this->view->fetch();
}
public function details($ids=null)
{
$row = $this->model
->alias('t')
->field('t.*,sta.staff_name')
->join('inspection_staff sta','t.user_id=sta.user_id','LEFT')
->where('t.id',$ids)
->find();
if (!$row) {
$this->error('任务不存在');
}
$this->view->assign('row',$row);
return $this->view->fetch();
}
}