上架记录
Showing
4 changed files
with
93 additions
and
0 deletions
... | @@ -48,4 +48,13 @@ class IssueController extends Controller | ... | @@ -48,4 +48,13 @@ class IssueController extends Controller |
48 | return $this->issueService->subCompany(); | 48 | return $this->issueService->subCompany(); |
49 | } | 49 | } |
50 | 50 | ||
51 | /** | ||
52 | * 最新发行记录 | ||
53 | * @return \Illuminate\Http\JsonResponse | ||
54 | */ | ||
55 | public function latestRecord() | ||
56 | { | ||
57 | return $this->issueService->latestRecord(); | ||
58 | } | ||
59 | |||
51 | } | 60 | } | ... | ... |
app/Models/Legal/SongsApply.php
0 → 100644
1 | <?php | ||
2 | |||
3 | |||
4 | namespace App\Models\Legal; | ||
5 | |||
6 | |||
7 | use App\Models\BaseModel; | ||
8 | use Illuminate\Database\Eloquent\SoftDeletes; | ||
9 | |||
10 | class SongsApply extends BaseModel | ||
11 | { | ||
12 | use SoftDeletes; | ||
13 | |||
14 | /** | ||
15 | * @var string | ||
16 | */ | ||
17 | protected $table = 'songs_apply'; | ||
18 | |||
19 | /** | ||
20 | * @var array | ||
21 | */ | ||
22 | public $guarded = []; | ||
23 | |||
24 | /** | ||
25 | * @var string[] | ||
26 | */ | ||
27 | public $hidden = ['album_id']; | ||
28 | |||
29 | /** | ||
30 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
31 | */ | ||
32 | public function songs_album() | ||
33 | { | ||
34 | return $this->belongsTo(SongsIssueAlbum::class, 'album_id', 'id')->select('id', 'album_name','ver','singer','submit_at','operator'); | ||
35 | } | ||
36 | } |
app/Models/Legal/SongsIssueAlbum.php
0 → 100644
1 | <?php | ||
2 | |||
3 | |||
4 | namespace App\Models\Legal; | ||
5 | |||
6 | use App\Models\BaseModel; | ||
7 | use Illuminate\Database\Eloquent\SoftDeletes; | ||
8 | |||
9 | class SongsIssueAlbum extends BaseModel | ||
10 | { | ||
11 | use SoftDeletes; | ||
12 | |||
13 | protected $table = 'songs_issue_album'; | ||
14 | |||
15 | public $guarded = []; | ||
16 | |||
17 | |||
18 | /** | ||
19 | * 关联封面 | ||
20 | * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
21 | */ | ||
22 | public function cover() | ||
23 | { | ||
24 | return $this->hasOne(FileMap::class, 'id','cover_map_id'); | ||
25 | } | ||
26 | } |
... | @@ -3,8 +3,10 @@ | ... | @@ -3,8 +3,10 @@ |
3 | namespace App\Services; | 3 | namespace App\Services; |
4 | 4 | ||
5 | use App\Helper\AesEncrypt; | 5 | use App\Helper\AesEncrypt; |
6 | use App\Helper\CosHelper; | ||
6 | use App\Helper\ErrorCode; | 7 | use App\Helper\ErrorCode; |
7 | use App\Helper\Response; | 8 | use App\Helper\Response; |
9 | use App\Models\Legal\SongsApply; | ||
8 | use App\Models\Legal\Stakeholder; | 10 | use App\Models\Legal\Stakeholder; |
9 | use App\Models\Legal\Subject; | 11 | use App\Models\Legal\Subject; |
10 | use Illuminate\Support\Facades\Log; | 12 | use Illuminate\Support\Facades\Log; |
... | @@ -69,7 +71,27 @@ class IssueService extends Service | ... | @@ -69,7 +71,27 @@ class IssueService extends Service |
69 | ->get(['no as value', 'name']); | 71 | ->get(['no as value', 'name']); |
70 | 72 | ||
71 | return Response::success($subject); | 73 | return Response::success($subject); |
74 | } | ||
75 | |||
76 | /** | ||
77 | * 发行(上架成功记录) | ||
78 | * @return \Illuminate\Http\JsonResponse | ||
79 | */ | ||
80 | public function latestRecord() | ||
81 | { | ||
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') | ||
84 | ->select(['name','album_id','singer','issue_time','qy_url'])->paginate($this->pageSize); | ||
85 | |||
86 | $cos = new CosHelper(env('MATERIAL_BUCKET')); | ||
87 | |||
88 | foreach ($res as &$item) { | ||
89 | if (!empty($item->songs_album)) { | ||
90 | $item->cover = $cos->getPreviewUrl($item->songs_album->cover->key); | ||
91 | } | ||
92 | } | ||
72 | 93 | ||
94 | return Response::success($res); | ||
73 | } | 95 | } |
74 | 96 | ||
75 | 97 | ... | ... |
-
Please register or sign in to post a comment