Browse Source

防止刷新获取阅读量

layui
mail_yanpeng@163.com 6 years ago
parent
commit
41ba02113e
  1. 6
      controllers/BlogController.go
  2. 7
      filter/Security.go
  3. 4
      views/blog.html
  4. 9
      views/index.html
  5. 4
      views/login.html
  6. 4
      views/map.html
  7. 8
      views/us.html
  8. 4
      views/user.html

6
controllers/BlogController.go

@ -116,8 +116,10 @@ func (this *BlogController) Get() {
this.Data["NickName"] = this.GetSession("nickname") this.Data["NickName"] = this.GetSession("nickname")
this.Data["IsLogin"] = this.GetSession("nickname") != nil this.Data["IsLogin"] = this.GetSession("nickname") != nil
this.TplName = "blog.html" this.TplName = "blog.html"
service.CountBrows(blog.UserId) if this.Ctx.Input.GetData("refresh") != true {
service.EditBlogBrows(id) service.CountBrows(blog.UserId)
service.EditBlogBrows(id)
}
return return
} }

7
filter/Security.go

@ -6,8 +6,13 @@ import (
) )
var FilterAdmin = func(ctx *context.Context) { var FilterAdmin = func(ctx *context.Context) {
url := ctx.Input.URL() url := ctx.Input.URI()
refer := ctx.Input.Refer()
site := ctx.Input.Site()
logs.Info(url) logs.Info(url)
if site+url == refer {
ctx.Input.SetData("refresh",true)
}
//beego.Informational(url) //beego.Informational(url)
//if url != "/login"{ //if url != "/login"{
// ctx.Redirect(302, "/login") // ctx.Redirect(302, "/login")

4
views/blog.html

@ -148,7 +148,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -157,7 +157,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
function recomm(pid, flag) { function recomm(pid, flag) {
layer.prompt({title: '请输入评论内容', value: name, formType: 2}, function (val, index) { layer.prompt({title: '请输入评论内容', value: name, formType: 2}, function (val, index) {

9
views/index.html

@ -8,7 +8,10 @@
<div class="jumbotron" style="margin-top: 41px;padding-left: 50px;margin-bottom: 10px"> <div class="jumbotron" style="margin-top: 41px;padding-left: 50px;margin-bottom: 10px">
<h1>Hello, world!</h1> <h1>Hello, world!</h1>
<p>云悦 2.0(golang)版本正式上线</p> <p>云悦 2.0(golang)版本正式上线</p>
<p><a class="btn btn-primary btn-lg" href="/us" role="button">Learn more</a></p> <p>
<a class="btn btn-primary btn-lg" href="/us" role="button">Learn more</a>
<a class="btn btn-primary btn-lg" href="/blog/new" target="_blank" role="button">写文章</a>
</p>
</div> </div>
<div style="margin: 0 5%" class="blog-root"> <div style="margin: 0 5%" class="blog-root">
<div style="display: flex"> <div style="display: flex">
@ -62,7 +65,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -71,7 +74,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
</script> </script>
</html> </html>

4
views/login.html

@ -78,7 +78,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -87,7 +87,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
</script> </script>
</html> </html>

4
views/map.html

@ -67,7 +67,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -76,7 +76,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
</script> </script>
</html> </html>

8
views/us.html

@ -1,6 +1,6 @@
{{template "header"}} {{template "header"}}
<meta name="keywords" content="关于我们,源码下载,程序部署步骤,云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose"> <meta name="keywords" content="福利,源码下载,程序部署步骤,云悦,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>关于我们 - 云悦</title> <title>福利 - 云悦</title>
<link type="text/css" rel="styleSheet" href="/static/css/us.css"/> <link type="text/css" rel="styleSheet" href="/static/css/us.css"/>
</head> </head>
<body> <body>
@ -53,7 +53,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -62,7 +62,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
</script> </script>
</html> </html>

4
views/user.html

@ -78,7 +78,7 @@
s.parentNode.insertBefore(bp, s); s.parentNode.insertBefore(bp, s);
/*360收录*/ /*360收录*/
/* var qihuo = document.createElement('script'); var qihuo = document.createElement('script');
if (curProtocol === 'https') { if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c'; qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
} }
@ -87,7 +87,7 @@
} }
qihuo.id = "sozz" qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1]; var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);*/ s.parentNode.insertBefore(qihuo, s);
}) })
</script> </script>
</html> </html>
Loading…
Cancel
Save