From 880e9e59c42f57f5d2c090f7ade98606f5486ce0 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 9 Jul 2026 16:53:49 +0800 Subject: [PATCH] fix: use datetime.now instead of ServerEnv in _generate_sub_reseller_code --- supplychain/init.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/supplychain/init.py b/supplychain/init.py index 65ca844..89cc8be 100644 --- a/supplychain/init.py +++ b/supplychain/init.py @@ -79,9 +79,8 @@ WHERE resellerid = ${resellerid}$ AND contract_code LIKE ${prefix}$""" def _generate_sub_reseller_code(resellerid): """Generate unique sub-reseller code: SR-{YYYYMMDD}-{seq}.""" - env = ServerEnv() - today = env.strdate(env.today()) - prefix = f"SR-{today.replace('-', '')}" + today = datetime.now().strftime("%Y%m%d") + prefix = f"SR-{today}" db, dbname = _get_sor() with db.sqlorContext(dbname) as sor: sql = """SELECT COUNT(*) as cnt FROM sub_resellers