20 lines
1.3 KiB
Plaintext
20 lines
1.3 KiB
Plaintext
# api/pbl_domain_ref_bind.dspy — 契约端点:绑定基础域对象到 PBL 蓝图/班级/团队(幂等 upsert)
|
||
# 实现:pbl_domain_ext/api.py:pbl_domain_ref_bind(init.py 经 load_pbl_domain_ext() 注册为 ServerEnv 全局 env.pbl_domain_ref_bind)
|
||
# 入参:tenant_id* ref_type*(world|scene|entity) ref_id* ref_code ref_name blueprint_id class_id team_id ext_json operator_id
|
||
# 规范:module-development-spec §2.5 —— dspy 无 import、显式 return、转发**全部**客户端参数(禁硬编码 dispatch 字段)
|
||
# 薄扩展铁律:只读写关联表 pbl_domain_ref,基表 world/scene/entity 一律只读(Q-OPEN-3)
|
||
debug('pbl_domain_ref_bind.dspy: START params_kw=%s' % (dict(params_kw) if params_kw else {}))
|
||
|
||
try:
|
||
_params = dict(params_kw) if params_kw else {}
|
||
_resp = pbl_domain_ref_bind(_params)
|
||
if not isinstance(_resp, dict):
|
||
_resp = {'success': False, 'code': 'PBL_DE_INTERNAL',
|
||
'message': '契约函数返回非 dict', 'data': None}
|
||
debug('pbl_domain_ref_bind.dspy: DONE success=%s code=%s' % (_resp.get('success'), _resp.get('code')))
|
||
return _resp
|
||
except Exception as exc:
|
||
debug('pbl_domain_ref_bind.dspy: FAIL %s' % format_exc())
|
||
return {'success': False, 'code': 'PBL_DE_INTERNAL', 'message': str(exc),
|
||
'detail': format_exc(), 'http_status': 500, 'data': None}
|