field('a.*,b.nickname,c.name') ->order('a.id DESC') ->leftJoin('user b', 'b.uid = a.uid') ->leftJoin('out c', 'c.id = a.out_id'); if ($where['name']) $model->where('b.nickname|a.uid', 'like', '%'.$where['name'].'%'); if ($where['status'] == 1){ $model->where('a.status', 0); } if ($where['status'] == 2){ $model->where('a.status', 1); } if ($where['status'] == 3){ $model->where('a.status', 2); } if ($where['status'] == 4){ $model->where('a.status', -1); } $data['count'] = $model->count(); if ($where['page'] && $where['limit']){ $model->page($where['page'], $where['limit']); }else{ $model->page(20, 1); } $list = $model->select(); $list = count($list) ? $list->toArray() : []; foreach ($list as &$item) { if ($item['money'] == 0){ $item['money'] = User::where('uid', $item['uid'])->find()['pay_price']; } } $data['data'] = $list; return $data; } }