diff --git a/jcloud/api/billing.py b/jcloud/api/billing.py index bd46189..12b100c 100644 --- a/jcloud/api/billing.py +++ b/jcloud/api/billing.py @@ -13,6 +13,8 @@ import jingrow from jingrow import _ # Import this for translation functionality from jingrow.core.utils import find from jingrow.utils import fmt_money, get_request_site_address, getdate, add_months +import random +from datetime import datetime from jcloud.api.regional_payments.mpesa.utils import ( create_invoice_partner_site, @@ -1217,7 +1219,7 @@ def create_alipay_order_for_recharge(amount): total_amount = round(float(amount), 2) # 生成唯一订单号 - order_id = f"{jingrow.utils.now_datetime().strftime('%Y%m%d%H%M%S')}{jingrow.utils.random_string(6)}" + order_id = datetime.now().strftime('%Y%m%d%H%M%S%f')[:-3] + ''.join(random.choices('0123456789', k=6)) # 创建订单记录 payment_record = jingrow.get_pg({ @@ -1272,7 +1274,7 @@ def create_wechatpay_order_for_recharge(amount): total_amount = round(float(amount), 2) # 生成唯一订单号 - order_id = f"{jingrow.utils.now_datetime().strftime('%Y%m%d%H%M%S')}{jingrow.utils.random_string(6)}" + order_id = datetime.now().strftime('%Y%m%d%H%M%S%f')[:-3] + ''.join(random.choices('0123456789', k=6)) # 创建订单记录 payment_record = jingrow.get_pg({ @@ -1336,7 +1338,7 @@ def create_order(**kwargs): team = get_current_team(True) # 生成唯一订单号 - order_id = f"{jingrow.utils.now_datetime().strftime('%Y%m%d%H%M%S')}{jingrow.utils.random_string(6)}" + order_id = datetime.now().strftime('%Y%m%d%H%M%S%f')[:-3] + ''.join(random.choices('0123456789', k=6)) # 创建订单记录 order = jingrow.get_pg({ @@ -1394,7 +1396,7 @@ def create_renewal_order(site, renewal_months=1): amount = current_plan.price_cny * renewal_months if team_currency == "CNY" else current_plan.price_usd * renewal_months # 生成唯一订单号 - order_id = f"{jingrow.utils.now_datetime().strftime('%Y%m%d%H%M%S')}{jingrow.utils.random_string(6)}" + order_id = datetime.now().strftime('%Y%m%d%H%M%S%f')[:-3] + ''.join(random.choices('0123456789', k=6)) # 创建订单记录 order = jingrow.get_pg({