*
Showing
5 changed files
with
127 additions
and
1 deletions
1 | <?php | ||
2 | |||
3 | namespace App\Http\Controllers\Admin; | ||
4 | |||
5 | use App\Http\Controllers\Controller; | ||
6 | use App\Http\Requests\Admin\MusicianWithdrawRequest; | ||
7 | use App\Services\MusicianWithdrawService; | ||
8 | |||
9 | |||
10 | /** | ||
11 | * Class MusicianWithdrawController | ||
12 | * @package App\Controller\Musician | ||
13 | */ | ||
14 | class MusicianWithdrawController extends Controller | ||
15 | { | ||
16 | /** | ||
17 | * @var MusicianWithdrawService | ||
18 | */ | ||
19 | protected $musicianWithdrawService; | ||
20 | |||
21 | /** | ||
22 | * MusicianWithdrawController constructor. | ||
23 | * @param MusicianWithdrawService $musicianWithdrawService | ||
24 | */ | ||
25 | public function __construct(MusicianWithdrawService $musicianWithdrawService) | ||
26 | { | ||
27 | $this->musicianWithdrawService = $musicianWithdrawService; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * 提现 | ||
32 | * @param MusicianWithdrawRequest $musicianWithdrawRequest | ||
33 | * @return \Illuminate\Http\JsonResponse | ||
34 | */ | ||
35 | public function withdraw(MusicianWithdrawRequest $musicianWithdrawRequest) | ||
36 | { | ||
37 | return $this->musicianWithdrawService->withdraw(); | ||
38 | } | ||
39 | } |
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | namespace App\Http\Controllers\Musician; | 3 | namespace App\Http\Controllers\Musician; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\Musician\MusicianWithdrawRequest; | ||
6 | use App\Services\MusicianWithdrawService; | 7 | use App\Services\MusicianWithdrawService; |
7 | 8 | ||
8 | class MusicianWithdrawController extends Controller | 9 | class MusicianWithdrawController extends Controller |
... | @@ -25,7 +26,7 @@ class MusicianWithdrawController extends Controller | ... | @@ -25,7 +26,7 @@ class MusicianWithdrawController extends Controller |
25 | * 冻结资金 | 26 | * 冻结资金 |
26 | * @return \Illuminate\Http\JsonResponse | 27 | * @return \Illuminate\Http\JsonResponse |
27 | */ | 28 | */ |
28 | public function prepare() | 29 | public function prepare(MusicianWithdrawRequest $musicianWithdrawRequest) |
29 | { | 30 | { |
30 | return $this->musicianWithdrawService->prepare(); | 31 | return $this->musicianWithdrawService->prepare(); |
31 | } | 32 | } | ... | ... |
1 | <?php | ||
2 | |||
3 | namespace App\Http\Requests\Admin; | ||
4 | |||
5 | use Illuminate\Foundation\Http\FormRequest; | ||
6 | |||
7 | class MusicianWithdrawRequest extends FormRequest | ||
8 | { | ||
9 | /** | ||
10 | * Determine if the user is authorized to make this request. | ||
11 | * | ||
12 | * @return bool | ||
13 | */ | ||
14 | public function authorize() | ||
15 | { | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | /** | ||
20 | * Get the validation rules that apply to the request. | ||
21 | * | ||
22 | * @return array | ||
23 | */ | ||
24 | public function rules() | ||
25 | { | ||
26 | return [ | ||
27 | 'order_id' => ['required', 'bail'], | ||
28 | 'status' => ['required', 'bail', 'in:1,2'] | ||
29 | ]; | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * 获取已定义验证规则的错误消息 | ||
34 | */ | ||
35 | public function messages(): array | ||
36 | { | ||
37 | return [ | ||
38 | 'order_id.required' => '订单号不存在', | ||
39 | 'status.required' => '审核状态错误', | ||
40 | 'status.in' => '审核状态错误', | ||
41 | ]; | ||
42 | } | ||
43 | } |
1 | <?php | ||
2 | |||
3 | namespace App\Http\Requests\Musician; | ||
4 | |||
5 | use Illuminate\Foundation\Http\FormRequest; | ||
6 | |||
7 | class MusicianWithdrawRequest extends FormRequest | ||
8 | { | ||
9 | /** | ||
10 | * Determine if the user is authorized to make this request. | ||
11 | * | ||
12 | * @return bool | ||
13 | */ | ||
14 | public function authorize() | ||
15 | { | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | /** | ||
20 | * Get the validation rules that apply to the request. | ||
21 | * | ||
22 | * @return array | ||
23 | */ | ||
24 | public function rules() | ||
25 | { | ||
26 | return [ | ||
27 | 'order_id' => ['required', 'bail'], | ||
28 | ]; | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * @return string[] | ||
33 | */ | ||
34 | public function messages(): array | ||
35 | { | ||
36 | return [ | ||
37 | 'order_id.required' => '订单号不存在', | ||
38 | ]; | ||
39 | } | ||
40 | } |
... | @@ -13,6 +13,9 @@ use Illuminate\Support\Facades\Route; | ... | @@ -13,6 +13,9 @@ use Illuminate\Support\Facades\Route; |
13 | | | 13 | | |
14 | */ | 14 | */ |
15 | Route::group([], function (){ | 15 | Route::group([], function (){ |
16 | |||
17 | Route::get('musician/xxx1', 'MusicianWithdrawController@withdraw'); | ||
18 | |||
16 | //提现审核通过 | 19 | //提现审核通过 |
17 | Route::post('musician/withdraw', 'MusicianWithdrawController@withdraw'); | 20 | Route::post('musician/withdraw', 'MusicianWithdrawController@withdraw'); |
18 | }); | 21 | }); | ... | ... |
-
Please register or sign in to post a comment