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
fc3bcf49
...
fc3bcf49f8025d10c634ba41ada2eea0ad13d63d
authored
2021-08-23 11:38:20 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
*
1 parent
c28dab40
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
3 deletions
app/Models/BaseModel.php
app/Models/Legal/Song.php
app/Models/Legal/SongsIpExts.php
app/Services/MusicianSongService.php
app/Services/MusicianWithdrawService.php
app/Models/BaseModel.php
View file @
fc3bcf4
...
...
@@ -2,6 +2,7 @@
namespace
App\Models
;
use
DateTimeInterface
;
use
Illuminate\Database\Eloquent\Builder
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
...
...
@@ -14,6 +15,11 @@ class BaseModel extends Model
{
use
HasFactory
;
public
function
serializeDate
(
DateTimeInterface
$date
)
{
return
$date
->
format
(
'Y-m-d H:i:s'
);
}
/**
* @return string
*/
...
...
app/Models/Legal/Song.php
View file @
fc3bcf4
...
...
@@ -29,4 +29,5 @@ class Song extends BaseModel
{
return
$this
->
hasOne
(
SongFile
::
class
,
'song_id'
)
->
where
(
'type'
,
4
);
}
}
...
...
app/Models/Legal/SongsIpExts.php
0 → 100644
View file @
fc3bcf4
<?php
namespace
App\Models\Legal
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
/**
* Class SongsIpExts
* @package App\Models\Legal
*/
class
SongsIpExts
extends
BaseModel
{
use
HasFactory
;
public
$table
=
'songs_ip_exts'
;
}
app/Services/MusicianSongService.php
View file @
fc3bcf4
...
...
@@ -7,6 +7,7 @@ use App\Helper\Response;
use
App\Models\Legal\Contract
;
use
App\Models\Legal\Song
;
use
App\Models\Legal\SongsIp
;
use
App\Models\Legal\SongsIpExts
;
use
App\Models\Legal\SongStakeholder
;
use
App\Models\Legal\StakeholderSongCollate
;
use
Carbon\Carbon
;
...
...
@@ -31,9 +32,14 @@ class MusicianSongService extends Service
$songip_table
=
SongsIp
::
table
();
$res
=
Song
::
query
()
->
join
(
$songip_table
,
"
{
$song_table
}
.id"
,
'='
,
"
{
$songip_table
}
.song_id"
)
->
with
([
'contractDetail'
,
'coverResource'
])
->
whereIn
(
"
{
$songip_table
}
.song_id"
,
$song_ids
)
->
select
([
"
{
$song_table
}
.id"
,
'publish_song'
])
->
with
([
'contractDetail'
,
'coverResource'
])
->
whereIn
(
"
{
$songip_table
}
.song_id"
,
$song_ids
)
->
select
([
"
{
$song_table
}
.id"
,
"
{
$songip_table
}
.id as sp_id"
,
'publish_song'
])
->
groupBy
([
"song_id"
])
->
paginate
(
$this
->
pageSize
);
$sp_exts
=
[];
if
(
$sp_ids
=
array_column
(
$res
->
items
(),
'sp_id'
))
{
$sp_exts
=
SongsIpExts
::
query
()
->
whereIn
(
'song_ip_id'
,
$sp_ids
)
->
get
()
->
keyBy
(
'song_ip_id'
);
}
foreach
(
$res
as
&
$item
)
{
list
(
$name
,
$singer
)
=
explode
(
'|'
,
$item
->
publish_song
);
...
...
@@ -41,6 +47,7 @@ class MusicianSongService extends Service
$item
->
setAttribute
(
'name'
,
$name
);
$item
->
setAttribute
(
'singer'
,
$singer
);
$item
->
setAttribute
(
'cover'
,
empty
(
$item
->
coverResource
)
?
''
:
$item
->
coverResource
->
url
);
$item
->
setAttribute
(
'ext'
,
$sp_exts
[
$item
->
sp_id
]
??
[]);
$tmp
=
$item
->
toArray
();
if
(
empty
(
$tmp
[
'contract_detail'
]))
{
...
...
app/Services/MusicianWithdrawService.php
View file @
fc3bcf4
...
...
@@ -2,7 +2,6 @@
namespace
App\Services
;
use
App\Helper\Response
;
use
App\Models\Legal\StakeholderIncomeByPayer
;
...
...
@@ -60,7 +59,6 @@ class MusicianWithdrawService extends Service
break
;
}
if
(
StakeholderIncomeByPayer
::
query
()
->
whereIn
(
'serial_no'
,
$this
->
request
->
input
(
'serial_no'
))
->
update
([
'withdraw_status'
=>
$withdraw_status
,
]))
{
...
...
@@ -69,4 +67,7 @@ class MusicianWithdrawService extends Service
return
Response
::
error
();
}
}
}
...
...
Please
register
or
sign in
to post a comment