captcha.go 373 B

1234567891011121314151617181920
  1. package system
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "device-manage/tools"
  5. "device-manage/tools/app"
  6. "device-manage/tools/captcha"
  7. )
  8. func GenerateCaptchaHandler(c *gin.Context) {
  9. id, b64s, err := captcha.DriverDigitFunc()
  10. tools.HasError(err, "验证码获取失败", 500)
  11. app.Custum(c, gin.H{
  12. "code": 200,
  13. "data": b64s,
  14. "id": id,
  15. "msg": "success",
  16. })
  17. }