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
af4b5f2b
...
af4b5f2b047a81911a70e083f0854d153029dcf7
authored
2023-01-09 10:34:42 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
处理数据
2 parents
f49e83f5
82af5d3c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
1 deletions
app/Http/Controllers/Musician/IssueController.php
app/Models/Legal/SongsApply.php
app/Models/Legal/SongsIssueAlbum.php
app/Services/IssueService.php
routes/api.php
app/Http/Controllers/Musician/IssueController.php
View file @
af4b5f2
...
...
@@ -48,4 +48,13 @@ class IssueController extends Controller
return
$this
->
issueService
->
subCompany
();
}
/**
* 最新发行记录
* @return \Illuminate\Http\JsonResponse
*/
public
function
latestOnlineRecord
()
{
return
$this
->
issueService
->
latestOnlineRecord
();
}
}
...
...
app/Models/Legal/SongsApply.php
0 → 100644
View file @
af4b5f2
<?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'
);
}
}
app/Models/Legal/SongsIssueAlbum.php
0 → 100644
View file @
af4b5f2
<?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 @
af4b5f2
...
...
@@ -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,30 @@ class IssueService extends Service
->
get
([
'no as value'
,
'name'
]);
return
Response
::
success
(
$subject
);
}
/**
* 发行(上架成功记录)
* @return \Illuminate\Http\JsonResponse
*/
public
function
latestOnlineRecord
()
{
$res
=
SongsApply
::
query
()
->
where
([
'from'
=>
1
,
'user_id'
=>
$this
->
request
->
get
(
'identifier'
)
->
company_id
])
->
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
->
cover
))
{
$item
->
cover
=
$cos
->
getPreviewUrl
(
$item
->
songs_album
->
cover
->
key
);
}
unset
(
$item
->
songs_album
);
$item
->
singer
=
explode
(
','
,
$item
->
singer
);
}
return
Response
::
success
(
$res
);
}
...
...
routes/api.php
View file @
af4b5f2
...
...
@@ -53,7 +53,8 @@ Route::group([], function (){
//发行
Route
::
group
([
"prefix"
=>
"issue"
],
function
(){
Route
::
post
(
'/album/subCompany'
,
'IssueController@subCompany'
);
Route
::
any
(
'{uri}'
,
'IssueController@index'
)
->
where
([
'uri'
=>
'.*+'
]);
Route
::
get
(
'/song/latestOnlineRecord'
,
'IssueController@latestOnlineRecord'
);
Route
::
post
(
'{uri}'
,
'IssueController@index'
)
->
where
([
'uri'
=>
'.*+'
]);
});
//api-v2
...
...
Please
register
or
sign in
to post a comment