Commit e325b426 e325b426f0914006657b5347e09fb61d0ebc6557 by lemon

合约地址

1 parent dc59533e
......@@ -52,7 +52,9 @@ class MusicianAgreementService extends Service
*/
public function agreementList()
{
$treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,location'])
$client = new CosHelper();
$treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,key'])
->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) {
......@@ -61,8 +63,12 @@ class MusicianAgreementService extends Service
$files = [];
if (!empty($treaty_item['file'])) {
if ($file_info = array_column($treaty_item['file'], 'file_info')){
$files = array_column($file_info, 'location');
$files = array_column($file_info, 'key');
}
}
foreach ($files as &$file) {
$file = $client->getPreviewUrl($file);
}
if ((time() >= strtotime($item->effective_date)) && (time() <= strtotime($item->date_ending))) {
......@@ -80,7 +86,7 @@ class MusicianAgreementService extends Service
//歌曲版权
$contract_table = Contract::table();
$contract = Contract::query()->with(['files', 'files.fileInfo:id,location', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids)
$contract = Contract::query()->with(['files', 'files.fileInfo:id,key', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids)
->join(StakeholderContract::table()." as sc", Contract::table().".id", '=', 'sc.contract_id')
->select(["{$contract_table}.id", 'contract_no', 'name', 'right_type', 'proportion', 'date_signing', 'date_starting', 'date_ending', 'cooperation_type', 'prepaid_money', 'reward_money'])->get()->toArray();
......@@ -89,8 +95,12 @@ class MusicianAgreementService extends Service
$files = [];
if (!empty($contract_item['files'])) {
if ($file_info = array_column($contract_item['files'], 'file_info')){
$files = array_column($file_info, 'location');
$files = array_column($file_info, 'key');
}
}
foreach ($files as &$file) {
$file = $client->getPreviewUrl($file);
}
if (!isset($rights[$contract_item['id']])) {
......