Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]文章阅读数统计显示不正常 #157

Closed
2 of 12 tasks
leirock opened this issue Feb 21, 2021 · 6 comments
Closed
2 of 12 tasks

[BUG]文章阅读数统计显示不正常 #157

leirock opened this issue Feb 21, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@leirock
Copy link
Contributor

leirock commented Feb 21, 2021

问题描述 | Describe the bug

Hexo NexT 博客网址,首页文章阅读数统计显示的不是每一篇文章的阅读数,变成了首页的访问数(也就是每一篇的阅读数都一样了);点进文章后,阅读数显示是正常的。Docker 镜像是最新版的。

问题网站 | Website URL

https://blog.dlzhang.com

部署方式 | Deploy Type

  • 服务部署在哪里? | Where your waline deploy?
    • Vercel
    • CloudBase
    • Docker
    • VPS, Virtual Host
    • Other
  • 数据存储在哪里?| Where your comment data store?
@njzjz
Copy link
Contributor

njzjz commented Feb 21, 2021

@lei2rock +1 我也有这个问题

@YiHui-Liu
Copy link
Contributor

是Waline.min.js的问题,我将你的网站中Waline.min.js的来源修改为我自己用的之后,恢复正常
image
你可以下载我的Waline.min.js进行对比:https://fox-file.oss-cn-beijing.aliyuncs.com/Waline.min.js

@leirock
Copy link
Contributor Author

leirock commented Feb 22, 2021

@YiHui-Liu 我用的是 waline 官方最新的 waline.min.js,所以既然出现了问题,这个 waline.min.js 肯定是有问题

@lizheming lizheming added the bug Something isn't working label Feb 23, 2021
@njzjz
Copy link
Contributor

njzjz commented Feb 27, 2021

应该是b00dc64 的问题,add函数中postVisitCount的参数是location.pathname,而showfetchVisitCount的参数是ids.join()
这就相当于,原来的操作是,add location.pathname & show ids.join(),现在变成了add location.pathname & show location.pathname,
在post页面,location.pathnameids.join()是相同的,但首页是不同的。

解决方案可能有:把location.pathnameids.join()都传到server上,或者干脆只传ids.join()location.pathname
不过我没理解为什么add和show的参数不一样。。。不应该统一吗。。。
另外 path ? Visitor.add({serverURL, path}) : Visitor.show({serverURL});这个好像没用,path不可能为空。

@lizheming
Copy link
Collaborator

@njzjz path 这块的逻辑有点问题,在于之前根据 @njzjz 反馈的需求把阅读统计和阅读展现放一块了,所以导致了现在 path 没有用了。

阅读统计需要考虑两个场景:

  1. 列表页多文章统计数据展现
  2. 文章页单文章统计数据展现,需要展示当前展现更新后的数据

如你所说把 location.pathname 和 ids.join() 都传过去应该是可以解决问题的,不过我还在思考有没有更好的解决方法。

@lizheming
Copy link
Collaborator

@waline/client@0.14.8 已修复该问题,感谢反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants