fix: align create_sub_reseller with sub_distributors model — sub_dist_name, no code field

This commit is contained in:
yumoqing 2026-07-09 16:55:07 +08:00
parent 880e9e59c4
commit aae4271668

View File

@ -318,14 +318,13 @@ async def create_sub_reseller(request, params_kw):
data = params_kw
db, dbname = _get_sor()
async with db.sqlorContext(dbname) as sor:
sub_reseller_code = data.get("sub_reseller_code") or _generate_sub_reseller_code(resellerid)
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# Create org entry for this sub_reseller
new_orgid = getID()
org_rec = {
"id": new_orgid,
"orgname": data.get("sub_reseller_name"),
"orgname": data.get("sub_dist_name"),
"orgtype": "sub_reseller",
"status": "1",
"created_by": user_id,
@ -339,8 +338,7 @@ async def create_sub_reseller(request, params_kw):
"id": getID(),
"resellerid": resellerid,
"orgid": new_orgid,
"sub_reseller_code": sub_reseller_code,
"sub_reseller_name": data.get("sub_reseller_name"),
"sub_dist_name": data.get("sub_dist_name"),
"contact_person": data.get("contact_person"),
"contact_phone": data.get("contact_phone"),
"contact_email": data.get("contact_email"),
@ -354,7 +352,7 @@ async def create_sub_reseller(request, params_kw):
"created_at": now,
"updated_at": now,
}
await sor.C("sub_resellers", rec)
await sor.C("sub_distributors", rec)
return json.dumps({"status": "ok", "data": rec, "message": "创建成功"})