开始新增代码生成配置2.0功能,配置文件格式规定完成

This commit is contained in:
hoteas 2021-07-21 00:55:59 +08:00
parent 9cd7ad34b3
commit 47b28e7b57
2 changed files with 14 additions and 3 deletions

View File

@ -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: "/"})
//没有跨域设置
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
}

7
var.go
View File

@ -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",