|
|
|
@ -12,26 +12,57 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
|
|
|
public function setSearch(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'=' => ['status'],
|
|
|
|
|
'%like%' => ['nick_name','phone'],
|
|
|
|
|
'=' => ['status','age','gender'],
|
|
|
|
|
'%like%' => ['nick_name','real_name','phone'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取用户列表
|
|
|
|
|
public function lists(): array
|
|
|
|
|
{
|
|
|
|
|
$field = "id,phone,avatar,nick_name,real_name,id_card,gender,age,total_balance,total_integral,status,create_time";
|
|
|
|
|
return User::field($field)->where($this->searchWhere)->where('status','<>',2)
|
|
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
|
|
->order('id desc')->select()->each(function($item){
|
|
|
|
|
$item['status_text'] = $item->status_text;
|
|
|
|
|
$item['gender_text'] = $item->gender_text;
|
|
|
|
|
})->toArray();
|
|
|
|
|
$params = $this->params;
|
|
|
|
|
$field = "u.id,phone,avatar,nick_name,real_name,id_card,gender,age,total_balance,total_integral,CONCAT(province_name,city_name,area_name,street_name,village_name,brigade_name,address) as address,status,create_time";
|
|
|
|
|
return User::alias('u')->field($field)
|
|
|
|
|
->leftJoin('geo_province p','u.province = p.province_code')
|
|
|
|
|
->leftJoin('geo_city c','u.city = c.city_code')
|
|
|
|
|
->leftJoin('geo_area a','u.area = a.area_code')
|
|
|
|
|
->leftJoin('geo_street s','u.street = s.street_code')
|
|
|
|
|
->leftJoin('geo_village v','u.village = v.village_code')
|
|
|
|
|
->leftJoin('geo_brigade b','u.brigade = b.id')
|
|
|
|
|
->where('status','<>',2)
|
|
|
|
|
->where($this->searchWhere)
|
|
|
|
|
->where(function($query) use ($params){
|
|
|
|
|
if(isset($params['address'])){
|
|
|
|
|
$query->where('CONCAT(province_name,city_name,area_name,street_name,village_name,brigade_name,address) LIKE "%'.$params['address'].'%"');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
|
|
->order('u.id desc')
|
|
|
|
|
->select()->each(function($item){
|
|
|
|
|
$item['gender_text'] = $item->gender_text;
|
|
|
|
|
$item['status_text'] = $item->status_text;
|
|
|
|
|
})->toArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取数量
|
|
|
|
|
public function count(): int
|
|
|
|
|
{
|
|
|
|
|
return User::field('id')->where($this->searchWhere)->where('status','<>',2)->count();
|
|
|
|
|
$params = $this->params;
|
|
|
|
|
$field = "u.id,CONCAT(province_name,city_name,area_name,street_name,village_name,brigade_name,address) as address,status,create_time";
|
|
|
|
|
return User::alias('u')->field($field)
|
|
|
|
|
->leftJoin('geo_province p','u.province = p.province_code')
|
|
|
|
|
->leftJoin('geo_city c','u.city = c.city_code')
|
|
|
|
|
->leftJoin('geo_area a','u.area = a.area_code')
|
|
|
|
|
->leftJoin('geo_street s','u.street = s.street_code')
|
|
|
|
|
->leftJoin('geo_village v','u.village = v.village_code')
|
|
|
|
|
->leftJoin('geo_brigade b','u.brigade = b.id')
|
|
|
|
|
->where('status','<>',2)
|
|
|
|
|
->where($this->searchWhere)
|
|
|
|
|
->where(function($query) use ($params){
|
|
|
|
|
if(isset($params['address'])){
|
|
|
|
|
$query->where('CONCAT(province_name,city_name,area_name,street_name,village_name,brigade_name,address) LIKE "%'.$params['address'].'%"');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->count();
|
|
|
|
|
}
|
|
|
|
|
}
|