Skip to content

Commit

Permalink
fix: 修复知识空间重复显示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Sep 6, 2023
1 parent 3c3e49e commit 9671464
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
13 changes: 11 additions & 2 deletions src/adaptors/web/jianshu/jianshuWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class JianshuWebAdaptor extends BaseWebApi {
}

public async getUsersBlogs(): Promise<Array<UserBlog>> {
let result: UserBlog[] = []
const result: UserBlog[] = []
const header = {
accept: "application/json",
}
Expand Down Expand Up @@ -161,8 +161,17 @@ class JianshuWebAdaptor extends BaseWebApi {
const jianshuPostKey = this.getJianshuPostidKey(postid)
const pageId = jianshuPostKey.pageId

// 查询历史版本
const header = {
accept: "application/json",
}
const res = await this.webProxyFetch(`https://www.jianshu.com/author/notes/${pageId}/note_logs`, [header])
this.logger.debug("jianshu get post version res =>", res)

// 文章更新并发布
await this.updateJianshuArticle(pageId, post.title, post.description)
const newVersion = res.length + 1
this.logger.debug("jianshu update post with new version =>", newVersion)
await this.updateJianshuArticle(pageId, post.title, post.description, newVersion)
flag = true
} catch (e) {
this.logger.error("简书文章更新失败", e)
Expand Down
4 changes: 3 additions & 1 deletion src/adaptors/web/juejin/juejinWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class JuejinWebAdaptor extends BaseWebApi {

public async addPost(post: Post) {}

public async editPost(postid: string, post: Post, publish?: boolean): Promise<boolean> {}
public async editPost(postid: string, post: Post, publish?: boolean): Promise<boolean> {
return false
}
}

export { JuejinWebAdaptor }
18 changes: 6 additions & 12 deletions src/components/publish/SinglePublishDoPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,11 @@ onMounted(async () => {

<!-- 知识空间 -->
<publish-knowledge-space
v-model:knowledge-space-type="formData.publishCfg.cfg.knowledgeSpaceType"
v-model:knowledge-space-config="formData.knowledgeSpaceConfig"
v-model:cate-slugs="formData.mergedPost.cate_slugs"
@emitSyncCateSlugs="syncCateSlugs"
v-if="formData.publishCfg.cfg.knowledgeSpaceEnabled"
v-model:knowledge-space-type="formData.publishCfg.cfg.knowledgeSpaceType"
v-model:knowledge-space-config="formData.knowledgeSpaceConfig"
v-model:cate-slugs="formData.mergedPost.cate_slugs"
@emitSyncCateSlugs="syncCateSlugs"
/>
<el-divider border-style="dashed" />

Expand Down Expand Up @@ -517,6 +518,7 @@ onMounted(async () => {

<!-- 分类 -->
<publish-categories
v-if="formData.publishCfg.cfg.cateEnabled"
v-model:use-ai="formData.useAi"
v-model:category-type="formData.publishCfg.cfg.categoryType"
v-model:category-config="formData.categoryConfig"
Expand All @@ -526,14 +528,6 @@ onMounted(async () => {
@emitSyncCates="syncCates"
/>

<!-- 知识空间 -->
<publish-knowledge-space
v-model:knowledge-space-type="formData.publishCfg.cfg.knowledgeSpaceType"
v-model:knowledge-space-config="formData.knowledgeSpaceConfig"
v-model:cate-slugs="formData.mergedPost.cate_slugs"
@emitSyncCateSlugs="syncCateSlugs"
/>

<!-- 发布时间 -->
<publish-time v-model="formData.mergedPost" @emitSyncPublishTime="syncPublishTime" />

Expand Down

0 comments on commit 9671464

Please sign in to comment.