|
@@ -43,31 +43,36 @@ class Renwu extends Backend |
|
@@ -43,31 +43,36 @@ class Renwu extends Backend |
43
|
$this->relationSearch = true;
|
43
|
$this->relationSearch = true;
|
44
|
//设置过滤方法
|
44
|
//设置过滤方法
|
45
|
$this->request->filter(['strip_tags', 'trim']);
|
45
|
$this->request->filter(['strip_tags', 'trim']);
|
46
|
- if ($this->request->isAjax())
|
|
|
47
|
- {
|
46
|
+ if ($this->request->isAjax()) {
|
48
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
47
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
49
|
- if ($this->request->request('keyField'))
|
|
|
50
|
- {
|
48
|
+ if ($this->request->request('keyField')) {
|
51
|
return $this->selectpage();
|
49
|
return $this->selectpage();
|
52
|
}
|
50
|
}
|
53
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
51
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
54
|
$total = $this->model
|
52
|
$total = $this->model
|
55
|
- ->with(['user','vip'])
|
53
|
+ ->alias('a')
|
|
|
54
|
+ ->with(['user', 'vip'])
|
56
|
->where($where)
|
55
|
->where($where)
|
57
|
->order($sort, $order)
|
56
|
->order($sort, $order)
|
|
|
57
|
+ ->join('user u', 'u.id= a.xi_id')
|
|
|
58
|
+ ->join('user u', 'u.id= a.zhao_id')
|
58
|
->count();
|
59
|
->count();
|
59
|
|
60
|
|
60
|
$list = $this->model
|
61
|
$list = $this->model
|
61
|
- ->with(['user','vip'])
|
62
|
+ ->with(['user', 'vip'])
|
62
|
->where($where)
|
63
|
->where($where)
|
63
|
->order($sort, $order)
|
64
|
->order($sort, $order)
|
64
|
->limit($offset, $limit)
|
65
|
->limit($offset, $limit)
|
|
|
66
|
+ ->join('user u', 'u.id= a.xi_id')
|
|
|
67
|
+ ->join('user u', 'u.id= a.zhao_id')
|
65
|
->select();
|
68
|
->select();
|
66
|
|
69
|
|
67
|
foreach ($list as $row) {
|
70
|
foreach ($list as $row) {
|
68
|
|
71
|
|
69
|
- $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']);
|
72
|
+ $row->getRelation('user')->visible(['nickname', 'mobile', 'address', 'address_con', 'car_num', 'color', 'car_type', 'vip']);
|
70
|
$row->getRelation('vip')->visible(['title']);
|
73
|
$row->getRelation('vip')->visible(['title']);
|
|
|
74
|
+ $row->getRelation('xi_id')->visible(['nickname']);
|
|
|
75
|
+ $row->getRelation('zhao_id')->visible(['nickname']);
|
71
|
}
|
76
|
}
|
72
|
$list = collection($list)->toArray();
|
77
|
$list = collection($list)->toArray();
|
73
|
$result = array("total" => $total, "rows" => $list);
|
78
|
$result = array("total" => $total, "rows" => $list);
|