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
93fe78ba
...
93fe78ba0c69bbcdded30a18f43db3f014993e0d
authored
2021-09-18 12:12:48 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
发行作品
1 parent
3964663d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
0 deletions
app/Http/Controllers/Common/ReleaseSongController.php
app/Http/Controllers/Musician/MusicianSongController.php
app/Models/Legal/SongsIp.php
app/Providers/RouteServiceProvider.php
app/Services/ReleaseSongService.php
routes/common.php
app/Http/Controllers/Common/ReleaseSongController.php
0 → 100644
View file @
93fe78b
<?php
namespace
App\Http\Controllers\Common
;
use
App\Http\Controllers\Controller
;
use
App\Services\ReleaseSongService
;
/**
* Class ReleaseSongController
* @package App\Http\Controllers\Musician
*/
class
ReleaseSongController
extends
Controller
{
/**
* @var ReleaseSongService
*/
protected
$releaseSongService
;
/**
* ReleaseSongController constructor.
* @param ReleaseSongService $releaseSongService
*/
public
function
__construct
(
ReleaseSongService
$releaseSongService
)
{
$this
->
releaseSongService
=
$releaseSongService
;
}
/**
* 授权歌曲列表
* @return \Illuminate\Http\JsonResponse
*/
public
function
list
()
{
return
$this
->
releaseSongService
->
releaseSong
();
}
}
app/Http/Controllers/Musician/MusicianSongController.php
View file @
93fe78b
...
...
@@ -53,4 +53,5 @@ class MusicianSongController extends Controller
{
return
$this
->
musicianSongService
->
right
(
$song_id
);
}
}
...
...
app/Models/Legal/SongsIp.php
View file @
93fe78b
...
...
@@ -26,4 +26,12 @@ class SongsIp extends BaseModel
{
return
$this
->
belongsTo
(
Contract
::
class
,
'contract_id'
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public
function
songsIpExt
()
{
return
$this
->
hasOne
(
SongsIpExts
::
class
,
'song_ip_id'
);
}
}
...
...
app/Providers/RouteServiceProvider.php
View file @
93fe78b
...
...
@@ -38,11 +38,18 @@ class RouteServiceProvider extends ServiceProvider
$this
->
configureRateLimiting
();
$this
->
routes
(
function
()
{
//需授权
Route
::
prefix
(
'api'
)
->
middleware
(
'api'
)
->
namespace
(
$this
->
namespace
.
'\Musician'
)
->
group
(
base_path
(
'routes/api.php'
));
//公用
Route
::
prefix
(
'api'
)
->
middleware
(
'api'
)
->
namespace
(
$this
->
namespace
.
'\Common'
)
->
group
(
base_path
(
'routes/common.php'
));
Route
::
prefix
(
'admin'
)
->
middleware
(
'api'
)
->
namespace
(
$this
->
namespace
.
'\Admin'
)
...
...
app/Services/ReleaseSongService.php
0 → 100644
View file @
93fe78b
<?php
namespace
App\Services
;
use
App\Helper\Response
;
use
App\Models\Legal\SongsIp
;
/**
* Class ReleaseSongService
* @package App\Services
*/
class
ReleaseSongService
extends
Service
{
/**
* 最新的发行作品
* @return \Illuminate\Http\JsonResponse
*/
public
function
releaseSong
()
{
$res
=
SongsIp
::
query
()
->
with
(
'songsIpExt'
)
->
select
([
'id'
,
'song_id'
,
'name'
,
'singer'
,
'online_time'
])
->
orderByDesc
(
'online_time'
)
->
paginate
(
$this
->
pageSize
);
return
Response
::
success
(
$res
);
}
}
routes/common.php
0 → 100644
View file @
93fe78b
<?php
use
Illuminate\Support\Facades\Route
;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route
::
group
([],
function
(){
//首页-最新发行作品
Route
::
get
(
'release_song'
,
'ReleaseSongController@list'
);
});
Please
register
or
sign in
to post a comment