|
|
@@ -61,31 +61,11 @@ class User extends Backend
|
|
|
return $this->selectpage();
|
|
|
}
|
|
|
|
|
|
- list(, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
+ [$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
|
|
|
|
- //搜索条件
|
|
|
- $where = [];
|
|
|
- $filter = json_decode(urldecode(input('filter')), TRUE);
|
|
|
- list($where, $pid, $algebra) = $this->_where($filter);
|
|
|
-
|
|
|
- $list = $this->model
|
|
|
- ->with('ledgerWallet')
|
|
|
- ->alias('a');
|
|
|
-
|
|
|
- if ($pid > 0) {//上级大于0的时候,默认搜索伞下
|
|
|
- if($algebra > 0){
|
|
|
- $list = $list->where('a.id', 'in', function ($query) use($pid, $algebra) {
|
|
|
- $query->table('user_path')->where('parent_id', $pid)->where('distance', $algebra)->field('user_id');
|
|
|
-
|
|
|
- });
|
|
|
- }else{
|
|
|
- $list = $list->where('a.id', 'in', function ($query) use($pid, $algebra) {
|
|
|
- $query->table('user_path')->where('parent_id', $pid)->field('user_id');
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- $list = $list->where($where)->order($sort, $order)->paginate($limit);
|
|
|
+
|
|
|
+
|
|
|
+ $list = $this->model->with('ledgerWallet')->where($where)->order($sort, $order)->paginate($limit);
|
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
|
return json($result);
|
|
|
}
|
|
|
@@ -163,7 +143,7 @@ class User extends Backend
|
|
|
|
|
|
if (isset($filter['id'])) $map['a.id'] = ['=', $filter['id']];
|
|
|
if (isset($filter['address'])) $map['a.address'] = ['like', $filter['address']];
|
|
|
- //if (isset($filter['parent_id']) && !isset($filter['algebra'])) $map['a.parent_id'] = ['=', $filter['parent_id']];
|
|
|
+ if (isset($filter['parent_id'])) $map['parent_id'] = ['=', $filter['parent_id']];
|
|
|
if (isset($filter['create_time'])) {
|
|
|
$arr = explode(' - ', $filter['create_time']);
|
|
|
$map['a.create_time']= ['between time',[$arr[0], $arr[1]]];
|