Commit e5f55e16 e5f55e161776d52fbeec4d5774bbf8db2452ea2a by lemon

*

1 parent 129aac98
......@@ -51,6 +51,7 @@ class AuthIdentifier
//通过身份证查询id
$stakeholder_ids = Stakeholder::stakeholderIds($identifier);
if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL);
$request->attributes->add([
......
......@@ -52,34 +52,6 @@ class MusicianAgreementService extends Service
{
$client = new CosHelper();
$treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['filesNew:id,key,link_id'])
->select(['id', 'treaty_no as no', 'treaty_type', 'treaty_name as name', 'effective_date', 'deadline_date as date_ending', 'cost_model', 'music_no', 's_rate', 'l_rate', 'c_rate', 'p_rate', 'cost', 'prepaid'])->get();
foreach ($treaty as &$item) {
$item->setAttribute('model', $item->charge_model);
$treaty_item = $item->toArray();
$files = [];
if (!empty($treaty_item['files_new'])) {
$files = array_column($treaty_item['files_new'], 'key');
}
foreach ($files as &$file) {
$file = $client->getPreviewUrl($file);
}
if ((time() >= strtotime($item->effective_date)) && (time() <= strtotime($item->date_ending))) {
//进行中
$item->setAttribute('status', 1);
} else {
//未生效 || 已经结束
$item->setAttribute('status', 0);
}
$item->setAttribute('type', 1); //经纪合约
$item->setAttribute('files', $files);
unset($item->filesNew);
}
//歌曲版权
$contract_table = Contract::table();
$contract = Contract::query()->with(['filesNew:id,key,link_id', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids)
......@@ -138,7 +110,7 @@ class MusicianAgreementService extends Service
unset($right_item['songs'], $right_item['right']);
}
$agreement = array_merge($treaty->toArray(), $rights);
$agreement = array_merge($rights);
//排序
usort($agreement, function ($a, $b) {
......
......@@ -25,6 +25,7 @@ class MusicianSongService extends Service
*/
public function releaseSong()
{
$song_ids = array_filter(array_unique(SongStakeholder::query()->identify()->pluck('song_id')->toArray()));
if (empty($song_ids)) return Response::success();
......