获取发行最新记录
Showing
2 changed files
with
6 additions
and
4 deletions
| ... | @@ -31,6 +31,6 @@ class SongsApply extends BaseModel | ... | @@ -31,6 +31,6 @@ class SongsApply extends BaseModel |
| 31 | */ | 31 | */ |
| 32 | public function songs_album() | 32 | public function songs_album() |
| 33 | { | 33 | { |
| 34 | return $this->belongsTo(SongsIssueAlbum::class, 'album_id', 'id')->select('id', 'album_name','ver','singer','submit_at','operator'); | 34 | return $this->belongsTo(SongsIssueAlbum::class, 'album_id', 'id'); |
| 35 | } | 35 | } |
| 36 | } | 36 | } | ... | ... |
| ... | @@ -80,15 +80,17 @@ class IssueService extends Service | ... | @@ -80,15 +80,17 @@ class IssueService extends Service |
| 80 | public function latestOnlineRecord() | 80 | public function latestOnlineRecord() |
| 81 | { | 81 | { |
| 82 | $res = SongsApply::query()->where(['from'=>1, 'user_id'=>$this->request->get('identifier')->company_id]) | 82 | $res = SongsApply::query()->where(['from'=>1, 'user_id'=>$this->request->get('identifier')->company_id]) |
| 83 | ->whereNotNull('qy_url')->with('songs_album.cover:link_id,key') | 83 | ->whereNotNull('qy_url')->with(['songs_album:id,cover_map_id', 'songs_album.cover:id,link_id,key']) |
| 84 | ->select(['name','album_id','singer','issue_time','qy_url'])->paginate($this->pageSize); | 84 | ->select(['name','album_id','singer','online_time','qy_url'])->orderByDesc('online_time') |
| 85 | ->paginate($this->pageSize); | ||
| 85 | 86 | ||
| 86 | $cos = new CosHelper(env('MATERIAL_BUCKET')); | 87 | $cos = new CosHelper(env('MATERIAL_BUCKET')); |
| 87 | 88 | ||
| 88 | foreach ($res as &$item) { | 89 | foreach ($res as &$item) { |
| 89 | if (!empty($item->songs_album)) { | 90 | if (!empty($item->songs_album->cover)) { |
| 90 | $item->cover = $cos->getPreviewUrl($item->songs_album->cover->key); | 91 | $item->cover = $cos->getPreviewUrl($item->songs_album->cover->key); |
| 91 | } | 92 | } |
| 93 | unset($item->songs_album); | ||
| 92 | } | 94 | } |
| 93 | 95 | ||
| 94 | return Response::success($res); | 96 | return Response::success($res); | ... | ... |
-
Please register or sign in to post a comment