update
This commit is contained in:
parent
d45ea0a48f
commit
69e16d04c1
@ -50,6 +50,8 @@ from app.models.community_timeperiod import CommunityTimePeriodDB
|
|||||||
from app.models.community_profit_sharing import CommunityProfitSharing
|
from app.models.community_profit_sharing import CommunityProfitSharing
|
||||||
from app.core.qcloud import QCloudManager
|
from app.core.qcloud import QCloudManager
|
||||||
from app.core.wechat import WeChatClient
|
from app.core.wechat import WeChatClient
|
||||||
|
from app.models.community import CommunityStatus
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: Session) -> OrderPriceResult:
|
def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: Session) -> OrderPriceResult:
|
||||||
@ -208,16 +210,17 @@ async def pre_order(
|
|||||||
if request.delivery_date and request.delivery_date < datetime.now().date():
|
if request.delivery_date and request.delivery_date < datetime.now().date():
|
||||||
return error_response(code=400, message="配送日期不能选择过去的时间")
|
return error_response(code=400, message="配送日期不能选择过去的时间")
|
||||||
|
|
||||||
# 检查是否在服务时间
|
|
||||||
community = db.query(CommunityDB).filter(
|
community = db.query(CommunityDB).filter(
|
||||||
CommunityDB.id == request.community_id
|
CommunityDB.id == request.community_id
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if community:
|
|
||||||
# 检查是否在服务时间
|
# 检查是否在服务时间
|
||||||
if community.weekdays and request.delivery_date:
|
if community and community.status != CommunityStatus.OPENING:
|
||||||
if request.delivery_date.isoweekday() not in community.weekdays:
|
return error_response(code=400, message="服务暂未开放")
|
||||||
|
|
||||||
|
# 检查是否在服务时间
|
||||||
|
if community and community.weekdays and request.delivery_date:
|
||||||
|
if request.delivery_date.isoweekday() not in community.weekdays:
|
||||||
#排序
|
#排序
|
||||||
sorted_weekdays = sorted(community.weekdays)
|
sorted_weekdays = sorted(community.weekdays)
|
||||||
|
|
||||||
|
|||||||
BIN
jobs.sqlite
BIN
jobs.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user