v39.0.0.1

This commit is contained in:
Changhua 2023-07-14 00:20:30 +08:00
parent 1451a1041c
commit 6a1382d95b
2 changed files with 18 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ from fastapi import Body, FastAPI
from pydantic import BaseModel
from wcferry import Wcf, WxMsg
__version__ = "39.0.0.0"
__version__ = "39.0.0.1"
class Msg(BaseModel):
@ -55,6 +55,7 @@ class Http(FastAPI):
self.add_api_route("/sql", self.query_sql, methods=["POST"], summary="执行 SQL如果数据量大注意分页以免 OOM")
self.add_api_route("/new-friend", self.accept_new_friend, methods=["POST"], summary="通过好友申请")
self.add_api_route("/chatroom-member", self.add_chatroom_members, methods=["POST"], summary="添加群成员")
self.add_api_route("/chatroom-member", self.del_chatroom_members, methods=["DELETE"], summary="删除群成员")
self.add_api_route("/transfer", self.receive_transfer, methods=["POST"], summary="接收转账")
self.add_api_route("/dec-image", self.decrypt_image, methods=["POST"], summary="解密图片")
@ -291,6 +292,21 @@ class Http(FastAPI):
ret = self.wcf.add_chatroom_members(roomid, wxids)
return {"status": ret, "message": "成功"if ret == 1 else "失败"}
def del_chatroom_members(self,
roomid: str = Body("xxxxxxxx@chatroom", description="群的 id"),
wxids: str = Body("wxid_xxxxxxxxxxxxx", description="要删除的 wxid多个用逗号分隔")) -> dict:
"""删除群成员
Args:
roomid (str): 群的 id
wxids (str): 要删除的 wxid多个用逗号分隔
Returns:
int: 1 为成功其他失败
"""
ret = self.wcf.del_chatroom_members(roomid, wxids)
return {"status": ret, "message": "成功"if ret == 1 else "失败"}
def receive_transfer(self,
wxid: str = Body("wxid_xxxxxxxxxxxxx", description="转账消息里的发送人 wxid"),
transferid: str = Body("transferid", description="转账消息里的 transferid"),