改为东八区时间。
This commit is contained in:
parent
f504123bae
commit
d55e536838
@ -578,7 +578,7 @@ async def cancel_order(
|
|||||||
template_id=settings.DELIVERY_ORDER_CANCELLED_TEMPLATE_ID,
|
template_id=settings.DELIVERY_ORDER_CANCELLED_TEMPLATE_ID,
|
||||||
data={
|
data={
|
||||||
"character_string1": order.orderid,
|
"character_string1": order.orderid,
|
||||||
"time19": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"time19": CommonUtils.get_current_time(),
|
||||||
"thing5": "用户主动取消订单"
|
"thing5": "用户主动取消订单"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -744,7 +744,7 @@ async def deliveryman_cancel_order(
|
|||||||
template_id=settings.DELIVERY_ORDER_CANCELLED_TEMPLATE_ID,
|
template_id=settings.DELIVERY_ORDER_CANCELLED_TEMPLATE_ID,
|
||||||
data={
|
data={
|
||||||
"character_string1": order.orderid,
|
"character_string1": order.orderid,
|
||||||
"time19": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"time19": CommonUtils.get_current_time(),
|
||||||
"thing5": order.cancel_reason
|
"thing5": order.cancel_reason
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -821,7 +821,7 @@ async def complete_order(
|
|||||||
data={
|
data={
|
||||||
"character_string13": order.orderid,
|
"character_string13": order.orderid,
|
||||||
"thing3": deliveryman_user.nickname,
|
"thing3": deliveryman_user.nickname,
|
||||||
"time5" : datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
"time5" : CommonUtils.get_current_time()
|
||||||
},
|
},
|
||||||
miniprogram={
|
miniprogram={
|
||||||
"appid": settings.WECHAT_APPID,
|
"appid": settings.WECHAT_APPID,
|
||||||
@ -883,7 +883,7 @@ async def receive_order(
|
|||||||
template_id=settings.DELIVERY_ORDER_RECEIVED_TEMPLATE_ID,
|
template_id=settings.DELIVERY_ORDER_RECEIVED_TEMPLATE_ID,
|
||||||
data={
|
data={
|
||||||
"character_string9": order.orderid,
|
"character_string9": order.orderid,
|
||||||
"time8": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"time8": CommonUtils.get_current_time(),
|
||||||
"thing3": deliveryman_user.nickname
|
"thing3": deliveryman_user.nickname
|
||||||
},
|
},
|
||||||
miniprogram={
|
miniprogram={
|
||||||
|
|||||||
@ -1,9 +1,19 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import pytz # 需要先安装: pip install pytz
|
||||||
|
|
||||||
class CommonUtils:
|
class CommonUtils:
|
||||||
"""工具类"""
|
"""工具类"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_current_time(timezone='Asia/Shanghai'):
|
||||||
|
"""
|
||||||
|
获取指定时区的当前时间
|
||||||
|
:param timezone: 时区名称,默认为上海时区(东八区)
|
||||||
|
"""
|
||||||
|
tz = pytz.timezone(timezone)
|
||||||
|
return datetime.now(tz).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_order_id(prefix: str) -> str:
|
def generate_order_id(prefix: str) -> str:
|
||||||
|
|||||||
@ -15,4 +15,5 @@ bcrypt
|
|||||||
aiohttp==3.9.1
|
aiohttp==3.9.1
|
||||||
cryptography==42.0.2
|
cryptography==42.0.2
|
||||||
qrcode>=7.3.1
|
qrcode>=7.3.1
|
||||||
pillow>=9.0.0
|
pillow>=9.0.0
|
||||||
|
pytz==2024.1
|
||||||
Loading…
Reference in New Issue
Block a user