['status','phone'], '%like%' => ['nickname'], ]; } // 获取用户列表 public function lists(): array { $field = "id,phone,avatar,nickname,realname,id_card,gender,age,total_balance,total_integral,province,city,area,street,village,brigade,address,status,create_time"; return User::field($field)->where('status','<>',2)->where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength)->order('id desc') ->select()->each(function($item){ $item['address'] = $item->province_text.$item->city_text.$item->area_text.$item->street_text.$item->village_text.$item->brigade_text.$item->address; $item['gender_text'] = $item->gender_text; $item['status_text'] = $item->status_text; unset($item['province'],$item['city'],$item['area'],$item['street'],$item['village'],$item['brigade']); })->toArray(); } // 获取数量 public function count(): int { return User::field('id')->where('status','<>',2)->where($this->searchWhere)->count(); } }