123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Admin\Actions\Form;
- use App\Models\User;
- use App\Models\UserEpisodesRecord;
- use App\Models\UserWithdraw;
- use Dcat\Admin\Contracts\LazyRenderable;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Widgets\Form;
- class WithdrawReview extends Form implements LazyRenderable
- {
- use LazyWidget;
- public function handle(array $input)
- {
- $status = $input['status'];
- try {
- $withdraw = UserWithdraw::find($input['id']);
- if ($status > 0) {
- $withdraw->status = $status;
- $withdraw->save();
- }
- // 驳回返还收益
- if($withdraw->status == 3){
- $user = User::find($withdraw->user_id);
- $user->income = $user->income + $withdraw->price;
- $user->save();
- }
- } catch (\Exception $exception) {
- return $this->response()->error($exception->getMessage());
- }
- return $this->response()->success('success')->refresh();
- }
- public function form()
- {
- $id = isset($this->payload['id']) ? $this->payload['id'] : 0;
- $this->hidden('id')->value($id);
- $this->radio('status', '审核结果')
- ->options(config('global.withdraw_status'))->default(1);
- $this->disableResetButton();
- }
- }
|