PopularitySharehelpController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace App\Http\Controllers\Share;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Controllers\Core\Auth;
  5. use App\Services\Share\PopularitySharehelpService;
  6. use Illuminate\Http\Request;
  7. /**
  8. * Class PopularitySharehelpController
  9. * @package App\Http\Controllers\Share
  10. */
  11. class PopularitySharehelpController extends Controller
  12. {
  13. /**
  14. * 人气值分享助力
  15. * @param int $share_uid
  16. * @return array
  17. * @throws \App\Exceptions\AlertException
  18. */
  19. public function check(int $share_uid)
  20. {
  21. $uid = Auth::auth();
  22. $pshs = new PopularitySharehelpService();
  23. $data = $pshs->check($share_uid, $uid);
  24. return response([
  25. 'code' => 200,
  26. 'message' => 'success',
  27. 'data' => $data
  28. ]);
  29. }
  30. /**
  31. * 助力页概览
  32. */
  33. public function helpOverView()
  34. {
  35. $uid = Auth::auth();
  36. $pshs = new PopularitySharehelpService();
  37. $data = $pshs->helpOverView($uid);
  38. return response([
  39. 'code' => 200,
  40. 'message' => 'success',
  41. 'data' => $data
  42. ]);
  43. }
  44. /**
  45. * 加持中的助力
  46. * @param Request $request
  47. * @return array
  48. */
  49. public function inglist(Request $request)
  50. {
  51. $uid = Auth::auth();
  52. $page = $request->get('page') ?? 1;
  53. $pages = array(
  54. 'limit' => 20,
  55. 'page' => $page
  56. );
  57. $psgs = new PopularitySharehelpService();
  58. $data = $psgs->inglist($uid, $pages);
  59. return response([
  60. 'code' => 200,
  61. 'message' => 'success',
  62. 'data' => $data
  63. ]);
  64. }
  65. /**
  66. * 失效的助力
  67. * @param Request $request
  68. * @return array
  69. */
  70. public function historylist(Request $request)
  71. {
  72. $uid = Auth::auth();
  73. $page = $request->get('page') ?? 1;
  74. $pages = array(
  75. 'limit' => 20,
  76. 'page' => $page
  77. );
  78. $popularityShareHelpService = new PopularitySharehelpService();
  79. $data = $popularityShareHelpService->historylist($uid, $pages);
  80. return response([
  81. 'code' => 200,
  82. 'message' => 'success',
  83. 'data' => $data
  84. ]);
  85. }
  86. }