Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
5b44ba73
...
5b44ba730df7430fe46265f9b222b454a10cb3c5
authored
2022-12-29 10:27:49 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
上架记录
1 parent
43caf7a6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
0 deletions
app/Http/Controllers/Musician/IssueController.php
app/Models/Legal/SongsApply.php
app/Models/Legal/SongsIssueAlbum.php
app/Services/IssueService.php
app/Http/Controllers/Musician/IssueController.php
View file @
5b44ba7
...
...
@@ -48,4 +48,13 @@ class IssueController extends Controller
return
$this
->
issueService
->
subCompany
();
}
/**
* 最新发行记录
* @return \Illuminate\Http\JsonResponse
*/
public
function
latestRecord
()
{
return
$this
->
issueService
->
latestRecord
();
}
}
...
...
app/Models/Legal/SongsApply.php
0 → 100644
View file @
5b44ba7
<?php
namespace
App\Models\Legal
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
SongsApply
extends
BaseModel
{
use
SoftDeletes
;
/**
* @var string
*/
protected
$table
=
'songs_apply'
;
/**
* @var array
*/
public
$guarded
=
[];
/**
* @var string[]
*/
public
$hidden
=
[
'album_id'
];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public
function
songs_album
()
{
return
$this
->
belongsTo
(
SongsIssueAlbum
::
class
,
'album_id'
,
'id'
)
->
select
(
'id'
,
'album_name'
,
'ver'
,
'singer'
,
'submit_at'
,
'operator'
);
}
}
app/Models/Legal/SongsIssueAlbum.php
0 → 100644
View file @
5b44ba7
<?php
namespace
App\Models\Legal
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
SongsIssueAlbum
extends
BaseModel
{
use
SoftDeletes
;
protected
$table
=
'songs_issue_album'
;
public
$guarded
=
[];
/**
* 关联封面
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public
function
cover
()
{
return
$this
->
hasOne
(
FileMap
::
class
,
'id'
,
'cover_map_id'
);
}
}
app/Services/IssueService.php
View file @
5b44ba7
...
...
@@ -3,8 +3,10 @@
namespace
App\Services
;
use
App\Helper\AesEncrypt
;
use
App\Helper\CosHelper
;
use
App\Helper\ErrorCode
;
use
App\Helper\Response
;
use
App\Models\Legal\SongsApply
;
use
App\Models\Legal\Stakeholder
;
use
App\Models\Legal\Subject
;
use
Illuminate\Support\Facades\Log
;
...
...
@@ -69,7 +71,27 @@ class IssueService extends Service
->
get
([
'no as value'
,
'name'
]);
return
Response
::
success
(
$subject
);
}
/**
* 发行(上架成功记录)
* @return \Illuminate\Http\JsonResponse
*/
public
function
latestRecord
()
{
$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
);
$cos
=
new
CosHelper
(
env
(
'MATERIAL_BUCKET'
));
foreach
(
$res
as
&
$item
)
{
if
(
!
empty
(
$item
->
songs_album
))
{
$item
->
cover
=
$cos
->
getPreviewUrl
(
$item
->
songs_album
->
cover
->
key
);
}
}
return
Response
::
success
(
$res
);
}
...
...
Please
register
or
sign in
to post a comment