field('c.*,a.create_time as download_time,b.nickname,b.avatar,b.mobile,d.name as cname') ->alias('a') ->join('user b','a.user_id=b.id','LEFT') ->join('resource c','a.resource_id=c.id','LEFT') ->join('resource_category d','c.cid=d.id','LEFT') ->where($where) ->order('a.create_time', 'desc') ->paginate([ 'page' => $get['page'], 'list_rows' => $get['limit'], 'var_page' => 'page' ]) ->toArray(); foreach ($lists['data'] as &$item) { $item['category'] = $item['cname'] ?? '未知'; $item['is_show'] = $item['is_show'] ? '显示' : '隐藏'; $item['path'] = $item['path']?UrlServer::getFileUrl($item['path']):''; $item['path_name']= $item['path']?substr($item['path'],strrpos($item['path'],"/")+1):''; $item['address'] = $item['province_id']?AreaServer::getAddress([ $item['province_id'], $item['city_id'], $item['district_id']]):''; } return ['count'=>$lists['total'], 'lists'=>$lists['data']]; } catch (Exception $e) { return ['error'=>$e->getMessage()]; } } }