23 lines
391 B
Go
23 lines
391 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"knowledge/api/responses"
|
|
"knowledge/utils"
|
|
)
|
|
|
|
type Public struct{}
|
|
|
|
// GetCaptcha 获取验证码
|
|
func (b *Public) GetCaptcha(c *gin.Context) {
|
|
id, b64s, err := utils.GenerateCaptcha()
|
|
if err != nil {
|
|
responses.FailWithMessage("验证码获取失败", c)
|
|
}
|
|
|
|
responses.OkWithData(gin.H{
|
|
"id": id,
|
|
"b64s": b64s,
|
|
}, c)
|
|
}
|