| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Http\Controllers\Account;
- use App\Libs\ApiResponse;
- use App\Services\Account\CaptchaService;
- use Illuminate\Routing\Controller as BaseController;
- class CaptchaController extends BaseController
- {
- use ApiResponse;
- protected $captchaService;
- public function __construct(
- CaptchaService $captchaService
- ) {
- $this->captchaService = $captchaService;
- }
- /**
- * 获取登录图片验证码(免登录接口)
- *
- * 返回 { key, image },image 为 data:image/png;base64,... 可直接用于 img src
- *
- * @return mixed
- */
- public function getCaptcha()
- {
- return $this->success($this->captchaService->generate());
- }
- }
|