From 98ca47340b93258538bc201d4bacd7ce4643e900 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 2 May 2025 23:24:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=A7=84=E5=88=99=E4=B8=BA23=E4=BD=8D?= =?UTF-8?q?=E7=BA=AF=E6=95=B0=E5=AD=97=EF=BC=8C=E5=89=8D17=E4=BD=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3+6=E4=BD=8D=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jcloud/api/billing.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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({