perf: perm account valid

This commit is contained in:
ibuler
2025-04-08 14:57:49 +08:00
committed by 老广
parent 45f0343cfa
commit ba3bce1e2e
6 changed files with 34 additions and 22 deletions

View File

@@ -136,24 +136,36 @@ class Account(AbsConnectivity, LabeledMixin, BaseAccount, JSONFilterMixin):
"""
if self.username.startswith('@'):
return self.username
return self.id
return str(self.id)
def is_ds_account(self):
if self.username.startswith('@'):
return False
if self.platform.category == 'ds':
return True
return False
@lazyproperty
def ds_id(self):
if self.username.startswith('@'):
return None
if self.platform.category == 'ds':
if self.is_ds_account():
return self.asset.ds.id
return None
@lazyproperty
def ds_domain(self):
if self.username.startswith('@'):
return None
if self.ds_id:
return self.asset.ds.domain_name
return None
@lazyproperty
def ds(self):
if not self.is_ds_account():
return {}
return {
'id': self.ds_id,
'domain': self.ds_domain,
}
@lazyproperty
def full_username(self):
if self.ds_domain: