多说评论导入到typecho本地

插件开发及发布

版主: woniou

回复
头像
elilin
帖子: 11
注册时间: 2014年 12月 4日 11:25
联系:

多说评论导入到typecho本地

帖子 elilin »

最近感觉多说的服务器经常性的抽风,所以想撤掉多说用回typecho自带的评论

请问我要怎么才能把多说所有的评论导入到typecho?或者能导入多说导出的json文件也行?

谢谢
一笑奈何
帖子: 47
注册时间: 2015年 5月 19日 20:01
来自: https://www.198804.cn/
联系:

Re: 多说评论导入到typecho本地

帖子 一笑奈何 »

嗯,多说总是打开突然就慢了, 结果导数据,给我博客弄的 到处都是重复的评论, 删了好久
头像
ClayMore
帖子: 2483
注册时间: 2007年 11月 29日 02:55
来自: Sleeping Forest
联系:

Re: 多说评论导入到typecho本地

帖子 ClayMore »

多说插件默认设置是同步的 不用再导出


__________________

新版阿里百秀Alibaixiu主题 v11.1 For Typecho
http://xiu.160.me/
头像
elilin
帖子: 11
注册时间: 2014年 12月 4日 11:25
联系:

Re: 多说评论导入到typecho本地

帖子 elilin »

ClayMore 写了:多说插件默认设置是同步的 不用再导出


__________________

新版阿里百秀Alibaixiu主题 v11.1 For Typecho
http://xiu.160.me/


我是说导回到本地服务器,不用多说了
头像
ClayMore
帖子: 2483
注册时间: 2007年 11月 29日 02:55
来自: Sleeping Forest
联系:

Re: 多说评论导入到typecho本地

帖子 ClayMore »

就是多说插件会自动和本地评论同步的



__________________

新版阿里百秀Alibaixiu主题 v11.1 For Typecho
http://xiu.160.me/
wujunze
帖子: 9
注册时间: 2015年 10月 16日 09:46

Re: 多说评论导入到typecho本地

帖子 wujunze »

我的多说插件并没有同步啊 233333
vc12345679
帖子: 6
注册时间: 2016年 9月 8日 00:59

Re: 多说评论导入到typecho本地

帖子 vc12345679 »

作为菜鸟,不太懂,抛砖引玉一下

多说的json定义 http://dev.duoshuo.com/docs/500fc3cdb17b12d24b00000a

导出时勾选包含文章数据和包含评论数据,所以导出文件中包含threads和posts数据。

threads是文章记录,属性如下;
thread_id 多说文章ID。
thread_key 文章在当前站点中的唯一表示符,例如文章ID。
title 文章的标题。
url 文章链接。
author_key 文章作者在本站的ID。
author_id 文章作者的多说ID,如果为空,说明发表文章时没有登陆多说账号。
likes 文章被点【赞】的次数。
views 文章浏览数。
posts是来自多说的评论,不包括微博、以删除评论、垃圾评论;
post_id 多说评论ID。
thread_id 这条评论对应的文章记录。
message 评论内容。
created_at 评论发表时间。
author_id 作者在多说的id。空表示匿名用户。
author_name 作者显示名。有可能为空。
author_email 作者邮箱。有可能为空。
author_url 作者填写的URL。有可能为空。
ip 作者的IP地址。

写个php,json_decode(JSON内容, true)

遍历一遍,用threads=>title去typecho/typecho_contents表里搜出相应的cid、authorid、parent,顺便把commentsNum+1

再去typecho/typecho_comments表

coid, Auto Index,不用管
cid, 对应搜出的cid
created, 对应posts=>created_at,可能需要转换处理
author, 对应posts=>author_name
authorId, 这个对应什么?填"0"?
ownerId, 对应搜出的author_id
mail, 对应posts=>author_email
url, 对应posts=>author_url
ip, 对应posts=>ip
agent, 好像没有对应,就瞎填个多说好了
text, 对应posts=>message
type, 全都填"comment"?
status, 全都填"approved"
parent, 对应搜出的parent

created时间转换?authorId填0?type填comment?这三处不太确定,求指点
回复