作为菜鸟,不太懂,抛砖引玉一下
多说的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?这三处不太确定,求指点