forked from golang/hotime
测试
This commit is contained in:
parent
62cf625fe9
commit
9c3ba81135
@ -302,7 +302,7 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
if that.Config.GetString("crossDomain") == "" {
|
if that.Config.GetString("crossDomain") == "" {
|
||||||
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
||||||
} else {
|
} else {
|
||||||
//跨域允许需要设置cookie的允许跨域
|
//跨域允许需要设置cookie的允许跨域https才有效果
|
||||||
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure")
|
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -459,9 +459,13 @@ func Init(config string) Application {
|
|||||||
appIns.SetCache()
|
appIns.SetCache()
|
||||||
appIns.MakeCode = &code.MakeCode{}
|
appIns.MakeCode = &code.MakeCode{}
|
||||||
codeConfig := appIns.Config.GetMap("codeConfig")
|
codeConfig := appIns.Config.GetMap("codeConfig")
|
||||||
if codeConfig != nil && appIns.Config.GetInt("mode") == 2 {
|
if codeConfig != nil {
|
||||||
for k, _ := range codeConfig {
|
for k, _ := range codeConfig {
|
||||||
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), appIns.Db)
|
if appIns.Config.GetInt("mode") == 2{
|
||||||
|
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), &appIns.Db)
|
||||||
|
}else{
|
||||||
|
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ type MakeCode struct {
|
|||||||
Error
|
Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) {
|
func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB) {
|
||||||
isMake := false
|
isMake := false
|
||||||
idSlice := Slice{}
|
idSlice := Slice{}
|
||||||
|
|
||||||
@ -112,6 +112,12 @@ func (that *MakeCode) Db2JSON(name string, path string, db db.HoTimeDB) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if db==nil{
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据库反哺
|
||||||
myInit := strings.Replace(InitTpt, "{{name}}", name, -1)
|
myInit := strings.Replace(InitTpt, "{{name}}", name, -1)
|
||||||
ctrList := ""
|
ctrList := ""
|
||||||
|
|
||||||
|
@ -30,17 +30,17 @@ var Project = Proj{
|
|||||||
this.Display(5, "登录失败")
|
this.Display(5, "登录失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.Session("id", user.GetCeilInt("id"))
|
this.Session("admin_id", user.GetCeilInt("id"))
|
||||||
this.Session("name", name)
|
this.Session("admin_name", name)
|
||||||
this.Display(0, "登录成功")
|
this.Display(0, this.SessionId)
|
||||||
},
|
},
|
||||||
"logout": func(this *Context) {
|
"logout": func(this *Context) {
|
||||||
this.Session("id", nil)
|
this.Session("admin_id", nil)
|
||||||
this.Session("name", nil)
|
this.Session("admin_name", nil)
|
||||||
this.Display(0, "退出登录成功")
|
this.Display(0, "退出登录成功")
|
||||||
},
|
},
|
||||||
"info": func(that *Context) {
|
"info": func(that *Context) {
|
||||||
re := that.Db.Get("admin", that.MakeCode.Info("admin"), Map{"id": that.Session("id").ToCeilInt()})
|
re := that.Db.Get("admin", that.MakeCode.Info("admin"), Map{"id": that.Session("admin_id").ToCeilInt()})
|
||||||
|
|
||||||
if re == nil {
|
if re == nil {
|
||||||
that.Display(4, "找不到对应信息")
|
that.Display(4, "找不到对应信息")
|
||||||
|
@ -9,11 +9,21 @@ var categoryCtr = Ctr{
|
|||||||
"info": func(that *Context) {
|
"info": func(that *Context) {
|
||||||
parentId := ObjToInt(that.Req.FormValue("id"))
|
parentId := ObjToInt(that.Req.FormValue("id"))
|
||||||
//parentId := ObjToInt(that.RouterString[2])
|
//parentId := ObjToInt(that.RouterString[2])
|
||||||
|
childData:=[]Map{}
|
||||||
if parentId == 0 {
|
if parentId == 0 {
|
||||||
parentId = 1
|
childData1 := that.Db.Select("category", "*", Map{"parent_id": nil})
|
||||||
|
|
||||||
|
for _, v := range childData1 {
|
||||||
|
data := that.Db.Get("category", "*", Map{"parent_id": v.GetCeilInt("id")})
|
||||||
|
childData=append(childData,data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
childData = that.Db.Select("category", "*", Map{"parent_id": parentId})
|
||||||
}
|
}
|
||||||
|
|
||||||
childData := that.Db.Select("category", "*", Map{"parent_id": parentId})
|
|
||||||
|
|
||||||
for _, v := range childData {
|
for _, v := range childData {
|
||||||
v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")})
|
v["child"] = that.Db.Select("category", "*", Map{"parent_id": v.GetCeilInt("id")})
|
||||||
|
@ -42,9 +42,8 @@
|
|||||||
"4": "数据处理异常",
|
"4": "数据处理异常",
|
||||||
"5": "数据结果异常"
|
"5": "数据结果异常"
|
||||||
},
|
},
|
||||||
"mode": 2,
|
"mode": 0,
|
||||||
"port": "80",
|
"port": "80",
|
||||||
"sessionName": "HOTIME",
|
"sessionName": "HOTIME",
|
||||||
"smsYzmTpt": "【乐呵呵旅游网】您正在进行身份验证,验证码{验证码},打死不要告诉别人哦!!!",
|
|
||||||
"tpt": "tpt"
|
"tpt": "tpt"
|
||||||
}
|
}
|
@ -18,12 +18,12 @@ func main() {
|
|||||||
//RESTfull接口适配
|
//RESTfull接口适配
|
||||||
appIns.SetConnectListener(func(context *hotime.Context) bool {
|
appIns.SetConnectListener(func(context *hotime.Context) bool {
|
||||||
|
|
||||||
if context.RouterString[0] == "admin" {
|
if len(context.RouterString)>1&& context.RouterString[0] == "admin" {
|
||||||
if context.RouterString[1] == "hotime" && context.RouterString[2] == "login" {
|
if context.RouterString[1] == "hotime" && context.RouterString[2] == "login" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if context.Session("id").Data == nil {
|
if context.Session("admin_id").Data == nil {
|
||||||
context.Display(2, "你还没有登录")
|
context.Display(2, "你还没有登录")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
.el-upload{height:100px;width:100px;background:#eee;overflow:hidden}.el-upload img[data-v-6c7786a3]{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;display:block}.el-upload i[data-v-6c7786a3]{font-size:40px;margin:30% 31%;display:block}
|
|
@ -1 +0,0 @@
|
|||||||
.el-upload{height:100px;width:100px;background:#eee;overflow:hidden}.el-upload img[data-v-08891adc]{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;display:block}.el-upload i[data-v-08891adc]{font-size:40px;margin:30% 31%;display:block}
|
|
@ -1 +0,0 @@
|
|||||||
.not-show-tab-label .el-tabs__header,.not-show-tab-search{display:none}
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 66 KiB |
@ -1,3 +1,3 @@
|
|||||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>hotime</title><style>body{
|
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>hotime</title><style>body{
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}</style><link href="css/chunk-1c438cad.2fd7d31d.css" rel="prefetch"><link href="css/chunk-33a591b6.c9205cb6.css" rel="prefetch"><link href="css/chunk-7439f1d8.d21501a2.css" rel="prefetch"><link href="css/chunk-ef454b32.e4ca99de.css" rel="prefetch"><link href="js/chunk-1c438cad.3f82f09e.js" rel="prefetch"><link href="js/chunk-2d238068.ace3c99b.js" rel="prefetch"><link href="js/chunk-33a591b6.b442fc2f.js" rel="prefetch"><link href="js/chunk-3b58c314.349138a7.js" rel="prefetch"><link href="js/chunk-7439f1d8.1acd0ee6.js" rel="prefetch"><link href="js/chunk-c4f57cb2.0ec370ce.js" rel="prefetch"><link href="js/chunk-ef454b32.e8e8b1b2.js" rel="prefetch"><link href="css/app.40aa38f6.css" rel="preload" as="style"><link href="js/app.52f44003.js" rel="preload" as="script"><link href="css/app.40aa38f6.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but hotime doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/app.52f44003.js"></script></body></html>
|
}</style><link href="css/chunk-038340db.e4ca99de.css" rel="prefetch"><link href="css/chunk-0524801b.1e910850.css" rel="prefetch"><link href="css/chunk-1c438cad.2fd7d31d.css" rel="prefetch"><link href="css/chunk-1d1a12b6.8c684de3.css" rel="prefetch"><link href="css/chunk-2c1d9b2f.78c69bda.css" rel="prefetch"><link href="css/chunk-5ccac4d0.5f1c91ca.css" rel="prefetch"><link href="css/chunk-c569a38e.01bc1b83.css" rel="prefetch"><link href="css/chunk-c7a51d14.4a0871eb.css" rel="prefetch"><link href="js/chunk-038340db.3c8b0cb6.js" rel="prefetch"><link href="js/chunk-0524801b.de9b433f.js" rel="prefetch"><link href="js/chunk-14f17cfa.c5104e8c.js" rel="prefetch"><link href="js/chunk-1c438cad.72a22c19.js" rel="prefetch"><link href="js/chunk-1d1a12b6.6900cc01.js" rel="prefetch"><link href="js/chunk-2c1d9b2f.39065c9e.js" rel="prefetch"><link href="js/chunk-5b2ead63.af868ff8.js" rel="prefetch"><link href="js/chunk-5ccac4d0.98ff45de.js" rel="prefetch"><link href="js/chunk-68815fbc.04152d5f.js" rel="prefetch"><link href="js/chunk-c569a38e.16d55c64.js" rel="prefetch"><link href="js/chunk-c7a51d14.3cd28dc4.js" rel="prefetch"><link href="css/app.5e2eb449.css" rel="preload" as="style"><link href="js/app.f5f26baa.js" rel="preload" as="script"><link href="css/app.5e2eb449.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but hotime doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/app.f5f26baa.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-1c438cad"],{8497:function(e,a,t){"use strict";t("c45a")},c45a:function(e,a,t){},fdab:function(e,a,t){"use strict";t.r(a);var v=t("f2bf"),r=Object(v.hb)("data-v-b9167eee");Object(v.I)("data-v-b9167eee");var n={class:"hello"},b=Object(v.m)('<p data-v-b9167eee> For a guide and recipes on how to configure / customize this project,<br data-v-b9167eee> check out the <a href="https://cli.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>vue-cli documentation</a>. </p><h3 data-v-b9167eee>Installed CLI Plugins</h3><ul data-v-b9167eee><li data-v-b9167eee><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener" data-v-b9167eee>babel</a></li><li data-v-b9167eee><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener" data-v-b9167eee>eslint</a></li></ul><h3 data-v-b9167eee>Essential Links</h3><ul data-v-b9167eee><li data-v-b9167eee><a href="https://vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>Core Docs</a></li><li data-v-b9167eee><a href="https://forum.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>Forum</a></li><li data-v-b9167eee><a href="https://chat.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>Community Chat</a></li><li data-v-b9167eee><a href="https://twitter.com/vuejs" target="_blank" rel="noopener" data-v-b9167eee>Twitter</a></li><li data-v-b9167eee><a href="https://news.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>News</a></li></ul><h3 data-v-b9167eee>Ecosystem</h3><ul data-v-b9167eee><li data-v-b9167eee><a href="https://router.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>vue-router</a></li><li data-v-b9167eee><a href="https://vuex.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>vuex</a></li><li data-v-b9167eee><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener" data-v-b9167eee>vue-devtools</a></li><li data-v-b9167eee><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener" data-v-b9167eee>vue-loader</a></li><li data-v-b9167eee><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener" data-v-b9167eee>awesome-vue</a></li></ul>',7);Object(v.G)();var l=r(function(e,a,t,r,l,o){return Object(v.F)(),Object(v.j)("div",n,[Object(v.o)("h1",null,Object(v.S)(t.msg),1),b])}),r={name:"HelloWorld",props:{msg:String}};t("8497");r.render=l,r.__scopeId="data-v-b9167eee";a.default=r}}]);
|
|
@ -1 +0,0 @@
|
|||||||
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2d238068"],{fe2e:function(t,e,n){"use strict";n.r(e);var h=n("f2bf"),j=Object(h.hb)("data-v-9e95abd2"),n={data:function(){return{routerViewShow:!0,items:[]}},mounted:function(){this.routeInit()},methods:{createItems:function(t,e){return e.push({path:t.path,label:t.label,icon:t.icon,table:t.table}),e=null!=t.parent.path?this.createItems(t.parent,e):e},routeInit:function(){var t=this;this.routerViewShow=!1,setTimeout(function(){t.routerViewShow=!0},50);var e=window.Hotime.mapData[this.$route.path],n=[];null!=e&&((n=this.createItems(e,n)).reverse(),0!=n.length&&null==n[0].table&&(n[0].path="/"),this.items=n)}},watch:{$route:function(t){this.routeInit(t)}}};n.render=j(function(t,e,n,r,c,o){var a=Object(h.O)("el-breadcrumb-item"),u=Object(h.O)("el-breadcrumb"),i=Object(h.O)("el-header"),b=Object(h.O)("router-view"),l=Object(h.O)("el-container");return Object(h.F)(),Object(h.j)(l,{style:{height:"100%"}},{default:j(function(){return[Object(h.o)(i,{style:{height:"30px",padding:"0px"}},{default:j(function(){return[Object(h.o)(u,{"separator-class":"el-icon-arrow-right",style:{"margin-bottom":"30px"}},{default:j(function(){return[(Object(h.F)(!0),Object(h.j)(h.b,null,Object(h.M)(c.items,function(t){return Object(h.F)(),Object(h.j)(a,{key:t.path,to:{path:t.path}},{default:j(function(){return[Object(h.o)("i",{class:t.icon,style:{"margin-right":"3px"}},null,2),Object(h.n)(Object(h.S)(t.label),1)]}),_:2},1032,["to"])}),128))]}),_:1})]}),_:1}),Object(h.o)(l,{style:{"overflow-y":"auto"}},{default:j(function(){return[c.routerViewShow?(Object(h.F)(),Object(h.j)(b,{key:0},{default:j(function(t){var e=t.Component;return[Object(h.o)(h.e,{name:"el-zoom-in-center"},{default:j(function(){return[(Object(h.F)(),Object(h.j)(h.c,null,[(Object(h.F)(),Object(h.j)(Object(h.Q)(e)))],1024))]}),_:2},1024)]}),_:1})):Object(h.k)("",!0)]}),_:1})]}),_:1})}),n.__scopeId="data-v-9e95abd2";e.default=n}}]);
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user