首发专辑
Showing
1 changed file
with
4 additions
and
10 deletions
... | @@ -17,16 +17,10 @@ class ReleaseSongService extends Service | ... | @@ -17,16 +17,10 @@ class ReleaseSongService extends Service |
17 | */ | 17 | */ |
18 | public function releaseSong() | 18 | public function releaseSong() |
19 | { | 19 | { |
20 | $res = SongsIp::query()->with(['songsIpExt:id,song_ip_id,track_cover'])->select(['id','song_id', 'edition']) | 20 | $res = SongsIp::query()->where('online_time', '<=', now()->toDateTimeString()) |
21 | ->orderByDesc('online_time')->paginate($this->pageSize); | 21 | ->select(['songs_ip.id', 'edition as name', 'track_cover as cover']) |
22 | 22 | ->join('songs_ip_exts as six', 'songs_ip.song_id', '=', 'six.song_ip_id') | |
23 | foreach ($res as &$item) { | 23 | ->orderByDesc('online_time')->groupBy('edition')->paginate($this->pageSize); |
24 | |||
25 | $item->setAttribute('id', $item->id); | ||
26 | $item->setAttribute('name', $item->edition); | ||
27 | $item->setAttribute('cover', $item->songsIpExt ? $item->songsIpExt->track_cover : ''); | ||
28 | unset($item->songsIpExt, $item->edition, $item->song_id); | ||
29 | } | ||
30 | 24 | ||
31 | return Response::success($res); | 25 | return Response::success($res); |
32 | } | 26 | } | ... | ... |
-
Please register or sign in to post a comment