captcha.go 669 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * @desc:验证码获取
  3. * @company:云南奇讯科技有限公司
  4. * @Author: yixiaohu
  5. * @Date: 2022/3/2 17:45
  6. */
  7. package controller
  8. import (
  9. "context"
  10. "github.com/tiger1103/gfast/v3/api/v1/common"
  11. "github.com/tiger1103/gfast/v3/internal/app/common/service"
  12. )
  13. var Captcha = captchaController{}
  14. type captchaController struct {
  15. }
  16. // Get 获取验证码
  17. func (c *captchaController) Get(ctx context.Context, req *common.CaptchaReq) (res *common.CaptchaRes, err error) {
  18. var (
  19. idKeyC, base64stringC string
  20. )
  21. idKeyC, base64stringC, err = service.Captcha().GetVerifyImgString(ctx)
  22. res = &common.CaptchaRes{
  23. Key: idKeyC,
  24. Img: base64stringC,
  25. }
  26. return
  27. }