Commit e325b426 e325b426f0914006657b5347e09fb61d0ebc6557 by lemon

合约地址

1 parent dc59533e
...@@ -52,7 +52,9 @@ class MusicianAgreementService extends Service ...@@ -52,7 +52,9 @@ class MusicianAgreementService extends Service
52 */ 52 */
53 public function agreementList() 53 public function agreementList()
54 { 54 {
55 $treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,location']) 55 $client = new CosHelper();
56
57 $treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,key'])
56 ->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(); 58 ->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();
57 59
58 foreach ($treaty as &$item) { 60 foreach ($treaty as &$item) {
...@@ -61,10 +63,14 @@ class MusicianAgreementService extends Service ...@@ -61,10 +63,14 @@ class MusicianAgreementService extends Service
61 $files = []; 63 $files = [];
62 if (!empty($treaty_item['file'])) { 64 if (!empty($treaty_item['file'])) {
63 if ($file_info = array_column($treaty_item['file'], 'file_info')){ 65 if ($file_info = array_column($treaty_item['file'], 'file_info')){
64 $files = array_column($file_info, 'location'); 66 $files = array_column($file_info, 'key');
65 } 67 }
66 } 68 }
67 69
70 foreach ($files as &$file) {
71 $file = $client->getPreviewUrl($file);
72 }
73
68 if ((time() >= strtotime($item->effective_date)) && (time() <= strtotime($item->date_ending))) { 74 if ((time() >= strtotime($item->effective_date)) && (time() <= strtotime($item->date_ending))) {
69 //进行中 75 //进行中
70 $item->setAttribute('status', 1); 76 $item->setAttribute('status', 1);
...@@ -80,7 +86,7 @@ class MusicianAgreementService extends Service ...@@ -80,7 +86,7 @@ class MusicianAgreementService extends Service
80 86
81 //歌曲版权 87 //歌曲版权
82 $contract_table = Contract::table(); 88 $contract_table = Contract::table();
83 $contract = Contract::query()->with(['files', 'files.fileInfo:id,location', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids) 89 $contract = Contract::query()->with(['files', 'files.fileInfo:id,key', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids)
84 ->join(StakeholderContract::table()." as sc", Contract::table().".id", '=', 'sc.contract_id') 90 ->join(StakeholderContract::table()." as sc", Contract::table().".id", '=', 'sc.contract_id')
85 ->select(["{$contract_table}.id", 'contract_no', 'name', 'right_type', 'proportion', 'date_signing', 'date_starting', 'date_ending', 'cooperation_type', 'prepaid_money', 'reward_money'])->get()->toArray(); 91 ->select(["{$contract_table}.id", 'contract_no', 'name', 'right_type', 'proportion', 'date_signing', 'date_starting', 'date_ending', 'cooperation_type', 'prepaid_money', 'reward_money'])->get()->toArray();
86 92
...@@ -89,10 +95,14 @@ class MusicianAgreementService extends Service ...@@ -89,10 +95,14 @@ class MusicianAgreementService extends Service
89 $files = []; 95 $files = [];
90 if (!empty($contract_item['files'])) { 96 if (!empty($contract_item['files'])) {
91 if ($file_info = array_column($contract_item['files'], 'file_info')){ 97 if ($file_info = array_column($contract_item['files'], 'file_info')){
92 $files = array_column($file_info, 'location'); 98 $files = array_column($file_info, 'key');
93 } 99 }
94 } 100 }
95 101
102 foreach ($files as &$file) {
103 $file = $client->getPreviewUrl($file);
104 }
105
96 if (!isset($rights[$contract_item['id']])) { 106 if (!isset($rights[$contract_item['id']])) {
97 $rights[$contract_item['id']] = [ 107 $rights[$contract_item['id']] = [
98 'id'=>$contract_item['id'], 108 'id'=>$contract_item['id'],
......