update
This commit is contained in:
parent
ac945a864c
commit
847056fe05
@ -114,21 +114,19 @@ async def get_community_time_periods(
|
|||||||
"""获取社区的配送时段列表"""
|
"""获取社区的配送时段列表"""
|
||||||
try:
|
try:
|
||||||
# 查询社区的配送时段
|
# 查询社区的配送时段
|
||||||
community_time_periods = db.query(CommunityTimePeriodDB).filter(
|
community_time_periods = db.query(CommunityTimePeriodDB, TimePeriodDB.name.label("time_period_name"),TimePeriodDB.from_time.label("time_period_from_time"), TimePeriodDB.to_time.label("time_period_to_time")).join(TimePeriodDB).filter(
|
||||||
CommunityTimePeriodDB.community_id == community_id
|
CommunityTimePeriodDB.community_id == community_id
|
||||||
).all()
|
).order_by(TimePeriodDB.from_time).all()
|
||||||
|
|
||||||
# 获取时段详情
|
|
||||||
result = []
|
result = []
|
||||||
for ctp in community_time_periods:
|
for ctp in community_time_periods:
|
||||||
time_period = db.query(TimePeriodDB).filter(TimePeriodDB.id == ctp.time_period_id).first()
|
result.append({
|
||||||
if time_period:
|
"time_period_id": ctp.CommunityTimePeriodDB.time_period_id,
|
||||||
ctp_info = CommunityTimePeriodWithDetail.model_validate(ctp)
|
"time_period_name": ctp.time_period_name,
|
||||||
ctp_info.time_period = TimePeriodInfo.model_validate(time_period)
|
"capacity": ctp.CommunityTimePeriodDB.capacity,
|
||||||
result.append(ctp_info)
|
"from_time": ctp.time_period_from_time,
|
||||||
|
"to_time": ctp.time_period_to_time
|
||||||
# 按时段开始时间排序
|
})
|
||||||
result.sort(key=lambda x: x.time_period.from_time if x.time_period else None)
|
|
||||||
|
|
||||||
return success_response(data=result)
|
return success_response(data=result)
|
||||||
|
|
||||||
|
|||||||
@ -135,10 +135,8 @@ async def wechat_corp_callback(
|
|||||||
# 处理进群事件
|
# 处理进群事件
|
||||||
|
|
||||||
if update_detail == 'add_member':
|
if update_detail == 'add_member':
|
||||||
userid = msg_root.find('MemChangeList')[0].find('Item').text
|
# 发送欢迎消息
|
||||||
print(f"userid: {userid}")
|
await wecom_client.send_welcome_message(chat_id)
|
||||||
unionid = await wecom_client.get_unionid_from_userid(userid)
|
|
||||||
print(f"根据userid获取unionid结果: {unionid}")
|
|
||||||
|
|
||||||
|
|
||||||
return Response(content="success", media_type="text/plain")
|
return Response(content="success", media_type="text/plain")
|
||||||
|
|||||||
@ -128,7 +128,15 @@ class WecomClient:
|
|||||||
"chatid": group_id,
|
"chatid": group_id,
|
||||||
"msgtype": "text",
|
"msgtype": "text",
|
||||||
"text": {
|
"text": {
|
||||||
"content": f"欢迎 @{user_info['name']} 加入群聊!\n我们为您准备了专属优惠券,请查收~"
|
"content": f"""🥳 欢迎您进群,在群内可以享受📦【代取快递】跑腿服务。
|
||||||
|
|
||||||
|
‼ 微信下单,快递到家 ‼
|
||||||
|
|
||||||
|
🎁 新人礼包
|
||||||
|
𝟏 赠送𝟏𝟓张【𝟑元跑腿券】
|
||||||
|
𝟐 赠送𝟔枚鲜鸡蛋【首次下单】
|
||||||
|
━ ━ ━ ━ ━🎊━ ━ ━ ━ ━
|
||||||
|
↓点击↓小程序领券下单 &"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user