This commit is contained in:
aaron 2025-03-06 16:10:40 +08:00
parent d0255862b8
commit f210d12453
2 changed files with 6 additions and 6 deletions

View File

@ -107,6 +107,7 @@ async def batch_create_community_time_period(
logging.exception(f"批量添加社区配送时段失败: {str(e)}")
return error_response(code=500, message="批量添加社区配送时段失败,请稍后重试")
# 获取社区的配送时段列表
@router.get("/community/{community_id}", response_model=ResponseModel)
async def get_community_time_periods(
community_id: int,
@ -129,8 +130,8 @@ async def get_community_time_periods(
# 获取今日订单数量
today_orders_count = redis_client.get_community_period_orders_count(today_date,ctp.CommunityTimePeriodDB.id)
# 如果已经过了时段,则不加入列表
if datetime.now().time() > ctp.time_period_to_time:
# 当前时间 < 配送时段结束时间前半小时
if datetime.now().time() > ctp.time_period_to_time - timedelta(hours=0.5):
tomorrow_count+=1
continue
@ -268,8 +269,7 @@ async def get_group_by_community(
except Exception as e:
logging.exception(f"获取社区配送时段列表失败: {str(e)}")
return error_response(code=500, message="获取社区配送时段列表失败,请稍后重试")

View File

@ -88,7 +88,7 @@ async def wechat_phone_login(
nickname=f"蜜友{phone[-4:]}",
phone=phone,
user_code=user_code,
referral_code=request.referral_code,
referral_code=None if len(request.referral_code) == 0 else request.referral_code,
password=get_password_hash("123456"),
openid=openid, # 保存 openid
unionid=unionid, # 保存 unionid
@ -111,7 +111,7 @@ async def wechat_phone_login(
# 创建访问令牌
access_token = create_access_token(
data={"phone": user.phone, "sub": user.userid}
data={"phone": user.phone, "userid": user.userid}
)
# 设置JWT cookie