This commit is contained in:
hackrobot
2024-07-17 22:22:27 +08:00
parent 36091e7796
commit ecf9b300d1
8 changed files with 23 additions and 7 deletions

Binary file not shown.

View File

@@ -52,7 +52,9 @@ def get_db():
@app.get("/hello")
def hello():
response = f"你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 微信机器人\n2. 数字游民\n3. 加群\n..........................\n[该消息是接受好友自动回复]"
# response = f"你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 微信机器人\n2. 数字游民\n3. 加群\n..........................\n[该消息是接受好友自动回复]"
response = f"你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 数字游民\n..........................\n[该消息是接受好友自动回复]"
return PlainTextResponse(content=response)
@@ -180,30 +182,38 @@ def add_user(nickname: Optional[Any] = None,
openid=openid)
if background_tasks:
background_tasks.add_task(create_user_task, db, user_data)
response = f"{nickname}你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 微信机器人\n2. 数字游民\n3. 加群\n..........................\n[该消息是接受好友自动回复]"
# response = f"{nickname}你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 微信机器人\n2. 数字游民\n3. 加群\n..........................\n[该消息是接受好友自动回复]"
response = f"{nickname}你好,\n..........................\n一名开发者\n副业:跨境电商\n#公众号:异度世界\n..........................\n回复关键词,了解更多:\n1. 数字游民\n..........................\n[该消息是接受好友自动回复]"
# 关键词回复
if keyword == '加群':
if keyword == '加群' or keyword =="数字游民" or keyword =="3" or keyword =="1":
print("keyword==加群")
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
wxid=wxid,
group_image_path="images/group.jpg")
group_image_path="images/nomadqr.jpg")
return FileResponse(combined_image_path)
elif keyword == '手册':
print("keyword==手册")
response = f"手册正在编写中"
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
wxid=wxid,
group_image_path="images/group.jpg")
group_image_path="images/bookqr.jpg")
return FileResponse(combined_image_path)
elif keyword == '活动':
print("keyword==活动")
response = f"活动正在筹备中"
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
wxid=wxid,
group_image_path="images/group.jpg")
group_image_path="images/meetupqr.jpg")
return FileResponse(combined_image_path)
elif keyword == 'qrcode':
print("keyword==qrcode")
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
wxid='qrcode',
group_image_path="images/nomadqr.jpg")
return FileResponse(combined_image_path)
else:
print('其他keyword')
return PlainTextResponse(content=response)

View File

@@ -1,4 +1,4 @@
from sqlalchemy import Column, Integer, String
from sqlalchemy import Boolean, Column, Integer, String
from app.database import Base
class User(Base):
@@ -12,3 +12,6 @@ class User(Base):
gender = Column(String)
friendaddtime = Column(String)
openid = Column(String, index=True)
ebook = Column(Boolean, default=False) # 新增电子书字段
activity_status = Column(String, default="0") # 新增活动报名字段
vip_member = Column(Boolean, default=False) # 新增VIP会员字段

View File

@@ -9,6 +9,9 @@ class UserBase(BaseModel):
gender: Optional[str] = None
friendaddtime: Optional[str] = None
openid: Optional[str] = None
ebook: Optional[bool] = None # 新增电子书字段
activity_status: Optional[str] = None # 新增活动报名字段
vip_member: Optional[bool] = None # 新增VIP会员字段
class UserCreate(UserBase):
pass

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 56 KiB

BIN
test.db

Binary file not shown.