MemberSignupVerifyController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Themes\kbgolf\pro\app\Http\Controllers\Auth;
  3. use App\Services\MessageVerifyService;
  4. use App\ThirdPartyApi\Interfaces\SmsInterface;
  5. class MemberSignupVerifyController
  6. {
  7. private $messageVerifyService;
  8. private $smsService;
  9. public function __construct(MessageVerifyService $messageVerifyService, SmsInterface $smsService)
  10. {
  11. $this->messageVerifyService = $messageVerifyService;
  12. $this->smsService = $smsService;
  13. }
  14. public function index()
  15. {
  16. $route = route('member-signup-verify.store');
  17. return view('views.auth.member-signup-verify', compact('route'));
  18. }
  19. public function store()
  20. {
  21. if (request('cert_number') != session('smsCert.number')) {
  22. notify()->error(_e('Action failed'), 'Error', 'bottomRight');
  23. return redirect()->back()->withInput();
  24. }
  25. session()->forget('smsCert.number');
  26. session()->put('smsCert.code', 200);
  27. return redirect()->route('member-signup-branch');
  28. }
  29. public function sendCert()
  30. {
  31. $smsCert = rand(100000, 999999);
  32. $reqInfo = [
  33. 'number' => $smsCert,
  34. 'date' => date('YmdHis'),
  35. 'mobile_no' => request('mobile_no')
  36. ];
  37. $title ='본인확인';
  38. $msg ="[Dabory] 본인확인 인증번호는 [{$smsCert}]입니다. 정확히 입력해주세요.";
  39. $receiver = request('mobile_no');
  40. session()->put('smsCert', $reqInfo);
  41. $response = $this->smsService->sendMessage($title, $msg, $receiver);
  42. // $response = $this->messageVerifyService->send(request('mobile_no'));
  43. return response()->json($response);
  44. }
  45. }