CaptchaService.php 985 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @Name
  4. * @Description
  5. * @Author 刘学玺
  6. * @Date 2024/8/22 18:17
  7. */
  8. namespace App\Http\Services\Backend\Server\System;
  9. use App\Exceptions\ApiException;
  10. use App\Http\Services\Backend\Server\System\Captcha\BlockPuzzleService;
  11. use App\Http\Services\Service;
  12. use Symfony\Component\HttpFoundation\Response;
  13. class CaptchaService extends Service
  14. {
  15. /**
  16. * @throws ApiException
  17. */
  18. public function get($params)
  19. {
  20. is_null($params) && self::error('MENU_EXISTS_CHILDREN', Response::HTTP_UNPROCESSABLE_ENTITY);
  21. empty($params['captchaType']) && self::error('MENU_EXISTS_CHILDREN', Response::HTTP_UNPROCESSABLE_ENTITY);
  22. $this->getService($params['captchaType'])->get($params);
  23. }
  24. protected function getService(String $captchaType) {
  25. // return (CaptchaService)CaptchaServiceFactory.instances.get(captchaType);
  26. return match ($captchaType) {
  27. 'blockPuzzle' => new BlockPuzzleService()
  28. };
  29. }
  30. }