VipController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Http\Controllers\User;
  3. use App\Console\Commands\User\TestCommand;
  4. use App\Exceptions\AlertException;
  5. use App\Http\Controllers\Controller;
  6. use App\Http\Controllers\Core\Auth;
  7. use App\Services\Notice\UserNoticeService;
  8. use App\Services\User\NoticeService;
  9. use App\Services\User\ProfileService;
  10. use Illuminate\Support\Facades\Redis;
  11. use Illuminate\Support\Facades\Request;
  12. class VipController extends Controller
  13. {
  14. /**
  15. * 会员通知
  16. * @param Request $request
  17. * @return \Illuminate\Http\JsonResponse
  18. */
  19. public function notice(Request $request)
  20. {
  21. $uid = Auth::auth();
  22. $NoticeService = new NoticeService();
  23. $NoticeService->vip($uid);
  24. return response()->json([
  25. 'code' => 200,
  26. 'message' => 'OK'
  27. ]);
  28. }
  29. /**
  30. * 获取内测资格
  31. */
  32. public function getTestQual()
  33. {
  34. $uid = Auth::auth();
  35. if (Redis::sismember("fpdx_supervip_test", $uid)) {
  36. throw new AlertException("你已经获取内测资格", 200);
  37. } else {
  38. $tc = new UserNoticeService();
  39. $tc->test($uid);
  40. return array(
  41. 'code' => 200,
  42. 'message' => 'success'
  43. );
  44. }
  45. }
  46. public function beVip()
  47. {
  48. $uid = Auth::auth();
  49. $pfs = new ProfileService();
  50. $pfs->beVip($uid, true);
  51. return response()->json([
  52. 'code' => 200,
  53. 'message' => 'OK'
  54. ]);
  55. }
  56. }