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
7d117511
...
7d117511057af6fd2266d5b1f8d06f95bc38d8ef
authored
2021-07-19 11:14:11 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(*
1 parent
7dca7a31
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
app/Models/Legal/Song.php
app/Models/Legal/SongFile.php
app/Services/MusicianSongService.php
app/Models/Legal/Song.php
View file @
7d11751
...
...
@@ -20,4 +20,12 @@ class Song extends BaseModel
{
return
$this
->
belongsToMany
(
ContractDetail
::
class
,
'contract_song'
,
'song_id'
,
'contract_detail_id'
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public
function
cover
()
{
return
$this
->
hasOne
(
SongFile
::
class
,
'song_id'
)
->
where
(
'type'
,
4
);
}
}
...
...
app/Models/Legal/SongFile.php
0 → 100644
View file @
7d11751
<?php
namespace
App\Models\Legal
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
/**
* Class SongFile
* @package App\Models\Legal
*/
class
SongFile
extends
BaseModel
{
use
HasFactory
;
}
app/Services/MusicianSongService.php
View file @
7d11751
...
...
@@ -32,7 +32,7 @@ class MusicianSongService extends Service
$res
=
Song
::
query
()
->
join
(
$songip_table
,
"
{
$song_table
}
.id"
,
'='
,
"
{
$songip_table
}
.song_id"
)
->
with
(
'contractDetail'
)
->
whereIn
(
"
{
$songip_table
}
.song_id"
,
$song_ids
)
->
select
([
"
{
$song_table
}
.id"
,
'publish_song'
])
->
with
(
[
'contractDetail'
,
'cover'
]
)
->
whereIn
(
"
{
$songip_table
}
.song_id"
,
$song_ids
)
->
select
([
"
{
$song_table
}
.id"
,
'publish_song'
])
->
groupBy
([
"song_id"
])
->
paginate
(
$this
->
pageSize
);
foreach
(
$res
as
&
$item
)
{
...
...
@@ -40,7 +40,7 @@ class MusicianSongService extends Service
$item
->
setAttribute
(
'name'
,
$name
);
$item
->
setAttribute
(
'singer'
,
$singer
);
$item
->
setAttribute
(
'cover'
,
''
);
$item
->
setAttribute
(
'cover'
,
$item
->
cover
->
url
?:
''
);
$tmp
=
$item
->
toArray
();
if
(
empty
(
$tmp
[
'contract_detail'
]))
{
...
...
Please
register
or
sign in
to post a comment