feat(weibo): 增加协作 CK 批量复制与商品图片代理
This commit is contained in:
@@ -19,6 +19,7 @@ from core.weibo import (
|
||||
)
|
||||
|
||||
from ..models import WeiboAccount, WeiboWorkbenchAccount
|
||||
from .weibo_image_service import embed_weibo_goods_images
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -348,6 +349,7 @@ def query_weibo_mall(
|
||||
account: WeiboAccount,
|
||||
*,
|
||||
activity: str = "",
|
||||
embed_images: bool = False,
|
||||
) -> dict:
|
||||
try:
|
||||
data = WeiboClient(account.cookie or "").list_mall(
|
||||
@@ -356,6 +358,12 @@ def query_weibo_mall(
|
||||
except (WeiboError, ValueError) as exc:
|
||||
_mark_manual_failure(db, account, exc)
|
||||
raise
|
||||
goods = data.get("list")
|
||||
if embed_images and isinstance(goods, list):
|
||||
embed_weibo_goods_images(
|
||||
[item for item in goods if isinstance(item, dict)],
|
||||
account_id=account.id,
|
||||
)
|
||||
if isinstance(data.get("weidou_balance"), int):
|
||||
account.weidou_balance = data["weidou_balance"]
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user