AgentController.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Services\Common\AgentService;
  4. /**
  5. * 代理管理控制器
  6. */
  7. class AgentController extends Backend
  8. {
  9. /**
  10. * 获取代理列表
  11. */
  12. public function index()
  13. {
  14. $agentService = new AgentService();
  15. $pageSize = request()->get('limit', 15);
  16. return $agentService->getDataList(request()->all(), $pageSize);
  17. }
  18. /**
  19. * 获取代理详情
  20. */
  21. public function info()
  22. {
  23. $id = request()->get('id');
  24. if (!$id) {
  25. return ['code' => 1, 'msg' => '参数错误'];
  26. }
  27. $agentService = new AgentService();
  28. return $agentService->getInfo($id);
  29. }
  30. /**
  31. * 删除代理
  32. */
  33. public function delete()
  34. {
  35. $agentService = new AgentService();
  36. return $agentService->delete();
  37. }
  38. /**
  39. * 更新状态(禁用/启用)
  40. */
  41. public function status()
  42. {
  43. $agentService = new AgentService();
  44. return $agentService->status();
  45. }
  46. /**
  47. * 审核代理
  48. */
  49. public function audit()
  50. {
  51. $agentService = new AgentService();
  52. return $agentService->audit();
  53. }
  54. /**
  55. * 冻结/解冻代理
  56. */
  57. public function freeze()
  58. {
  59. $agentService = new AgentService();
  60. return $agentService->freeze();
  61. }
  62. }