Commit e5f55e16 e5f55e161776d52fbeec4d5774bbf8db2452ea2a by lemon

*

1 parent 129aac98
...@@ -51,6 +51,7 @@ class AuthIdentifier ...@@ -51,6 +51,7 @@ class AuthIdentifier
51 51
52 //通过身份证查询id 52 //通过身份证查询id
53 $stakeholder_ids = Stakeholder::stakeholderIds($identifier); 53 $stakeholder_ids = Stakeholder::stakeholderIds($identifier);
54
54 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL); 55 if (empty($stakeholder_ids)) return Response::error(ErrorCode::MATCH_IDENTIFIER_FAIL);
55 56
56 $request->attributes->add([ 57 $request->attributes->add([
......
...@@ -52,34 +52,6 @@ class MusicianAgreementService extends Service ...@@ -52,34 +52,6 @@ class MusicianAgreementService extends Service
52 { 52 {
53 $client = new CosHelper(); 53 $client = new CosHelper();
54 54
55 $treaty = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->with(['filesNew:id,key,link_id'])
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();
57
58 foreach ($treaty as &$item) {
59 $item->setAttribute('model', $item->charge_model);
60 $treaty_item = $item->toArray();
61 $files = [];
62 if (!empty($treaty_item['files_new'])) {
63 $files = array_column($treaty_item['files_new'], 'key');
64 }
65
66 foreach ($files as &$file) {
67 $file = $client->getPreviewUrl($file);
68 }
69
70 if ((time() >= strtotime($item->effective_date)) && (time() <= strtotime($item->date_ending))) {
71 //进行中
72 $item->setAttribute('status', 1);
73 } else {
74 //未生效 || 已经结束
75 $item->setAttribute('status', 0);
76 }
77
78 $item->setAttribute('type', 1); //经纪合约
79 $item->setAttribute('files', $files);
80 unset($item->filesNew);
81 }
82
83 //歌曲版权 55 //歌曲版权
84 $contract_table = Contract::table(); 56 $contract_table = Contract::table();
85 $contract = Contract::query()->with(['filesNew:id,key,link_id', 'moreSongs'])->where(['flag'=>1])->whereIn('sc.stakeholder_id', $this->stakeholder_ids) 57 $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 ...@@ -138,7 +110,7 @@ class MusicianAgreementService extends Service
138 unset($right_item['songs'], $right_item['right']); 110 unset($right_item['songs'], $right_item['right']);
139 } 111 }
140 112
141 $agreement = array_merge($treaty->toArray(), $rights); 113 $agreement = array_merge($rights);
142 114
143 //排序 115 //排序
144 usort($agreement, function ($a, $b) { 116 usort($agreement, function ($a, $b) {
......
...@@ -25,6 +25,7 @@ class MusicianSongService extends Service ...@@ -25,6 +25,7 @@ class MusicianSongService extends Service
25 */ 25 */
26 public function releaseSong() 26 public function releaseSong()
27 { 27 {
28
28 $song_ids = array_filter(array_unique(SongStakeholder::query()->identify()->pluck('song_id')->toArray())); 29 $song_ids = array_filter(array_unique(SongStakeholder::query()->identify()->pluck('song_id')->toArray()));
29 30
30 if (empty($song_ids)) return Response::success(); 31 if (empty($song_ids)) return Response::success();
......