diff --git a/application.go b/application.go index efc5fc9..affa38b 100644 --- a/application.go +++ b/application.go @@ -298,9 +298,13 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) { if len(token) == 32 { sessionId = token } - //http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId+";SameSite=Strict", Path: "/"}) - //http.SetCookie(w, &http.Cookie{Name: "SameSite", Value: "Strict", Path: "/"}) - w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure") + //没有跨域设置 + if that.Config.GetString("crossDomain") == "" { + http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"}) + } else { + //跨域允许需要设置cookie的允许跨域 + w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure") + } } else { sessionId = cookie.Value } diff --git a/var.go b/var.go index 32b1233..004900d 100644 --- a/var.go +++ b/var.go @@ -14,6 +14,13 @@ var Config = Map{ "codeConfig": Map{ "admin": "config/app.json", }, + "codeConfig1": Map{ + "admin": Map{ //默认无,必须,接口类别名称 + "package": "admin", //默认admin,非必须,有则生成代码到此目录,无则采用缺省模式不生成代码只生成接口 + "config": "config/app.json", //默认config/app.json,必须,接口描述配置文件 + "rule": "config/rule.json", //默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成 + }, + }, "db": Map{ "sqlite": Map{ "path": "config/data.db",