feat: 实现设置账号并发数功能(支持 bulk-update 与 fallback 逐个更新)
This commit is contained in:
@@ -297,6 +297,21 @@ class Sub2ApiWebsiteClient:
|
||||
data = _unwrap_data(resp)
|
||||
return data if isinstance(data, dict) else {"value": data}
|
||||
|
||||
def bulk_update_accounts(self, account_ids: list[str], body: dict[str, Any], endpoint: str = "/accounts/bulk-update") -> dict[str, Any]:
|
||||
"""批量更新账号。"""
|
||||
int_ids = []
|
||||
for aid in account_ids:
|
||||
try:
|
||||
int_ids.append(int(aid))
|
||||
except ValueError:
|
||||
pass
|
||||
resp = self._request("POST", endpoint, {
|
||||
"account_ids": int_ids,
|
||||
**body
|
||||
})
|
||||
data = _unwrap_data(resp)
|
||||
return data if isinstance(data, dict) else {"value": data}
|
||||
|
||||
@staticmethod
|
||||
def _unwrap_list(value: dict) -> list | None:
|
||||
"""递归展开嵌套的列表包装:data.items、data.data、items、accounts 等。"""
|
||||
|
||||
Reference in New Issue
Block a user