Commit def13a22 def13a2290adecb8e660cf59bf14395f6986f9c0 by lemon

合同文件

1 parent 6d771020
...@@ -22,9 +22,9 @@ class Treaty extends BaseModel ...@@ -22,9 +22,9 @@ class Treaty extends BaseModel
22 /** 22 /**
23 * @return \Illuminate\Database\Eloquent\Relations\HasMany 23 * @return \Illuminate\Database\Eloquent\Relations\HasMany
24 */ 24 */
25 public function file() 25 public function filesNew()
26 { 26 {
27 return $this->hasMany(TreatyFile::class, 'treaty_id'); 27 return $this->hasMany(FileMap::class, 'link_id', 'id')->where('link', 'treaty');
28 } 28 }
29 29
30 /** 30 /**
......
...@@ -20,7 +20,7 @@ class MusicianAgreementService extends Service ...@@ -20,7 +20,7 @@ class MusicianAgreementService extends Service
20 */ 20 */
21 public function treatyList() 21 public function treatyList()
22 { 22 {
23 $res = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->where('deadline_date', '>', $this->now)->with(['file:id,treaty_id,file_id', 'file.fileInfo:id,key']) 23 $res = Treaty::query()->whereIn('party_b', $this->stakeholder_ids)->where('deadline_date', '>', $this->now)->with(['filesNew:id,key,link_id'])
24 ->select(['id', 'treaty_name', 'treaty_type', 'service_type', 'deadline_date', 'music_no'])->orderByDesc('created_at')->paginate($this->pageSize); 24 ->select(['id', 'treaty_name', 'treaty_type', 'service_type', 'deadline_date', 'music_no'])->orderByDesc('created_at')->paginate($this->pageSize);
25 25
26 $client = new CosHelper(); 26 $client = new CosHelper();
...@@ -28,9 +28,9 @@ class MusicianAgreementService extends Service ...@@ -28,9 +28,9 @@ class MusicianAgreementService extends Service
28 foreach ($res as &$item) { 28 foreach ($res as &$item) {
29 $item_res = $item->toArray(); 29 $item_res = $item->toArray();
30 $files = []; 30 $files = [];
31 if (!empty($item_res['file'])) { 31 if (!empty($item_res['files_new'])) {
32 foreach ($item_res['file'] as $file_item) { 32 foreach ($item_res['files_new'] as $file_item) {
33 !empty($file_item['file_info']['key']) && $files[] = $file_item['file_info']['key']; 33 !empty($file_item['key']) && $files[] = $file_item['key'];
34 } 34 }
35 } 35 }
36 36
......