Commit 92bb410c 92bb410c8587f8f74452e65b4c5ab029ae60482a by lemon

获取发行最新记录

1 parent 19802215
......@@ -31,6 +31,6 @@ class SongsApply extends BaseModel
*/
public function songs_album()
{
return $this->belongsTo(SongsIssueAlbum::class, 'album_id', 'id')->select('id', 'album_name','ver','singer','submit_at','operator');
return $this->belongsTo(SongsIssueAlbum::class, 'album_id', 'id');
}
}
......
......@@ -80,15 +80,17 @@ class IssueService extends Service
public function latestOnlineRecord()
{
$res = SongsApply::query()->where(['from'=>1, 'user_id'=>$this->request->get('identifier')->company_id])
->whereNotNull('qy_url')->with('songs_album.cover:link_id,key')
->select(['name','album_id','singer','issue_time','qy_url'])->paginate($this->pageSize);
->whereNotNull('qy_url')->with(['songs_album:id,cover_map_id', 'songs_album.cover:id,link_id,key'])
->select(['name','album_id','singer','online_time','qy_url'])->orderByDesc('online_time')
->paginate($this->pageSize);
$cos = new CosHelper(env('MATERIAL_BUCKET'));
foreach ($res as &$item) {
if (!empty($item->songs_album)) {
if (!empty($item->songs_album->cover)) {
$item->cover = $cos->getPreviewUrl($item->songs_album->cover->key);
}
unset($item->songs_album);
}
return Response::success($res);
......