fix(rbac): 固化非促销码注册创建自由客户归属记录(bind_type=3)
This commit is contained in:
parent
395ac8618a
commit
fe2a3a6ab1
@ -48,6 +48,27 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
debug(f'register: customer {orgid} bound via promo_code {promo_code_id}')
|
debug(f'register: customer {orgid} bound via promo_code {promo_code_id}')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'register: bind_customer failed for {orgid} via {promo_code_id}: {e}')
|
exception(f'register: bind_customer failed for {orgid} via {promo_code_id}: {e}')
|
||||||
|
else:
|
||||||
|
# 非促销码注册: 创建自由客户归属记录 (bind_type=3 域名注册)
|
||||||
|
try:
|
||||||
|
reseller_id = parentid or '0'
|
||||||
|
async with DBPools().sqlorContext('discount') as disc_sor:
|
||||||
|
existing = await disc_sor.sqlExe(
|
||||||
|
'SELECT id FROM discount_customer_bind WHERE customerid = ${cid}$',
|
||||||
|
{'cid': orgid}
|
||||||
|
)
|
||||||
|
if not existing:
|
||||||
|
await disc_sor.C('discount_customer_bind', {
|
||||||
|
'id': getID(),
|
||||||
|
'customerid': orgid,
|
||||||
|
'resellerid': reseller_id,
|
||||||
|
'sale_id': None,
|
||||||
|
'promo_code_id': None,
|
||||||
|
'bind_type': '3',
|
||||||
|
})
|
||||||
|
debug(f'register: free customer {orgid} bind created (reseller={reseller_id})')
|
||||||
|
except Exception as e:
|
||||||
|
exception(f'register: create free customer bind failed for {orgid}: {e}')
|
||||||
|
|
||||||
# 注册成功后自动登录
|
# 注册成功后自动登录
|
||||||
await remember_user(user.id, username=user.username, userorgid=user.orgid)
|
await remember_user(user.id, username=user.username, userorgid=user.orgid)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user