You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Controller\v3;
  3. use App\Constants\v3\ErrorCode;
  4. use App\Controller\BaseController;
  5. use App\Request\v3\UserBindTelRequest;
  6. use App\Service\v3\Interfaces\UserBindTelServiceInterface;
  7. use App\Service\v3\Interfaces\VerifyCodeServiceInterface;
  8. use Hyperf\Di\Annotation\Inject;
  9. /**
  10. * 用户相关
  11. * Class UserController
  12. * @package App\Controller\v3
  13. */
  14. class UserController extends BaseController
  15. {
  16. /**
  17. * @Inject
  18. * @var VerifyCodeServiceInterface
  19. */
  20. protected $verifyCodeService;
  21. /**
  22. * @Inject
  23. * @var UserBindTelServiceInterface
  24. */
  25. protected $userBindTelService;
  26. public function bindTel(UserBindTelRequest $request)
  27. {
  28. // 获取参数
  29. $params = $request->validated();
  30. // 校验验证码
  31. $this->verifyCodeService->check($params['user_id'], $params['tel'], $params['verify_code']);
  32. // 绑定
  33. $this->userBindTelService->do($params['user_id'], $params['tel']);
  34. return $this->success([]);
  35. }
  36. }