GteamController.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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\GteamService;
  6. class GteamController extends Controller
  7. {
  8. /**
  9. * 检验邀请
  10. * @param int $invite_id
  11. * @return array
  12. * @throws \App\Exceptions\AlertException
  13. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  14. */
  15. public function check(int $invite_id)
  16. {
  17. $uid = Auth::auth();
  18. $gs = new GteamService();
  19. $data = $gs->check($uid, $invite_id);
  20. return array(
  21. 'code' => 200,
  22. 'message' => 'success',
  23. 'data' => $data
  24. );
  25. }
  26. /**
  27. * vip邀请助力
  28. * @param int $invite_id
  29. * @return array
  30. * @throws \App\Exceptions\AlertException
  31. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  32. */
  33. public function vipCheck(int $invite_id)
  34. {
  35. $uid = Auth::auth();
  36. $gs = new GteamService();
  37. $data = $gs->vipCheck($uid, $invite_id);
  38. return array(
  39. 'code' => 200,
  40. 'message' => 'success',
  41. 'data' => $data
  42. );
  43. }
  44. /**
  45. * 获取助力的气泡
  46. * @param int $activity_id
  47. * @return array
  48. */
  49. public function lastInvite(int $activity_id)
  50. {
  51. $gs = new GteamService();
  52. $data = $gs->lastInvite($activity_id);
  53. return array(
  54. 'code' => 200,
  55. 'message' => 'success',
  56. 'data' => $data
  57. );
  58. }
  59. /**
  60. * 获取最近的助力记录
  61. * @param int $invite_id
  62. * @return array
  63. */
  64. public function history(int $invite_id)
  65. {
  66. $gs = new GteamService();
  67. $data = $gs->history($invite_id);
  68. return array(
  69. 'code' => 200,
  70. 'message' => 'success',
  71. 'data' => $data
  72. );
  73. }
  74. /**
  75. * 匹配成功率分享完成列表
  76. * @param Request $request
  77. * @return array
  78. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  79. */
  80. public function succlist(Request $request)
  81. {
  82. $uid = Auth::auth();
  83. $page = $request->get('page') ?? 1;
  84. $pages = array(
  85. 'limit' => 20,
  86. 'page' => $page
  87. );
  88. $gs = new GteamService();
  89. $data = $gs->succlist($uid, $pages);
  90. return array(
  91. 'code' => 200,
  92. 'message' => 'success',
  93. 'data' => $data
  94. );
  95. }
  96. }