Operatelog.php
2.5 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
namespace app\admin\controller\facrm;
use app\common\controller\Backend;
use think\Db;
use think\Exception;
use think\exception\PDOException;
/**
* 操作记录
*/
class Operatelog extends Backend
{
protected $model = null;
protected $noNeedRight = [];
/**
* 快速搜索时执行查找的字段
*/
protected $searchFields = 'content';
public function _initialize()
{
parent::_initialize();
$this->model = model('\app\admin\model\facrm\Operatelog');
$this->request->filter(['strip_tags']);
}
/**
* 查看
*/
public function index($customer_id = null,$contract_id=null,$receivable_id=null)
{
if ($this->request->isAjax()) {
$filter_w=[];
if ($customer_id) {
$filter_w['customer_id'] = $customer_id;
}
if ($contract_id) {
$filter_w['contract_id'] = $contract_id;
}
if ($receivable_id) {
$filter_w['receivable_id'] = $receivable_id;
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where($filter_w)
->order($sort, $order)->fetchSql(false)
->count();
$list = $this->model
->where($filter_w)
->where($where)
->order($sort, $order)
->limit($offset, $limit)->fetchSql(false)
->select();
foreach ($list as $row){
$row->hidden(['content']);
}
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 详情
*/
public function detail($ids)
{
$row = $this->model->get(['id' => $ids]);
if (!$row) {
$this->error(__('No Results were found'));
}
$this->view->assign("row", $row->toArray());
return $this->view->fetch();
}
/**
* 修改
* @Internal
* @return mixed
*/
public function edit($key = null){
$this->error();
}
/**
* 添加
* @Internal
* @return mixed
*/
public function add()
{
$this->error();
}
/**
* @Internal
* @return mixed
*/
public function multi($ids = "")
{
$this->error();
}
}