['uid'], '%like%' => ['name', 'contact'], ]; } /** * @notes 获取用户反馈表列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/05/13 16:56 */ public function lists(): array { return UserFeedback::where($this->searchWhere) ->field(['id', 'uid', 'content', 'images', 'name', 'contact']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty(); $data['user_name'] = !$user->isEmpty() ? $user['nickname'] : ''; }) ->toArray(); } /** * @notes 获取用户反馈表数量 * @return int * @author likeadmin * @date 2024/05/13 16:56 */ public function count(): int { return UserFeedback::where($this->searchWhere)->count(); } }