Commit 92bb410c 92bb410c8587f8f74452e65b4c5ab029ae60482a by lemon

获取发行最新记录

1 parent 19802215
...@@ -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);
......