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
efa0dbcd
...
efa0dbcd559ff18e06341b8cd8d40fd32a1909a6
authored
2021-08-06 16:57:42 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
*
1 parent
df356054
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
app/Services/MusicianIncomeService.php
app/Services/MusicianIncomeService.php
View file @
efa0dbc
...
...
@@ -18,20 +18,33 @@ class MusicianIncomeService extends Service
*/
public
function
income
()
{
$start_month
=
$this
->
request
->
input
(
'start'
,
date
(
'Ym'
,
strtotime
(
'-6 month'
))
);
$end_month
=
$this
->
request
->
input
(
'end'
,
date
(
'Ym'
,
strtotime
(
'-1 month'
))
);
$start_month
=
$this
->
request
->
input
(
'start'
);
$end_month
=
$this
->
request
->
input
(
'end'
);
$res
=
StakeholderSongCollate
::
query
()
->
custom
(
$this
->
request
->
only
([
'song_id'
]))
->
identify
()
->
groupBy
(
'month'
)
->
orderBy
(
'month'
)
->
selectRaw
(
'month, sum(share_amount) as income'
)
->
get
()
->
toArray
();
->
groupBy
(
'month'
)
->
orderBy
(
'month'
)
->
selectRaw
(
'month, sum(share_amount) as income'
)
->
get
()
->
toArray
();
$stat_income
=
[];
$total_income
=
'0'
;
foreach
(
$res
as
$item
)
{
if
(
$item
[
'month'
]
>=
$start_month
&&
$item
[
'month'
]
<=
$end_month
)
{
$stat_income
[]
=
$item
;
if
(
empty
(
$start_month
)
||
empty
(
$end_month
))
{
if
(
count
(
$stat_income
)
<
7
)
{
$stat_income
[]
=
$item
;
continue
;
}
break
;
}
else
{
if
(
$item
[
'month'
]
>=
$start_month
&&
$item
[
'month'
]
<=
$end_month
)
{
$stat_income
[]
=
$item
;
}
}
$total_income
=
bcadd
(
$total_income
,
$item
->
income
,
self
::
DECIMAL
);
}
return
Response
::
success
(
$stat_income
);
return
Response
::
success
(
[
'list'
=>
$stat_income
,
'total_income'
=>
$total_income
]
);
}
/**
...
...
Please
register
or
sign in
to post a comment