fix(crb): 清理 Menu.CompanyUUID select_related 残留(FK→UUIDField 收敛后 FieldError),修复 /API/wallet 500
This commit is contained in:
1 parent
51e47cc942
commit
b1dd91dde0
1 file changed
+3
-3
@@ -118,12 +118,12 @@ def _MenuLinkCompanyUUID(page_path: str):
|
||||
cached = _MENU_COMPANY_CACHE.get(page_path)
|
||||
if cached is not None:
|
||||
return cached
|
||||
menu = Menu.objects.filter(MenuLink=page_path).select_related('CompanyUUID').first()
|
||||
menu = Menu.objects.filter(MenuLink=page_path).first()
|
||||
if menu is None or menu.CompanyUUID is None:
|
||||
_MENU_COMPANY_CACHE[page_path] = (None, False)
|
||||
return None, False
|
||||
# Menu.CompanyUUID 是 ForeignKey 到 Company,Company.CompanyUUID 才是 UUIDObj
|
||||
company_uuid = menu.CompanyUUID.CompanyUUID
|
||||
# Menu.CompanyUUID 是 UUIDField(UUIDObj 带 .bytes),直接取 bytes
|
||||
company_uuid = menu.CompanyUUID
|
||||
company_bytes = company_uuid.bytes if hasattr(company_uuid, 'bytes') else company_uuid
|
||||
_MENU_COMPANY_CACHE[page_path] = (company_bytes, True)
|
||||
return company_bytes, True
|
||||
|
||||
Reference in new issue
Block a user