合同文件
Showing
1 changed file
with
9 additions
and
15 deletions
... | @@ -29,9 +29,7 @@ class MusicianAgreementService extends Service | ... | @@ -29,9 +29,7 @@ class MusicianAgreementService extends Service |
29 | $item_res = $item->toArray(); | 29 | $item_res = $item->toArray(); |
30 | $files = []; | 30 | $files = []; |
31 | if (!empty($item_res['files_new'])) { | 31 | if (!empty($item_res['files_new'])) { |
32 | foreach ($item_res['files_new'] as $file_item) { | 32 | $files = array_column($item_res['files_new'], 'key'); |
33 | !empty($file_item['key']) && $files[] = $file_item['key']; | ||
34 | } | ||
35 | } | 33 | } |
36 | 34 | ||
37 | foreach ($files as &$file) { | 35 | foreach ($files as &$file) { |
... | @@ -39,7 +37,7 @@ class MusicianAgreementService extends Service | ... | @@ -39,7 +37,7 @@ class MusicianAgreementService extends Service |
39 | } | 37 | } |
40 | 38 | ||
41 | $item->setAttribute('files', $files); | 39 | $item->setAttribute('files', $files); |
42 | unset($item->file); | 40 | unset($item->filesNew); |
43 | } | 41 | } |
44 | 42 | ||
45 | return Response::success($res); | 43 | return Response::success($res); |
... | @@ -54,17 +52,15 @@ class MusicianAgreementService extends Service | ... | @@ -54,17 +52,15 @@ class MusicianAgreementService extends Service |
54 | { | 52 | { |
55 | $client = new CosHelper(); | 53 | $client = new CosHelper(); |
56 | 54 | ||
57 | $treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,key']) | 55 | $treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['filesNew:id,key,link_id']) |
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(); | 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(); |
59 | 57 | ||
60 | foreach ($treaty as &$item) { | 58 | foreach ($treaty as &$item) { |
61 | $item->setAttribute('model', $item->charge_model); | 59 | $item->setAttribute('model', $item->charge_model); |
62 | $treaty_item = $item->toArray(); | 60 | $treaty_item = $item->toArray(); |
63 | $files = []; | 61 | $files = []; |
64 | if (!empty($treaty_item['file'])) { | 62 | if (!empty($treaty_item['files_new'])) { |
65 | if ($file_info = array_column($treaty_item['file'], 'file_info')){ | 63 | $files = array_column($treaty_item['files_new'], 'key'); |
66 | $files = array_column($file_info, 'key'); | ||
67 | } | ||
68 | } | 64 | } |
69 | 65 | ||
70 | foreach ($files as &$file) { | 66 | foreach ($files as &$file) { |
... | @@ -81,22 +77,20 @@ class MusicianAgreementService extends Service | ... | @@ -81,22 +77,20 @@ class MusicianAgreementService extends Service |
81 | 77 | ||
82 | $item->setAttribute('type', 1); //经纪合约 | 78 | $item->setAttribute('type', 1); //经纪合约 |
83 | $item->setAttribute('files', $files); | 79 | $item->setAttribute('files', $files); |
84 | unset($item->file); | 80 | unset($item->filesNew); |
85 | } | 81 | } |
86 | 82 | ||
87 | //歌曲版权 | 83 | //歌曲版权 |
88 | $contract_table = Contract::table(); | 84 | $contract_table = Contract::table(); |
89 | $contract = Contract::query()->with(['files', 'files.fileInfo:id,key', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids) | 85 | $contract = Contract::query()->with(['filesNew:id,key,link_id', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids) |
90 | ->join(StakeholderContract::table()." as sc", Contract::table().".id", '=', 'sc.contract_id') | 86 | ->join(StakeholderContract::table()." as sc", Contract::table().".id", '=', 'sc.contract_id') |
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(); | 87 | ->select(["{$contract_table}.id", 'contract_no', 'name', 'right_type', 'proportion', 'date_signing', 'date_starting', 'date_ending', 'cooperation_type', 'prepaid_money', 'reward_money'])->get()->toArray(); |
92 | 88 | ||
93 | $rights = []; | 89 | $rights = []; |
94 | foreach ($contract as $contract_item) { | 90 | foreach ($contract as $contract_item) { |
95 | $files = []; | 91 | $files = []; |
96 | if (!empty($contract_item['files'])) { | 92 | if (!empty($contract_item['files_new'])) { |
97 | if ($file_info = array_column($contract_item['files'], 'file_info')){ | 93 | $files = array_column($contract_item['files_new'], 'key'); |
98 | $files = array_column($file_info, 'key'); | ||
99 | } | ||
100 | } | 94 | } |
101 | 95 | ||
102 | foreach ($files as &$file) { | 96 | foreach ($files as &$file) { | ... | ... |
-
Please register or sign in to post a comment