mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-07 17:53:42 +08:00
opt: 取消强制手机号验证,更新配置
This commit is contained in:
@@ -47,6 +47,10 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
|
||||
logger.Error(err)
|
||||
return
|
||||
}
|
||||
// 设置读写超时时间
|
||||
_ = ws.SetWriteDeadline(time.Now().Add(300 * time.Second))
|
||||
_ = ws.SetReadDeadline(time.Now().Add(300 * time.Second))
|
||||
|
||||
sessionId := c.Query("session_id")
|
||||
roleId := h.GetInt(c, "role_id", 0)
|
||||
chatId := c.Query("chat_id")
|
||||
|
||||
@@ -46,6 +46,7 @@ type CodeStats struct {
|
||||
// Token 生成自验证 token
|
||||
func (h *VerifyHandler) Token(c *gin.Context) {
|
||||
// 如果不是通过浏览器访问,则返回错误的 token
|
||||
// TODO: 引入验证码机制防刷机制
|
||||
if c.GetHeader("Sec-Fetch-Mode") != "cors" {
|
||||
token := fmt.Sprintf("%s:%d", utils.RandString(32), time.Now().Unix())
|
||||
encrypt, err := utils.AesEncrypt(h.App.Config.AesEncryptKey, []byte(token))
|
||||
@@ -109,7 +110,6 @@ func (h *VerifyHandler) SendMsg(c *gin.Context) {
|
||||
var stat CodeStats
|
||||
err = h.db.Get(MobileStatPrefix+data.Mobile, &stat)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
stat = CodeStats{
|
||||
Mobile: data.Mobile,
|
||||
Count: 0,
|
||||
|
||||
Reference in New Issue
Block a user