diff --git a/README.md b/README.md index 294303e..10bd3fc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,23 @@ ->bash + [点击预览效果](https://www.aiprose.com/) https://www.aiprose.com + + +· 项目源码: 点击查看 + +· 项目框架: + +golang 1.11 + +beego:1.7.2 [beego官网](beego官网) + +阿里UI: [sui3官网](http://sui3.taobao.org/) + +富文本编辑器: [wangeditor官网](http://www.wangeditor.com/) + +数据库: mysql(5.5.60-MariaDB) + +·项目搭建步骤: + +* 安装配置golang 最新版本 (开发最好安装一下bee) * go get github.com/astaxie/beego @@ -6,4 +25,6 @@ * go get github.com/go-sql-driver/mysql -* go get github.com/olivere/elastic \ No newline at end of file +* go get github.com/olivere/elastic + +* windows环境需要安装gcc [gcc下载地址](http://tdm-gcc.tdragon.net/download) \ No newline at end of file diff --git a/controllers/BlogController.go b/controllers/BlogController.go index d0f1b5e..e1f2fee 100644 --- a/controllers/BlogController.go +++ b/controllers/BlogController.go @@ -114,11 +114,13 @@ func (this *BlogController) Get() { this.Data["UserId"] = this.GetSession("userid") this.Data["HeadImg"] = this.GetSession("headimg") this.Data["NickName"] = this.GetSession("nickname") - this.Data["UserId"] = this.GetSession("userid") this.Data["IsLogin"] = this.GetSession("nickname") != nil + this.Data["IsDDesc"] = true this.TplName = "blog.html" - service.CountBrows(blog.UserId) - service.EditBlogBrows(id) + if this.Ctx.Input.GetData("refresh") != true { + service.CountBrows(blog.UserId) + service.EditBlogBrows(id) + } return } diff --git a/controllers/PageController.go b/controllers/PageController.go index 36f23bd..6ca69e9 100644 --- a/controllers/PageController.go +++ b/controllers/PageController.go @@ -56,6 +56,10 @@ func (this *PageController) IframeNote() { // @router /us func (this *PageController) UsPage() { this.Data["IsUs"] = true + this.Data["UserId"] = this.GetSession("userid") + this.Data["HeadImg"] = this.GetSession("headimg") + this.Data["NickName"] = this.GetSession("nickname") + this.Data["IsLogin"] = this.GetSession("nickname") != nil this.TplName = "us.html" } diff --git a/controllers/UserController.go b/controllers/UserController.go index fb07cc2..812c23d 100644 --- a/controllers/UserController.go +++ b/controllers/UserController.go @@ -44,6 +44,7 @@ func (this *UserController) UserInfo() { this.Data["HeadImg"] = this.GetSession("headimg") this.Data["NickName"] = this.GetSession("nickname") this.Data["IsLogin"] = this.GetSession("nickname") != nil + this.Data["IsDDesc"] = true this.TplName = "user.html" return } diff --git a/filter/Security.go b/filter/Security.go index 70e28fc..9d2a801 100644 --- a/filter/Security.go +++ b/filter/Security.go @@ -6,8 +6,14 @@ import ( ) var FilterAdmin = func(ctx *context.Context) { - url := ctx.Input.URL() + url := ctx.Input.URI() + refer := ctx.Input.Refer() logs.Info(url) + //logs.Info(refer) + //logs.Info("https://www.aiprose.com"+url) + if "https://www.aiprose.com"+url == refer { + ctx.Input.SetData("refresh", true) + } //beego.Informational(url) //if url != "/login"{ // ctx.Redirect(302, "/login") diff --git a/models/DataInit.go b/models/DataInit.go index 01e4b7b..0d2512c 100644 --- a/models/DataInit.go +++ b/models/DataInit.go @@ -23,6 +23,6 @@ func RegistDB() { //orm.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite) //orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10) - orm.RegisterModel(new(Attachment),new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment)) + orm.RegisterModel(new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment)) orm.RegisterDataBase("default", "mysql", "root:booszy@tcp(127.0.0.1:3306)/beeblog?charset=utf8&loc=Local", 30) } \ No newline at end of file diff --git a/service/BlogService.go b/service/BlogService.go index d03a6e4..ac18441 100644 --- a/service/BlogService.go +++ b/service/BlogService.go @@ -156,7 +156,7 @@ func SaveBlog(blog *models.Blog, strs []string) error { func EditBlog(blog *models.Blog, strs []string) error { o := orm.NewOrm() o.Begin() - id, eror := o.Update(blog) + _, eror := o.Update(blog) if eror != nil { o.Rollback() return eror @@ -165,7 +165,7 @@ func EditBlog(blog *models.Blog, strs []string) error { if strs != nil && len(strs) > 0 { nlabels := make([]*models.NLabel, len(strs)) for i := 0; i < len(strs); i++ { - nlabels[i] = &models.NLabel{Title: strs[i], BlogId: id, UserId: blog.UserId} + nlabels[i] = &models.NLabel{Title: strs[i], BlogId: blog.Id, UserId: blog.UserId} } if _, err := o.InsertMulti(len(nlabels), nlabels); err != nil { o.Rollback() diff --git a/service/CommentService.go b/service/CommentService.go index 7597dc0..155d222 100644 --- a/service/CommentService.go +++ b/service/CommentService.go @@ -9,7 +9,7 @@ import ( func FindCommentByBlog(bid int64) ([]*models.Comment, error) { var comms []*models.Comment o := orm.NewOrm() - _, err := o.QueryTable(&models.Comment{}).Filter("Pid", 0).OrderBy("-Ctime").All(&comms) + _, err := o.QueryTable(&models.Comment{}).Filter("Pid", 0).Filter("BlogId",bid).OrderBy("-Ctime").All(&comms) if err != nil { return nil, err } diff --git a/static/css/me.css b/static/css/me.css index 2cc2b68..24b9ca4 100644 --- a/static/css/me.css +++ b/static/css/me.css @@ -65,6 +65,12 @@ height: 110px; padding: 0 4%; } + +.me-blog-footer{ + height: 110px; + padding: 0 4%; + margin-left: 290px; +} .info-header{ flex: 1; } diff --git a/static/img/2.png b/static/img/2.png deleted file mode 100644 index 3376619..0000000 Binary files a/static/img/2.png and /dev/null differ diff --git a/static/img/redalipay.png b/static/img/redalipay.png new file mode 100644 index 0000000..b6f6e86 Binary files /dev/null and b/static/img/redalipay.png differ diff --git a/static/img/snow.png b/static/img/snow.png new file mode 100644 index 0000000..6f4c56f Binary files /dev/null and b/static/img/snow.png differ diff --git a/views/T.footer.tpl b/views/T.footer.tpl index e6c3169..114b516 100644 --- a/views/T.footer.tpl +++ b/views/T.footer.tpl @@ -8,7 +8,7 @@ - diff --git a/views/uinfo.html b/views/uinfo.html index 232c43b..71c6112 100644 --- a/views/uinfo.html +++ b/views/uinfo.html @@ -1,5 +1,5 @@ -{{template "header"}} -博客 - 个人随笔 +{{template "header" .}} +我的资料 - 云悦 diff --git a/views/ulike.html b/views/ulike.html index 5bb9045..b813a31 100644 --- a/views/ulike.html +++ b/views/ulike.html @@ -1,5 +1,5 @@ -{{template "header"}} -博客 - 个人随笔 +{{template "header" .}} +博客 - 云悦 @@ -48,7 +48,7 @@ - diff --git a/views/unote.html b/views/unote.html index 2a94366..ddeb7af 100644 --- a/views/unote.html +++ b/views/unote.html @@ -1,5 +1,5 @@ -{{template "header"}} -博客 - 个人随笔 +{{template "header" .}} +博客 - 云悦 diff --git a/views/us.html b/views/us.html index 217b0d4..0dc5464 100644 --- a/views/us.html +++ b/views/us.html @@ -1,13 +1,13 @@ -{{template "header"}} - -关于我们 - 个人随笔 +{{template "header" .}} + +福利 - 云悦 {{template "nav" .}}

Hello, world!

-

个人随笔2.0(golang)版本正式上线

+

云悦 2.0(golang)版本正式上线

@@ -29,8 +29,9 @@
- - + + +
diff --git a/views/user.html b/views/user.html index b2d2acb..e78ff6e 100644 --- a/views/user.html +++ b/views/user.html @@ -1,7 +1,8 @@ -{{template "header"}} +{{template "header" .}} -【{{.User.NickName}}】个人主页 - 个人随笔 + content="{{.User.NickName}}主页,云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose"> + +【{{.User.NickName}}】个人主页 - 云悦