Skip to content

Commit

Permalink
feat: verbose 提交
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Jul 26, 2024
1 parent ef37b5d commit b7220a9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
27 changes: 27 additions & 0 deletions campux/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,33 @@ async def post_post_log(
"comment": comment
}
)

async def submit_post_verbose(
self,
post_id: int,
key: str,
values: dict
):
"""POST /v1/post/submit-verbose
{
"post_id": 1,
"key": "2297454589",
"values": {
"tid": "123456789"
}
}
"""

return await self.data(
"POST",
"/v1/post/submit-verbose",
body={
"post_id": post_id,
"key": key,
"values": values
}
)

campux_api = None

Expand Down
12 changes: 11 additions & 1 deletion campux/social/mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def _publish_post(self, post_id: int):
image = await self.ap.cpx_api.download_image(image_key)
images_to_post.append(image)

await self.platform_api.publish_emotion(
tid = await self.platform_api.publish_emotion(
f"#{post_id}"+self.ap.config.campux_publish_text_extra,
images_to_post
)
Expand All @@ -127,6 +127,16 @@ async def _publish_post(self, post_id: int):
new_stat="in_queue",
comment=f"{self.ap.config.campux_qq_bot_uin} 发表稿件"
)

# 提交post verbose
await self.ap.cpx_api.submit_post_verbose(
post_id,
key=str(self.platform_api.get_account_id()),
values={
"tid": tid
}
)

# 通知到hash
await self.ap.mq.mark_post_published(post_id)

3 changes: 3 additions & 0 deletions campux/social/qzone/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class QzoneAPI:

uin: int

def get_account_id(self) -> int:
return self.uin

async def do(
self,
method: str,
Expand Down

0 comments on commit b7220a9

Please sign in to comment.