captcha.go 786 B

123456789101112131415161718192021222324252627282930313233
  1. package api
  2. import (
  3. "gfast/app/common/service"
  4. "gfast/library"
  5. // "github.com/gogf/gf/frame/g"
  6. "github.com/gogf/gf/net/ghttp"
  7. )
  8. type captcha struct{}
  9. var Captcha = new(captcha)
  10. type Res struct {
  11. IdKeyC string `json:"idKeyC"` //图片的key
  12. Base64stringC string `json:"base64stringC"` //动态验证码图片 base64
  13. }
  14. // Img
  15. // @Summary 获取验证码图片信息
  16. // @Description 获取验证码图片信息
  17. // @Tags 公共
  18. // @Success 0 {object} library.Response{data=Res} "{"code": 200, "data": {idKeyC:" ",base64stringC:"" }}"
  19. // @Router /captcha/get [get]
  20. // @Security
  21. func (c *captcha) Img(r *ghttp.Request) {
  22. idKeyC, base64stringC := service.Captcha.GetVerifyImgString()
  23. re := Res{
  24. idKeyC,
  25. base64stringC,
  26. }
  27. library.SusJson(true, r, "ok", re)
  28. }