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
264c5439
...
264c5439acbd479d2248b054a4636912bc9cd7c5
authored
2022-04-15 15:42:34 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户编辑
1 parent
e5f55e16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
7 deletions
app/Models/Legal/Contract.php
app/Services/MusicianAgreementService.php
routes/api.php
app/Models/Legal/Contract.php
View file @
264c543
...
...
@@ -266,6 +266,21 @@ class Contract extends BaseModel
}
/**
* @return false|string[]
*/
public
function
getServiceTypeNameAttribute
()
{
$names
=
[];
$service_types
=
explode
(
','
,
$this
->
service_type
);
foreach
(
$service_types
as
$val
)
{
$names
[]
=
Treaty
::
$service_type
[
$val
]
??
null
;
}
return
array_filter
(
$names
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public
function
files
()
...
...
@@ -281,6 +296,14 @@ class Contract extends BaseModel
return
$this
->
hasMany
(
FileMap
::
class
,
'link_id'
,
'id'
)
->
where
(
'link'
,
'contract'
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public
function
filesNewTreaty
()
{
return
$this
->
hasMany
(
FileMap
::
class
,
'link_id'
,
'id'
)
->
where
(
'link'
,
'treaty'
);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
...
...
app/Services/MusicianAgreementService.php
View file @
264c543
...
...
@@ -20,22 +20,24 @@ class MusicianAgreementService extends Service
*/
public
function
treatyList
()
{
$res
=
Treaty
::
query
()
->
whereIn
(
'party_b'
,
$this
->
stakeholder_ids
)
->
where
(
'deadline_date'
,
'>'
,
$this
->
now
)
->
with
([
'filesNew:id,key,link_id'
])
->
select
([
'id'
,
'treaty_name'
,
'treaty_type'
,
'service_type'
,
'deadline_date'
,
'music_no'
])
->
orderByDesc
(
'created_at'
)
->
paginate
(
$this
->
pageSize
);
//->whereIn('stakeholder_id', $this->stakeholder_ids)
$res
=
Contract
::
query
()
->
where
(
'flag'
,
3
)
->
where
(
'date_ending'
,
'>'
,
$this
->
now
)
->
with
([
'filesNewTreaty:id,key,link_id'
])
->
select
([
'id'
,
'name as treaty_name'
,
'treaty_type'
,
'service_types as service_type'
,
'date_ending as deadline_date'
,
'music_nums as music_no'
])
->
orderByDesc
(
'created_at'
)
->
paginate
(
$this
->
pageSize
);
$client
=
new
CosHelper
();
foreach
(
$res
as
&
$item
)
{
$item_res
=
$item
->
toArray
();
$files
=
[];
if
(
!
empty
(
$item_res
[
'files_new'
]))
{
$files
=
array_column
(
$item_res
[
'files_new'
],
'key'
);
if
(
!
empty
(
$item_res
[
'files_new
_treaty
'
]))
{
$files
=
array_column
(
$item_res
[
'files_new
_treaty
'
],
'key'
);
}
foreach
(
$files
as
&
$file
)
{
$file
=
$client
->
getPreviewUrl
(
$file
);
}
$item
->
setAttribute
(
'service_type'
,
$item
->
service_type_name
);
$item
->
setAttribute
(
'files'
,
$files
);
unset
(
$item
->
filesNew
);
}
...
...
routes/api.php
View file @
264c543
...
...
@@ -37,12 +37,9 @@ Route::group([], function (){
//钱包-账户详情
Route
::
get
(
'musician_balance/account_detail'
,
'MusicianBalanceController@accountDetail'
);
//提现发票抬头 - 通过公司中文
Route
::
post
(
'withdraw/receipt_by_name'
,
'MusicianWithdrawController@receiptByName'
);
//提现发票抬头 - 通过账单流水号
Route
::
post
(
'withdraw/receipt_by_no'
,
'MusicianWithdrawController@receiptByNo'
);
//账单状态修改
Route
::
post
(
'withdraw/bill_confirm'
,
'MusicianWithdrawController@billConfirm'
);
//账单状态修改
...
...
Please
register
or
sign in
to post a comment