mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
opt: 取消强制手机号验证,更新配置
This commit is contained in:
parent
2efc669ab2
commit
84f9a83f55
@ -1,12 +1,18 @@
|
|||||||
Listen = "0.0.0.0:5678"
|
Listen = "0.0.0.0:5678"
|
||||||
ProxyURL = "YOUR_PROXY_URL"
|
ProxyURL = "http://172.22.11.200:7777"
|
||||||
MysqlDns = "mysql_user:mysql_pass@tcp(localhost:3306)/chatgpt_plus?charset=utf8&parseTime=True&loc=Local"
|
MysqlDns = "root:mysql_pass@tcp(localhost:3306)/chatgpt_plus?charset=utf8mb4&collation=utf8mb4_unicode_ci&parseTime=True&loc=Local"
|
||||||
|
StaticDir = "./static"
|
||||||
|
StaticUrl = "http://localhost:5678/static"
|
||||||
|
AesEncryptKey = "YOUR_AES_KEY"
|
||||||
|
FunApiToken = "YOUR_FUN_API_TOKEN"
|
||||||
|
StartWechatBot = false
|
||||||
|
|
||||||
[Session]
|
[Session]
|
||||||
SecretKey = "azyehq3ivunjhbntz78isj00i4hz2mt9xtddysfucxakadq4qbfrt0b7q3lnvg80"
|
Driver = "cookie"
|
||||||
|
SecretKey = "m0cjm3gsuw9jk73np1ni7r42koilybjcndlycjdmq7za3pbqn7w12fyok5pqh6q5"
|
||||||
Name = "CHAT_SESSION_ID"
|
Name = "CHAT_SESSION_ID"
|
||||||
Path = "/"
|
Path = "/"
|
||||||
Domain = ""
|
Domain = "localhost"
|
||||||
MaxAge = 86400
|
MaxAge = 86400
|
||||||
Secure = false
|
Secure = false
|
||||||
HttpOnly = false
|
HttpOnly = false
|
||||||
@ -15,3 +21,16 @@ MysqlDns = "mysql_user:mysql_pass@tcp(localhost:3306)/chatgpt_plus?charset=utf8&
|
|||||||
[Manager]
|
[Manager]
|
||||||
Username = "admin"
|
Username = "admin"
|
||||||
Password = "admin123"
|
Password = "admin123"
|
||||||
|
|
||||||
|
[Redis]
|
||||||
|
Host = "localhost"
|
||||||
|
Port = 6379
|
||||||
|
Password = ""
|
||||||
|
|
||||||
|
[SmsConfig]
|
||||||
|
AccessKey = "YOUR_ACCESS_KEY"
|
||||||
|
AccessSecret = "YOUR_SECRET_KEY"
|
||||||
|
Product = "Dysmsapi"
|
||||||
|
Domain = "dysmsapi.aliyuncs.com"
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ func NewDefaultConfig() *types.AppConfig {
|
|||||||
HttpOnly: false,
|
HttpOnly: false,
|
||||||
SameSite: http.SameSiteLaxMode,
|
SameSite: http.SameSiteLaxMode,
|
||||||
},
|
},
|
||||||
AlApiToken: "",
|
FunApiToken: "",
|
||||||
StartWechatBot: false,
|
StartWechatBot: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,9 @@ type AppConfig struct {
|
|||||||
|
|
||||||
AesEncryptKey string
|
AesEncryptKey string
|
||||||
SmsConfig AliYunSmsConfig // 短信发送配置
|
SmsConfig AliYunSmsConfig // 短信发送配置
|
||||||
AlApiToken string // AL API 服务 token
|
FunApiToken string // 函数服务 API token
|
||||||
StartWechatBot bool // 是否启动微信机器人
|
StartWechatBot bool // 是否启动微信机器人
|
||||||
|
EnabledMsgService bool // 是否启用短信服务
|
||||||
}
|
}
|
||||||
|
|
||||||
type AliYunSmsConfig struct {
|
type AliYunSmsConfig struct {
|
||||||
|
@ -47,6 +47,10 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) {
|
|||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 设置读写超时时间
|
||||||
|
_ = ws.SetWriteDeadline(time.Now().Add(300 * time.Second))
|
||||||
|
_ = ws.SetReadDeadline(time.Now().Add(300 * time.Second))
|
||||||
|
|
||||||
sessionId := c.Query("session_id")
|
sessionId := c.Query("session_id")
|
||||||
roleId := h.GetInt(c, "role_id", 0)
|
roleId := h.GetInt(c, "role_id", 0)
|
||||||
chatId := c.Query("chat_id")
|
chatId := c.Query("chat_id")
|
||||||
|
@ -46,6 +46,7 @@ type CodeStats struct {
|
|||||||
// Token 生成自验证 token
|
// Token 生成自验证 token
|
||||||
func (h *VerifyHandler) Token(c *gin.Context) {
|
func (h *VerifyHandler) Token(c *gin.Context) {
|
||||||
// 如果不是通过浏览器访问,则返回错误的 token
|
// 如果不是通过浏览器访问,则返回错误的 token
|
||||||
|
// TODO: 引入验证码机制防刷机制
|
||||||
if c.GetHeader("Sec-Fetch-Mode") != "cors" {
|
if c.GetHeader("Sec-Fetch-Mode") != "cors" {
|
||||||
token := fmt.Sprintf("%s:%d", utils.RandString(32), time.Now().Unix())
|
token := fmt.Sprintf("%s:%d", utils.RandString(32), time.Now().Unix())
|
||||||
encrypt, err := utils.AesEncrypt(h.App.Config.AesEncryptKey, []byte(token))
|
encrypt, err := utils.AesEncrypt(h.App.Config.AesEncryptKey, []byte(token))
|
||||||
@ -109,7 +110,6 @@ func (h *VerifyHandler) SendMsg(c *gin.Context) {
|
|||||||
var stat CodeStats
|
var stat CodeStats
|
||||||
err = h.db.Get(MobileStatPrefix+data.Mobile, &stat)
|
err = h.db.Get(MobileStatPrefix+data.Mobile, &stat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
|
||||||
stat = CodeStats{
|
stat = CodeStats{
|
||||||
Mobile: data.Mobile,
|
Mobile: data.Mobile,
|
||||||
Count: 0,
|
Count: 0,
|
||||||
|
@ -114,13 +114,13 @@ func main() {
|
|||||||
|
|
||||||
// 创建函数
|
// 创建函数
|
||||||
fx.Provide(func(config *types.AppConfig) (function.FuncZaoBao, error) {
|
fx.Provide(func(config *types.AppConfig) (function.FuncZaoBao, error) {
|
||||||
return function.NewZaoBao(config.AlApiToken), nil
|
return function.NewZaoBao(config.FunApiToken), nil
|
||||||
}),
|
}),
|
||||||
fx.Provide(func(config *types.AppConfig) (function.FuncWeiboHot, error) {
|
fx.Provide(func(config *types.AppConfig) (function.FuncWeiboHot, error) {
|
||||||
return function.NewWeiboHot(config.AlApiToken), nil
|
return function.NewWeiboHot(config.FunApiToken), nil
|
||||||
}),
|
}),
|
||||||
fx.Provide(func(config *types.AppConfig) (function.FuncHeadlines, error) {
|
fx.Provide(func(config *types.AppConfig) (function.FuncHeadlines, error) {
|
||||||
return function.NewHeadLines(config.AlApiToken), nil
|
return function.NewHeadLines(config.FunApiToken), nil
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// 创建控制器
|
// 创建控制器
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
Listen = "0.0.0.0:5678"
|
Listen = "0.0.0.0:5678"
|
||||||
ProxyURL = "http://172.22.11.200:7777"
|
ProxyURL = "http://172.22.11.200:7777"
|
||||||
MysqlDns = "root:12345678@tcp(172.28.173.76:3307)/chatgpt_plus?charset=utf8mb4&collation=utf8mb4_unicode_ci&parseTime=True&loc=Local"
|
MysqlDns = "root:mysql_pass@tcp(localhost:3306)/chatgpt_plus?charset=utf8mb4&collation=utf8mb4_unicode_ci&parseTime=True&loc=Local"
|
||||||
StaticDir = "./static"
|
StaticDir = "./static"
|
||||||
StaticUrl = "http://localhost:8080/static"
|
StaticUrl = "http://localhost:5678/static"
|
||||||
|
AesEncryptKey = "YOUR_AES_KEY"
|
||||||
|
FunApiToken = "YOUR_FUN_API_TOKEN"
|
||||||
|
StartWechatBot = false
|
||||||
|
|
||||||
[Session]
|
[Session]
|
||||||
Driver = "cookie"
|
Driver = "cookie"
|
||||||
SecretKey = "8k0c67y2or1n7kbmn1w1c86ygqscguoktuf9t524jm64ls585z8uibpdssiy128s"
|
SecretKey = "m0cjm3gsuw9jk73np1ni7r42koilybjcndlycjdmq7za3pbqn7w12fyok5pqh6q5"
|
||||||
Name = "CHAT_PLUS_SESSION"
|
Name = "CHAT_SESSION_ID"
|
||||||
Path = "/"
|
Path = "/"
|
||||||
Domain = ""
|
Domain = "localhost"
|
||||||
MaxAge = 86400
|
MaxAge = 86400
|
||||||
Secure = false
|
Secure = false
|
||||||
HttpOnly = false
|
HttpOnly = false
|
||||||
@ -23,3 +26,11 @@ StaticUrl = "http://localhost:8080/static"
|
|||||||
Host = "localhost"
|
Host = "localhost"
|
||||||
Port = 6379
|
Port = 6379
|
||||||
Password = ""
|
Password = ""
|
||||||
|
|
||||||
|
[SmsConfig]
|
||||||
|
AccessKey = "YOUR_ACCESS_KEY"
|
||||||
|
AccessSecret = "YOUR_SECRET_KEY"
|
||||||
|
Product = "Dysmsapi"
|
||||||
|
Domain = "dysmsapi.aliyuncs.com"
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,9 +304,6 @@ onMounted(() => {
|
|||||||
checkSession().then((user) => {
|
checkSession().then((user) => {
|
||||||
loginUser.value = user
|
loginUser.value = user
|
||||||
isLogin.value = true
|
isLogin.value = true
|
||||||
if (user.mobile === '') {
|
|
||||||
showBindMobileDialog.value = true
|
|
||||||
}
|
|
||||||
// 加载角色列表
|
// 加载角色列表
|
||||||
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
|
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
|
||||||
roles.value = res.data;
|
roles.value = res.data;
|
||||||
|
@ -97,9 +97,6 @@ const showBindMobileDialog = ref(false)
|
|||||||
checkSession().then((user) => {
|
checkSession().then((user) => {
|
||||||
loginUser.value = user
|
loginUser.value = user
|
||||||
isLogin.value = true
|
isLogin.value = true
|
||||||
if (user.mobile === '') {
|
|
||||||
showBindMobileDialog.value = true
|
|
||||||
}
|
|
||||||
// 加载角色列表
|
// 加载角色列表
|
||||||
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
|
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user