FundTransferAction.php 971 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Module\Fund\Admin\Actions;
  3. use App\Module\Fund\Models\FundModel;
  4. use Illuminate\Http\Request;
  5. use UCore\DcatAdmin\RowActionHandler;
  6. /**
  7. * 转账操作
  8. *
  9. * 在资金账户列表中添加转账的快捷操作
  10. */
  11. class FundTransferAction extends RowActionHandler
  12. {
  13. /**
  14. * 操作按钮标题
  15. *
  16. * @var string
  17. */
  18. public $title = '转账';
  19. /**
  20. * 处理请求
  21. *
  22. * @param Request $request
  23. * @return mixed
  24. */
  25. public function handle(Request $request)
  26. {
  27. $id = $this->getKey();
  28. $fund = FundModel::find($id);
  29. if (!$fund) {
  30. return $this->response()->error('资金账户不存在');
  31. }
  32. // 跳转到转账页面,并带上用户ID和资金账户ID作为初始参数
  33. return $this->response()->redirect(
  34. admin_url("fund_transfer/create?user_id={$fund->user_id}&fund_id={$fund->fund_id}")
  35. );
  36. }
  37. }