用户编辑
Showing
3 changed files
with
29 additions
and
7 deletions
... | @@ -266,6 +266,21 @@ class Contract extends BaseModel | ... | @@ -266,6 +266,21 @@ class Contract extends BaseModel |
266 | } | 266 | } |
267 | 267 | ||
268 | /** | 268 | /** |
269 | * @return false|string[] | ||
270 | */ | ||
271 | public function getServiceTypeNameAttribute() | ||
272 | { | ||
273 | $names = []; | ||
274 | $service_types = explode(',', $this->service_type); | ||
275 | foreach ($service_types as $val) { | ||
276 | $names[] = Treaty::$service_type[$val] ?? null; | ||
277 | } | ||
278 | |||
279 | return array_filter($names); | ||
280 | |||
281 | } | ||
282 | |||
283 | /** | ||
269 | * @return \Illuminate\Database\Eloquent\Relations\HasMany | 284 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
270 | */ | 285 | */ |
271 | public function files() | 286 | public function files() |
... | @@ -281,6 +296,14 @@ class Contract extends BaseModel | ... | @@ -281,6 +296,14 @@ class Contract extends BaseModel |
281 | return $this->hasMany(FileMap::class, 'link_id', 'id')->where('link', 'contract'); | 296 | return $this->hasMany(FileMap::class, 'link_id', 'id')->where('link', 'contract'); |
282 | } | 297 | } |
283 | 298 | ||
299 | /** | ||
300 | * @return \Illuminate\Database\Eloquent\Relations\HasMany | ||
301 | */ | ||
302 | public function filesNewTreaty() | ||
303 | { | ||
304 | return $this->hasMany(FileMap::class, 'link_id', 'id')->where('link', 'treaty'); | ||
305 | } | ||
306 | |||
284 | 307 | ||
285 | /** | 308 | /** |
286 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany | 309 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany | ... | ... |
... | @@ -20,22 +20,24 @@ class MusicianAgreementService extends Service | ... | @@ -20,22 +20,24 @@ 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(['filesNew:id,key,link_id']) | 23 | //->whereIn('stakeholder_id', $this->stakeholder_ids) |
24 | ->select(['id', 'treaty_name', 'treaty_type', 'service_type', 'deadline_date', 'music_no'])->orderByDesc('created_at')->paginate($this->pageSize); | 24 | $res = Contract::query()->where('flag', 3)->where('date_ending', '>', $this->now)->with(['filesNewTreaty:id,key,link_id']) |
25 | ->select(['id', 'name as treaty_name', 'treaty_type', 'service_types as service_type', 'date_ending as deadline_date', 'music_nums as music_no'])->orderByDesc('created_at')->paginate($this->pageSize); | ||
25 | 26 | ||
26 | $client = new CosHelper(); | 27 | $client = new CosHelper(); |
27 | 28 | ||
28 | foreach ($res as &$item) { | 29 | foreach ($res as &$item) { |
29 | $item_res = $item->toArray(); | 30 | $item_res = $item->toArray(); |
30 | $files = []; | 31 | $files = []; |
31 | if (!empty($item_res['files_new'])) { | 32 | if (!empty($item_res['files_new_treaty'])) { |
32 | $files = array_column($item_res['files_new'], 'key'); | 33 | $files = array_column($item_res['files_new_treaty'], 'key'); |
33 | } | 34 | } |
34 | 35 | ||
35 | foreach ($files as &$file) { | 36 | foreach ($files as &$file) { |
36 | $file = $client->getPreviewUrl($file); | 37 | $file = $client->getPreviewUrl($file); |
37 | } | 38 | } |
38 | 39 | ||
40 | $item->setAttribute('service_type', $item->service_type_name); | ||
39 | $item->setAttribute('files', $files); | 41 | $item->setAttribute('files', $files); |
40 | unset($item->filesNew); | 42 | unset($item->filesNew); |
41 | } | 43 | } | ... | ... |
... | @@ -37,12 +37,9 @@ Route::group([], function (){ | ... | @@ -37,12 +37,9 @@ Route::group([], function (){ |
37 | //钱包-账户详情 | 37 | //钱包-账户详情 |
38 | Route::get('musician_balance/account_detail', 'MusicianBalanceController@accountDetail'); | 38 | Route::get('musician_balance/account_detail', 'MusicianBalanceController@accountDetail'); |
39 | 39 | ||
40 | //提现发票抬头 - 通过公司中文 | ||
41 | Route::post('withdraw/receipt_by_name', 'MusicianWithdrawController@receiptByName'); | ||
42 | //提现发票抬头 - 通过账单流水号 | 40 | //提现发票抬头 - 通过账单流水号 |
43 | Route::post('withdraw/receipt_by_no', 'MusicianWithdrawController@receiptByNo'); | 41 | Route::post('withdraw/receipt_by_no', 'MusicianWithdrawController@receiptByNo'); |
44 | 42 | ||
45 | |||
46 | //账单状态修改 | 43 | //账单状态修改 |
47 | Route::post('withdraw/bill_confirm', 'MusicianWithdrawController@billConfirm'); | 44 | Route::post('withdraw/bill_confirm', 'MusicianWithdrawController@billConfirm'); |
48 | //账单状态修改 | 45 | //账单状态修改 | ... | ... |
-
Please register or sign in to post a comment