FundStatisticsAction.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 FundStatisticsAction 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作为筛选条件
  33. // 这样可以查看该用户的所有资金账户
  34. return $this->response()->redirect(
  35. admin_url("fund-accounts?user_id={$fund->user_id}")
  36. );
  37. }
  38. }