diff --git a/application/adminapi/controller/User.php b/application/adminapi/controller/User.php index d1c5f150..80c9bcd8 100644 --- a/application/adminapi/controller/User.php +++ b/application/adminapi/controller/User.php @@ -35,6 +35,8 @@ class User extends adminApi $page_limit = input('page_limit', 30); $search_str = input('search', ''); $search_user_code = input('search_user_code', ''); + $order_type = input('order_type', 'id'); + $order_type_val = input('order_type_val', 'desc'); $where['a.is_robot'] =0; // $where['a.delete_time'] = 0; //如果是手机号查手机号 @@ -60,7 +62,7 @@ class User extends adminApi if($is_real == 1) { $where['b.is_real'] = 1; }else { - $where['b.is_real'] = ['<>',1]; + $where['b.is_real'] = [['<>',1],['null', null],'or']; } } //高级搜索 @@ -98,19 +100,30 @@ class User extends adminApi a.init_code, a.status '; + if($order_type_val ==1){ + $order_type_val_str = 'desc'; + }else{ + $order_type_val_str = 'asc'; + } + $order = 'a.id '.$order_type_val_str; + if($order_type=='coin'){ + $order = "c.coin ".$order_type_val_str; + }elseif($order_type=='earnings'){ + $order = "c.earnings ".$order_type_val_str; + } $user_data = db::name('user')->alias('a') ->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT') ->join('user_wallet c', 'a.id = c.user_id','LEFT') ->where($where) ->field($field) - ->order('a.id desc'); + ->order($order); $lists = $user_data->page($page, $page_limit)->select(); $count = db::name('user')->alias('a') ->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT') ->join('user_wallet c', 'a.id = c.user_id','LEFT') ->where($where) ->field($field) - ->order('a.id desc')->count(); + ->count(); foreach ($lists as $key => $value) { if($value['status'] == 1){ $lists[$key]['status_str'] ='正常';