Record.php
1.9 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace app\run\controller;
use app\common\controller\Frontend;
use think\Db;
use think\exception\ValidateException;
use think\Request;
class Record extends Frontend
{
protected $noNeedLogin = [''];
protected $noNeedRight = '*';
protected $layout = '';
public $model = null;
protected $modelValidate = true;
protected $modelSceneValidate = true;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\reservoir\run\Worklog;
}
public function index()
{
$list = $this->model->with(['reservoirrunwork'])->order('createtime', 'desc')->paginate($this->limit, false, [
'query' => Request::instance()->param(),//不丢失已存在的url参数
]);
$page = $list->render();
$this->assign('list', $list);
$this->assign('page', $page);
return $this->view->fetch();
}
// public function add(){
// $params = input('post.params/a');
// try {
// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
// $this->model->validateFailException(true)->validate($validate);
// // $params['completetime'] = strtotime($params['completetime']);
// $result = $this->model->allowField(true)->save($params);
// } catch (ValidateException $e) {
// $this->error($e->getMessage());
// }
// if ($result !== false) {
// $this->success();
// }
// }
// public function del($id){
// $dairy = $this->model->get($id);
// $result = $dairy->delete();
// if($result){
// $this->success();
// }
// else{
// $this->error('删除失败');
// }
// }
}