Captcha.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\api\service\passport;
  13. use app\common\service\BaseService;
  14. use yiovo\captcha\facade\CaptchaApi;
  15. use think\response\Json;
  16. class Captcha extends BaseService
  17. {
  18. /**
  19. * 图形验证码
  20. * @return array
  21. */
  22. public function create(): array
  23. {
  24. $data = CaptchaApi::create();
  25. return [
  26. 'base64' => str_replace("\r\n", '', $data['base64']),
  27. 'key' => $data['key'],
  28. 'md5' => $data['md5']
  29. ];
  30. }
  31. }