合同文件
Showing
2 changed files
with
12 additions
and
5 deletions
| ... | @@ -274,6 +274,15 @@ class Contract extends BaseModel | ... | @@ -274,6 +274,15 @@ class Contract extends BaseModel |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | /** | 276 | /** |
| 277 | * @return \Illuminate\Database\Eloquent\Relations\HasMany | ||
| 278 | */ | ||
| 279 | public function filesNew() | ||
| 280 | { | ||
| 281 | return $this->hasMany(FileMap::class, 'link_id', 'id')->where('link', 'contract'); | ||
| 282 | } | ||
| 283 | |||
| 284 | |||
| 285 | /** | ||
| 277 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany | 286 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
| 278 | */ | 287 | */ |
| 279 | public function moreSongs() | 288 | public function moreSongs() | ... | ... |
| ... | @@ -205,7 +205,7 @@ class MusicianSongService extends Service | ... | @@ -205,7 +205,7 @@ class MusicianSongService extends Service |
| 205 | $client = new CosHelper(); | 205 | $client = new CosHelper(); |
| 206 | 206 | ||
| 207 | $res = SongStakeholder::query()->where('song_id', $song_id)->identify() | 207 | $res = SongStakeholder::query()->where('song_id', $song_id)->identify() |
| 208 | ->with(['contract:id,cooperation_type,date_starting,date_ending,district_id,is_exclusive', 'contract.stakeholderContract', 'contract.files', 'contract.files.fileInfo:id,key']) | 208 | ->with(['contract:id,cooperation_type,date_starting,date_ending,district_id,is_exclusive', 'contract.stakeholderContract', 'contract.filesNew:id,key,link_id']) |
| 209 | ->get()->toArray(); | 209 | ->get()->toArray(); |
| 210 | 210 | ||
| 211 | $contracts = []; | 211 | $contracts = []; |
| ... | @@ -216,10 +216,8 @@ class MusicianSongService extends Service | ... | @@ -216,10 +216,8 @@ class MusicianSongService extends Service |
| 216 | 216 | ||
| 217 | $files = []; | 217 | $files = []; |
| 218 | 218 | ||
| 219 | if (!empty($item['contract']['files'])) { | 219 | if (!empty($item['contract']['files_new'])) { |
| 220 | if ($file_info = array_column($item['contract']['files'], 'file_info')){ | 220 | $files = array_column($item['contract']['files_new'], 'key'); |
| 221 | $files = array_column($file_info, 'key'); | ||
| 222 | } | ||
| 223 | } | 221 | } |
| 224 | 222 | ||
| 225 | foreach ($files as &$file) { | 223 | foreach ($files as &$file) { | ... | ... |
-
Please register or sign in to post a comment