qwdwq
This commit is contained in:
66
main.py
66
main.py
@@ -296,40 +296,44 @@ def h5group(nickname, db: Session = Depends(get_db)):
|
|||||||
for groupItem in groupList['data']:
|
for groupItem in groupList['data']:
|
||||||
if groupItem['nickname'] == matchesString:
|
if groupItem['nickname'] == matchesString:
|
||||||
inGroup = True
|
inGroup = True
|
||||||
|
if inGroup:
|
||||||
|
return {"code": 200, "success": "fail", "message": "已经在群聊中"}
|
||||||
|
else:
|
||||||
|
new_wxid = None
|
||||||
|
allFriend = WXBotService.get_address_list(config.account_wxid)
|
||||||
|
for friendItem in allFriend['data']["contactList"]:
|
||||||
|
if friendItem['nickname'] == matchesString:
|
||||||
|
# if matchesString in friendItem['nickname']:
|
||||||
|
new_wxid = friendItem['wxid']
|
||||||
|
else:
|
||||||
|
# print('通过nickname查不到wxid')
|
||||||
|
pass
|
||||||
|
if new_wxid:
|
||||||
|
|
||||||
|
WXBotService.add_group_members_40_more(
|
||||||
|
robot_wxid=config.account_wxid,
|
||||||
|
from_wxid=config.chatroomId, #异度星球群
|
||||||
|
new_wxid=new_wxid)
|
||||||
|
print('new_wxid--', new_wxid)
|
||||||
|
# 发送小程序
|
||||||
|
# utils.sendminiProgram(data=None,
|
||||||
|
# account_wxid=config.account_wxid,
|
||||||
|
# wxid=new_wxid,
|
||||||
|
# msgXml=planetXml)
|
||||||
|
# WXBotService.send_text_message(
|
||||||
|
# robot_wxid=config.account_wxid,
|
||||||
|
# from_wxid=new_wxid,
|
||||||
|
# msg=f'已收到-[在看]支持,谢谢,请从小程序,点击"立即加入"\n[本消息是机器人自动回复]')
|
||||||
|
return {"code": 200, "success": "ok", "message": "群聊邀请已发送"}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
"code": 200,
|
||||||
|
"success": "ok",
|
||||||
|
"message": "查不到nickname"
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
print("Error: 'data' is None.")
|
print("Error: 'data' is None.")
|
||||||
|
|
||||||
if inGroup:
|
|
||||||
return {"code": 200, "success": "fail", "message": "已经在群聊中"}
|
|
||||||
else:
|
|
||||||
new_wxid = None
|
|
||||||
allFriend = WXBotService.get_address_list(config.account_wxid)
|
|
||||||
for friendItem in allFriend['data']["contactList"]:
|
|
||||||
if friendItem['nickname'] == matchesString:
|
|
||||||
# if matchesString in friendItem['nickname']:
|
|
||||||
new_wxid = friendItem['wxid']
|
|
||||||
else:
|
|
||||||
# print('通过nickname查不到wxid')
|
|
||||||
pass
|
|
||||||
if new_wxid:
|
|
||||||
|
|
||||||
WXBotService.add_group_members_40_more(
|
|
||||||
robot_wxid=config.account_wxid,
|
|
||||||
from_wxid=config.chatroomId, #异度星球群
|
|
||||||
new_wxid=new_wxid)
|
|
||||||
print('new_wxid--', new_wxid)
|
|
||||||
# 发送小程序
|
|
||||||
# utils.sendminiProgram(data=None,
|
|
||||||
# account_wxid=config.account_wxid,
|
|
||||||
# wxid=new_wxid,
|
|
||||||
# msgXml=planetXml)
|
|
||||||
# WXBotService.send_text_message(
|
|
||||||
# robot_wxid=config.account_wxid,
|
|
||||||
# from_wxid=new_wxid,
|
|
||||||
# msg=f'已收到-[在看]支持,谢谢,请从小程序,点击"立即加入"\n[本消息是机器人自动回复]')
|
|
||||||
return {"code": 200, "success": "ok", "message": "群聊邀请已发送"}
|
|
||||||
else:
|
|
||||||
return {"code": 200, "success": "ok", "message": "查不到nickname"}
|
|
||||||
else:
|
else:
|
||||||
print("未找到匹配项,或者有特殊字符")
|
print("未找到匹配项,或者有特殊字符")
|
||||||
return {"code": 200, "success": "ok", "message": "未找到匹配项,或者有特殊字符"}
|
return {"code": 200, "success": "ok", "message": "未找到匹配项,或者有特殊字符"}
|
||||||
|
|||||||
Reference in New Issue
Block a user