captcah.go 594 B

1234567891011121314151617181920212223242526272829
  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/apiv1/common"
  11. "github.com/tiger1103/gfast/v3/internal/app/common/service"
  12. )
  13. var Captcha = cCaptcha{}
  14. type cCaptcha struct {
  15. }
  16. // Get 获取验证码
  17. func (c *cCaptcha) Get(ctx context.Context, req *common.CaptchaReq) (res *common.CaptchaRes, err error) {
  18. idKeyC, base64stringC := service.Captcha.GetVerifyImgString(ctx)
  19. res = &common.CaptchaRes{
  20. Key: idKeyC,
  21. Img: base64stringC,
  22. }
  23. return
  24. }