update
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
22
app/main.py
22
app/main.py
@@ -52,7 +52,9 @@ def get_db():
|
|||||||
|
|
||||||
@app.get("/hello")
|
@app.get("/hello")
|
||||||
def 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)
|
return PlainTextResponse(content=response)
|
||||||
|
|
||||||
|
|
||||||
@@ -180,30 +182,38 @@ def add_user(nickname: Optional[Any] = None,
|
|||||||
openid=openid)
|
openid=openid)
|
||||||
if background_tasks:
|
if background_tasks:
|
||||||
background_tasks.add_task(create_user_task, db, user_data)
|
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==加群")
|
print("keyword==加群")
|
||||||
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
||||||
wxid=wxid,
|
wxid=wxid,
|
||||||
group_image_path="images/group.jpg")
|
group_image_path="images/nomadqr.jpg")
|
||||||
return FileResponse(combined_image_path)
|
return FileResponse(combined_image_path)
|
||||||
elif keyword == '手册':
|
elif keyword == '手册':
|
||||||
print("keyword==手册")
|
print("keyword==手册")
|
||||||
response = f"手册正在编写中"
|
response = f"手册正在编写中"
|
||||||
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
||||||
wxid=wxid,
|
wxid=wxid,
|
||||||
group_image_path="images/group.jpg")
|
group_image_path="images/bookqr.jpg")
|
||||||
return FileResponse(combined_image_path)
|
return FileResponse(combined_image_path)
|
||||||
elif keyword == '活动':
|
elif keyword == '活动':
|
||||||
print("keyword==活动")
|
print("keyword==活动")
|
||||||
response = f"活动正在筹备中"
|
response = f"活动正在筹备中"
|
||||||
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
combined_image_path = generateqr(url="http://nomad.hackrobot.cn",
|
||||||
wxid=wxid,
|
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)
|
return FileResponse(combined_image_path)
|
||||||
else:
|
else:
|
||||||
|
print('其他keyword')
|
||||||
return PlainTextResponse(content=response)
|
return PlainTextResponse(content=response)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from sqlalchemy import Column, Integer, String
|
from sqlalchemy import Boolean, Column, Integer, String
|
||||||
from app.database import Base
|
from app.database import Base
|
||||||
|
|
||||||
class User(Base):
|
class User(Base):
|
||||||
@@ -12,3 +12,6 @@ class User(Base):
|
|||||||
gender = Column(String)
|
gender = Column(String)
|
||||||
friendaddtime = Column(String)
|
friendaddtime = Column(String)
|
||||||
openid = Column(String, index=True)
|
openid = Column(String, index=True)
|
||||||
|
ebook = Column(Boolean, default=False) # 新增电子书字段
|
||||||
|
activity_status = Column(String, default="0") # 新增活动报名字段
|
||||||
|
vip_member = Column(Boolean, default=False) # 新增VIP会员字段
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ class UserBase(BaseModel):
|
|||||||
gender: Optional[str] = None
|
gender: Optional[str] = None
|
||||||
friendaddtime: Optional[str] = None
|
friendaddtime: Optional[str] = None
|
||||||
openid: 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):
|
class UserCreate(UserBase):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 56 KiB |
Reference in New Issue
Block a user