后台用户列表排序修改。

This commit is contained in:
2025-12-20 18:42:00 +08:00
parent 3e90c1ae38
commit ff5222e333

View File

@@ -35,6 +35,8 @@ class User extends adminApi
$page_limit = input('page_limit', 30); $page_limit = input('page_limit', 30);
$search_str = input('search', ''); $search_str = input('search', '');
$search_user_code = input('search_user_code', ''); $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.is_robot'] =0;
// $where['a.delete_time'] = 0; // $where['a.delete_time'] = 0;
//如果是手机号查手机号 //如果是手机号查手机号
@@ -60,7 +62,7 @@ class User extends adminApi
if($is_real == 1) { if($is_real == 1) {
$where['b.is_real'] = 1; $where['b.is_real'] = 1;
}else { }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.init_code,
a.status 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') $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('(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') ->join('user_wallet c', 'a.id = c.user_id','LEFT')
->where($where) ->where($where)
->field($field) ->field($field)
->order('a.id desc'); ->order($order);
$lists = $user_data->page($page, $page_limit)->select(); $lists = $user_data->page($page, $page_limit)->select();
$count = db::name('user')->alias('a') $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('(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') ->join('user_wallet c', 'a.id = c.user_id','LEFT')
->where($where) ->where($where)
->field($field) ->field($field)
->order('a.id desc')->count(); ->count();
foreach ($lists as $key => $value) { foreach ($lists as $key => $value) {
if($value['status'] == 1){ if($value['status'] == 1){
$lists[$key]['status_str'] ='正常'; $lists[$key]['status_str'] ='正常';