From b9bbae64645bedffe73f8c2123b9a7ed29f05936 Mon Sep 17 00:00:00 2001 From: "mail_yanpeng@163.com" Date: Thu, 16 May 2019 14:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9D=9E=E5=9D=97=E7=BA=A7?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=20&=20=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 34 ++++++++++++++++++++++++++++------ static/css/common.css | 5 +++++ static/css/common.min.css | 3 +-- views/blog.html | 1 - 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index dae5616..337ec24 100644 --- a/main.go +++ b/main.go @@ -1,15 +1,37 @@ package main import ( + "beeblog/filter" + "beeblog/models" _ "beeblog/routers" "github.com/astaxie/beego" - "beeblog/models" "github.com/astaxie/beego/logs" "github.com/astaxie/beego/orm" - "beeblog/filter" "github.com/astaxie/beego/plugins/cors" + "github.com/olivere/elastic" + "log" + "os" + "time" ) + +var host = "http://47.98.109.5:8209/" + +func connect() *elastic.Client { + client, err := elastic.NewClient( + elastic.SetURL(host), + elastic.SetSniff(false), + elastic.SetHealthcheckInterval(10*time.Second), + elastic.SetGzip(true), + elastic.SetErrorLog(log.New(os.Stderr, "ELASTIC ", log.LstdFlags)), + elastic.SetInfoLog(log.New(os.Stdout, "", log.LstdFlags))) + + if err != nil { + panic(err) + } + return client +} + func init() { models.RegistDB() beego.InsertFilter("/*", beego.BeforeRouter, filter.LogFilter) @@ -19,10 +41,8 @@ func main() { orm.Debug = false orm.RunSyncdb("default", false, true) beego.AddFuncMap("NAdd",NAdd) - //beego.SetLevel(beego.LevelInformational) - //logs.LevelDebug - //beego.SetLogger("file", `{"filename":"/opt/logs/aiprose.log"}`) - logs.SetLogger(logs.AdapterFile, `{"filename":"test.log","level":3}`) + + logs.SetLogger(logs.AdapterFile, `{"filename":"/opt/logs/aiprose.log","level":3}`) beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, @@ -30,6 +50,8 @@ func main() { ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, AllowCredentials: true, })) + //client := connect() + //fmt.Println("client", client) beego.Run() } diff --git a/static/css/common.css b/static/css/common.css index 9fdd65b..51322d1 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -607,4 +607,9 @@ img { .amap-logo,.amap-copyright { display: none !important; visibility: hidden !important; +} + +.blog-detaile p code{ + color: red; + padding: 2px 5px; } \ No newline at end of file diff --git a/static/css/common.min.css b/static/css/common.min.css index a7cb106..09d8fba 100644 --- a/static/css/common.min.css +++ b/static/css/common.min.css @@ -1,2 +1 @@ -body{font-size:14px!important;background:#fff;color:#353535}a{color:#28a3ef;text-decoration:none}.layui-nav{text-align:right}.navbar-default{border-color:#f8d9ea!important}.img-circle-large{width:110px;height:110px}.root-container{height:100%;width:100%;max-width:100%}.nav-container{max-height:50px;position:fixed;width:100%;z-index:1000;left:0;top:0}.nav-container li a:hover{transform:rotate(5deg) scale(1.1)}.nav-container p{display:inline-block;float:left;line-height:48px;font-size:20px}.layui-nav .layui-this:after,.layui-nav-bar,.layui-nav-tree .layui-nav-itemed:after{height:2px}::-webkit-scrollbar{width:1px}::-webkit-scrollbar-track-piece{background-color:rgba(0,0,0,0);-webkit-border-radius:6px}.cursor{cursor:pointer}.footer-root{color:rgba(255,255,255,.7);position:relative;width:100%;height:105px;display:flex}.footer-friend{text-align:center;height:25px;line-height:25px}.footer-friend a{color:rgba(255,255,255,.7);text-decoration:none}.img-circle{width:36px;height:36px;border-radius:50%}.login-footer .wxcode{margin-right:20px}.layui-nav .layui-nav-item{line-height:48px}.footer-container{background-color:#393d49;padding:30px 5% 0 5%}.pagination{margin:18px 0}.pagination ul li{line-height:20px;width:20px;height:20px;display:inline-block;border-color:#28a3ef;font-size:16px}.pagination ul li .next .prev{font-size:20px!important}.pagination ul .active{background-color:#28a3ef}.pagination ul .active a{color:#fff}.breadcrumb-container{padding:20px}.blog-root{height:100%;width:68%;margin:40px auto}.blog-root .blog-title{margin:60px 0 20px 0;text-align:center}.blog-root .blog-detaile{color:#2f2f2f}.blog-root .blog-detaile pre{border:1px #d2e8b9 solid;box-shadow:1px 1px 2px 2px #d2e8b9;margin:5px 0}.blog-root .blog-detaile h4{font-size:20px;font-weight:500}.blog-user{position:fixed;top:60px;left:5px;width:100px;height:100%;background-color:#f9f9f9}.blog-info{padding:15px}.blog-info .blog-author{display:flex}.blog-info .blog-author .author-headimg{display:inline-block;width:48px;height:48px}.blog-info .blog-author .blog-label{flex:1;height:22px;line-height:22px;text-align:right;padding-top:26px}.blog-info .blog-author .blog-label label{color:#888;border:1px dotted #aaa;padding:5px;border-radius:5px;font-size:10px}.blog-info .blog-author .author-headimg .img-circle{width:48px!important;height:48px!important;margin-top:0!important}.blog-info .blog-author .author-info{display:inline-block;height:48px!important;vertical-align:bottom;text-align:left;margin-left:5px}.blog-info .blog-author .author-info a{display:inline-block;height:28px;line-height:28px;font-size:16px}.blog-info .blog-author .author-info span{display:inline-block;height:20px;line-height:20px;font-size:12px;color:#888;padding-right:8px}.blog-info em{padding:0 8px!important}.comms-root{width:68%;margin:0 auto}.comms-root a{text-decoration:none}img{max-width:100%!important}.blog-referral{width:100%;margin:40px auto}.blog-referral p{padding:3px 0}.layui-code-view .layui-code-ol li{margin-left:0!important}.home-container{height:100%;margin:50px 5% 0 5%}.home-container hr{margin:0}.home-hearder{margin:10px 0;display:flex;height:30px;line-height:30px}.home-hearder .m-select{color:#353535;width:150px;display:inline-block;height:32px;border-radius:3px;padding:4px 14px}.home-hearder .layui-btn-group .active a{color:#fff}.home-hearder .layui-btn-group a{color:#353535;text-decoration:none}.nelson-btn{color:#ec6149!important;border-radius:15px;border:1px solid #bbb!important}.nelson-btn:hover{background:#fff!important;color:#ec6149!important;border-radius:15px;border:1px solid #ec6149!important}.home-content{display:flex;min-height:50px;line-height:50px}.home-content-title{display:inline-block;font-size:16px;flex:1}.home-content-desc{display:flex}.home-content-desc span{display:inline-block;text-align:center}.blog-root h5{color:#888;font-size:14px;margin:9px 0;font-family:inherit;font-weight:700;line-height:1.5}.blog-root a{text-decoration:none}.blog-root p{margin:1px 0 9px}.login-root{background:#f0e7db url("/static/img/login.png") no-repeat;position:absolute;min-height:100%;width:100%;overflow:hidden}.login-root .input-container{position:fixed;left:65%;top:33px;background:url("/static/img/loginbg.png") no-repeat center top}.login-root .input-container .input-root{width:370px;height:500px}.login-root .input-container .input-root p{font-size:21px;text-align:center;padding-top:195px}.login-root .input-container .input-root .inputs-class{padding:0 50px}.login-root .input-container .input-root .input-group{display:table;border-collapse:separate}.login-root .input-container .input-root .inputs-class .input-class{height:32px;margin:18px 0;display:flex}.login-root .input-container .input-root .inputs-class .input-class input{flex:1;height:26px!important;padding:2px 14px;font-size:12px;line-height:1.5;border-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0;display:table-cell;border:1px solid #ccc}.login-root .input-container .input-root .inputs-class .input-class .input-group-addon{color:#555;line-height:26px!important;font-size:12px;padding:2px 14px;line-height:1.5;border-radius:3px;display:table-cell;border:1px solid #ccc;border-right:0} -.login-footer{position:absolute;bottom:0;left:0;width:100%;height:110px}.login-root{background:#f0e7db url("/static/img/login.png") no-repeat;position:absolute;min-height:100%;width:100%;overflow:hidden}.login-root .input-container{position:fixed;left:65%;top:33px;background:url("/static/img/loginbg.png") no-repeat center top}.login-root .input-container .input-root{width:370px;height:500px}.login-root .input-container .input-root p{font-size:21px;text-align:center;padding-top:195px}.login-root .input-container .input-root .inputs-class{padding:0 50px}.login-root .input-container .input-root .input-group{display:table;border-collapse:separate}.login-root .input-container .input-root .inputs-class .input-class{height:32px;margin:18px 0;display:flex}.login-root .input-container .input-root .inputs-class .input-class input{flex:1;height:26px!important;padding:2px 14px;font-size:12px;line-height:1.5;border-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0;display:table-cell;border:1px solid #ccc}.login-root .input-container .input-root .inputs-class .input-class .input-group-addon{color:#555;line-height:26px!important;font-size:12px;padding:2px 14px;line-height:1.5;border-radius:3px;display:table-cell;border:1px solid #ccc;border-right:0}.login-footer{position:absolute;bottom:0;left:0;width:100%;height:110px}.me-menu{position:fixed;top:60px;left:20px;width:260px;height:100%;background-color:#f9f9f9}.me-menu p{cursor:pointer;font-size:15px;color:#555;margin:0;height:32px;line-height:32px}.me-menu .active{color:#3cbef8!important}.me-menu p a{margin-left:5px;color:#555;text-decoration:none}.me-menu .active span{display:inline-block;height:100%;width:2px;background-color:#3cbef8}.me-menu .active a{color:#3cbef8;vertical-align:top;height:32px;line-height:32px;display:inline-block}.me-blog-root{height:100%;margin:50px 4% 0 0}.me-blog-list{margin-left:300px}.me-blog-list p{height:30px;line-height:30px;margin:0;font-size:15px}.me-footer{position:absolute;bottom:0;left:0;width:100%;height:110px;padding:0 4%}.me-blog-footer{height:110px;padding:0 4%;margin-left:290px}.info-header{flex:1}.info-header span{margin-right:6px}.uinfo{color:#515a6e;margin:5px}.udesc span{margin-right:8px}.blog-list{display:flex;font-size:16px;min-height:35px;line-height:35px}.us-root{margin-top:50px;display:flex;margin-left:5%;font-size:16px;min-height:720px;height:100%}.us-root p{padding:5px 0;color:#323232}.blog-title{display:flex;height:50px;line-height:50px}.blog-title input{padding-left:12px;flex:1;height:44px;border:0}.blog-title button{height:32px;color:#fff;margin-top:9px}.w-e-toolbar{height:40px;line-height:30px}.map-root{position:absolute;width:100%;height:100%;left:0;top:0}.map-root .map-container{width:100%;height:100%}.amap-logo,.amap-copyright{display:none!important;visibility:hidden!important} \ No newline at end of file +body{font-size:14px !important;background:#fff;color:#353535;}a{color:#28a3ef;text-decoration:none;}.layui-nav{text-align:right;}.navbar-default{border-color:#f8d9ea !important;}.img-circle-large{width:110px;height:110px;}.root-container{height:100%;width:100%;max-width:100%;}.nav-container{max-height:50px;position:fixed;width:100%;z-index:1000;left:0;top:0;}.nav-container li a:hover{transform:rotate(5deg) scale(1.1);}.nav-container p{display:inline-block;float:left;line-height:48px;font-size:20px;}.layui-nav .layui-this:after,.layui-nav-bar,.layui-nav-tree .layui-nav-itemed:after{height:2px;}::-webkit-scrollbar{width:1px;}::-webkit-scrollbar-track-piece{background-color:rgba(0,0,0,0);-webkit-border-radius:6px;}.cursor{cursor:pointer}.footer-root{color:rgba(255,255,255,.7);position:relative;width:100%;height:105px;display:flex;}.footer-friend{text-align:center;height:25px;line-height:25px;}.footer-friend a{color:rgba(255,255,255,.7);text-decoration:none;}.img-circle{width:36px;height:36px;border-radius:50%;}.login-footer .wxcode{margin-right:20px;}.layui-nav .layui-nav-item{line-height:48px;}.footer-container{background-color:#393D49;padding:30px 5% 0 5%;}.pagination{margin:18px 0;}.pagination ul li{line-height:20px;width:20px;height:20px;display:inline-block;border-color:#28a3ef;font-size:16px;}.pagination ul li .next .prev{font-size:20px !important;}.pagination ul .active{background-color:#28a3ef;}.pagination ul .active a{color:#fff;}.breadcrumb-container{padding:20px;}.blog-root{height:100%;width:68%;margin:40px auto;}.blog-root .blog-title{margin:60px 0 20px 0;text-align:center}.blog-root .blog-detaile{color:#2f2f2f;}.blog-root .blog-detaile pre{border:1px #d2e8b9 solid;box-shadow:1px 1px 2px 2px #d2e8b9;margin:5px 0;}.blog-root .blog-detaile h4{font-size:20px;font-weight:500;}.blog-user{position:fixed;top:60px;left:5px;width:100px;height:100%;background-color:#f9f9f9;}.blog-info{padding:15px;}.blog-info .blog-author{display:flex;}.blog-info .blog-author .author-headimg{display:inline-block;width:48px;height:48px;}.blog-info .blog-author .blog-label{flex:1;height:22px;line-height:22px;text-align:right;padding-top:26px;}.blog-info .blog-author .blog-label label{color:#888;border:1px dotted #aaa;padding:5px;border-radius:5px;font-size:10px;}.blog-info .blog-author .author-headimg .img-circle{width:48px !important;height:48px !important;margin-top:0px !important;}.blog-info .blog-author .author-info{display:inline-block;height:48px !important;vertical-align:bottom;text-align:left;margin-left:5px;}.blog-info .blog-author .author-info a{display:inline-block;height:28px;line-height:28px;font-size:16px;}.blog-info .blog-author .author-info span{display:inline-block;height:20px;line-height:20px;font-size:12px;color:#888;padding-right:8px;}.blog-info em{padding:0 8px !important;}.comms-root{width:68%;margin:0 auto;}.comms-root a{text-decoration:none;}img{max-width:100% !important;}.blog-referral{width:100%;margin:40px auto;}.blog-referral p{padding:3px 0;}.layui-code-view .layui-code-ol li{margin-left:0px !important;}.home-container{height:100%;margin:50px 5% 0 5%;}.home-container hr{margin:0;}.home-hearder{margin:10px 0;display:flex;height:30px;line-height:30px;}.home-hearder .m-select{color:#353535;width:150px;display:inline-block;height:32px;border-radius:3px;padding:4px 14px;}.home-hearder .layui-btn-group .active a{color:#fff;}.home-hearder .layui-btn-group a{color:#353535;text-decoration:none;}.nelson-btn{color:#ec6149 !important;border-radius:15px;border:1px solid #bbb !important;}.nelson-btn:hover{background:#fff !important;color:#ec6149 !important;border-radius:15px;border:1px solid #ec6149 !important;}.home-content{display:flex;min-height:50px;line-height:50px;}.home-content-title{display:inline-block;font-size:16px;flex:1;}.home-content-desc{display:flex}.home-content-desc span{display:inline-block;text-align:center}.blog-root h5{color:#888;font-size:14px;margin:9px 0;font-family:inherit;font-weight:700;line-height:1.5;}.blog-root a{text-decoration:none;}.blog-root p{margin:1px 0 9px;}.login-root{background:#f0e7db url("/static/img/login.png") no-repeat;position:absolute;min-height:100%;width:100%;overflow:hidden;}.login-root .input-container{position:fixed;left:65%;top:33px;background:url("/static/img/loginbg.png") no-repeat center top;}.login-root .input-container .input-root{width:370px;height:500px;}.login-root .input-container .input-root p{font-size:21px;text-align:center;padding-top:195px;}.login-root .input-container .input-root .inputs-class{padding:0 50px;}.login-root .input-container .input-root .input-group{display:table;border-collapse:separate;}.login-root .input-container .input-root .inputs-class .input-class{height:32px;margin:18px 0;display:flex;}.login-root .input-container .input-root .inputs-class .input-class input{flex:1;height:26px !important;padding:2px 14px;font-size:12px;line-height:1.5;border-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0;display:table-cell;border:1px solid #ccc;}.login-root .input-container .input-root .inputs-class .input-class .input-group-addon{color:#555;line-height:26px !important;font-size:12px;padding:2px 14px;line-height:1.5;border-radius:3px;display:table-cell;border:1px solid #ccc;border-right:none;}.login-footer{position:absolute;bottom:0;left:0;width:100%;height:110px;}.login-root{background:#f0e7db url("/static/img/login.png") no-repeat;position:absolute;min-height:100%;width:100%;overflow:hidden;}.login-root .input-container{position:fixed;left:65%;top:33px;background:url("/static/img/loginbg.png") no-repeat center top;}.login-root .input-container .input-root{width:370px;height:500px;}.login-root .input-container .input-root p{font-size:21px;text-align:center;padding-top:195px;}.login-root .input-container .input-root .inputs-class{padding:0 50px;}.login-root .input-container .input-root .input-group{display:table;border-collapse:separate;}.login-root .input-container .input-root .inputs-class .input-class{height:32px;margin:18px 0;display:flex;}.login-root .input-container .input-root .inputs-class .input-class input{flex:1;height:26px !important;padding:2px 14px;font-size:12px;line-height:1.5;border-radius:3px;border-top-left-radius:0;border-bottom-left-radius:0;display:table-cell;border:1px solid #ccc;}.login-root .input-container .input-root .inputs-class .input-class .input-group-addon{color:#555;line-height:26px !important;font-size:12px;padding:2px 14px;line-height:1.5;border-radius:3px;display:table-cell;border:1px solid #ccc;border-right:none;}.login-footer{position:absolute;bottom:0;left:0;width:100%;height:110px;}.me-menu{position:fixed;top:60px;left:20px;width:260px;height:100%;background-color:#f9f9f9;}.me-menu p{cursor:pointer;font-size:15px;color:#555;margin:0;height:32px;line-height:32px;}.me-menu .active{color:#3CBEF8 !important}.me-menu p a{margin-left:5px;color:#555;text-decoration:none;}.me-menu .active span{display:inline-block;height:100%;width:2px;background-color:#3CBEF8;}.me-menu .active a{color:#3CBEF8;vertical-align:top;height:32px;line-height:32px;display:inline-block;}.me-blog-root{height:100%;margin:50px 4% 0 0;}.me-blog-list{margin-left:300px;}.me-blog-list p{height:30px;line-height:30px;margin:0;font-size:15px;}.me-footer{position:absolute;bottom:0;left:0;width:100%;height:110px;padding:0 4%;}.me-blog-footer{height:110px;padding:0 4%;margin-left:290px;}.info-header{flex:1;}.info-header span{margin-right:6px;}.uinfo{color:#515a6e;margin:5px;}.udesc span{margin-right:8px;}.blog-list{display:flex;font-size:16px;min-height:35px;line-height:35px;}.us-root{margin-top:50px;display:flex;margin-left:5%;font-size:16px;min-height:720px;height:100%;}.us-root p{padding:5px 0;color:#323232;}.blog-title{display:flex;height:50px;line-height:50px;}.blog-title input{padding-left:12px;flex:1;height:44px;border:0;}.blog-title button{height:32px;color:#fff;margin-top:9px;}.w-e-toolbar{height:40px;line-height:30px;}.map-root{position:absolute;width:100%;height:100%;left:0;top:0;}.map-root .map-container{width:100%;height:100%;}.amap-logo,.amap-copyright{display:none !important;visibility:hidden !important;}.blog-detaile p code{color:red;padding:2px 5px;} \ No newline at end of file diff --git a/views/blog.html b/views/blog.html index 9d0ad2c..eec1bcd 100644 --- a/views/blog.html +++ b/views/blog.html @@ -2,7 +2,6 @@ {{.Blog.Title}} - 码农随笔 -