MusicianWithdrawService.php
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace App\Services;
use App\Helper\Response;
use App\Models\Legal\StakeholderIncomeByPayer;
/**
* Class MusicianAgreementService
* @package App\Services
*/
class MusicianWithdrawService extends Service
{
/**
* 发票信息
* @return \Illuminate\Http\JsonResponse
*/
public function receiptInfo()
{
$receipt = [];
StakeholderIncomeByPayer::query()->with('company:company_id,receipt_name,receipt_no,receipt_tel,receipt_address,receipt_bank,receipt_bank_no')
->whereIn('serial_no', $this->request->input('serial_no'))->get()->map(function ($item) use (&$receipt) {
if (!empty($item->company)) {
$receipt[$item->company_id] = [
'receipt_name'=>$item->company->receipt_name,
'receipt_no' =>$item->company->receipt_no,
'receipt_tel' =>$item->company->receipt_tel,
'receipt_address'=>$item->company->receipt_address,
'receipt_bank'=>$item->company->receipt_bank,
'receipt_bank_no'=>$item->company->receipt_bank_no,
];
}
return $receipt;
});
return Response::success($receipt);
}
/**
* 修改提现状态
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function changeStatus()
{
$withdraw_status = '';
switch ($this->request->input('type')) {
case 'fail':
$withdraw_status = 0;
break;
case 'advance':
$withdraw_status = 1;
break;
case 'success':
$withdraw_status = 2;
break;
}
if (StakeholderIncomeByPayer::query()->whereIn('serial_no', $this->request->input('serial_no'))->update([
'withdraw_status'=>$withdraw_status,
])) {
return Response::success();
} else {
return Response::error();
}
}
}