fix: tenant_domain_get returns sub_distributor_id_text for bricks code resolution
This commit is contained in:
parent
70f90aeb45
commit
4ba37047bd
@ -8,8 +8,23 @@ ns["sort"] = "created_at"
|
|||||||
ns["order"] = "desc"
|
ns["order"] = "desc"
|
||||||
env = request._run_ns
|
env = request._run_ns
|
||||||
async with get_sor_context(env, "tenant") as sor:
|
async with get_sor_context(env, "tenant") as sor:
|
||||||
recs = await sor.sqlPaging("SELECT * FROM tenant_domain", ns)
|
sql = """SELECT a.*, b.orgname as sub_distributor_id_text
|
||||||
|
FROM tenant_domain a
|
||||||
|
LEFT JOIN organization b ON a.resellerid = b.id
|
||||||
|
ORDER BY a.created_at DESC"""
|
||||||
|
recs = await sor.sqlPaging(sql, ns)
|
||||||
rows = []
|
rows = []
|
||||||
for r in recs["rows"]:
|
for r in recs["rows"]:
|
||||||
rows.append({"id": r.id, "domain": r.domain, "resellerid": r.resellerid, "orgid": r.orgid, "status": r.status, "created_at": str(r.created_at), "updated_at": str(r.updated_at)})
|
status_text = '启用' if r.status == 'active' else ('停用' if r.status == 'inactive' else r.status)
|
||||||
|
rows.append({
|
||||||
|
"id": r.id,
|
||||||
|
"domain": r.domain,
|
||||||
|
"resellerid": r.resellerid,
|
||||||
|
"sub_distributor_id": r.resellerid,
|
||||||
|
"sub_distributor_id_text": r.sub_distributor_id_text or r.resellerid,
|
||||||
|
"orgid": r.orgid,
|
||||||
|
"status": status_text,
|
||||||
|
"created_at": str(r.created_at),
|
||||||
|
"updated_at": str(r.updated_at)
|
||||||
|
})
|
||||||
return {"total": recs["total"], "rows": rows}
|
return {"total": recs["total"], "rows": rows}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user