Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fb2ad0394 | ||
|
|
594e00673e | ||
|
|
b471ba0426 |
No files matched your search
@@ -4,6 +4,53 @@
|
||||
|
||||
---
|
||||
|
||||
## 2026-11-17 · v3.6.19
|
||||
|
||||
### ✨ 新功能
|
||||
|
||||
- **商品类目可手动修改(「无法识别商品类目,无法转卖」的治本方案)**
|
||||
- 新端点 `POST /resell/categories`:一次调用返回「当前类目 + 识别类目 + 候选类目列表」,带源商品图片调用 kgraph(实测带图识别才稳定),候选缺失的 catId 用识别结果/详情类目自动补齐
|
||||
- 发布弹窗新增「商品类目」区块 + 「修改类目」入口:可搜索的候选列表(最多 150 条)、当前项高亮「当前」、点选即回填并随发布提交,可随时「收起」
|
||||
- 后端 `ResellPublishRequest.cat` 手选类目字段,发布时优先级:手选 > 商品详情自带类目 > kgraph 自动识别
|
||||
|
||||
### 🐛 修复
|
||||
|
||||
- **「无法识别商品类目,无法转卖」(发布被 400 拦下)**
|
||||
- 根因:上一版把类目校验设成 `catId` + `channelCatId` + `tbCatId` 三项齐全,但不少闲鱼类目(本例「电子资料」)本身就没有 `tbCatId` → 详情类目被判无效 → 转 kgraph → 长标题常识别不出 → 直接 400
|
||||
- 依据(抓参考实现源码核对):`validPublishCategoryMap` 只要求 catId+catName+channelCatId,`PublishCategory` 注释写明「部分闲鱼类目没有 TBCatID」,其内置兜底类目正是 `电子资料 (50023914 / 202036301)` 且要求 tbCatId 留空不许伪造
|
||||
- 修复:校验放宽为 `catId` + `channelCatId`;`itemCatDTO.tbCatId` 缺失时写空串,绝不再提交字符串 `"None"`(这正是 `FAIL_BIZ_JSON_ERROR` 的雷)
|
||||
- **发布报文两处(11-17 11:19 提交 594e006,随本版首个镜像一起发布,上一版镜像未包含)**
|
||||
- `itemLabelExtList` 不再透传详情接口的展示型标签(结构与发布接口不同,原样提交会让闲鱼解析报文失败),改为发布实现统一用的空数组
|
||||
- 发布地址必须带 `divisionId`(`selectedPoi` 缺失时回落到常用地址)
|
||||
|
||||
### ✅ 验证
|
||||
|
||||
- 服务端断言:两个商品的当前类目均判定可发布(`电子资料` tb 为空、`其他服务`),候选 8 条 / 1 条全部带齐 catId+channelCatId,前端渲染条数与后端返回一致
|
||||
- 浏览器 1440×900 实测:打开一键转卖弹窗 →「商品类目」显示真实类目 → 点「修改类目」展开搜索框与候选 → 搜「视频」出空态、清空恢复 → 点选后类目由「其他服务」变「电子资料」并自动收起;全程未点发布
|
||||
- 登录态验证走临时密码,用完已还原并复核失效(`checkpw=False`、原哈希一致)
|
||||
|
||||
---
|
||||
|
||||
## 2026-11-17 · v3.6.18
|
||||
|
||||
### 🐛 修复
|
||||
|
||||
- **一键转卖发布 502 复发(`FAIL_BIZ_JSON_ERROR::发布失败,请稍后重试吧!`)**
|
||||
- 先用只读手段排除了四类常见原因:登录态(`prepublish.check` 返回 `limited=false`)、违禁词(`badwords.prepubcheck` 对 5 条收藏的标题+描述全部 `forbidPublish=false`)、描述长度(当前收藏 265~562 字,远低于上限)、在售数量(20 件,闲鱼上限 50)
|
||||
- **发布前只读违禁词预检**:命中直接返回具体词(400),不再拿一次「必失败」的发布去给账号加风险分;预检接口自身故障时不阻断发布
|
||||
- **风控冷却 600 秒**:goofish-cli 实测「发布失败后立刻重试会继续给账号加风险分」,原来 60 秒冷却会让前端每分钟重试一轮,反而把风控拖得更久。现在命中 `FAIL_BIZ_*`/`RGV587`/`USER_VALIDATE` 后 600 秒内直接返回「还需等待 N 秒(这段时间内重试会加重风控)」
|
||||
- **上游失败打印完整响应**:`ret` + `data` 一起打日志(原来只有 `ret` 的通用文案,真正的子错误码在 `data` 里,没打出来就只能靠再发一次来猜)
|
||||
- **发布载荷摘要日志**:每次发布记录标题/描述长度、图片数、标签数、类目、价格、发货方式、数量
|
||||
- 前端兜底提示「请等 1 分钟后再试」→「发布已暂停 10 分钟,请到时再试」(与后端冷却时长一致)
|
||||
|
||||
### 🔍 排查记录
|
||||
|
||||
- 最后一次成功发布是 **2026-11-16 16:51**(探针在 1 秒内连发 6 件),其后 22:02、22:10、11-17 09:00 三次全部被闲鱼以通用「发布失败」拒绝
|
||||
- **双实例抢同一账号**:旧系统 `xianyu-super`(8585) 与本系统(8586) 同时在跑账号 `687910262`——8585 近 6 小时 499 条相关日志,token 刷新每 300 秒一次且全部 `FAIL_SYS_SESSION_EXPIRED`;07:00 看门狗日报已判定「两个实例互相挤同一会话,大概率就是触发被挤爆啦风控的原因」。**待办:8585 / 8586 二选一保留该账号**
|
||||
- 下一次发布失败时,日志里会直接给出上游 `data` 的真实子错误码,可据此终局定位
|
||||
|
||||
---
|
||||
|
||||
## 2026-11-17 · v3.6.17
|
||||
|
||||
### 🐛 修复
|
||||
|
||||
+346
-29
@@ -20,9 +20,18 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from utils.xianyu_seller_api import SellerApiError, XianyuSellerAPI
|
||||
from utils.search_parse import parse_search_items
|
||||
from loguru import logger
|
||||
|
||||
MAX_IMAGES = 9
|
||||
|
||||
# 闲鱼服务端拒绝发布后的一段冷却。goofish-cli 的实测结论是:发布失败后立刻重试
|
||||
# 会继续给账号加风险分,每 60 秒来一轮只会把风控拖得更久。所以这里直接挡住发布
|
||||
# 并告诉用户还要等多久,而不是放任前端反复重试。
|
||||
PUBLISH_COOLDOWN_SECONDS = 600
|
||||
_publish_blocked_until: Dict[str, float] = {}
|
||||
# 命中这些码说明是闲鱼风控/服务端拒绝,不是我们自己的参数问题
|
||||
_RISK_DETAIL_RE = re.compile(r"FAIL_BIZ_[A-Z_]+|RGV587[A-Z_]*|USER_VALIDATE", re.I)
|
||||
|
||||
|
||||
def _normalize_search_items(parsed: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
||||
"""共享解析产出的字段比 ResellItem 多(publish_time/keywords),
|
||||
@@ -48,6 +57,14 @@ class ResellPreviewRequest(BaseModel):
|
||||
item_id: str
|
||||
|
||||
|
||||
class ResellCatOverride(BaseModel):
|
||||
"""手选类目:catId/channelCatId 必填,tbCatId 允许为空(部分闲鱼类目没有)。"""
|
||||
cat_id: str = Field(min_length=1, max_length=32)
|
||||
channel_cat_id: str = Field(min_length=1, max_length=32)
|
||||
tb_cat_id: str = Field(default="", max_length=32)
|
||||
cat_name: str = Field(default="", max_length=60)
|
||||
|
||||
|
||||
class ResellPublishRequest(BaseModel):
|
||||
cookie_id: str
|
||||
item_id: str
|
||||
@@ -63,6 +80,15 @@ class ResellPublishRequest(BaseModel):
|
||||
# 自定义图片列表 [{url, width, height}]:用户在弹窗里增删/替换后的最终图片;
|
||||
# 为空或全非法时回退源商品图片,保持向后兼容
|
||||
images: Optional[List[Dict[str, Any]]] = None
|
||||
# 用户在弹窗里手选的类目;三项齐全时直接采用,不再走自动识别
|
||||
cat: Optional[ResellCatOverride] = None
|
||||
|
||||
|
||||
class ResellCategoryRequest(BaseModel):
|
||||
"""类目选择器数据源:当前类目 + 可选类目列表。"""
|
||||
cookie_id: str
|
||||
item_id: str = Field(default="", max_length=64)
|
||||
title: str = Field(default="", max_length=120)
|
||||
|
||||
|
||||
class ResellAiOptimizeRequest(BaseModel):
|
||||
@@ -223,6 +249,74 @@ def create_resell_router(
|
||||
)
|
||||
return {"success": True, "item": _normalize_detail(result.get("data") or {})}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 类目选择器数据源:当前类目 + kgraph 候选类目(「修改类目」用)
|
||||
# ------------------------------------------------------------------
|
||||
@router.post("/resell/categories")
|
||||
async def resell_categories(
|
||||
req: ResellCategoryRequest,
|
||||
current_user: dict[str, Any] = Depends(get_current_user),
|
||||
):
|
||||
details = require_account(req.cookie_id, current_user)
|
||||
title = (req.title or "").strip()
|
||||
current: Dict[str, Any] = {}
|
||||
current_name = ""
|
||||
|
||||
# 当前类目取源商品详情;查询失败不拦,候选列表照常返回
|
||||
detail_images: List[Dict[str, Any]] = []
|
||||
if req.item_id:
|
||||
try:
|
||||
result = await call_buyer(
|
||||
req.cookie_id,
|
||||
details["value"],
|
||||
"mtop.taobao.idle.pc.detail",
|
||||
{"itemId": str(req.item_id)},
|
||||
spm_cnt="a21ybx.detail.0.0",
|
||||
)
|
||||
norm = _normalize_detail(result.get("data") or {})
|
||||
current = dict(norm.get("cat") or {})
|
||||
current_name = str(norm.get("cat_name") or "")
|
||||
title = title or str(norm.get("title") or "")
|
||||
detail_images = list(norm.get("images") or [])
|
||||
except HTTPException:
|
||||
pass
|
||||
|
||||
# 一次 kgraph 调用同时拿到识别结果和候选类目列表;
|
||||
# 带上源商品图片,识别命中率和候选质量都明显更高
|
||||
guess, guess_name, options = await _kgraph_categories(
|
||||
req.cookie_id, details["value"], title, detail_images,
|
||||
req.item_id or "catpick",
|
||||
)
|
||||
if not current:
|
||||
current, current_name = dict(guess), guess_name
|
||||
elif not _cat_is_publishable(current):
|
||||
matched = _match_option(current, options)
|
||||
if matched:
|
||||
current = {
|
||||
"catId": current.get("catId") or matched["cat_id"],
|
||||
"channelCatId": current.get("channelCatId") or matched["channel_cat_id"],
|
||||
"tbCatId": current.get("tbCatId") or matched["tb_cat_id"],
|
||||
}
|
||||
current_name = current_name or matched["cat_name"]
|
||||
|
||||
# 候选的 catId 补齐:kgraph 用识别结果补过,仍缺的用详情类目补
|
||||
context_cat_id = str(current.get("catId") or "") or str(guess.get("catId") or "")
|
||||
filled: List[Dict[str, Any]] = []
|
||||
for opt in options:
|
||||
if not opt.get("cat_id"):
|
||||
opt = dict(opt, cat_id=context_cat_id)
|
||||
if opt.get("cat_id") and opt.get("channel_cat_id"):
|
||||
filled.append(opt)
|
||||
options = filled
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
"current": _cat_out(current, current_name),
|
||||
"predicted": _cat_out(guess, guess_name),
|
||||
"options": options,
|
||||
"title": title,
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 一键转卖发布
|
||||
# ------------------------------------------------------------------
|
||||
@@ -234,6 +328,18 @@ def create_resell_router(
|
||||
details = require_account(req.cookie_id, current_user)
|
||||
cookies_str = details["value"]
|
||||
|
||||
# 冷却期内直接拦下:让前端显示还要等多久,而不是又发一次必失败的请求
|
||||
blocked_until = _publish_blocked_until.get(req.cookie_id, 0.0)
|
||||
if time.time() < blocked_until:
|
||||
remain = int(round(blocked_until - time.time()))
|
||||
raise HTTPException(
|
||||
status_code=502,
|
||||
detail=(
|
||||
f"闲鱼判定该账号处于发布风控冷却期,发布已暂停,还需等待 {remain} 秒"
|
||||
"(这段时间内重试会加重风控)"
|
||||
),
|
||||
)
|
||||
|
||||
if not req.title.strip():
|
||||
raise HTTPException(status_code=400, detail="标题不能为空")
|
||||
try:
|
||||
@@ -274,14 +380,44 @@ def create_resell_router(
|
||||
cat = dict(item_do.get("itemCatDTO") or {})
|
||||
cat_name = _category_name(labels)
|
||||
|
||||
# 2. 类目名缺失时用 kgraph AI 识别兜底(正常详情都带,兜底很少触发)
|
||||
if not cat.get("catId") or not cat_name:
|
||||
cat, cat_name = await _recommend_category(
|
||||
# 2. 类目:用户手选的优先,其次详情自带的(只补缺项,不改原类目),
|
||||
# 最后才用 kgraph 识别兜底。发布要求 itemCatDTO 的
|
||||
# catId/channelCatId/tbCatId 三项齐全——缺一项会提交字符串 "None",
|
||||
# 闲鱼以 FAIL_BIZ_JSON_ERROR 拒绝整个报文。
|
||||
if req.cat:
|
||||
cat = {
|
||||
"catId": req.cat.cat_id,
|
||||
"channelCatId": req.cat.channel_cat_id,
|
||||
"tbCatId": req.cat.tb_cat_id,
|
||||
}
|
||||
cat_name = (req.cat.cat_name or "").strip() or _category_name(labels)
|
||||
elif not (_cat_is_publishable(cat) and cat_name):
|
||||
guess, guess_name, options = await _kgraph_categories(
|
||||
req.cookie_id, cookies_str,
|
||||
req.title.strip(), images, req.item_id,
|
||||
)
|
||||
if not cat.get("catId"):
|
||||
raise HTTPException(status_code=400, detail="无法识别商品类目,无法转卖")
|
||||
matched = _match_option(cat, options)
|
||||
if matched:
|
||||
cat = {
|
||||
"catId": str(cat.get("catId") or matched["cat_id"]),
|
||||
"channelCatId": str(cat.get("channelCatId") or matched["channel_cat_id"]),
|
||||
"tbCatId": str(cat.get("tbCatId") or matched["tb_cat_id"]),
|
||||
}
|
||||
cat_name = cat_name or matched["cat_name"]
|
||||
if not _cat_is_publishable(cat):
|
||||
cat, cat_name = guess, cat_name or guess_name
|
||||
else:
|
||||
cat_name = cat_name or guess_name
|
||||
if not _cat_is_publishable(cat):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="无法识别商品类目,无法转卖:请点「修改类目」手动选择一个类目再发布",
|
||||
)
|
||||
if not (cat_name or "").strip():
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="类目名称缺失:请点「修改类目」重新选择类目再发布",
|
||||
)
|
||||
|
||||
# 3. 默认发布地址
|
||||
poi_result = await call_buyer(
|
||||
@@ -292,32 +428,95 @@ def create_resell_router(
|
||||
)
|
||||
poi_data = poi_result.get("data") or {}
|
||||
addresses = poi_data.get("commonAddresses") or []
|
||||
selected = poi_data.get("selectedPoi") or (addresses[0] if addresses else None)
|
||||
# 发布地址必须带 divisionId:缺了 itemAddrDTO 会退化成空字段,闲鱼
|
||||
# 解析报文失败,返回 FAIL_BIZ_JSON_ERROR(通用文案,看不出是地址问题)。
|
||||
candidates = [poi_data.get("selectedPoi") or {}]
|
||||
candidates += [a for a in addresses if isinstance(a, dict)]
|
||||
selected = next(
|
||||
(a for a in candidates if a.get("divisionId")),
|
||||
None,
|
||||
)
|
||||
if not selected:
|
||||
raise HTTPException(status_code=400, detail="账号未设置发布地址,请先在闲鱼 App 设置默认地址")
|
||||
|
||||
# 4. 组装发布报文(结构对齐 goofish-cli 真实发布验证过的 payload)
|
||||
publish_desc = (req.desc or "").strip() or (item_do.get("desc") or "").strip()
|
||||
|
||||
# 发布前先跑只读的违禁词预检。闲鱼的违禁词/外联词检查覆盖标题、描述、评论、
|
||||
# 消息所有位置,命中会直接让发布失败;预检是只读接口,先拦下来既能给出具体
|
||||
# 词,也省掉一次“必失败”的发布去给账号加风险分。预检接口本身挂了不挡发布。
|
||||
try:
|
||||
badwords_result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.taobao.idleitem.badwords.prepubcheck",
|
||||
{
|
||||
"title": f"{req.title.strip()}\n{publish_desc[:2000]}",
|
||||
"scene": "pcPublish",
|
||||
"sessionId": str(time.time_ns() // 1000),
|
||||
},
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
version="2.0",
|
||||
)
|
||||
except Exception: # noqa: BLE001 - 预检失败不能挡住正常发布
|
||||
badwords_result = None
|
||||
if badwords_result:
|
||||
bw_data = badwords_result.get("data") or {}
|
||||
if bw_data.get("forbidPublish"):
|
||||
hit_words: List[str] = []
|
||||
for entry in ((bw_data.get("badWordAlertInfo") or {}).get("items")) or []:
|
||||
hit_words.extend(str(w) for w in (entry.get("words") or []))
|
||||
if len(hit_words) >= 8:
|
||||
break
|
||||
hint = "、".join(hit_words[:8]) or "标题或描述"
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=f"闲鱼违禁词预检未通过:{hint}。请修改标题/描述后重试",
|
||||
)
|
||||
|
||||
payload = _build_publish_payload(
|
||||
title=req.title.strip(),
|
||||
desc=(req.desc or "").strip() or (item_do.get("desc") or "").strip(),
|
||||
desc=publish_desc,
|
||||
price_cent=price_cent,
|
||||
post_price_cent=_money(req.post_price) if req.delivery == "一口价" and req.post_price > 0 else None,
|
||||
delivery=req.delivery,
|
||||
quantity=req.quantity,
|
||||
images=images,
|
||||
labels=labels,
|
||||
cat=cat,
|
||||
cat_name=cat_name,
|
||||
location=selected,
|
||||
original_price=item_do.get("originalPrice"),
|
||||
)
|
||||
|
||||
result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.idle.pc.idleitem.publish",
|
||||
payload,
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
# 每次发布都留一份载荷摘要,出问题时不用再猜用户填了什么
|
||||
logger.info(
|
||||
f"【转卖发布】{req.cookie_id} item={req.item_id} "
|
||||
f"title_len={len(req.title.strip())} desc_len={len(publish_desc)} "
|
||||
f"images={len(images)} cat={cat.get('catId')}/{cat.get('channelCatId')} "
|
||||
f"cat_name={cat_name} "
|
||||
f"price={req.price} delivery={req.delivery} qty={req.quantity}"
|
||||
)
|
||||
|
||||
try:
|
||||
result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.idle.pc.idleitem.publish",
|
||||
payload,
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
)
|
||||
except HTTPException as exc:
|
||||
detail_text = str(exc.detail)
|
||||
if _RISK_DETAIL_RE.search(detail_text):
|
||||
# 闲鱼风控/服务端拒绝:进入冷却,期间任何发布请求都直接给可读提示
|
||||
_publish_blocked_until[req.cookie_id] = time.time() + PUBLISH_COOLDOWN_SECONDS
|
||||
upstream = _RISK_DETAIL_RE.sub("", detail_text).split("::")[-1].strip(" :")
|
||||
raise HTTPException(
|
||||
status_code=502,
|
||||
detail=(
|
||||
f"闲鱼服务端拒绝了本次发布({upstream[:60] or '风控拦截'})。"
|
||||
f"为避免加重风控,发布已暂停 {PUBLISH_COOLDOWN_SECONDS // 60} 分钟,请到时再试"
|
||||
),
|
||||
) from exc
|
||||
raise
|
||||
new_id = str(((result.get("data") or {}).get("itemId") or "")).strip()
|
||||
if not new_id:
|
||||
raise HTTPException(status_code=502, detail="发布接口未返回商品 ID,请到闲鱼核实是否已发布")
|
||||
@@ -499,14 +698,76 @@ def _category_name(labels: List[Dict[str, Any]]) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
async def _recommend_category(
|
||||
def _cat_is_publishable(cat: Optional[Dict[str, Any]]) -> bool:
|
||||
"""发布可用的类目:catId 与 channelCatId 必填。
|
||||
|
||||
tbCatId 是可选的——部分闲鱼类目(例如「电子资料」)本身没有淘宝类目 ID,
|
||||
官方发布实现里该项留空即可;缺失时必须写成空串,绝不能变成字符串 "None"
|
||||
(那会让闲鱼以 FAIL_BIZ_JSON_ERROR 拒掉整个报文)。
|
||||
"""
|
||||
return bool(cat and cat.get("catId") and cat.get("channelCatId"))
|
||||
|
||||
|
||||
def _category_option(raw: Any) -> Optional[Dict[str, str]]:
|
||||
"""kgraph「分类」候选 → 前端可选的手选类目。
|
||||
|
||||
候选里 catId / tbCatId 常为空:catId 用调用方上下文补,tbCatId 本就允许为空。
|
||||
"""
|
||||
if not isinstance(raw, dict):
|
||||
return None
|
||||
channel = str(raw.get("channelCatId") or "")
|
||||
name = str(raw.get("catName") or "")
|
||||
if not channel or not name:
|
||||
return None
|
||||
return {
|
||||
"cat_id": str(raw.get("catId") or ""),
|
||||
"cat_name": name,
|
||||
"channel_cat_id": channel,
|
||||
"tb_cat_id": str(raw.get("tbCatId") or ""),
|
||||
}
|
||||
|
||||
|
||||
def _cat_out(cat: Optional[Dict[str, Any]], name: str = "") -> Dict[str, str]:
|
||||
"""详情里的 itemCatDTO(数值 id)→ 前端/手选类目统一的四项格式。"""
|
||||
cat = cat or {}
|
||||
return {
|
||||
"cat_id": str(cat.get("catId") or ""),
|
||||
"channel_cat_id": str(cat.get("channelCatId") or ""),
|
||||
"tb_cat_id": str(cat.get("tbCatId") or ""),
|
||||
"cat_name": (name or "").strip() or str(cat.get("catName") or ""),
|
||||
}
|
||||
|
||||
|
||||
def _match_option(
|
||||
cat: Optional[Dict[str, Any]],
|
||||
options: List[Dict[str, str]],
|
||||
) -> Optional[Dict[str, str]]:
|
||||
"""详情类目与候选对上号时,用它补齐缺的 tbCatId / 类目名(不改原类目)。"""
|
||||
if not cat:
|
||||
return None
|
||||
for key in ("catId", "channelCatId"):
|
||||
value = str(cat.get(key) or "")
|
||||
if not value:
|
||||
continue
|
||||
field = "cat_id" if key == "catId" else "channel_cat_id"
|
||||
hit = next((opt for opt in options if opt[field] == value), None)
|
||||
if hit:
|
||||
return hit
|
||||
return None
|
||||
|
||||
|
||||
async def _kgraph_categories(
|
||||
cookie_id: str,
|
||||
cookies_str: str,
|
||||
title: str,
|
||||
images: List[Dict[str, Any]],
|
||||
unique_seed: str,
|
||||
) -> tuple[Dict[str, Any], str]:
|
||||
"""kgraph AI 类目识别,仅在详情缺类目时兜底。"""
|
||||
) -> tuple[Dict[str, Any], str, List[Dict[str, str]]]:
|
||||
"""kgraph 类目识别:返回 (识别类目, 类目名, 可选类目列表)。
|
||||
|
||||
cardList 里 propertyName=分类 的 valuesList 就是发布页那份类目选择列表,
|
||||
每项自带 catId/channelCatId/tbCatId,供前端「修改类目」手选用。
|
||||
"""
|
||||
image_infos = [{
|
||||
"extraInfo": {"isH": "false", "isT": "false", "raw": "false"},
|
||||
"isQrCode": False,
|
||||
@@ -535,18 +796,69 @@ async def _recommend_category(
|
||||
version="2.0",
|
||||
)
|
||||
except SellerApiError:
|
||||
return {}, ""
|
||||
return {}, "", []
|
||||
finally:
|
||||
await client.close()
|
||||
predict = ((result.get("data") or {}).get("categoryPredictResult")) or {}
|
||||
if not predict.get("catId"):
|
||||
return {}, ""
|
||||
|
||||
data = result.get("data") or {}
|
||||
options: List[Dict[str, str]] = []
|
||||
seen = set()
|
||||
for card in data.get("cardList") or []:
|
||||
if not isinstance(card, dict):
|
||||
continue
|
||||
card_data = card.get("cardData") if isinstance(card.get("cardData"), dict) else card
|
||||
if card_data.get("propertyName") != "分类":
|
||||
continue
|
||||
for raw in (card_data.get("valuesList") or card.get("valuesList") or [])[:400]:
|
||||
opt = _category_option(raw)
|
||||
if not opt:
|
||||
continue
|
||||
key = (opt["cat_id"], opt["channel_cat_id"])
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
options.append(opt)
|
||||
|
||||
predict = data.get("categoryPredictResult") or {}
|
||||
predict_cat_id = str(predict.get("catId") or "")
|
||||
# 候选常常只带 channelCatId(同一频道类目共用一个 catId),
|
||||
# 先用识别结果的 catId 补齐,补不出的丢掉——发布必须有 catId。
|
||||
for opt in options:
|
||||
if not opt["cat_id"]:
|
||||
opt["cat_id"] = predict_cat_id
|
||||
options = [opt for opt in options if opt["cat_id"]]
|
||||
|
||||
if not predict_cat_id:
|
||||
return {}, "", options
|
||||
|
||||
cat = {
|
||||
"catId": str(predict.get("catId")),
|
||||
"channelCatId": str(predict.get("channelCatId")),
|
||||
"tbCatId": str(predict.get("tbCatId")),
|
||||
"catId": predict_cat_id,
|
||||
"channelCatId": str(predict.get("channelCatId") or ""),
|
||||
"tbCatId": str(predict.get("tbCatId") or ""),
|
||||
}
|
||||
return cat, str(predict.get("catName") or "")
|
||||
matched = _match_option(cat, options) if not _cat_is_publishable(cat) else None
|
||||
if matched:
|
||||
cat = {
|
||||
"catId": cat["catId"] or matched["cat_id"],
|
||||
"channelCatId": cat["channelCatId"] or matched["channel_cat_id"],
|
||||
"tbCatId": cat["tbCatId"] or matched["tb_cat_id"],
|
||||
}
|
||||
cat_name = str(predict.get("catName") or (matched or {}).get("cat_name") or "")
|
||||
if not _cat_is_publishable(cat):
|
||||
return {}, "", options
|
||||
return cat, cat_name, options
|
||||
|
||||
|
||||
async def _recommend_category(
|
||||
cookie_id: str,
|
||||
cookies_str: str,
|
||||
title: str,
|
||||
images: List[Dict[str, Any]],
|
||||
unique_seed: str,
|
||||
) -> tuple[Dict[str, Any], str]:
|
||||
"""kgraph AI 类目识别,仅在详情缺类目时兜底(返回值保持两元组)。"""
|
||||
cat, cat_name, _ = await _kgraph_categories(cookie_id, cookies_str, title, images, unique_seed)
|
||||
return cat, cat_name
|
||||
|
||||
|
||||
def _build_publish_payload(
|
||||
@@ -558,7 +870,6 @@ def _build_publish_payload(
|
||||
delivery: str,
|
||||
quantity: int,
|
||||
images: List[Dict[str, Any]],
|
||||
labels: List[Dict[str, Any]],
|
||||
cat: Dict[str, Any],
|
||||
cat_name: str,
|
||||
location: Dict[str, Any],
|
||||
@@ -619,17 +930,23 @@ def _build_publish_payload(
|
||||
"simpleItem": "true",
|
||||
"imageInfoDOList": image_do_list,
|
||||
"itemTextDTO": {"desc": desc, "title": title, "titleDescSeparate": True},
|
||||
"itemLabelExtList": labels or [],
|
||||
# 必须是空数组:这里的 labels 是详情接口 itemDO.itemLabelExtList 的
|
||||
# 展示型标签(propertyText/valueText),与发布接口要的结构完全不同,
|
||||
# 原样透传会让闲鱼反序列化失败并返回 FAIL_BIZ_JSON_ERROR。
|
||||
# 已核对真实发布实现(goofish-cli / PC 发布页):这一项恒为空。
|
||||
"itemLabelExtList": [],
|
||||
"itemPriceDTO": price_dto,
|
||||
"userRightsProtocols": [{"enable": False, "serviceCode": "SKILL_PLAY_NO_MIND"}],
|
||||
"itemPostFeeDTO": post_fee,
|
||||
"itemAddrDTO": item_addr,
|
||||
"defaultPrice": False,
|
||||
# tbCatId 缺失时必须写空串:写成字符串 "None" 会被闲鱼以
|
||||
# FAIL_BIZ_JSON_ERROR 拒掉(部分闲鱼类目本就没有淘宝类目 ID)。
|
||||
"itemCatDTO": {
|
||||
"catId": str(cat.get("catId")),
|
||||
"catId": str(cat.get("catId") or ""),
|
||||
"catName": cat_name,
|
||||
"channelCatId": str(cat.get("channelCatId")),
|
||||
"tbCatId": str(cat.get("tbCatId")),
|
||||
"channelCatId": str(cat.get("channelCatId") or ""),
|
||||
"tbCatId": str(cat.get("tbCatId") or ""),
|
||||
},
|
||||
"onlyTakeSelf": False,
|
||||
"uniqueCode": str(time.time_ns() // 1000),
|
||||
|
||||
@@ -21,6 +21,7 @@ from app.routers.resell import (
|
||||
_detail_images,
|
||||
_money,
|
||||
_normalize_detail,
|
||||
_recommend_category,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -235,7 +236,14 @@ def create_xyh_items_router(
|
||||
labels = item_do.get("itemLabelExtList") or []
|
||||
cat = dict(item_do.get("itemCatDTO") or {})
|
||||
cat_name = _category_name(labels)
|
||||
if not cat.get("catId") or not cat_name:
|
||||
if not (cat.get("catId") and cat.get("channelCatId")
|
||||
and cat.get("tbCatId") and cat_name):
|
||||
# 类目字段不全时透传会变成 "None",闲鱼以 FAIL_BIZ_JSON_ERROR 拒绝
|
||||
cat, cat_name = await _recommend_category(
|
||||
req.cookie_id, cookies_str,
|
||||
req.title.strip(), images, req.item_id,
|
||||
)
|
||||
if not cat.get("catId"):
|
||||
raise HTTPException(status_code=400, detail="详情里没有类目信息,无法保存编辑")
|
||||
|
||||
# 2. 发布地址(与转卖一致,取账号默认)
|
||||
@@ -247,7 +255,9 @@ def create_xyh_items_router(
|
||||
)
|
||||
poi_data = poi_result.get("data") or {}
|
||||
addresses = poi_data.get("commonAddresses") or []
|
||||
selected = poi_data.get("selectedPoi") or (addresses[0] if addresses else None)
|
||||
candidates = [poi_data.get("selectedPoi") or {}]
|
||||
candidates += [a for a in addresses if isinstance(a, dict)]
|
||||
selected = next((a for a in candidates if a.get("divisionId")), None)
|
||||
if not selected:
|
||||
raise HTTPException(status_code=400, detail="账号未设置发布地址,请先在闲鱼 App 设置默认地址")
|
||||
|
||||
@@ -261,7 +271,6 @@ def create_xyh_items_router(
|
||||
delivery=req.delivery,
|
||||
quantity=max(1, int(req.quantity or 1)),
|
||||
images=images,
|
||||
labels=labels,
|
||||
cat=cat,
|
||||
cat_name=cat_name,
|
||||
location=selected,
|
||||
|
||||
@@ -11,10 +11,11 @@ import {
|
||||
Store,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { AccountDetail, ResellItem, ResellPreviewItem } from '../types';
|
||||
import { AccountDetail, ResellCategory, ResellItem, ResellPreviewItem } from '../types';
|
||||
import {
|
||||
getAccountDetails,
|
||||
getResellAiOptimize,
|
||||
getResellCategories,
|
||||
getResellFavorites,
|
||||
previewResellItem,
|
||||
publishResellItem,
|
||||
@@ -62,6 +63,8 @@ interface PublishForm {
|
||||
delivery: string;
|
||||
postPrice: string;
|
||||
quantity: string;
|
||||
/** 发布用的类目:预览/手选后填;为空则后端自动识别 */
|
||||
cat: ResellCategory | null;
|
||||
}
|
||||
|
||||
const emptyForm: PublishForm = {
|
||||
@@ -71,6 +74,21 @@ const emptyForm: PublishForm = {
|
||||
delivery: '包邮',
|
||||
postPrice: '0',
|
||||
quantity: '1',
|
||||
cat: null,
|
||||
};
|
||||
|
||||
// 详情里的类目字段转成发布用格式;缺 catId/channelCatId 的返回 null(交给手选)
|
||||
const catFromDetail = (detail: ResellPreviewItem): ResellCategory | null => {
|
||||
const cat = detail.cat || {};
|
||||
const catId = String(cat.catId ?? '');
|
||||
const channelCatId = String(cat.channelCatId ?? '');
|
||||
if (!catId || !channelCatId) return null;
|
||||
return {
|
||||
cat_id: catId,
|
||||
channel_cat_id: channelCatId,
|
||||
tb_cat_id: String(cat.tbCatId ?? ''),
|
||||
cat_name: detail.cat_name || '',
|
||||
};
|
||||
};
|
||||
|
||||
const Resell: React.FC = () => {
|
||||
@@ -109,6 +127,11 @@ const Resell: React.FC = () => {
|
||||
// AI 一键优化:候选标题 + 生成中状态
|
||||
const [aiTitles, setAiTitles] = useState<string[]>([]);
|
||||
const [aiLoading, setAiLoading] = useState(false);
|
||||
// 类目选择器:候选类目列表 + 手选状态
|
||||
const [catOptions, setCatOptions] = useState<ResellCategory[]>([]);
|
||||
const [catLoading, setCatLoading] = useState(false);
|
||||
const [showCatPicker, setShowCatPicker] = useState(false);
|
||||
const [catKeyword, setCatKeyword] = useState('');
|
||||
|
||||
const accountNames = useMemo(
|
||||
() => new Map(accounts.map(account => [
|
||||
@@ -118,6 +141,13 @@ const Resell: React.FC = () => {
|
||||
[accounts],
|
||||
);
|
||||
|
||||
// 类目候选按关键词过滤(候选来自闲鱼 kgraph,通常上百条)
|
||||
const filteredCats = useMemo(() => {
|
||||
const kw = catKeyword.trim().toLowerCase();
|
||||
if (!kw) return catOptions;
|
||||
return catOptions.filter(opt => opt.cat_name.toLowerCase().includes(kw));
|
||||
}, [catOptions, catKeyword]);
|
||||
|
||||
useEffect(() => {
|
||||
getAccountDetails()
|
||||
.then(data => {
|
||||
@@ -307,6 +337,32 @@ const Resell: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 类目候选:发布弹窗打开时拉一次,供「修改类目」搜索选择
|
||||
const loadCategories = async (itemId: string, title: string) => {
|
||||
setCatLoading(true);
|
||||
try {
|
||||
const res = await getResellCategories({
|
||||
cookie_id: selectedAccount,
|
||||
item_id: itemId,
|
||||
title: title || '',
|
||||
});
|
||||
setCatOptions(res.options || []);
|
||||
// 详情没给出可用类目时,用接口返回的当前类目兜底(tbCatId 允许为空)
|
||||
const current = res.current;
|
||||
if (current?.cat_id && current?.channel_cat_id) {
|
||||
setForm(prev => (prev.cat ? prev : { ...prev, cat: current }));
|
||||
}
|
||||
} catch (error) {
|
||||
// 候选列表拿不到不拦发布:仍按已识别/自动识别的类目发
|
||||
setNotice({
|
||||
type: 'warning',
|
||||
message: `类目列表加载失败(${error instanceof Error ? error.message : '未知错误'}),可稍后再点「修改类目」`,
|
||||
});
|
||||
} finally {
|
||||
setCatLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const openResell = async (item: ResellItem) => {
|
||||
if (!selectedAccount) {
|
||||
setNotice({ type: 'error', message: '请先选择账号' });
|
||||
@@ -318,6 +374,9 @@ const Resell: React.FC = () => {
|
||||
setAiTitles([]);
|
||||
setShowAddUrl(false);
|
||||
setImgUrlDraft('');
|
||||
setShowCatPicker(false);
|
||||
setCatKeyword('');
|
||||
setCatOptions([]);
|
||||
// 预览未回前先用卡片图占位,详情回来后整组覆盖
|
||||
setEditImages(
|
||||
(item.images?.length
|
||||
@@ -346,6 +405,7 @@ const Resell: React.FC = () => {
|
||||
price: detailPrice.replace(/[^\d.]/g, '') || current.price,
|
||||
desc: detail.desc || '',
|
||||
quantity: String(detail.quantity || 1),
|
||||
cat: catFromDetail(detail) || current.cat,
|
||||
}));
|
||||
} catch (error) {
|
||||
// 预览失败不拦转卖:仍可用列表里的标题/价格手动填
|
||||
@@ -353,6 +413,8 @@ const Resell: React.FC = () => {
|
||||
} finally {
|
||||
setPreviewLoading(false);
|
||||
}
|
||||
// 类目候选与当前类目并行拉取,弹窗打开即可点「修改类目」
|
||||
void loadCategories(item.item_id, item.title || '');
|
||||
};
|
||||
|
||||
const closeResell = () => {
|
||||
@@ -360,6 +422,8 @@ const Resell: React.FC = () => {
|
||||
setPublishItem(null);
|
||||
setPreview(null);
|
||||
setPublishedUrl('');
|
||||
setShowCatPicker(false);
|
||||
setCatKeyword('');
|
||||
};
|
||||
|
||||
const submitPublish = async () => {
|
||||
@@ -395,6 +459,7 @@ const Resell: React.FC = () => {
|
||||
post_price: Number(form.postPrice) || 0,
|
||||
quantity: Number(form.quantity) || 1,
|
||||
images: editImages.length ? editImages : undefined,
|
||||
cat: form.cat && form.cat.cat_id ? form.cat : undefined,
|
||||
});
|
||||
setPublishedUrl(res.url);
|
||||
setNotice({ type: 'success', message: `转卖发布成功:${res.title}` });
|
||||
@@ -880,9 +945,72 @@ const Resell: React.FC = () => {
|
||||
<p className="mt-1 text-xs text-gray-400">{form.desc.length} / 8000</p>
|
||||
</div>
|
||||
|
||||
{preview?.cat_name && (
|
||||
<p className="text-xs text-gray-400">类目:{preview.cat_name}(发布时自动带上)</p>
|
||||
)}
|
||||
<div>
|
||||
<div className="mb-2 flex items-center justify-between gap-3">
|
||||
<label className="text-sm font-bold text-gray-700">商品类目</label>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowCatPicker(value => !value)}
|
||||
className="text-xs font-bold text-[#ff4400] hover:underline"
|
||||
>
|
||||
{showCatPicker ? '收起' : '修改类目'}
|
||||
</button>
|
||||
</div>
|
||||
<div className="ios-input rounded-md px-3 py-2.5 text-sm text-gray-800">
|
||||
{form.cat?.cat_name || preview?.cat_name || '未识别(发布时自动识别)'}
|
||||
</div>
|
||||
{showCatPicker && (
|
||||
<div className="mt-2 rounded-md border border-gray-200 bg-gray-50 p-3">
|
||||
<input
|
||||
value={catKeyword}
|
||||
onChange={event => setCatKeyword(event.target.value)}
|
||||
placeholder="搜索类目,如:电子资料 / 内存条"
|
||||
className="ios-input w-full rounded-md px-3 py-2 text-sm"
|
||||
aria-label="搜索类目"
|
||||
/>
|
||||
{catLoading ? (
|
||||
<p className="mt-2 flex items-center gap-2 text-xs text-gray-500">
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin" /> 正在加载类目…
|
||||
</p>
|
||||
) : filteredCats.length ? (
|
||||
<ul className="mt-2 max-h-56 overflow-y-auto rounded-md bg-white">
|
||||
{filteredCats.slice(0, 150).map(opt => {
|
||||
const active = Boolean(
|
||||
form.cat
|
||||
&& form.cat.cat_id === opt.cat_id
|
||||
&& form.cat.channel_cat_id === opt.channel_cat_id,
|
||||
);
|
||||
return (
|
||||
<li key={`${opt.cat_id}-${opt.channel_cat_id}`}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setForm(current => ({ ...current, cat: opt }));
|
||||
setShowCatPicker(false);
|
||||
setCatKeyword('');
|
||||
}}
|
||||
className={`flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm ${active ? 'bg-[#ffc940]/25 font-bold text-gray-900' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
>
|
||||
<span className="truncate">{opt.cat_name}</span>
|
||||
<span className={`shrink-0 text-[10px] ${active ? 'text-gray-900' : 'text-gray-400'}`}>
|
||||
{active ? '当前' : '选择'}
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="mt-2 text-xs text-gray-400">
|
||||
{catOptions.length ? '没有匹配的类目,换个关键词试试' : '候选类目加载失败,可关掉弹窗重开重试'}
|
||||
</p>
|
||||
)}
|
||||
<p className="mt-2 text-[11px] leading-4 text-gray-400">
|
||||
候选来自闲鱼发布页的分类列表,选中后按该类目发布;自动识别不准确时可在这里手动改。
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{publishedUrl && (
|
||||
<div className="rounded-md border border-green-200 bg-green-50 p-3 text-sm text-green-700">
|
||||
|
||||
@@ -39,7 +39,7 @@ const FIELD_LABELS: Record<string, string> = {
|
||||
/** 闲鱼常见的业务错误码 → 人话。放在前端兜底,后端也会做一次。 */
|
||||
const BIZ_HINTS: Array<[RegExp, string]> = [
|
||||
[/FAIL_BIZ_TITLE_LENGTH_TOO_LONG|标题不能超过\s*30/i, '标题不能超过 30 个字'],
|
||||
[/FAIL_BIZ_JSON_ERROR|RGV587|挤爆|USER_VALIDATE/i, '闲鱼风控拦截,请等 1 分钟后再试'],
|
||||
[/FAIL_BIZ_JSON_ERROR|RGV587|挤爆|USER_VALIDATE/i, '闲鱼风控拦截,发布已暂停 10 分钟,请到时再试'],
|
||||
[/FAIL_BIZ_DESC/i, '商品描述不符合闲鱼要求,请精简后重试'],
|
||||
[/SESSION_EXPIRED|FAIL_SYS_SESSION_EXPIRED|令牌/i, '闲鱼登录态已失效,请重新扫码登录该账号'],
|
||||
];
|
||||
|
||||
@@ -1666,6 +1666,14 @@ export const getPrCookies = async (): Promise<{
|
||||
cookies: { id: string }[];
|
||||
}> => get('/pricewatch/cookies');
|
||||
|
||||
/** 可手选的商品类目:catId / channelCatId / tbCatId 三项缺一不可(缺一项发布会被闲鱼拒) */
|
||||
export interface ResellCategory {
|
||||
cat_id: string;
|
||||
channel_cat_id: string;
|
||||
tb_cat_id: string;
|
||||
cat_name: string;
|
||||
}
|
||||
|
||||
/** 发布转卖,返回新商品 ID 与链接。 */
|
||||
export const publishResellItem = async (data: {
|
||||
cookie_id: string;
|
||||
@@ -1678,9 +1686,24 @@ export const publishResellItem = async (data: {
|
||||
quantity?: number;
|
||||
/** 弹窗里增删改后的图片列表;缺省则用源商品图片 */
|
||||
images?: { url: string; width: number; height: number }[];
|
||||
/** 用户在弹窗里手选的类目;带上则直接按它发布,不再自动识别 */
|
||||
cat?: ResellCategory;
|
||||
}): Promise<{ success: boolean; item_id: string; url: string; title: string; price: number }> =>
|
||||
post('/resell/publish', data);
|
||||
|
||||
/** 类目选择器数据源:当前类目 + 候选类目列表(「修改类目」弹层用)。 */
|
||||
export const getResellCategories = async (data: {
|
||||
cookie_id: string;
|
||||
item_id?: string;
|
||||
title?: string;
|
||||
}): Promise<{
|
||||
success: boolean;
|
||||
current: ResellCategory;
|
||||
predicted: ResellCategory;
|
||||
options: ResellCategory[];
|
||||
title: string;
|
||||
}> => post('/resell/categories', data);
|
||||
|
||||
/** 转卖图片本地上传(存服务端 resell_uploads,返回可直链访问的 path)。 */
|
||||
export const uploadResellImage = async (file: File): Promise<{ success: boolean; path: string }> => {
|
||||
const form = new FormData();
|
||||
|
||||
@@ -671,6 +671,14 @@ export interface ResellPreviewItem {
|
||||
area: string;
|
||||
}
|
||||
|
||||
/** 可手选的商品类目:catId / channelCatId / tbCatId 三项缺一不可(缺一项发布会被闲鱼拒) */
|
||||
export interface ResellCategory {
|
||||
cat_id: string;
|
||||
channel_cat_id: string;
|
||||
tb_cat_id: string;
|
||||
cat_name: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==================== AI 一键优化建议 ====================
|
||||
|
||||
@@ -1 +1 @@
|
||||
import{r as l,o as O,n as i,z as k,j as e,B as j,L as A,E as H,aF as F,S,K as q,aS as z}from"./index-B6vXMTe7.js";import{P as B,a as U,E as D,S as o}from"./ui-d5h_DIWi.js";import{S as $}from"./save-DH-JrqiY.js";import{M as E}from"./message-square-text-D8XDdRdS.js";import{E as G}from"./eye-off-BLAfRw6v.js";import{E as J}from"./eye-DrjE9to4.js";import{P as C}from"./play-CJJP6ME8.js";const I="https://ai.88531.cn/v1",Q="https://ai.88531.cn",f={ai_enabled:!1,model_name:"qwen-plus",api_key:"",api_key_configured:!1,base_url:I,user_agent:"codex_cli_rs/0.0.0 (Hermes Agent)",max_discount_percent:10,max_discount_amount:100,max_bargain_rounds:3,context_enabled:!0,context_message_limit:12,context_expire_minutes:120,custom_prompts:""},ae=()=>{const[c,P]=l.useState([]),[t,y]=l.useState(""),[a,d]=l.useState(f),[K,x]=l.useState(!0),[p,N]=l.useState(!1),[u,_]=l.useState(!1),[g,w]=l.useState(!1),[h,R]=l.useState("你好,这个商品现在还能买吗?"),[v,b]=l.useState(""),r=l.useMemo(()=>c.find(s=>s.id===t),[c,t]);l.useEffect(()=>{O().then(s=>{var m;P(s),y(((m=s[0])==null?void 0:m.id)||"")}).catch(s=>i(s instanceof Error?s.message:"账号加载失败","error")).finally(()=>x(!1))},[]),l.useEffect(()=>{t&&(x(!0),b(""),w(!1),k(t).then(s=>d({...f,...s,api_key:""})).catch(s=>i(s instanceof Error?s.message:"AI配置加载失败","error")).finally(()=>x(!1)))},[t]);const n=(s,m)=>{d(M=>({...M,[s]:m}))},T=async()=>{if(!t){i("请先选择账号","warning");return}if(!a.model_name.trim()||!a.base_url.trim()){i("模型名称和接口地址不能为空","warning");return}N(!0);try{await q(t,a);const s=await k(t);d({...f,...s,api_key:""}),i("人工智能回复配置已保存","success")}catch(s){i(s instanceof Error?s.message:"AI配置保存失败","error")}finally{N(!1)}},L=async()=>{if(!t||!h.trim()){i("请选择账号并输入测试消息","warning");return}_(!0),b("");try{const s=await z(t,{message:h.trim(),item_title:"测试商品",item_price:100,item_desc:"仅用于测试人工智能回复,不会发送到闲鱼。"});b(s.reply||s.message||"测试完成"),i("AI回复测试完成","success")}catch(s){i(s instanceof Error?s.message:"AI回复测试失败","error")}finally{_(!1)}};return K&&c.length===0?e.jsx(B,{label:"正在加载 AI 回复配置"}):e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(U,{title:"AI 回复",description:"按账号配置模型连接、上下文记忆、议价边界和业务回复规则。",icon:j,actions:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-end gap-2",children:[e.jsxs("label",{className:"min-w-0 sm:w-72",children:[e.jsx("span",{className:"field-label",children:"当前账号"}),e.jsx("select",{value:t,onChange:s=>y(s.target.value),className:"ios-input w-full rounded-md px-3 py-2 text-sm font-semibold",children:c.map(s=>e.jsx("option",{value:s.id,children:s.nickname||s.remark||`账号 ${s.id.slice(0,8)}`},s.id))})]}),e.jsxs("button",{type:"button",onClick:T,disabled:p||!t,className:"ios-btn-primary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[p?e.jsx(A,{className:"h-4 w-4 animate-spin"}):e.jsx($,{className:"h-4 w-4"}),p?"保存中":"保存配置"]})]})}),t?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"section-panel grid gap-4 p-4 lg:grid-cols-[1fr_auto] lg:items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-gray-900",children:[e.jsx(E,{className:"h-5 w-5"}),(r==null?void 0:r.nickname)||(r==null?void 0:r.remark)||t]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"回复优先级:关键词回复 → 人工智能回复 → 默认回复。AI失败时不会中断消息处理。"})]}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("span",{className:"text-sm font-bold text-gray-700",children:a.ai_enabled?"已启用":"已停用"}),e.jsx("input",{type:"checkbox",checked:a.ai_enabled,onChange:s=>n("ai_enabled",s.target.checked),className:"h-5 w-5 accent-yellow-400"})]})]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1.35fr)_minmax(340px,0.65fr)]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"section-panel",children:[e.jsx(o,{title:"模型连接",description:"支持 OpenAI 兼容接口;密钥留空时保留服务器中已有配置。",icon:j}),e.jsxs("div",{className:"grid gap-4 p-5 md:grid-cols-2",children:[e.jsxs("div",{className:"md:col-span-2 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-brand-200 bg-brand-50 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-800",children:"没有 API Key?每天可免费领取额度"}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-600",children:"兼容 OpenAI 接口,注册后把密钥填到下方即可直接用。"})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:e.jsxs("a",{href:Q,target:"_blank",rel:"norefLine truncated
|
||||
import{r as l,o as O,n as i,z as k,j as e,B as j,L as A,E as H,aF as F,S,K as q,aS as z}from"./index-DsODdDMf.js";import{P as B,a as U,E as D,S as o}from"./ui-CQHd7VNo.js";import{S as $}from"./save-1bfmWlQj.js";import{M as E}from"./message-square-text-SsmtmT8O.js";import{E as G}from"./eye-off-BivEoqlz.js";import{E as J}from"./eye-DqWY05EP.js";import{P as C}from"./play-DS4dwZmR.js";const I="https://ai.88531.cn/v1",Q="https://ai.88531.cn",f={ai_enabled:!1,model_name:"qwen-plus",api_key:"",api_key_configured:!1,base_url:I,user_agent:"codex_cli_rs/0.0.0 (Hermes Agent)",max_discount_percent:10,max_discount_amount:100,max_bargain_rounds:3,context_enabled:!0,context_message_limit:12,context_expire_minutes:120,custom_prompts:""},ae=()=>{const[c,P]=l.useState([]),[t,y]=l.useState(""),[a,d]=l.useState(f),[K,x]=l.useState(!0),[p,N]=l.useState(!1),[u,_]=l.useState(!1),[g,w]=l.useState(!1),[h,R]=l.useState("你好,这个商品现在还能买吗?"),[v,b]=l.useState(""),r=l.useMemo(()=>c.find(s=>s.id===t),[c,t]);l.useEffect(()=>{O().then(s=>{var m;P(s),y(((m=s[0])==null?void 0:m.id)||"")}).catch(s=>i(s instanceof Error?s.message:"账号加载失败","error")).finally(()=>x(!1))},[]),l.useEffect(()=>{t&&(x(!0),b(""),w(!1),k(t).then(s=>d({...f,...s,api_key:""})).catch(s=>i(s instanceof Error?s.message:"AI配置加载失败","error")).finally(()=>x(!1)))},[t]);const n=(s,m)=>{d(M=>({...M,[s]:m}))},T=async()=>{if(!t){i("请先选择账号","warning");return}if(!a.model_name.trim()||!a.base_url.trim()){i("模型名称和接口地址不能为空","warning");return}N(!0);try{await q(t,a);const s=await k(t);d({...f,...s,api_key:""}),i("人工智能回复配置已保存","success")}catch(s){i(s instanceof Error?s.message:"AI配置保存失败","error")}finally{N(!1)}},L=async()=>{if(!t||!h.trim()){i("请选择账号并输入测试消息","warning");return}_(!0),b("");try{const s=await z(t,{message:h.trim(),item_title:"测试商品",item_price:100,item_desc:"仅用于测试人工智能回复,不会发送到闲鱼。"});b(s.reply||s.message||"测试完成"),i("AI回复测试完成","success")}catch(s){i(s instanceof Error?s.message:"AI回复测试失败","error")}finally{_(!1)}};return K&&c.length===0?e.jsx(B,{label:"正在加载 AI 回复配置"}):e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(U,{title:"AI 回复",description:"按账号配置模型连接、上下文记忆、议价边界和业务回复规则。",icon:j,actions:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-end gap-2",children:[e.jsxs("label",{className:"min-w-0 sm:w-72",children:[e.jsx("span",{className:"field-label",children:"当前账号"}),e.jsx("select",{value:t,onChange:s=>y(s.target.value),className:"ios-input w-full rounded-md px-3 py-2 text-sm font-semibold",children:c.map(s=>e.jsx("option",{value:s.id,children:s.nickname||s.remark||`账号 ${s.id.slice(0,8)}`},s.id))})]}),e.jsxs("button",{type:"button",onClick:T,disabled:p||!t,className:"ios-btn-primary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[p?e.jsx(A,{className:"h-4 w-4 animate-spin"}):e.jsx($,{className:"h-4 w-4"}),p?"保存中":"保存配置"]})]})}),t?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"section-panel grid gap-4 p-4 lg:grid-cols-[1fr_auto] lg:items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-gray-900",children:[e.jsx(E,{className:"h-5 w-5"}),(r==null?void 0:r.nickname)||(r==null?void 0:r.remark)||t]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"回复优先级:关键词回复 → 人工智能回复 → 默认回复。AI失败时不会中断消息处理。"})]}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("span",{className:"text-sm font-bold text-gray-700",children:a.ai_enabled?"已启用":"已停用"}),e.jsx("input",{type:"checkbox",checked:a.ai_enabled,onChange:s=>n("ai_enabled",s.target.checked),className:"h-5 w-5 accent-yellow-400"})]})]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1.35fr)_minmax(340px,0.65fr)]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"section-panel",children:[e.jsx(o,{title:"模型连接",description:"支持 OpenAI 兼容接口;密钥留空时保留服务器中已有配置。",icon:j}),e.jsxs("div",{className:"grid gap-4 p-5 md:grid-cols-2",children:[e.jsxs("div",{className:"md:col-span-2 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-brand-200 bg-brand-50 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-800",children:"没有 API Key?每天可免费领取额度"}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-600",children:"兼容 OpenAI 接口,注册后把密钥填到下方即可直接用。"})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:e.jsxs("a",{href:Q,target:"_blank",rel:"norefLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as m,r as n,j as e,bE as h,e as g,P as b,E as l,aF as j,aV as f,aW as o,bF as N}from"./index-B6vXMTe7.js";import{a as u,E as y}from"./ui-d5h_DIWi.js";/**
|
||||
import{c as m,r as n,j as e,bE as h,e as g,P as b,E as l,aF as j,aV as f,aW as o,bF as N}from"./index-DsODdDMf.js";import{a as u,E as y}from"./ui-CQHd7VNo.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as ee,r as i,j as e,U as Ce,B as Q,M as Ze,L as C,S as G,e as Ae,k as es,b as z,X as T,l as ss,m as O,o as ts,p as as,q as rs,s as ls,t as ns,n as m,u as Ie,v as Me,w as is,x as os,y as ds,z as cs,A as ms,D as xs,F as us,G as hs,H as ps,I as gs,J as fs,K as bs,N as ys}from"./index-B6vXMTe7.js";import{P as js,a as Ns,E as _s}from"./ui-d5h_DIWi.js";import{C as Z}from"./check-DL81-py-.js";import{S as ws}from"./sparkles-CqzmPNd2.js";import{P as vs,a as ks}from"./power-xEOwpRim.js";import{T as Ss}from"./trash-2-BXclSDej.js";import{K as Cs}from"./key-C3ZC9YGe.js";import{E as As}from"./eye-off-BLAfRw6v.js";import{E as Is}from"./eye-DrjE9to4.js";import{S as $e}from"./save-DH-JrqiY.js";/**
|
||||
import{c as ee,r as i,j as e,U as Ce,B as Q,M as Ze,L as C,S as G,e as Ae,k as es,b as z,X as T,l as ss,m as O,o as ts,p as as,q as rs,s as ls,t as ns,n as m,u as Ie,v as Me,w as is,x as os,y as ds,z as cs,A as ms,D as xs,F as us,G as hs,H as ps,I as gs,J as fs,K as bs,N as ys}from"./index-DsODdDMf.js";import{P as js,a as Ns,E as _s}from"./ui-CQHd7VNo.js";import{C as Z}from"./check-D0r7RhTo.js";import{S as ws}from"./sparkles-CRcwNwKo.js";import{P as vs,a as ks}from"./power-BffuaJ6g.js";import{T as Ss}from"./trash-2-CvZQL5SJ.js";import{K as Cs}from"./key-B7TfiDhV.js";import{E as As}from"./eye-off-BivEoqlz.js";import{E as Is}from"./eye-DqWY05EP.js";import{S as $e}from"./save-1bfmWlQj.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{r as n,j as e,Q as C,e as T,aT as $,T as P,o as B,n as i,aY as H,bG as M}from"./index-B6vXMTe7.js";import{P as D,a as R,N as z,S as d}from"./ui-d5h_DIWi.js";import{S as G}from"./save-DH-JrqiY.js";import{S as O}from"./shield-alert-C73TDqA7.js";import{F as U}from"./flower-2-IRuBbax2.js";import{M as q}from"./message-square-text-D8XDdRdS.js";const r=200,A="宝贝收到了,很满意,感谢老板,欢迎下次再来!",I="亲,感谢支持!有任何问题随时找我~",K={auto_rate_enabled:"评价买家",auto_flower_enabled:"索要小红花",auto_thanks_enabled:"收货致谢",auto_receive_flower_enabled:"自动收下小红花"},Q=[{value:300,label:"5 分钟"},{value:900,label:"15 分钟"},{value:1800,label:"30 分钟"},{value:3600,label:"1 小时"},{value:7200,label:"2 小时(默认)"},{value:21600,label:"6 小时"},{value:86400,label:"24 小时"}],ee=()=>{const[l,c]=n.useState(null),[p,h]=n.useState(!1),[b,_]=n.useState(!1),[o,E]=n.useState([]),[f,x]=n.useState({}),j=()=>{h(!0),Promise.all([$(),P().catch(()=>null),B().catch(()=>[])]).then(([t,a,s])=>{c({...t,auto_rate_template:(t.auto_rate_template??"").trim()||(a==null?void 0:a.auto_rate_template)||A}),E(s),x((a==null?void 0:a.accounts)??{})}).finally(()=>h(!1))},F=async(t,a)=>{const s=f[t]??{auto_rate_enabled:!1,auto_flower_enabled:!1,auto_thanks_enabled:!1,auto_receive_flower_enabled:!1},w={...s,[a]:!s[a]};x(u=>({...u,[t]:w}));try{await M(t,{[a]:w[a]})}catch(u){x(k=>({...k,[t]:s})),i(`保存失败:${u.message}`)}};n.useEffect(()=>{j()},[]);const L=async()=>{if(!l)return;const t=(l.auto_rate_template||"").trim();if(!t){i("默认评价内容不能为空");return}if(t.length>r){i(`默认评价内容不能超过 ${r} 字`);return}_(!0);try{await H({auto_rate_template:t,auto_thanks_template:(l.auto_thanks_template||"").trim(),buyer_interaction_interval:String(S)}),i("买家互动配置已保存")}catch(a){i(`保存失败:${a.message}`)}finally{_(!1)}};if(!l)return e.jsx(D,{label:"正在加载买家互动配置"});const m=t=>f[t]??{auto_rate_enabled:!1,auto_flower_enabled:!1,auto_thanks_enabled:!1,auto_receive_flower_enabled:!1},g=o.some(t=>m(t.id).auto_rate_enabled),y=o.some(t=>m(t.id).auto_thanks_enabled),N=l.auto_rate_template??"",v=l.auto_thanks_template??"",S=Number(l.buyer_interaction_interval)||7200;return e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(R,{title:"买家互动",description:"评价买家、索要小红花与自动收花。涉及平台实际操作,请按账号开启。",icon:C,actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:j,disabled:p,className:"ios-btn-secondary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[e.jsx(T,{className:`h-4 w-4 ${p?"animate-spin":""}`}),"刷新"]}),e.jsxs("button",{type:"button",onClick:()=>void L(),disabled:b,className:"ios-btn-primary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[e.jsx(G,{className:"h-4 w-4"}),b?"保存中":"保存设置"]})]})}),e.jsx(z,{type:"warning",message:"评价提交后无法撤销,求花会向买家发送一条消息。建议先用测试订单验证效果。"}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("section",{className:"section-panel",children:[e.jsx(d,{title:"按账号开启",description:"逐个账号控制。关闭的账号不会自动执行,订单页也不显示入口、后端拒绝请求。",icon:O}),o.length===0?e.jsx("p",{className:"px-4 py-6 text-sm text-gray-500",children:"还没有账号,请先在账号管理里添加。"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 text-left text-xs text-gray-500",children:[e.jsx("th",{className:"px-4 py-2 font-semibold",children:"账号"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"评价买家"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"索要小红花"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"收货致谢"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"自动收下小红花"})]})}),e.jsx("tbody",{children:o.map(t=>{const a=m(t.id);return e.jsxs("tr",{className:"border-b border-gray-100 last:border-b-0",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"font-semibold text-gray-900",children:t.nickname||t.id}),e.jsx("p",{className:"mt-0.5 font-mono text-xs text-gray-400",children:t.id})]}),["auto_rate_enabled","auto_flower_enabled","auto_thanks_enabled","auto_receive_flower_enabled"].map(s=>e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("button",{type:"button",role:"switch","aria-checked":a[s],"aria-label":`${t.nickname||t.id} ${K[s]}`,onClick:()=>void F(t.id,s),className:`relative h-6 w-11 shrink-0 rounded-full transition-colors ${a[s]?"bg-[#ffe100]":"bg-gray-300"}`,children:e.jsx("span",{cLine truncated
|
||||
import{r as n,j as e,Q as C,e as T,aT as $,T as P,o as B,n as i,aY as H,bG as M}from"./index-DsODdDMf.js";import{P as D,a as R,N as z,S as d}from"./ui-CQHd7VNo.js";import{S as G}from"./save-1bfmWlQj.js";import{S as O}from"./shield-alert-JYWkaAgT.js";import{F as U}from"./flower-2-Qv1fS9dP.js";import{M as q}from"./message-square-text-SsmtmT8O.js";const r=200,A="宝贝收到了,很满意,感谢老板,欢迎下次再来!",I="亲,感谢支持!有任何问题随时找我~",K={auto_rate_enabled:"评价买家",auto_flower_enabled:"索要小红花",auto_thanks_enabled:"收货致谢",auto_receive_flower_enabled:"自动收下小红花"},Q=[{value:300,label:"5 分钟"},{value:900,label:"15 分钟"},{value:1800,label:"30 分钟"},{value:3600,label:"1 小时"},{value:7200,label:"2 小时(默认)"},{value:21600,label:"6 小时"},{value:86400,label:"24 小时"}],ee=()=>{const[l,c]=n.useState(null),[p,h]=n.useState(!1),[b,_]=n.useState(!1),[o,E]=n.useState([]),[f,x]=n.useState({}),j=()=>{h(!0),Promise.all([$(),P().catch(()=>null),B().catch(()=>[])]).then(([t,a,s])=>{c({...t,auto_rate_template:(t.auto_rate_template??"").trim()||(a==null?void 0:a.auto_rate_template)||A}),E(s),x((a==null?void 0:a.accounts)??{})}).finally(()=>h(!1))},F=async(t,a)=>{const s=f[t]??{auto_rate_enabled:!1,auto_flower_enabled:!1,auto_thanks_enabled:!1,auto_receive_flower_enabled:!1},w={...s,[a]:!s[a]};x(u=>({...u,[t]:w}));try{await M(t,{[a]:w[a]})}catch(u){x(k=>({...k,[t]:s})),i(`保存失败:${u.message}`)}};n.useEffect(()=>{j()},[]);const L=async()=>{if(!l)return;const t=(l.auto_rate_template||"").trim();if(!t){i("默认评价内容不能为空");return}if(t.length>r){i(`默认评价内容不能超过 ${r} 字`);return}_(!0);try{await H({auto_rate_template:t,auto_thanks_template:(l.auto_thanks_template||"").trim(),buyer_interaction_interval:String(S)}),i("买家互动配置已保存")}catch(a){i(`保存失败:${a.message}`)}finally{_(!1)}};if(!l)return e.jsx(D,{label:"正在加载买家互动配置"});const m=t=>f[t]??{auto_rate_enabled:!1,auto_flower_enabled:!1,auto_thanks_enabled:!1,auto_receive_flower_enabled:!1},g=o.some(t=>m(t.id).auto_rate_enabled),y=o.some(t=>m(t.id).auto_thanks_enabled),N=l.auto_rate_template??"",v=l.auto_thanks_template??"",S=Number(l.buyer_interaction_interval)||7200;return e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(R,{title:"买家互动",description:"评价买家、索要小红花与自动收花。涉及平台实际操作,请按账号开启。",icon:C,actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:j,disabled:p,className:"ios-btn-secondary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[e.jsx(T,{className:`h-4 w-4 ${p?"animate-spin":""}`}),"刷新"]}),e.jsxs("button",{type:"button",onClick:()=>void L(),disabled:b,className:"ios-btn-primary flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm",children:[e.jsx(G,{className:"h-4 w-4"}),b?"保存中":"保存设置"]})]})}),e.jsx(z,{type:"warning",message:"评价提交后无法撤销,求花会向买家发送一条消息。建议先用测试订单验证效果。"}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("section",{className:"section-panel",children:[e.jsx(d,{title:"按账号开启",description:"逐个账号控制。关闭的账号不会自动执行,订单页也不显示入口、后端拒绝请求。",icon:O}),o.length===0?e.jsx("p",{className:"px-4 py-6 text-sm text-gray-500",children:"还没有账号,请先在账号管理里添加。"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 text-left text-xs text-gray-500",children:[e.jsx("th",{className:"px-4 py-2 font-semibold",children:"账号"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"评价买家"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"索要小红花"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"收货致谢"}),e.jsx("th",{className:"px-4 py-2 text-center font-semibold",children:"自动收下小红花"})]})}),e.jsx("tbody",{children:o.map(t=>{const a=m(t.id);return e.jsxs("tr",{className:"border-b border-gray-100 last:border-b-0",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"font-semibold text-gray-900",children:t.nickname||t.id}),e.jsx("p",{className:"mt-0.5 font-mono text-xs text-gray-400",children:t.id})]}),["auto_rate_enabled","auto_flower_enabled","auto_thanks_enabled","auto_receive_flower_enabled"].map(s=>e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("button",{type:"button",role:"switch","aria-checked":a[s],"aria-label":`${t.nickname||t.id} ${K[s]}`,onClick:()=>void F(t.id,s),className:`relative h-6 w-11 shrink-0 rounded-full transition-colors ${a[s]?"bg-[#ffe100]":"bg-gray-300"}`,children:e.jsx("span",{cLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as P,r as m,j as e,X as D,a6 as re,n as j,a7 as de,a8 as M,a9 as G,b as z,aa as H,v as Y,ab as ce,ac as oe,ad as me}from"./index-B6vXMTe7.js";import{a as pe,S as xe,E as B}from"./ui-d5h_DIWi.js";import{P as U}from"./plus-M91O_yID.js";import{S as he}from"./square-pen-zAhXskLp.js";import{T as ye}from"./trash-2-BXclSDej.js";import{P as Z}from"./package-CSDxsYBE.js";import{S as ue}from"./save-DH-JrqiY.js";import{I as q}from"./image-DY0F8hXj.js";import{P as be}from"./package-check-BXdM6afK.js";/**
|
||||
import{c as P,r as m,j as e,X as D,a6 as re,n as j,a7 as de,a8 as M,a9 as G,b as z,aa as H,v as Y,ab as ce,ac as oe,ad as me}from"./index-DsODdDMf.js";import{a as pe,S as xe,E as B}from"./ui-CQHd7VNo.js";import{P as U}from"./plus-fhLljyPf.js";import{S as he}from"./square-pen-DR0-XdRq.js";import{T as ye}from"./trash-2-CvZQL5SJ.js";import{P as Z}from"./package-C5umlMc4.js";import{S as ue}from"./save-1bfmWlQj.js";import{I as q}from"./image-BPsEsLmt.js";import{P as be}from"./package-check-DMYEV4p7.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
var Db=Object.defineProperty;var $b=(e,t,r)=>t in e?Db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _i=(e,t,r)=>$b(e,typeof t!="symbol"?t+"":t,r);import{c as gu,r as v,a as bu,b as xu,g as Nb,R as Rb,d as Lb,j as I,C as zb,e as Bb,U as Fb,E as Wb,f as Kb,h as Ub,n as Hb,i as Ac}from"./index-B6vXMTe7.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-d5h_DIWi.js";import{P as Ro}from"./package-CSDxsYBE.js";import{T as Lh}from"./trending-up-BU9xAGFY.js";import{A as Xb}from"./activity-BTtvkBmV.js";import{P as Zb}from"./package-check-BXdM6afK.js";/**
|
||||
var Db=Object.defineProperty;var $b=(e,t,r)=>t in e?Db(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _i=(e,t,r)=>$b(e,typeof t!="symbol"?t+"":t,r);import{c as gu,r as v,a as bu,b as xu,g as Nb,R as Rb,d as Lb,j as I,C as zb,e as Bb,U as Fb,E as Wb,f as Kb,h as Ub,n as Hb,i as Ac}from"./index-DsODdDMf.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-CQHd7VNo.js";import{P as Ro}from"./package-C5umlMc4.js";import{T as Lh}from"./trending-up-2bhyfwOI.js";import{A as Xb}from"./activity-C3vSFSwT.js";import{P as Zb}from"./package-check-DMYEV4p7.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1 +1 @@
|
||||
import{r as d,j as e}from"./index-B6vXMTe7.js";const r=[{group:"快速开始",items:[{id:"dashboard",label:"系统总览"},{id:"accounts",label:"账号管理"}]},{group:"闲鱼业务",items:[{id:"items",label:"商品与发货"},{id:"resell",label:"一键转卖"},{id:"hotlist",label:"实时热卖榜"},{id:"pricewatch",label:"价格监控"},{id:"orders",label:"订单管理"},{id:"buyer-interaction",label:"买家互动"},{id:"cards",label:"卡密库存"}]},{group:"消息与自动化",items:[{id:"messages",label:"消息中心"},{id:"auto-reply",label:"自动回复"},{id:"ai-reply",label:"AI 回复"},{id:"product-automation",label:"商品自动化"}]},{group:"系统",items:[{id:"notifications",label:"通知与日志"},{id:"settings",label:"系统设置"},{id:"users",label:"用户管理"},{id:"about",label:"关于本系统"}]}],p={dashboard:{title:"系统总览",intro:"登录后的首页,汇总账号、订单、营收和库存数据,一眼判断当前经营状态。",steps:["顶部时间筛选可切换统计周期:今天 / 昨天 / 三天内 / 7天内 / 一个月内 / 自定义。","「有效成交额」与「已到账」两张卡片展示所选周期内的资金数据。","「系统运行中」状态灯表示后端自动回复、定时任务正常运行。","左侧菜单点击任意功能即可切换页面,右上角可切换日间/夜间模式。"],tips:["新部署时没有订单记录,金额显示 ¥0.00 属正常,产生交易后自动累计。"]},accounts:{title:"账号管理",intro:"所有功能的入口:先把闲鱼账号接入系统,其他页面才能选择该账号操作。",steps:["点击「添加账号」,填入账号备注名与 Cookie(从浏览器登录闲鱼后在开发者工具 Network 里复制)。","保存后列表会显示该账号,可点击「检测」验证 Cookie 是否仍然有效。","失效的账号需要重新复制 Cookie 更新;不用的账号可「禁用」而不必删除。","启用状态的账号才会参与自动回复、订单同步、消息聚合等自动化。"],tips:["Cookie 等同账号登录态,请勿泄露;本系统只保存在自己的服务器数据库中。"]},items:{title:"商品与发货",intro:"同步闲鱼在售商品,为每个商品配置自动发货内容(卡密、网盘链接或文字说明)。",steps:["选择账号后点击同步,把该账号在闲鱼的在售商品拉取到列表。","给商品设置发货内容:虚拟商品可填卡密说明或网盘链接,实物商品可填物流备注。","买家付款后系统按这里配置的内容自动回复发货,无需手动复制粘贴。","商品价格、标题变化可通过刷新按钮同步最新状态。"],tips:["发货内容支持多行文本与链接,建议按「商品名称 + 提取码」格式写清楚。"]},resell:{title:"一键转卖",intro:"从收藏或搜索结果里挑商品,改好标题价格直接发布到自己账号,做无货源转卖。",steps:["右上角先选择要发布到的闲鱼账号。","点「我的收藏」→「加载收藏」读取该账号收藏的在售商品;或切到「搜索商品」按关键词找货。","在列表中勾选想转卖的商品,修改标题、价格、描述等发布信息。","点「一键转卖」发布,商品即挂到自己账号名下。"],tips:["发布前核对价格是否留足利润;同名商品重复转卖前先在商品列表确认未上架过。"]},hotlist:{title:"实时热卖榜",intro:"抓取闲鱼实时热卖数据,帮你判断什么好卖、该上什么货。",steps:["选择分类或直接查看综合热卖榜,列表按近期成交热度排序。","点击商品可查看详情与价格区间,作为自己定价的参考。","看中的品可直接跳「一键转卖」上架到自己账号。"],tips:["榜单数据为实时抓取,个别时段可能延迟,可点刷新重新拉取。"]},pricewatch:{title:"价格监控",intro:"设定关键词和目标价,系统定时搜索闲鱼,出现低于目标价的商品立即通知你捡漏。",steps:["点「新建规则」:填写关键词(如想蹲的商品名)、目标价、检测间隔,保存后立即执行一次检测。","检测结果展示匹配商品数、历史最低价与「最近一次」的完整商品信息(超长内容自动换行展示)。","低于目标价时触发通知——前提是已在「通知与日志」页配置好通知渠道并勾选「价格监控」事件(见下方章节)。","点「历史记录」查看每次检测的明细;不需要的规则可停用或删除。"],tips:["通知没发出来时,页面顶部的红色提示会写明去哪配置,按提示到「通知与日志」页补配即可。","关键词越具体匹配越准,避免太宽泛导致噪音过多。"]},orders:{title:"订单管理",intro:"汇总所选账号的闲鱼订单,查看状态、手动补发与核对发货记录。",steps:["选择账号与时间范围筛选订单,列表显示买家、商品、金额与状态。","自动发货成Line truncated
|
||||
import{r as d,j as e}from"./index-DsODdDMf.js";const r=[{group:"快速开始",items:[{id:"dashboard",label:"系统总览"},{id:"accounts",label:"账号管理"}]},{group:"闲鱼业务",items:[{id:"items",label:"商品与发货"},{id:"resell",label:"一键转卖"},{id:"hotlist",label:"实时热卖榜"},{id:"pricewatch",label:"价格监控"},{id:"orders",label:"订单管理"},{id:"buyer-interaction",label:"买家互动"},{id:"cards",label:"卡密库存"}]},{group:"消息与自动化",items:[{id:"messages",label:"消息中心"},{id:"auto-reply",label:"自动回复"},{id:"ai-reply",label:"AI 回复"},{id:"product-automation",label:"商品自动化"}]},{group:"系统",items:[{id:"notifications",label:"通知与日志"},{id:"settings",label:"系统设置"},{id:"users",label:"用户管理"},{id:"about",label:"关于本系统"}]}],p={dashboard:{title:"系统总览",intro:"登录后的首页,汇总账号、订单、营收和库存数据,一眼判断当前经营状态。",steps:["顶部时间筛选可切换统计周期:今天 / 昨天 / 三天内 / 7天内 / 一个月内 / 自定义。","「有效成交额」与「已到账」两张卡片展示所选周期内的资金数据。","「系统运行中」状态灯表示后端自动回复、定时任务正常运行。","左侧菜单点击任意功能即可切换页面,右上角可切换日间/夜间模式。"],tips:["新部署时没有订单记录,金额显示 ¥0.00 属正常,产生交易后自动累计。"]},accounts:{title:"账号管理",intro:"所有功能的入口:先把闲鱼账号接入系统,其他页面才能选择该账号操作。",steps:["点击「添加账号」,填入账号备注名与 Cookie(从浏览器登录闲鱼后在开发者工具 Network 里复制)。","保存后列表会显示该账号,可点击「检测」验证 Cookie 是否仍然有效。","失效的账号需要重新复制 Cookie 更新;不用的账号可「禁用」而不必删除。","启用状态的账号才会参与自动回复、订单同步、消息聚合等自动化。"],tips:["Cookie 等同账号登录态,请勿泄露;本系统只保存在自己的服务器数据库中。"]},items:{title:"商品与发货",intro:"同步闲鱼在售商品,为每个商品配置自动发货内容(卡密、网盘链接或文字说明)。",steps:["选择账号后点击同步,把该账号在闲鱼的在售商品拉取到列表。","给商品设置发货内容:虚拟商品可填卡密说明或网盘链接,实物商品可填物流备注。","买家付款后系统按这里配置的内容自动回复发货,无需手动复制粘贴。","商品价格、标题变化可通过刷新按钮同步最新状态。"],tips:["发货内容支持多行文本与链接,建议按「商品名称 + 提取码」格式写清楚。"]},resell:{title:"一键转卖",intro:"从收藏或搜索结果里挑商品,改好标题价格直接发布到自己账号,做无货源转卖。",steps:["右上角先选择要发布到的闲鱼账号。","点「我的收藏」→「加载收藏」读取该账号收藏的在售商品;或切到「搜索商品」按关键词找货。","在列表中勾选想转卖的商品,修改标题、价格、描述等发布信息。","点「一键转卖」发布,商品即挂到自己账号名下。"],tips:["发布前核对价格是否留足利润;同名商品重复转卖前先在商品列表确认未上架过。"]},hotlist:{title:"实时热卖榜",intro:"抓取闲鱼实时热卖数据,帮你判断什么好卖、该上什么货。",steps:["选择分类或直接查看综合热卖榜,列表按近期成交热度排序。","点击商品可查看详情与价格区间,作为自己定价的参考。","看中的品可直接跳「一键转卖」上架到自己账号。"],tips:["榜单数据为实时抓取,个别时段可能延迟,可点刷新重新拉取。"]},pricewatch:{title:"价格监控",intro:"设定关键词和目标价,系统定时搜索闲鱼,出现低于目标价的商品立即通知你捡漏。",steps:["点「新建规则」:填写关键词(如想蹲的商品名)、目标价、检测间隔,保存后立即执行一次检测。","检测结果展示匹配商品数、历史最低价与「最近一次」的完整商品信息(超长内容自动换行展示)。","低于目标价时触发通知——前提是已在「通知与日志」页配置好通知渠道并勾选「价格监控」事件(见下方章节)。","点「历史记录」查看每次检测的明细;不需要的规则可停用或删除。"],tips:["通知没发出来时,页面顶部的红色提示会写明去哪配置,按提示到「通知与日志」页补配即可。","关键词越具体匹配越准,避免太宽泛导致噪音过多。"]},orders:{title:"订单管理",intro:"汇总所选账号的闲鱼订单,查看状态、手动补发与核对发货记录。",steps:["选择账号与时间范围筛选订单,列表显示买家、商品、金额与状态。","自动发货成Line truncated
|
||||
@@ -1 +1 @@
|
||||
import{r as n,bO as H,bP as O,j as e,bQ as S,L as y,e as A,E as B}from"./index-B6vXMTe7.js";import{P as F,a as U,N as q,b as z,E as Q}from"./ui-d5h_DIWi.js";import{T as R}from"./trending-up-BU9xAGFY.js";import{P as V}from"./package-CSDxsYBE.js";const W=2500,L=r=>r?r>=1e4?`${(r/1e4).toFixed(1).replace(/\.0$/,"")}万`:String(r):"0",Y=r=>{if(!r)return"—";const i=Date.now()-r;if(i<6e4)return"刚刚";if(i<36e5)return`${Math.floor(i/6e4)}分钟前`;if(i<864e5)return`${Math.floor(i/36e5)}小时前`;if(i<7*864e5)return`${Math.floor(i/864e5)}天前`;const o=new Date(r);return`${o.getMonth()+1}月${o.getDate()}日`},G=r=>{if(!r)return"—";const i=new Date(r),o=v=>String(v).padStart(2,"0");return`${i.getFullYear()}-${o(i.getMonth()+1)}-${o(i.getDate())}`},J=({rank:r})=>{const i=r===1?"bg-amber-400 text-white":r===2?"bg-gray-300 text-gray-700":r===3?"bg-orange-300 text-orange-900":"bg-[var(--surface-subtle)] text-[var(--text-soft)]";return e.jsx("span",{className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-sm font-bold ${i}`,children:r})},se=()=>{const[r,i]=n.useState(!0),[o,v]=n.useState({}),[$,P]=n.useState([]),[d,M]=n.useState("digital"),[j,f]=n.useState(null),[h,_]=n.useState(0),[u,k]=n.useState(!1),g=n.useRef(null),I=n.useRef(d);I.current=d;const w=n.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]),b=n.useCallback(async s=>{try{const a=await H();v(a.boards||{}),P(a.categories||[]),s!=null&&s.silent||i(!1),Object.values(a.boards||{}).some(x=>x.refreshing)?E():w()}catch(a){s!=null&&s.silent||(i(!1),f({type:"error",message:a.message||"榜单加载失败"}))}},[]),E=n.useCallback(()=>{g.current||(g.current=setInterval(()=>{b({silent:!0})},W))},[b]);n.useEffect(()=>(b(),w),[b,w]),n.useEffect(()=>{if(h<=0)return;const s=setInterval(()=>_(a=>a<=1?0:a-1),1e3);return()=>clearInterval(s)},[h]);const t=o[d];n.useEffect(()=>{const s=o[d];!s||r||s.refreshing||s.items.length>0||s.cooldown_remaining>0||N(d)},[d,r,o]);const N=async s=>{if(!u){k(!0);try{const a=await O(s);a.started?(f({type:"info",message:a.categories&&a.categories.length>1?"已开始刷新全部类目,完成后自动更新。":"已开始抓取,十几秒后榜单自动刷新。"}),E()):a.reason==="cooldown"?f({type:"error",message:a.message||"刷新过于频繁,请稍后再试"}):f({type:"info",message:a.message||"已有刷新任务进行中"})}catch(a){f({type:"error",message:a.message||"刷新触发失败"})}finally{k(!1)}}};n.useEffect(()=>{t&&t.cooldown_remaining>0&&_(t.cooldown_remaining)},[t]);const T=n.useMemo(()=>$.map(s=>{var a;return{id:s.id,label:s.name,count:(a=o[s.id])==null?void 0:a.items.length}}),[$,o]),C=n.useMemo(()=>{if(!t)return[];const s={};return(t.items||[]).forEach(l=>{(l.keywords||[]).forEach(x=>{const p=s[x]||(s[x]={hits:0,want:0});p.hits+=1,p.want+=l.want_count||0})}),(t.keywords&&t.keywords.length?t.keywords:Object.keys(s)).map(l=>{var x,p;return{kw:l,hits:((x=s[l])==null?void 0:x.hits)||0,want:((p=s[l])==null?void 0:p.want)||0}}).sort((l,x)=>x.want-l.want)},[t]),m=!!(t!=null&&t.refreshing),c=t==null?void 0:t.progress,D=t!=null&&t.updated_at?Y(t.updated_at*1e3):"尚未生成";return r?e.jsx(F,{label:"正在加载热卖榜"}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(U,{title:"实时热卖榜",description:"按「想要人数」排序的全网热卖商品,数据来自闲鱼实时搜索聚合。",icon:S,badge:e.jsx("span",{className:"rounded-full bg-[var(--surface-subtle)] px-2 py-0.5 text-xs text-[var(--text-soft)]",children:t?`更新于 ${D}`:"待生成"}),actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:"ios-btn-secondary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N("all"),disabled:u||m||h>0,children:[u||m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(A,{className:"h-4 w-4"}),"全部刷新"]}),e.jsxs("button",{type:"button",className:"ios-btn-primary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N(d),disabled:u||m||h>0,children:[m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(R,{className:"h-4 w-4"}),h>0?`${h}s 后可刷新`:"刷新本类目"]})]})}),j&&e.jsx(q,{type:j.type==="info"?"success":j.type,message:j.message,onClose:()=>f(null)}),e.jsx("div",{className:"toolbar",children:e.jsx(z,{value:d,onChange:M,items:T,ariaLabel:"热卖榜类目"})}),m&&e.jsx("div",{className:"section-panel",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--text-soft)]",children:[e.jsx(y,{className:"h-4 w-4 animate-spin text-[#ff4400]"}),e.jsxs("span",{children:["正在抓取「",(c==null?void 0:c.keyword)||"…","」",c&&c.total>0?`(${Math.min(c.done+1,c.total)}/${c.total})`:""]}),c&&c.total>0&&e.jsx("span",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-subtle)]",children:e.jsx("span",{className:"block h-full rounded-full bg-[#ff4400] transition-all",style:{width:`${Math.round(c.Line truncated
|
||||
import{r as n,bP as H,bQ as A,j as e,bR as R,L as y,e as B,E as F}from"./index-DsODdDMf.js";import{P as O,a as U,N as q,b as z,E as Q}from"./ui-CQHd7VNo.js";import{T as S}from"./trending-up-2bhyfwOI.js";import{P as V}from"./package-C5umlMc4.js";const W=2500,L=r=>r?r>=1e4?`${(r/1e4).toFixed(1).replace(/\.0$/,"")}万`:String(r):"0",Y=r=>{if(!r)return"—";const i=Date.now()-r;if(i<6e4)return"刚刚";if(i<36e5)return`${Math.floor(i/6e4)}分钟前`;if(i<864e5)return`${Math.floor(i/36e5)}小时前`;if(i<7*864e5)return`${Math.floor(i/864e5)}天前`;const o=new Date(r);return`${o.getMonth()+1}月${o.getDate()}日`},G=r=>{if(!r)return"—";const i=new Date(r),o=v=>String(v).padStart(2,"0");return`${i.getFullYear()}-${o(i.getMonth()+1)}-${o(i.getDate())}`},J=({rank:r})=>{const i=r===1?"bg-amber-400 text-white":r===2?"bg-gray-300 text-gray-700":r===3?"bg-orange-300 text-orange-900":"bg-[var(--surface-subtle)] text-[var(--text-soft)]";return e.jsx("span",{className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-sm font-bold ${i}`,children:r})},se=()=>{const[r,i]=n.useState(!0),[o,v]=n.useState({}),[$,P]=n.useState([]),[d,M]=n.useState("digital"),[j,f]=n.useState(null),[h,_]=n.useState(0),[u,k]=n.useState(!1),g=n.useRef(null),I=n.useRef(d);I.current=d;const w=n.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]),b=n.useCallback(async s=>{try{const a=await H();v(a.boards||{}),P(a.categories||[]),s!=null&&s.silent||i(!1),Object.values(a.boards||{}).some(x=>x.refreshing)?E():w()}catch(a){s!=null&&s.silent||(i(!1),f({type:"error",message:a.message||"榜单加载失败"}))}},[]),E=n.useCallback(()=>{g.current||(g.current=setInterval(()=>{b({silent:!0})},W))},[b]);n.useEffect(()=>(b(),w),[b,w]),n.useEffect(()=>{if(h<=0)return;const s=setInterval(()=>_(a=>a<=1?0:a-1),1e3);return()=>clearInterval(s)},[h]);const t=o[d];n.useEffect(()=>{const s=o[d];!s||r||s.refreshing||s.items.length>0||s.cooldown_remaining>0||N(d)},[d,r,o]);const N=async s=>{if(!u){k(!0);try{const a=await A(s);a.started?(f({type:"info",message:a.categories&&a.categories.length>1?"已开始刷新全部类目,完成后自动更新。":"已开始抓取,十几秒后榜单自动刷新。"}),E()):a.reason==="cooldown"?f({type:"error",message:a.message||"刷新过于频繁,请稍后再试"}):f({type:"info",message:a.message||"已有刷新任务进行中"})}catch(a){f({type:"error",message:a.message||"刷新触发失败"})}finally{k(!1)}}};n.useEffect(()=>{t&&t.cooldown_remaining>0&&_(t.cooldown_remaining)},[t]);const T=n.useMemo(()=>$.map(s=>{var a;return{id:s.id,label:s.name,count:(a=o[s.id])==null?void 0:a.items.length}}),[$,o]),C=n.useMemo(()=>{if(!t)return[];const s={};return(t.items||[]).forEach(l=>{(l.keywords||[]).forEach(x=>{const p=s[x]||(s[x]={hits:0,want:0});p.hits+=1,p.want+=l.want_count||0})}),(t.keywords&&t.keywords.length?t.keywords:Object.keys(s)).map(l=>{var x,p;return{kw:l,hits:((x=s[l])==null?void 0:x.hits)||0,want:((p=s[l])==null?void 0:p.want)||0}}).sort((l,x)=>x.want-l.want)},[t]),m=!!(t!=null&&t.refreshing),c=t==null?void 0:t.progress,D=t!=null&&t.updated_at?Y(t.updated_at*1e3):"尚未生成";return r?e.jsx(O,{label:"正在加载热卖榜"}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(U,{title:"实时热卖榜",description:"按「想要人数」排序的全网热卖商品,数据来自闲鱼实时搜索聚合。",icon:R,badge:e.jsx("span",{className:"rounded-full bg-[var(--surface-subtle)] px-2 py-0.5 text-xs text-[var(--text-soft)]",children:t?`更新于 ${D}`:"待生成"}),actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:"ios-btn-secondary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N("all"),disabled:u||m||h>0,children:[u||m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(B,{className:"h-4 w-4"}),"全部刷新"]}),e.jsxs("button",{type:"button",className:"ios-btn-primary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N(d),disabled:u||m||h>0,children:[m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(S,{className:"h-4 w-4"}),h>0?`${h}s 后可刷新`:"刷新本类目"]})]})}),j&&e.jsx(q,{type:j.type==="info"?"success":j.type,message:j.message,onClose:()=>f(null)}),e.jsx("div",{className:"toolbar",children:e.jsx(z,{value:d,onChange:M,items:T,ariaLabel:"热卖榜类目"})}),m&&e.jsx("div",{className:"section-panel",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--text-soft)]",children:[e.jsx(y,{className:"h-4 w-4 animate-spin text-[#ff4400]"}),e.jsxs("span",{children:["正在抓取「",(c==null?void 0:c.keyword)||"…","」",c&&c.total>0?`(${Math.min(c.done+1,c.total)}/${c.total})`:""]}),c&&c.total>0&&e.jsx("span",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-subtle)]",children:e.jsx("span",{className:"block h-full rounded-full bg-[#ff4400] transition-all",style:{width:`${Math.round(c.Line truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as Me,r,ae as Ms,af as Xe,n as k,j as e,e as De,X as ne,L as O,ag as Ds,ah as Fs,ai as Ps,v as be,aj as Es,ak as Ge,b as pe,al as Ce,am as Ie,an as Bs,ao as Rs,ap as Ls,aq as ns,ar as Qe,o as We,h as ke,a8 as Je,as as Ye,at as Se,w as Ts,au as zs,av as Ze,aw as Ae,ax as Us,ay as Ks,az as qs,aA as Os}from"./index-B6vXMTe7.js";import{E as re,S as $e,P as es,a as Vs,b as Hs,N as Xs}from"./ui-d5h_DIWi.js";import{S as ue}from"./shield-alert-C73TDqA7.js";import{S as ge}from"./save-DH-JrqiY.js";import{T as ye}from"./trash-2-BXclSDej.js";import{P as he}from"./plus-M91O_yID.js";import{P as Gs}from"./power-off-C-Cynwt5.js";import{a as Qs,P as Ws}from"./power-xEOwpRim.js";import{P as rs}from"./package-check-BXdM6afK.js";import{S as ss}from"./sparkles-CqzmPNd2.js";import{S as Js}from"./settings-2-Dpu5P58d.js";import{S as Ys}from"./square-pen-zAhXskLp.js";/**
|
||||
import{c as Me,r,ae as Ms,af as Xe,n as k,j as e,e as De,X as ne,L as O,ag as Ds,ah as Fs,ai as Ps,v as be,aj as Es,ak as Ge,b as pe,al as Ce,am as Ie,an as Bs,ao as Rs,ap as Ls,aq as ns,ar as Qe,o as We,h as ke,a8 as Je,as as Ye,at as Se,w as Ts,au as zs,av as Ze,aw as Ae,ax as Us,ay as Ks,az as qs,aA as Os}from"./index-DsODdDMf.js";import{E as re,S as $e,P as es,a as Vs,b as Hs,N as Xs}from"./ui-CQHd7VNo.js";import{S as ue}from"./shield-alert-JYWkaAgT.js";import{S as ge}from"./save-1bfmWlQj.js";import{T as ye}from"./trash-2-CvZQL5SJ.js";import{P as he}from"./plus-fhLljyPf.js";import{P as Gs}from"./power-off-DcIidedg.js";import{a as Qs,P as Ws}from"./power-BffuaJ6g.js";import{P as rs}from"./package-check-DMYEV4p7.js";import{S as ss}from"./sparkles-CRcwNwKo.js";import{S as Js}from"./settings-2-C_s9tppi.js";import{S as Ys}from"./square-pen-DR0-XdRq.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1 +1 @@
|
||||
import{r as i,o as J,b3 as fe,as as Ne,a8 as ve,b4 as we,j as e,M as R,B as P,e as Q,b as E,X as F,v as k,b5 as _e,n as t,al as V,am as ke,b6 as Se,b7 as Ce,b8 as De,b9 as Re,ba as Pe}from"./index-B6vXMTe7.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-d5h_DIWi.js";import{T}from"./truck-TJpV8qJ4.js";import{K as W}from"./key-C3ZC9YGe.js";import{P as Te}from"./plus-M91O_yID.js";import{P as $,a as $e}from"./power-xEOwpRim.js";import{T as A}from"./trash-2-BXclSDej.js";import{P as Ae}from"./power-off-C-Cynwt5.js";import{S as K}from"./save-DH-JrqiY.js";import{S as Ke}from"./sparkles-CqzmPNd2.js";const Ve=({mode:l})=>{const[x,L]=i.useState([]),[d,B]=i.useState(""),[y,Y]=i.useState("reply"),[j,Z]=i.useState([]),[I,h]=i.useState(!1),[f,z]=i.useState(null),[c,N]=i.useState({keyword:"",reply_content:""}),[C,ee]=i.useState([]),[se,ae]=i.useState([]),[te,u]=i.useState(!1),[v,H]=i.useState(null),[r,o]=i.useState({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),[O,le]=i.useState({}),[ie,g]=i.useState(!1),[Le,q]=i.useState(null),[n,m]=i.useState({cookie_id:"",enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),[re,U]=i.useState(!1);i.useEffect(()=>{if(l==="delivery"){b(),X(),J().then(L);return}J().then(s=>{L(s),s&&s.length>0&&B(a=>a||s[0].id)})},[l]),i.useEffect(()=>{l==="reply"&&d&&(_(),w())},[l,d]);const w=async()=>{try{const s=await fe();le(s)}catch(s){console.error("加载默认回复失败",s)}},b=async()=>{try{const s=await Ne();ee(s.filter(a=>!a.item_id))}catch(s){console.error("加载发货规则失败",s)}},X=async()=>{try{const s=await ve();ae(s)}catch(s){console.error("加载卡券失败",s)}},_=async()=>{if(d){U(!0);try{const s=await we(d);Z(s)}catch(s){console.error("加载关键词失败",s)}finally{U(!1)}}},ne=()=>{if(l==="delivery")H(null),o({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),u(!0);else if(y==="reply")z(null),N({keyword:"",reply_content:""}),h(!0);else{if(!d)return;G(d)}},G=async s=>{try{const a=await Se(s);q(a),m({cookie_id:s,enabled:a.enabled,reply_content:a.reply_content,reply_once:a.reply_once,reply_image_url:a.reply_image_url||""}),g(!0)}catch(a){console.error("加载默认回复失败",a),q(null),m({cookie_id:s,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),g(!0)}},de=s=>{y==="reply"&&(z(s),N({keyword:s.keyword,reply_content:s.reply_content}),h(!0))},ce=s=>{H(s),o({keyword:s.item_keyword,cookie_id:s.cookie_id||"",card_id:String(s.card_group_id),description:s.name,enabled:s.enabled}),u(!0)},oe=async()=>{if(!d){t("请先选择账号");return}if(!c.keyword.trim()||!c.reply_content.trim()){t("请填写关键词和回复内容");return}try{await Re({id:f==null?void 0:f.id,keyword:c.keyword,reply_content:c.reply_content,match_type:"exact",enabled:!0},d),h(!1),_(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},me=async()=>{if(!r.keyword.trim()){t("请填写触发关键词");return}if(!r.card_id){t("请选择卡券");return}try{await V({id:v==null?void 0:v.id,item_keyword:r.keyword,cookie_id:r.cookie_id||void 0,item_id:void 0,card_group_id:parseInt(r.card_id),name:r.description,priority:1,enabled:r.enabled}),u(!1),b(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},pe=async s=>{if(!(!d||!await k("确认删除该关键词吗?")))try{await _e(s,d),_(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},xe=async s=>{if(await k("确认删除该发货规则吗?"))try{await ke(s),b(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},ye=async s=>{try{await V({id:s.id,item_keyword:s.item_keyword,cookie_id:s.cookie_id,item_id:s.item_id,card_group_id:s.card_group_id,name:s.name,priority:s.priority,enabled:!s.enabled}),b()}catch(a){t("操作失败:"+a.message)}},he=async()=>{if(!n.cookie_id){t("请先选择账号");return}try{await Pe(n.cookie_id,{enabled:n.enabled,reply_content:n.reply_content,reply_once:n.reply_once,reply_image_url:n.reply_image_url}),g(!1),w(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},ue=async s=>{if(await k("确认删除该默认回复吗?"))try{await De(s),w(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},ge=async s=>{if(await k("确认清空该账号的回复记录吗?清空后可以重新对所有对话使用默认回复。"))try{await Ce(s),t("清空成功!")}catch(a){t("清空失败:"+a.message)}},be=Object.values(O).filter(s=>s.enabled).length,je=()=>{l==="delivery"?Promise.all([b(),X()]):y==="reply"?_():w()},D=(s,a,p)=>e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":p,onClick:a,className:`relative h-6 w-11 shrink-0 rounded-full transition-colors ${s?"bg-[#ffe100]":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition-transform ${s?"translate-x-5":""}`})});return e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(Ee,{title:l==="reply"?"自动回复":"通用自动发货",description:l==="reply"?"管理账Line truncated
|
||||
import{r as i,o as J,b3 as fe,as as Ne,a8 as ve,b4 as we,j as e,M as R,B as P,e as Q,b as E,X as F,v as k,b5 as _e,n as t,al as V,am as ke,b6 as Se,b7 as Ce,b8 as De,b9 as Re,ba as Pe}from"./index-DsODdDMf.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-CQHd7VNo.js";import{T}from"./truck-BWE0A9OO.js";import{K as W}from"./key-B7TfiDhV.js";import{P as Te}from"./plus-fhLljyPf.js";import{P as $,a as $e}from"./power-BffuaJ6g.js";import{T as A}from"./trash-2-CvZQL5SJ.js";import{P as Ae}from"./power-off-DcIidedg.js";import{S as K}from"./save-1bfmWlQj.js";import{S as Ke}from"./sparkles-CRcwNwKo.js";const Ve=({mode:l})=>{const[x,L]=i.useState([]),[d,B]=i.useState(""),[y,Y]=i.useState("reply"),[j,Z]=i.useState([]),[I,h]=i.useState(!1),[f,z]=i.useState(null),[c,N]=i.useState({keyword:"",reply_content:""}),[C,ee]=i.useState([]),[se,ae]=i.useState([]),[te,u]=i.useState(!1),[v,H]=i.useState(null),[r,o]=i.useState({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),[O,le]=i.useState({}),[ie,g]=i.useState(!1),[Le,q]=i.useState(null),[n,m]=i.useState({cookie_id:"",enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),[re,U]=i.useState(!1);i.useEffect(()=>{if(l==="delivery"){b(),X(),J().then(L);return}J().then(s=>{L(s),s&&s.length>0&&B(a=>a||s[0].id)})},[l]),i.useEffect(()=>{l==="reply"&&d&&(_(),w())},[l,d]);const w=async()=>{try{const s=await fe();le(s)}catch(s){console.error("加载默认回复失败",s)}},b=async()=>{try{const s=await Ne();ee(s.filter(a=>!a.item_id))}catch(s){console.error("加载发货规则失败",s)}},X=async()=>{try{const s=await ve();ae(s)}catch(s){console.error("加载卡券失败",s)}},_=async()=>{if(d){U(!0);try{const s=await we(d);Z(s)}catch(s){console.error("加载关键词失败",s)}finally{U(!1)}}},ne=()=>{if(l==="delivery")H(null),o({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),u(!0);else if(y==="reply")z(null),N({keyword:"",reply_content:""}),h(!0);else{if(!d)return;G(d)}},G=async s=>{try{const a=await Se(s);q(a),m({cookie_id:s,enabled:a.enabled,reply_content:a.reply_content,reply_once:a.reply_once,reply_image_url:a.reply_image_url||""}),g(!0)}catch(a){console.error("加载默认回复失败",a),q(null),m({cookie_id:s,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),g(!0)}},de=s=>{y==="reply"&&(z(s),N({keyword:s.keyword,reply_content:s.reply_content}),h(!0))},ce=s=>{H(s),o({keyword:s.item_keyword,cookie_id:s.cookie_id||"",card_id:String(s.card_group_id),description:s.name,enabled:s.enabled}),u(!0)},oe=async()=>{if(!d){t("请先选择账号");return}if(!c.keyword.trim()||!c.reply_content.trim()){t("请填写关键词和回复内容");return}try{await Re({id:f==null?void 0:f.id,keyword:c.keyword,reply_content:c.reply_content,match_type:"exact",enabled:!0},d),h(!1),_(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},me=async()=>{if(!r.keyword.trim()){t("请填写触发关键词");return}if(!r.card_id){t("请选择卡券");return}try{await V({id:v==null?void 0:v.id,item_keyword:r.keyword,cookie_id:r.cookie_id||void 0,item_id:void 0,card_group_id:parseInt(r.card_id),name:r.description,priority:1,enabled:r.enabled}),u(!1),b(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},pe=async s=>{if(!(!d||!await k("确认删除该关键词吗?")))try{await _e(s,d),_(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},xe=async s=>{if(await k("确认删除该发货规则吗?"))try{await ke(s),b(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},ye=async s=>{try{await V({id:s.id,item_keyword:s.item_keyword,cookie_id:s.cookie_id,item_id:s.item_id,card_group_id:s.card_group_id,name:s.name,priority:s.priority,enabled:!s.enabled}),b()}catch(a){t("操作失败:"+a.message)}},he=async()=>{if(!n.cookie_id){t("请先选择账号");return}try{await Pe(n.cookie_id,{enabled:n.enabled,reply_content:n.reply_content,reply_once:n.reply_once,reply_image_url:n.reply_image_url}),g(!1),w(),t("保存成功!")}catch(s){t("保存失败:"+s.message)}},ue=async s=>{if(await k("确认删除该默认回复吗?"))try{await De(s),w(),t("删除成功!")}catch(a){t("删除失败:"+a.message)}},ge=async s=>{if(await k("确认清空该账号的回复记录吗?清空后可以重新对所有对话使用默认回复。"))try{await Ce(s),t("清空成功!")}catch(a){t("清空失败:"+a.message)}},be=Object.values(O).filter(s=>s.enabled).length,je=()=>{l==="delivery"?Promise.all([b(),X()]):y==="reply"?_():w()},D=(s,a,p)=>e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":p,onClick:a,className:`relative h-6 w-11 shrink-0 rounded-full transition-colors ${s?"bg-[#ffe100]":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition-transform ${s?"translate-x-5":""}`})});return e.jsxs("div",{className:"page-stack animate-fade-in",children:[e.jsx(Ee,{title:l==="reply"?"自动回复":"通用自动发货",description:l==="reply"?"管理账Line truncated
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as We,r as n,aX as mt,o as xt,n as u,h as ut,bb as ht,bc as ft,j as t,e as $e,L as U,bd as pt,X as gt,be as bt,bf as jt,bg as yt,aU as vt,bh as wt,bi as Nt,bj as kt,bk as St,v as Te,bl as Ct,bm as Mt}from"./index-B6vXMTe7.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-d5h_DIWi.js";import{S as Z}from"./settings-2-Dpu5P58d.js";import{S as $t}from"./search-CcRo0a6D.js";import{P as Tt}from"./package-CSDxsYBE.js";import{I as Rt}from"./image-DY0F8hXj.js";import{Z as Et}from"./zap-CacyPsoN.js";import{S as Lt}from"./send-CCwDPbrT.js";import{P as Le}from"./plus-M91O_yID.js";import{T as Ue}from"./trash-2-BXclSDej.js";/**
|
||||
import{c as We,r as n,aX as mt,o as xt,n as u,h as ut,bb as ht,bc as ft,j as t,e as $e,L as U,bd as pt,X as gt,be as bt,bf as jt,bg as yt,aU as vt,bh as wt,bi as Nt,bj as kt,bk as St,v as Te,bl as Ct,bm as Mt}from"./index-DsODdDMf.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-CQHd7VNo.js";import{S as Z}from"./settings-2-C_s9tppi.js";import{S as $t}from"./search-sxbkAeV0.js";import{P as Tt}from"./package-C5umlMc4.js";import{I as Rt}from"./image-BPsEsLmt.js";import{Z as Et}from"./zap-T1zC1hkQ.js";import{S as Lt}from"./send-KQw7ZSlT.js";import{P as Le}from"./plus-fhLljyPf.js";import{T as Ue}from"./trash-2-CvZQL5SJ.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{r as l,j as t,bd as $,e as ee,L as te,aF as ot,C as ct,X as Se,o as dt,bn as mt,bo as xt,bp as pt,n as o,bq as ut,br as ht,bs as _e,v as se,bt as yt,bu as Re,bv as bt,bw as gt,bx as ft,by as jt,bz as Nt}from"./index-B6vXMTe7.js";import{a as vt,b as wt,S as E,E as L}from"./ui-d5h_DIWi.js";import{L as ae}from"./link-2-BDFLqg13.js";import{S as le}from"./shield-alert-C73TDqA7.js";import{A as ne}from"./activity-BTtvkBmV.js";import{P as $e}from"./plus-M91O_yID.js";import{P as Ee}from"./pen-line-Clj2OF6I.js";import{T as ie}from"./trash-2-BXclSDej.js";import{S as kt}from"./send-CCwDPbrT.js";import{C as Ct,a as St}from"./chevron-right-CQL8vgnL.js";import{S as Le}from"./save-DH-JrqiY.js";import{C as _t}from"./check-DL81-py-.js";const y={dingtalk:{label:"钉钉",fields:[{key:"webhook_url",label:"Webhook 地址",placeholder:"https://oapi.dingtalk.com/robot/send?..."},{key:"secret",label:"加签密钥",type:"password",optional:!0}],defaults:{}},feishu:{label:"飞书",fields:[{key:"webhook_url",label:"Webhook 地址",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{key:"secret",label:"签名密钥",type:"password",optional:!0}],defaults:{}},bark:{label:"Bark",fields:[{key:"device_key",label:"Device Key",type:"password"},{key:"server_url",label:"服务器地址",placeholder:"https://api.day.app",optional:!0}],defaults:{server_url:"https://api.day.app"}},email:{label:"邮件",fields:[{key:"smtp_server",label:"SMTP 服务器",placeholder:"留空则使用「系统设置 → 邮件服务」",optional:!0},{key:"smtp_port",label:"SMTP 端口",type:"number",placeholder:"留空则使用系统设置(如 465)",optional:!0},{key:"email_user",label:"发件邮箱",placeholder:"留空则使用系统设置的发件邮箱",optional:!0},{key:"email_password",label:"邮箱密码或授权码",type:"password",placeholder:"留空则使用系统设置的授权码",optional:!0},{key:"recipient_email",label:"接收邮箱",placeholder:"必填,通知发到这个邮箱"}],defaults:{}},webhook:{label:"Webhook",fields:[{key:"webhook_url",label:"Webhook 地址"},{key:"http_method",label:"请求方法",type:"select",options:["POST","PUT"]},{key:"headers",label:"请求头 JSON",type:"textarea",placeholder:'{"Authorization":"Bearer ..."}',optional:!0}],defaults:{http_method:"POST",headers:"{}"}},wechat:{label:"企业微信",fields:[{key:"webhook_url",label:"机器人 Webhook 地址"}],defaults:{}},telegram:{label:"Telegram",fields:[{key:"bot_token",label:"Bot Token",type:"password"},{key:"chat_id",label:"Chat ID"}],defaults:{}}},re=20,Rt=i=>{var k,x;const r=(x=(k=i==null?void 0:i.response)==null?void 0:k.data)==null?void 0:x.detail;if(r&&typeof r=="object"&&"message"in r){const b=r.message;if(typeof b=="string"&&b.trim())return b.trim()}return typeof r=="string"&&r.trim()?r.trim():i instanceof Error&&i.message?i.message:"测试发送失败,请稍后重试"},oe=i=>i.nickname||i.remark||i.id,T=i=>{if(!i)return"-";const r=new Date(i.includes("T")?i:`${i.replace(" ","T")}Z`);return Number.isNaN(r.getTime())?i:r.toLocaleString("zh-CN")},Wt=({isAdmin:i})=>{const[r,k]=l.useState("channels"),[x,b]=l.useState([]),[A,ce]=l.useState([]),[de,D]=l.useState([]),[Te,g]=l.useState({}),[f,Ae]=l.useState([]),[me,De]=l.useState([]),[C,xe]=l.useState(!0),[Pe,j]=l.useState(!1),[N,pe]=l.useState(null),[P,B]=l.useState("dingtalk"),[O,I]=l.useState(""),[d,p]=l.useState({}),[ue,he]=l.useState(!1),[Be,u]=l.useState(!1),[v,ye]=l.useState(null),[M,q]=l.useState(""),[W,G]=l.useState(""),[z,F]=l.useState(""),[H,h]=l.useState([]),[be,S]=l.useState(!1),[ge,Oe]=l.useState([]),[fe,Ie]=l.useState(0),[U,Me]=l.useState(""),[Z,qe]=l.useState(""),[w,_]=l.useState(0),[J,je]=l.useState(!1),[Ne,We]=l.useState([]),[ve,Ge]=l.useState(""),[R,we]=l.useState(""),[K,ke]=l.useState(!1),m=async()=>{xe(!0);try{const[e,s,a,n]=await Promise.all([dt(),mt(),xt(),pt()]);b(e),ce(s.data),D(a.data),g(c=>{const rt=new Set(a.data.map(Y=>String(Y.id)));return Object.fromEntries(Object.entries(c).filter(([Y])=>rt.has(Y)))}),Ae(n.events),De(n.priorities)}catch(e){o(`加载通知配置失败:${e.message}`)}finally{xe(!1)}};l.useEffect(()=>{m()},[]);const ze=()=>{const e="dingtalk";pe(null),B(e),I(""),p({...y[e].defaults}),j(!0)},Fe=e=>{pe(e),B(e.type),I(e.name),p({...y[e.type].defaults,...e.config}),j(!0)},He=e=>{B(e),p({...y[e].defaults})},Ue=async()=>{he(!0);try{N?await _e(N.id,{name:O,config:d,enabled:N.enabled}):await jt({name:O,type:P,config:d}),j(!1),await m()}catch(e){o(`保存通知渠道失败:${e.message}`)}finally{he(!1)}},Ze=async e=>{try{await _e(e.id,{enabled:!e.enabled}),ce(s=>s.map(a=>a.id===e.id?{...a,enabled:!a.enabled}:a)),e.enabled?D(s=>s.filter(a=>a.channel_id!==Number(e.id))):await m()}catch(s){o(`更新渠道状态失败:${s.message}`)}},Je=async e=>{if(await se(`确认删除通知渠道“${e.name}”?相关账号绑定也会被删除。`))try{await yt(e.id),await m()}catch(s){o(`删除通知渠道失败:${s.message}`)}},Ke=e=>{var s;return((s=f.find(a=Line truncated
|
||||
import{r as l,j as t,bd as $,e as ee,L as te,aF as ot,C as ct,X as Se,o as dt,bn as mt,bo as xt,bp as pt,n as o,bq as ut,br as ht,bs as _e,v as se,bt as yt,bu as Re,bv as bt,bw as gt,bx as ft,by as jt,bz as Nt}from"./index-DsODdDMf.js";import{a as vt,b as wt,S as E,E as L}from"./ui-CQHd7VNo.js";import{L as ae}from"./link-2-DPJwJ3Cv.js";import{S as le}from"./shield-alert-JYWkaAgT.js";import{A as ne}from"./activity-C3vSFSwT.js";import{P as $e}from"./plus-fhLljyPf.js";import{P as Ee}from"./pen-line-lDrHTQ2Z.js";import{T as ie}from"./trash-2-CvZQL5SJ.js";import{S as kt}from"./send-KQw7ZSlT.js";import{C as Ct,a as St}from"./chevron-right-CJ-DrOxg.js";import{S as Le}from"./save-1bfmWlQj.js";import{C as _t}from"./check-D0r7RhTo.js";const y={dingtalk:{label:"钉钉",fields:[{key:"webhook_url",label:"Webhook 地址",placeholder:"https://oapi.dingtalk.com/robot/send?..."},{key:"secret",label:"加签密钥",type:"password",optional:!0}],defaults:{}},feishu:{label:"飞书",fields:[{key:"webhook_url",label:"Webhook 地址",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{key:"secret",label:"签名密钥",type:"password",optional:!0}],defaults:{}},bark:{label:"Bark",fields:[{key:"device_key",label:"Device Key",type:"password"},{key:"server_url",label:"服务器地址",placeholder:"https://api.day.app",optional:!0}],defaults:{server_url:"https://api.day.app"}},email:{label:"邮件",fields:[{key:"smtp_server",label:"SMTP 服务器",placeholder:"留空则使用「系统设置 → 邮件服务」",optional:!0},{key:"smtp_port",label:"SMTP 端口",type:"number",placeholder:"留空则使用系统设置(如 465)",optional:!0},{key:"email_user",label:"发件邮箱",placeholder:"留空则使用系统设置的发件邮箱",optional:!0},{key:"email_password",label:"邮箱密码或授权码",type:"password",placeholder:"留空则使用系统设置的授权码",optional:!0},{key:"recipient_email",label:"接收邮箱",placeholder:"必填,通知发到这个邮箱"}],defaults:{}},webhook:{label:"Webhook",fields:[{key:"webhook_url",label:"Webhook 地址"},{key:"http_method",label:"请求方法",type:"select",options:["POST","PUT"]},{key:"headers",label:"请求头 JSON",type:"textarea",placeholder:'{"Authorization":"Bearer ..."}',optional:!0}],defaults:{http_method:"POST",headers:"{}"}},wechat:{label:"企业微信",fields:[{key:"webhook_url",label:"机器人 Webhook 地址"}],defaults:{}},telegram:{label:"Telegram",fields:[{key:"bot_token",label:"Bot Token",type:"password"},{key:"chat_id",label:"Chat ID"}],defaults:{}}},re=20,Rt=i=>{var k,x;const r=(x=(k=i==null?void 0:i.response)==null?void 0:k.data)==null?void 0:x.detail;if(r&&typeof r=="object"&&"message"in r){const b=r.message;if(typeof b=="string"&&b.trim())return b.trim()}return typeof r=="string"&&r.trim()?r.trim():i instanceof Error&&i.message?i.message:"测试发送失败,请稍后重试"},oe=i=>i.nickname||i.remark||i.id,T=i=>{if(!i)return"-";const r=new Date(i.includes("T")?i:`${i.replace(" ","T")}Z`);return Number.isNaN(r.getTime())?i:r.toLocaleString("zh-CN")},Wt=({isAdmin:i})=>{const[r,k]=l.useState("channels"),[x,b]=l.useState([]),[A,ce]=l.useState([]),[de,D]=l.useState([]),[Te,g]=l.useState({}),[f,Ae]=l.useState([]),[me,De]=l.useState([]),[C,xe]=l.useState(!0),[Pe,j]=l.useState(!1),[N,pe]=l.useState(null),[P,B]=l.useState("dingtalk"),[O,I]=l.useState(""),[d,p]=l.useState({}),[ue,he]=l.useState(!1),[Be,u]=l.useState(!1),[v,ye]=l.useState(null),[M,q]=l.useState(""),[W,G]=l.useState(""),[z,F]=l.useState(""),[H,h]=l.useState([]),[be,S]=l.useState(!1),[ge,Oe]=l.useState([]),[fe,Ie]=l.useState(0),[U,Me]=l.useState(""),[Z,qe]=l.useState(""),[w,_]=l.useState(0),[J,je]=l.useState(!1),[Ne,We]=l.useState([]),[ve,Ge]=l.useState(""),[R,we]=l.useState(""),[K,ke]=l.useState(!1),m=async()=>{xe(!0);try{const[e,s,a,n]=await Promise.all([dt(),mt(),xt(),pt()]);b(e),ce(s.data),D(a.data),g(c=>{const rt=new Set(a.data.map(Y=>String(Y.id)));return Object.fromEntries(Object.entries(c).filter(([Y])=>rt.has(Y)))}),Ae(n.events),De(n.priorities)}catch(e){o(`加载通知配置失败:${e.message}`)}finally{xe(!1)}};l.useEffect(()=>{m()},[]);const ze=()=>{const e="dingtalk";pe(null),B(e),I(""),p({...y[e].defaults}),j(!0)},Fe=e=>{pe(e),B(e.type),I(e.name),p({...y[e.type].defaults,...e.config}),j(!0)},He=e=>{B(e),p({...y[e].defaults})},Ue=async()=>{he(!0);try{N?await _e(N.id,{name:O,config:d,enabled:N.enabled}):await jt({name:O,type:P,config:d}),j(!1),await m()}catch(e){o(`保存通知渠道失败:${e.message}`)}finally{he(!1)}},Ze=async e=>{try{await _e(e.id,{enabled:!e.enabled}),ce(s=>s.map(a=>a.id===e.id?{...a,enabled:!a.enabled}:a)),e.enabled?D(s=>s.filter(a=>a.channel_id!==Number(e.id))):await m()}catch(s){o(`更新渠道状态失败:${s.message}`)}},Je=async e=>{if(await se(`确认删除通知渠道“${e.name}”?相关账号绑定也会被删除。`))try{await yt(e.id),await m()}catch(s){o(`删除通知渠道失败:${s.message}`)}},Ke=e=>{var s;return((s=f.find(a=Line truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as Re,r as l,h as ys,O as js,j as e,e as $,P as fs,E as vs,Q as Ns,b as N,X as _,o as _s,T as ws,V as Me,W as ks,Y as Ss,n,Z as Cs,v as Pe,_ as Os,$ as Es,a0 as Ls,a1 as Is,a2 as Ms,a3 as Ps,a4 as Ds,a5 as Fs}from"./index-B6vXMTe7.js";import{a as As,b as $s,E as Rs}from"./ui-d5h_DIWi.js";import{P as qs}from"./plus-M91O_yID.js";import{T as De}from"./truck-TJpV8qJ4.js";import{S as Ts}from"./search-CcRo0a6D.js";import{P as Y}from"./package-check-BXdM6afK.js";import{F as zs}from"./flower-2-IRuBbax2.js";import{E as Vs}from"./eye-DrjE9to4.js";import{S as Hs}from"./square-pen-zAhXskLp.js";import{T as Js}from"./trash-2-BXclSDej.js";import{C as Ws,a as Bs}from"./chevron-right-CQL8vgnL.js";import{S as Fe}from"./save-DH-JrqiY.js";/**
|
||||
import{c as Re,r as l,h as ys,O as js,j as e,e as $,P as fs,E as vs,Q as Ns,b as N,X as _,o as _s,T as ws,V as Me,W as ks,Y as Ss,n,Z as Cs,v as Pe,_ as Os,$ as Es,a0 as Ls,a1 as Is,a2 as Ms,a3 as Ps,a4 as Ds,a5 as Fs}from"./index-DsODdDMf.js";import{a as As,b as $s,E as Rs}from"./ui-CQHd7VNo.js";import{P as qs}from"./plus-fhLljyPf.js";import{T as De}from"./truck-BWE0A9OO.js";import{S as Ts}from"./search-sxbkAeV0.js";import{P as Y}from"./package-check-DMYEV4p7.js";import{F as zs}from"./flower-2-Qv1fS9dP.js";import{E as Vs}from"./eye-DqWY05EP.js";import{S as Hs}from"./square-pen-DR0-XdRq.js";import{T as Js}from"./trash-2-CvZQL5SJ.js";import{C as Ws,a as Bs}from"./chevron-right-CJ-DrOxg.js";import{S as Fe}from"./save-1bfmWlQj.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as B,r as d,bR as T,o as G,bS as J,bT as Q,j as e,bU as q,L as S,e as W,E as X}from"./index-B6vXMTe7.js";import{P as Z,a as ee,N as te,E as D}from"./ui-d5h_DIWi.js";import{S as K}from"./sparkles-CqzmPNd2.js";import{P as se}from"./package-CSDxsYBE.js";import{S as re}from"./search-CcRo0a6D.js";import{T as ae}from"./trending-up-BU9xAGFY.js";/**
|
||||
import{c as B,r as d,bS as T,o as G,bT as J,bU as Q,j as e,bV as q,L as S,e as W,E as X}from"./index-DsODdDMf.js";import{P as Z,a as ee,N as te,E as D}from"./ui-CQHd7VNo.js";import{S as K}from"./sparkles-CRcwNwKo.js";import{P as se}from"./package-C5umlMc4.js";import{S as re}from"./search-sxbkAeV0.js";import{T as ae}from"./trending-up-2bhyfwOI.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -8,4 +8,4 @@ import{c as B,r as d,bR as T,o as G,bS as J,bT as Q,j as e,bU as q,L as S,e as W
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ie=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],oe=B("layers",ie),ce=2500,de=[{id:"sold",label:"按销量"},{id:"similarity",label:"按相似度"},{id:"credit",label:"按信用"},{id:"reviews",label:"按评论数"}],O=n=>!n||n<0?"0":n>=1e4?`${(n/1e4).toFixed(1).replace(/\.0$/,"")}万`:String(n),xe=n=>n.replace(/&(hellip|nbsp|amp|lt|gt|quot|#39);/g,a=>({"…":"…"," ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"})[a]??a),me=n=>{if(!n)return"—";const a=Date.now()-n*1e3;if(a<6e4)return"刚刚";if(a<36e5)return`${Math.floor(a/6e4)}分钟前`;if(a<864e5)return`${Math.floor(a/36e5)}小时前`;if(a<7*864e5)return`${Math.floor(a/864e5)}天前`;const c=new Date(n*1e3);return`${c.getMonth()+1}月${c.getDate()}日`},z=({value:n,max:a=100,suffix:c="%"})=>{const u=a>0?n/a:0,r=u>=.7?"bg-emerald-50 text-emerald-700 border-emerald-200":u>=.4?"bg-sky-50 text-sky-700 border-sky-200":"bg-[var(--surface-subtle)] text-[var(--text-soft)] border-[var(--border)]";return e.jsxs("span",{className:`inline-flex min-w-[3.5rem] justify-center rounded-full border px-2 py-0.5 text-xs font-semibold tabular-nums ${r}`,title:`${n} / ${a}`,children:[n,c]})},fe=({level:n,fallback:a})=>n?e.jsxs("span",{className:"inline-flex flex-col items-center gap-0.5",title:`信用等级 ${n} 级${a?`(${a})`:""}`,children:[e.jsxs("span",{className:"text-xs leading-none tracking-tight text-amber-500",children:["★".repeat(n),e.jsx("span",{className:"text-[var(--border)]",children:"☆".repeat(5-n)})]}),e.jsx("span",{className:"text-[11px] leading-none text-[var(--text-soft)]",children:a||`${n}级`})]}):e.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",title:a||"未获取到信用数据",children:a||"—"}),pe=({reviews:n,goodRate:a,detail:c})=>e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",title:c,children:[e.jsx("span",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:O(n)}),a>0&&e.jsxs("span",{className:"text-[11px] leading-none tabular-nums text-emerald-600",children:[a,"% 好评"]})]}),w=({icon:n,label:a,children:c,title:u})=>e.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-[var(--surface-subtle)] px-3.5 py-3",title:u,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-soft)]",children:[e.jsx(n,{className:"h-3.5 w-3.5"}),a]}),e.jsx("div",{className:"mt-1.5 truncate text-sm font-semibold text-[var(--text)]",children:c})]}),ve=()=>{var E,P,R;const[n,a]=d.useState(!0),[c,u]=d.useState(""),[r,$]=d.useState(null),[f,y]=d.useState(!1),[x,j]=d.useState(null),[_,Y]=d.useState("sold"),[v,m]=d.useState(null),[A,C]=d.useState(""),[M,U]=d.useState(""),[b,I]=d.useState(!1),p=d.useRef(null),k=d.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null),y(!1),j(null)},[]),L=d.useCallback(async t=>{var o,s,l,g;try{const i=await T(t);i.data&&$(i.data),i.refreshing&&(y(!0),j({done:((o=i.progress)==null?void 0:o.done)??0,total:((s=i.progress)==null?void 0:s.total)??0,stage:((l=i.progress)==null?void 0:l.stage)||"抓取中"})),((g=i.progress)==null?void 0:g.state)==="error"&&i.progress.error&&m({type:"error",message:i.progress.error})}catch(i){console.error("加载同行店铺失败:",i)}},[]);d.useEffect(()=>{let t=!0;return(async()=>{try{const s=(await G())[0];if(!t)return;if(!s){m({type:"info",message:"请先在「账号管理」添加账号并同步商品,再回到本页。"}),a(!1);return}u(s.id),await L(s.id)}catch(o){console.error("初始化同行店铺失败:",o)}finally{t&&a(!1)}})(),()=>{t=!1,p.current&&clearInterval(p.current)}},[L]),d.useEffect(()=>{if(!(!f||!c))return p.current=setInterval(async()=>{var t,o,s,l,g;try{const i=await T(c);j({done:((t=i.progress)==null?void 0:t.done)??0,total:((o=i.progress)==null?void 0:o.total)??0,stage:((s=i.progress)==null?void 0:s.stage)||"抓取中"}),((l=i.progress)==null?void 0:l.state)==="done"?(k(),i.data&&$(i.data),m({type:"success",message:"同行店铺数据已更新。"})):((g=i.progress)==null?void 0:g.state)==="error"&&(k(),m({type:"error",message:i.progress.error||"抓取失败,请稍后重试。"}))}catch(i){console.error("轮询同行店铺失败:",i)}},ce),()=>{p.current&&clearInterval(p.current)}},[f,c,k]);const F=d.useCallback(async()=>{var t,o;if(!(!c||f)){m(null),C("");try{if((await J(c)).status==="running"){y(!0);return}y(!0),j({done:0,total:0,stage:"准备抓取"})}catch(s){const l=((o=(t=s==null?void 0:s.response)==null?void 0:t.data)==null?void 0:o.detail)||(s==null?void 0:s.message)||"触发刷新失败";m({type:"error",message:String(l)})}}},[c,f]),H=d.useCallback(async()=>{var t,o;if(!(!c||b)){I(!0),m(null);try{const s=await Q(c);s.statLine truncated
|
||||
*/const ie=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],oe=B("layers",ie),ce=2500,de=[{id:"sold",label:"按销量"},{id:"similarity",label:"按相似度"},{id:"credit",label:"按信用"},{id:"reviews",label:"按评论数"}],O=n=>!n||n<0?"0":n>=1e4?`${(n/1e4).toFixed(1).replace(/\.0$/,"")}万`:String(n),xe=n=>n.replace(/&(hellip|nbsp|amp|lt|gt|quot|#39);/g,a=>({"…":"…"," ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"})[a]??a),me=n=>{if(!n)return"—";const a=Date.now()-n*1e3;if(a<6e4)return"刚刚";if(a<36e5)return`${Math.floor(a/6e4)}分钟前`;if(a<864e5)return`${Math.floor(a/36e5)}小时前`;if(a<7*864e5)return`${Math.floor(a/864e5)}天前`;const c=new Date(n*1e3);return`${c.getMonth()+1}月${c.getDate()}日`},z=({value:n,max:a=100,suffix:c="%"})=>{const u=a>0?n/a:0,r=u>=.7?"bg-emerald-50 text-emerald-700 border-emerald-200":u>=.4?"bg-sky-50 text-sky-700 border-sky-200":"bg-[var(--surface-subtle)] text-[var(--text-soft)] border-[var(--border)]";return e.jsxs("span",{className:`inline-flex min-w-[3.5rem] justify-center rounded-full border px-2 py-0.5 text-xs font-semibold tabular-nums ${r}`,title:`${n} / ${a}`,children:[n,c]})},fe=({level:n,fallback:a})=>n?e.jsxs("span",{className:"inline-flex flex-col items-center gap-0.5",title:`信用等级 ${n} 级${a?`(${a})`:""}`,children:[e.jsxs("span",{className:"text-xs leading-none tracking-tight text-amber-500",children:["★".repeat(n),e.jsx("span",{className:"text-[var(--border)]",children:"☆".repeat(5-n)})]}),e.jsx("span",{className:"text-[11px] leading-none text-[var(--text-soft)]",children:a||`${n}级`})]}):e.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",title:a||"未获取到信用数据",children:a||"—"}),pe=({reviews:n,goodRate:a,detail:c})=>e.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",title:c,children:[e.jsx("span",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:O(n)}),a>0&&e.jsxs("span",{className:"text-[11px] leading-none tabular-nums text-emerald-600",children:[a,"% 好评"]})]}),w=({icon:n,label:a,children:c,title:u})=>e.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-[var(--surface-subtle)] px-3.5 py-3",title:u,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-soft)]",children:[e.jsx(n,{className:"h-3.5 w-3.5"}),a]}),e.jsx("div",{className:"mt-1.5 truncate text-sm font-semibold text-[var(--text)]",children:c})]}),ve=()=>{var E,P,R;const[n,a]=d.useState(!0),[c,u]=d.useState(""),[r,$]=d.useState(null),[f,y]=d.useState(!1),[x,j]=d.useState(null),[_,Y]=d.useState("sold"),[v,m]=d.useState(null),[A,C]=d.useState(""),[M,U]=d.useState(""),[b,I]=d.useState(!1),p=d.useRef(null),k=d.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null),y(!1),j(null)},[]),L=d.useCallback(async t=>{var o,s,l,g;try{const i=await T(t);i.data&&$(i.data),i.refreshing&&(y(!0),j({done:((o=i.progress)==null?void 0:o.done)??0,total:((s=i.progress)==null?void 0:s.total)??0,stage:((l=i.progress)==null?void 0:l.stage)||"抓取中"})),((g=i.progress)==null?void 0:g.state)==="error"&&i.progress.error&&m({type:"error",message:i.progress.error})}catch(i){console.error("加载同行店铺失败:",i)}},[]);d.useEffect(()=>{let t=!0;return(async()=>{try{const s=(await G())[0];if(!t)return;if(!s){m({type:"info",message:"请先在「账号管理」添加账号并同步商品,再回到本页。"}),a(!1);return}u(s.id),await L(s.id)}catch(o){console.error("初始化同行店铺失败:",o)}finally{t&&a(!1)}})(),()=>{t=!1,p.current&&clearInterval(p.current)}},[L]),d.useEffect(()=>{if(!(!f||!c))return p.current=setInterval(async()=>{var t,o,s,l,g;try{const i=await T(c);j({done:((t=i.progress)==null?void 0:t.done)??0,total:((o=i.progress)==null?void 0:o.total)??0,stage:((s=i.progress)==null?void 0:s.stage)||"抓取中"}),((l=i.progress)==null?void 0:l.state)==="done"?(k(),i.data&&$(i.data),m({type:"success",message:"同行店铺数据已更新。"})):((g=i.progress)==null?void 0:g.state)==="error"&&(k(),m({type:"error",message:i.progress.error||"抓取失败,请稍后重试。"}))}catch(i){console.error("轮询同行店铺失败:",i)}},ce),()=>{p.current&&clearInterval(p.current)}},[f,c,k]);const V=d.useCallback(async()=>{var t,o;if(!(!c||f)){m(null),C("");try{if((await J(c)).status==="running"){y(!0);return}y(!0),j({done:0,total:0,stage:"准备抓取"})}catch(s){const l=((o=(t=s==null?void 0:s.response)==null?void 0:t.data)==null?void 0:o.detail)||(s==null?void 0:s.message)||"触发刷新失败";m({type:"error",message:String(l)})}}},[c,f]),F=d.useCallback(async()=>{var t,o;if(!(!c||b)){I(!0),m(null);try{const s=await Q(c);s.statLine truncated
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import{c as C,r as l,bV as pe,bW as he,j as e,bX as X,e as E,X as q,bY as ue,aF as be,bZ as je,b_ as ge,b$ as V,c0 as ve,c1 as _e,c2 as ye}from"./index-B6vXMTe7.js";import{P as Z,a as Ne,N as R,E as J}from"./ui-d5h_DIWi.js";import{P as fe}from"./plus-M91O_yID.js";import{P as Q}from"./play-CJJP6ME8.js";import{P as we}from"./pen-line-Clj2OF6I.js";import{T as ke}from"./trash-2-BXclSDej.js";import{S as U}from"./search-CcRo0a6D.js";/**
|
||||
import{c as C,r as l,bW as pe,bX as he,j as e,bY as X,e as E,X as q,bZ as ue,aF as be,b_ as je,b$ as ge,c0 as Z,c1 as ve,c2 as _e,c3 as ye}from"./index-DsODdDMf.js";import{P as J,a as Ne,N as R,E as Q}from"./ui-CQHd7VNo.js";import{P as fe}from"./plus-fhLljyPf.js";import{P as U}from"./play-DS4dwZmR.js";import{P as we}from"./pen-line-lDrHTQ2Z.js";import{T as ke}from"./trash-2-CvZQL5SJ.js";import{S as V}from"./search-sxbkAeV0.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -18,4 +18,4 @@ import{c as C,r as l,bV as pe,bW as he,j as e,bX as X,e as E,X as q,bY as ue,aF
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ee=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Re=C("pause",Ee),Ie=2500,p=t=>t==null?"—":`¥${Number(t).toLocaleString("zh-CN",{maximumFractionDigits:2})}`,L=()=>Math.floor(Date.now()/1e3),F=t=>{if(!t||t<=0)return"—";const c=Math.floor(t);return c<60?`${c} 秒前`:c<3600?`${Math.floor(c/60)} 分钟前`:c<86400?`${Math.floor(c/3600)} 小时前`:`${Math.floor(c/86400)} 天前`},Le=t=>t==null||t<0?"已停用":t<60?`${Math.max(0,Math.round(t))} 秒后`:t<3600?`${Math.floor(t/60)} 分钟后`:`${Math.floor(t/3600)} 小时后`,k=t=>{const c=t.trim();if(c==="")return null;const h=Number(c);return Number.isFinite(h)&&h>=0?h:null},ee={name:"",keyword:"",min_price:"",max_price:"",target_price:"",interval_minutes:"30",pages:"2",enabled:!0,cookie_id:"",min_seller_credit:"",min_seller_deals:"",ai_precise:!1},Fe=t=>({name:t.name,keyword:t.keyword,min_price:t.min_price===null?"":String(t.min_price),max_price:t.max_price===null?"":String(t.max_price),target_price:t.target_price===null?"":String(t.target_price),interval_minutes:String(t.interval_minutes),pages:String(t.pages||2),enabled:t.enabled!==!1,cookie_id:t.cookie_id||"",min_seller_credit:t.min_seller_credit||"",min_seller_deals:t.min_seller_deals!=null?String(t.min_seller_deals):"",ai_precise:!!t.ai_precise}),se=t=>{const c=t.keyword.trim();if(!c)return{input:null,error:"请填写搜索关键词"};const h=t.name.trim()||c,v=k(t.min_price),m=k(t.max_price);if(v!==null&&m!==null&&v>m)return{input:null,error:"最低价不能大于最高价"};const g=k(t.target_price);if(g!==null&&m!==null&&g>m)return{input:null,error:"目标价不能高于最高价"};const u=Number(t.interval_minutes);if(!Number.isFinite(u)||u<5)return{input:null,error:"检查间隔至少 5 分钟"};const i=Number(t.pages);return!Number.isFinite(i)||i<1||i>5?{input:null,error:"每轮页数取 1~5"}:{input:{name:h,keyword:c,min_price:v,max_price:m,target_price:g,interval_minutes:Math.round(u),pages:Math.round(i),enabled:t.enabled,cookie_id:t.cookie_id||null,min_seller_credit:t.min_seller_credit||null,min_seller_deals:k(t.min_seller_deals),ai_precise:t.ai_precise}}};function ze(){const[t,c]=l.useState([]),[h,v]=l.useState(!0),[m,g]=l.useState(""),[u,i]=l.useState(null),[te,A]=l.useState([]),[ae,_]=l.useState(!1),[y,D]=l.useState(null),[n,d]=l.useState(ee),[T,H]=l.useState(!1),[O,N]=l.useState(""),[S,Y]=l.useState(!1),[o,f]=l.useState(null),[B,b]=l.useState(""),[$,z]=l.useState(null),[G,P]=l.useState([]),[re,K]=l.useState(!1),w=l.useRef(new Set),x=l.useCallback(async()=>{try{const r=(await pe()).rules??[];c(r),g("");const a=new Set;for(const j of r)j.running&&a.add(j.id);const M=[...w.current].filter(j=>!a.has(j));w.current=a,M.length&&x()}catch(s){g(s instanceof Error?s.message:"加载失败")}finally{v(!1)}},[]);l.useEffect(()=>{x(),he().then(r=>A(r.cookies??[])).catch(()=>A([]));const s=setInterval(()=>void x(),Ie);return()=>clearInterval(s)},[x]);const ne=()=>{D(null),d(ee),f(null),b(""),N(""),_(!0)},le=s=>{D(s.id),d(Fe(s)),f(null),b(""),N(""),_(!0)},ie=async()=>{const{input:s,error:r}=se(n);if(!s){b(r??"参数有误");return}Y(!0),b(""),f(null);try{const a=await je({keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,pages:s.pages,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise});f(a),a.error?b(a.error):a.lowest||b("没搜到符合条件的商品,换个关键词或放宽价格区间试试")}catch(a){b(a instanceof Error?a.message:"试搜失败")}finally{Y(!1)}},ce=async()=>{const{input:s,error:r}=se(n);if(!s){N(r??"参数有误");return}H(!0),N("");try{y===null?await ge(s):await V(y,s),_(!1),i({type:"info",message:y===null?"规则已创建,可以立即检查一次":"规则已保存"}),await x()}catch(a){N(a instanceof Error?a.message:"保存失败")}finally{H(!1)}},de=async s=>{w.current.add(s.id),i(null);try{const r=await ve(s.id);if(!r.started)i({type:"info",message:r.message??"任务未启动"});else if(r.record){const a=r.record.lowest_price;a==null?i({type:"warning",message:`「${s.name}」没搜到可比价的商品(已记录一次空结果)`}):r.notified?i({type:"success",message:`已找到最低价 ${p(a)},通知已发送(${r.notify_reason||"命中"})`}):i({type:"info",message:`本次最低价 ${p(a)}(${r.notify_reason||"未触发通知"})`}),r.notify_error&&i({type:"error",message:`通知发送失败:${r.notify_error}`})}}catch(r){i({type:"error",message:r instanceof Error?r.message:"检查失败"})}finally{w.current.delete(s.id),await x()}},oe=async s=>{try{await V(s.id,{name:s.name,keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,target_price:s.target_price,interval_minutes:s.interval_minutes,pages:s.pages,enabled:!s.enabled,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise}),i({type:"success",message:s.enablLine truncated
|
||||
*/const Ee=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Re=C("pause",Ee),Ie=2500,p=t=>t==null?"—":`¥${Number(t).toLocaleString("zh-CN",{maximumFractionDigits:2})}`,L=()=>Math.floor(Date.now()/1e3),F=t=>{if(!t||t<=0)return"—";const c=Math.floor(t);return c<60?`${c} 秒前`:c<3600?`${Math.floor(c/60)} 分钟前`:c<86400?`${Math.floor(c/3600)} 小时前`:`${Math.floor(c/86400)} 天前`},Le=t=>t==null||t<0?"已停用":t<60?`${Math.max(0,Math.round(t))} 秒后`:t<3600?`${Math.floor(t/60)} 分钟后`:`${Math.floor(t/3600)} 小时后`,k=t=>{const c=t.trim();if(c==="")return null;const h=Number(c);return Number.isFinite(h)&&h>=0?h:null},ee={name:"",keyword:"",min_price:"",max_price:"",target_price:"",interval_minutes:"30",pages:"2",enabled:!0,cookie_id:"",min_seller_credit:"",min_seller_deals:"",ai_precise:!1},Fe=t=>({name:t.name,keyword:t.keyword,min_price:t.min_price===null?"":String(t.min_price),max_price:t.max_price===null?"":String(t.max_price),target_price:t.target_price===null?"":String(t.target_price),interval_minutes:String(t.interval_minutes),pages:String(t.pages||2),enabled:t.enabled!==!1,cookie_id:t.cookie_id||"",min_seller_credit:t.min_seller_credit||"",min_seller_deals:t.min_seller_deals!=null?String(t.min_seller_deals):"",ai_precise:!!t.ai_precise}),se=t=>{const c=t.keyword.trim();if(!c)return{input:null,error:"请填写搜索关键词"};const h=t.name.trim()||c,v=k(t.min_price),m=k(t.max_price);if(v!==null&&m!==null&&v>m)return{input:null,error:"最低价不能大于最高价"};const g=k(t.target_price);if(g!==null&&m!==null&&g>m)return{input:null,error:"目标价不能高于最高价"};const u=Number(t.interval_minutes);if(!Number.isFinite(u)||u<5)return{input:null,error:"检查间隔至少 5 分钟"};const i=Number(t.pages);return!Number.isFinite(i)||i<1||i>5?{input:null,error:"每轮页数取 1~5"}:{input:{name:h,keyword:c,min_price:v,max_price:m,target_price:g,interval_minutes:Math.round(u),pages:Math.round(i),enabled:t.enabled,cookie_id:t.cookie_id||null,min_seller_credit:t.min_seller_credit||null,min_seller_deals:k(t.min_seller_deals),ai_precise:t.ai_precise}}};function ze(){const[t,c]=l.useState([]),[h,v]=l.useState(!0),[m,g]=l.useState(""),[u,i]=l.useState(null),[te,A]=l.useState([]),[ae,_]=l.useState(!1),[y,D]=l.useState(null),[n,d]=l.useState(ee),[T,H]=l.useState(!1),[O,N]=l.useState(""),[S,Y]=l.useState(!1),[o,f]=l.useState(null),[B,b]=l.useState(""),[$,z]=l.useState(null),[G,P]=l.useState([]),[re,K]=l.useState(!1),w=l.useRef(new Set),x=l.useCallback(async()=>{try{const r=(await pe()).rules??[];c(r),g("");const a=new Set;for(const j of r)j.running&&a.add(j.id);const M=[...w.current].filter(j=>!a.has(j));w.current=a,M.length&&x()}catch(s){g(s instanceof Error?s.message:"加载失败")}finally{v(!1)}},[]);l.useEffect(()=>{x(),he().then(r=>A(r.cookies??[])).catch(()=>A([]));const s=setInterval(()=>void x(),Ie);return()=>clearInterval(s)},[x]);const ne=()=>{D(null),d(ee),f(null),b(""),N(""),_(!0)},le=s=>{D(s.id),d(Fe(s)),f(null),b(""),N(""),_(!0)},ie=async()=>{const{input:s,error:r}=se(n);if(!s){b(r??"参数有误");return}Y(!0),b(""),f(null);try{const a=await je({keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,pages:s.pages,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise});f(a),a.error?b(a.error):a.lowest||b("没搜到符合条件的商品,换个关键词或放宽价格区间试试")}catch(a){b(a instanceof Error?a.message:"试搜失败")}finally{Y(!1)}},ce=async()=>{const{input:s,error:r}=se(n);if(!s){N(r??"参数有误");return}H(!0),N("");try{y===null?await ge(s):await Z(y,s),_(!1),i({type:"info",message:y===null?"规则已创建,可以立即检查一次":"规则已保存"}),await x()}catch(a){N(a instanceof Error?a.message:"保存失败")}finally{H(!1)}},de=async s=>{w.current.add(s.id),i(null);try{const r=await ve(s.id);if(!r.started)i({type:"info",message:r.message??"任务未启动"});else if(r.record){const a=r.record.lowest_price;a==null?i({type:"warning",message:`「${s.name}」没搜到可比价的商品(已记录一次空结果)`}):r.notified?i({type:"success",message:`已找到最低价 ${p(a)},通知已发送(${r.notify_reason||"命中"})`}):i({type:"info",message:`本次最低价 ${p(a)}(${r.notify_reason||"未触发通知"})`}),r.notify_error&&i({type:"error",message:`通知发送失败:${r.notify_error}`})}}catch(r){i({type:"error",message:r instanceof Error?r.message:"检查失败"})}finally{w.current.delete(s.id),await x()}},oe=async s=>{try{await Z(s.id,{name:s.name,keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,target_price:s.target_price,interval_minutes:s.interval_minutes,pages:s.pages,enabled:!s.enabled,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise}),i({type:"success",message:s.enablLine truncated
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as H,r as c,j as e,aB as J,e as ye,S as ge,E as be,L as j,aC as je,aD as _e,aE as Ne,aF as ve,X as O,o as fe,aG as we,aH as ke,aI as Ce,aJ as U,n as r,v as E,aK as $e,aL as Se,aM as Pe,aN as De,aO as Re,aP as Fe,aQ as Me,aR as Le}from"./index-B6vXMTe7.js";import{P as Ie,a as Ae,b as Ee,S as _,E as N,N as ze}from"./ui-d5h_DIWi.js";import{S as C}from"./search-CcRo0a6D.js";import{T as v}from"./trash-2-BXclSDej.js";import{S as z}from"./save-DH-JrqiY.js";import{P as X}from"./play-CJJP6ME8.js";import{P as Te}from"./package-check-BXdM6afK.js";import{L as Be}from"./link-2-BDFLqg13.js";/**
|
||||
import{c as H,r as c,j as e,aB as J,e as ye,S as ge,E as be,L as j,aC as je,aD as _e,aE as Ne,aF as ve,X as O,o as fe,aG as we,aH as ke,aI as Ce,aJ as U,n as r,v as E,aK as $e,aL as Se,aM as Pe,aN as De,aO as Re,aP as Fe,aQ as Me,aR as Le}from"./index-DsODdDMf.js";import{P as Ie,a as Ae,b as Ee,S as _,E as N,N as ze}from"./ui-CQHd7VNo.js";import{S as C}from"./search-sxbkAeV0.js";import{T as v}from"./trash-2-CvZQL5SJ.js";import{S as z}from"./save-1bfmWlQj.js";import{P as X}from"./play-DS4dwZmR.js";import{P as Te}from"./package-check-DMYEV4p7.js";import{L as Be}from"./link-2-DPJwJ3Cv.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
import{c as ze,r,o as Be,j as e,bH as he,L as p,b as Ke,X as pe,E as He,bI as We,bJ as Je,bK as Ve,bL as Xe,bM as Ye,bN as Ge,bO as Qe}from"./index-DsODdDMf.js";import{a as Ze,N as et,b as tt,E as ge}from"./ui-CQHd7VNo.js";import{S as A}from"./search-sxbkAeV0.js";import{P as st}from"./plus-fhLljyPf.js";import{S as at}from"./sparkles-CRcwNwKo.js";import{P as rt}from"./package-C5umlMc4.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const lt=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],U=ze("heart",lt),it=["包邮","无需邮寄","一口价","按距离计费"],W=d=>d.url?d.url:!d.item_id||d.item_id.startsWith("mock_")?"":`https://www.goofish.com/item?id=${d.item_id}`,fe=d=>new Promise(g=>{const c=new Image;c.onload=()=>g({width:c.naturalWidth||1e3,height:c.naturalHeight||1e3}),c.onerror=()=>g(null),c.src=d}),be={title:"",price:"",desc:"",delivery:"包邮",postPrice:"0",quantity:"1",cat:null},nt=d=>{const g=d.cat||{},c=String(g.catId??""),j=String(g.channelCatId??"");return!c||!j?null:{cat_id:c,channel_cat_id:j,tb_cat_id:String(g.tbCatId??""),cat_name:d.cat_name||""}},ht=()=>{var ue;const[d,g]=r.useState([]),[c,j]=r.useState(""),[N,ye]=r.useState("favorites"),[q,l]=r.useState(null),[S,je]=r.useState([]),[Ne,ve]=r.useState(1),[we,_e]=r.useState(!1),[f,J]=r.useState(!1),[v,ke]=r.useState(!1),[C,Se]=r.useState(""),[V,Ce]=r.useState([]),[D,X]=r.useState(!1),[Y,Ie]=r.useState(!1),[u,G]=r.useState(null),[b,M]=r.useState(null),[Q,Z]=r.useState(!1),[i,m]=r.useState(be),[I,ee]=r.useState(!1),[L,O]=r.useState(""),[h,y]=r.useState([]),[te,T]=r.useState(""),[Le,z]=r.useState(!1),[w,P]=r.useState(!1),_=r.useRef(null),B=r.useRef(null),[se,ae]=r.useState([]),[F,re]=r.useState(!1),[$,le]=r.useState([]),[Pe,ie]=r.useState(!1),[ne,E]=r.useState(!1),[K,R]=r.useState(""),Fe=r.useMemo(()=>new Map(d.map(t=>[t.id,t.nickname||t.remark||`账号 ${t.id.substring(0,6)}`])),[d]),ce=r.useMemo(()=>{const t=K.trim().toLowerCase();return t?$.filter(s=>s.cat_name.toLowerCase().includes(t)):$},[$,K]);r.useEffect(()=>{Be().then(t=>{const s=t.filter(n=>n.enabled),a=s.length>0?s:t;g(a),j(n=>{var o;return n||((o=a[0])==null?void 0:o.id)||""})}).catch(()=>l({type:"error",message:"账号列表加载失败"}))},[]);const H=async(t=1)=>{if(!c){l({type:"error",message:"请先选择账号"});return}J(!0),l(null);try{const s=await We(c,t,20),a=s.items||[];je(n=>t===1?a:[...n,...a]),_e(!!s.next_page),ve(t),ke(!0),a.length===0&&t===1&&l({type:"error",message:"该账号没有可转卖的有效收藏"})}catch(s){l({type:"error",message:s instanceof Error?s.message:"收藏列表加载失败"})}finally{J(!1)}},oe=r.useRef(!1);r.useEffect(()=>{!c||N!=="favorites"||v||f||oe.current||(oe.current=!0,H(1))},[c,N,v,f]);const de=async()=>{if(!c){l({type:"error",message:"请先选择账号"});return}if(!C.trim()){l({type:"error",message:"请输入搜索关键词"});return}X(!0),l(null);try{const t=await Je(c,C.trim());Ce(t.items||[]),Ie(!0),(t.items||[]).length===0&&l({type:"error",message:`没有搜到「${C.trim()}」相关商品`})}catch(t){l({type:"error",message:t instanceof Error?t.message:"搜索失败"})}finally{X(!1)}},$e=t=>{if(h.length<=1){l({type:"error",message:"至少保留一张图片"});return}y(s=>s.filter((a,n)=>n!==t))},Ee=t=>{t<=0||y(s=>{const a=[...s],[n]=a.splice(t,1);return[n,...a]})},Re=async()=>{const t=te.trim();if(!w){if(!/^https?:\/\//.test(t)){l({type:"error",message:"请输入以 http(s):// 开头的图片地址"});return}if(h.length>=9){l({type:"error",message:"最多 9 张图片"});return}P(!0);try{const s=await fe(t);if(!s){l({type:"error",message:"该图片地址无法加载(可能防盗链或已失效)"});return}y(a=>[...a,{url:t,...s}].slice(0,9)),T(""),z(!1),l({type:"success",message:"已添加图片"})}finally{P(!1)}}},Ae=async(t,s)=>{if(!t||!t.length)return;const a=t[0];P(!0);try{const n=await Ve(a),o=new URL(n.path,window.location.origin).href,k=await fe(o);if(!k){l({type:"error",message:"图片上传后无法加载,请重试"});return}if(s!=null)y(x=>x.map((Oe,Te)=>Te===s?{url:o,...k}:Oe)),l({type:"success",message:"图片已替换"});else{if(h.length>=9){l({type:"error",message:"最多 9 张图片"});return}y(x=>[...x,{url:o,...k}].slice(0,9)),l({type:"success",message:"图片已添加"})}/^(https?:\/\/)?(localhost|127\.0\.0\.1|192\.168\.)/.test(window.location.origin)&&l({type:"error",message:"当前访问地址非公网,闲鱼可能无法拉取上传的图片,建议通过公网域名操作"})}catch(n){l({type:"error",message:n instanceof Error?n.message:"图片上传失败"})}finally{P(!1),_.current&&(_.current.value=""),B.current=null}},Ue=async()=>{if(!(!u||!c||F)){re(!0);try{const t=await Xe({cookie_id:c,title:i.title,description:i.desc});if(!t.success){l({type:"error",message:t.message||"AI 优化失败,请重试"});return}const s=t.titles||[];ae(s),t.description&&t.description!==i.desc&&m(a=>({...a,desc:t.description})),l({type:"success",message:s.length?`AI 已生成 ${s.length} 个候选标题(点击选用),描述已同步优化`:"描述已优化"})}catch(t){l({type:"error",message:t instanceof Error?t.message:"AI 优化失败"})}finally{re(!1)}}},qe=async(t,s)=>{ie(!0);try{const a=await Qe({cookie_id:c,item_id:t,title:s||""});le(a.options||[]);const n=a.current;n!=null&&n.cat_id&&(n!=null&
Line truncated
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
import{c as Fe,r as l,o as Ee,j as e,bH as le,L as g,b as Re,X as ie,E as Ae,bI as $e,bJ as Ue,bK as qe,bL as De,bM as Me,bN as Te}from"./index-B6vXMTe7.js";import{a as ze,N as Be,b as He,E as ne}from"./ui-d5h_DIWi.js";import{S as F}from"./search-CcRo0a6D.js";import{P as Oe}from"./plus-M91O_yID.js";import{S as Ke}from"./sparkles-CqzmPNd2.js";import{P as We}from"./package-CSDxsYBE.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Je=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],E=Fe("heart",Je),Ve=["包邮","无需邮寄","一口价","按距离计费"],z=d=>d.url?d.url:!d.item_id||d.item_id.startsWith("mock_")?"":`https://www.goofish.com/item?id=${d.item_id}`,ce=d=>new Promise(k=>{const c=new Image;c.onload=()=>k({width:c.naturalWidth||1e3,height:c.naturalHeight||1e3}),c.onerror=()=>k(null),c.src=d}),oe={title:"",price:"",desc:"",delivery:"包邮",postPrice:"0",quantity:"1"},ss=()=>{const[d,k]=l.useState([]),[c,B]=l.useState(""),[y,de]=l.useState("favorites"),[R,a]=l.useState(null),[S,me]=l.useState([]),[xe,ue]=l.useState(1),[pe,he]=l.useState(!1),[f,H]=l.useState(!1),[j,ge]=l.useState(!1),[_,fe]=l.useState(""),[O,be]=l.useState([]),[A,K]=l.useState(!1),[W,ye]=l.useState(!1),[x,J]=l.useState(null),[h,$]=l.useState(null),[V,X]=l.useState(!1),[i,u]=l.useState(oe),[I,Y]=l.useState(!1),[C,U]=l.useState(""),[p,b]=l.useState([]),[G,q]=l.useState(""),[je,D]=l.useState(!1),[N,L]=l.useState(!1),v=l.useRef(null),M=l.useRef(null),[Q,Z]=l.useState([]),[P,ee]=l.useState(!1),Ne=l.useMemo(()=>new Map(d.map(s=>[s.id,s.nickname||s.remark||`账号 ${s.id.substring(0,6)}`])),[d]);l.useEffect(()=>{Ee().then(s=>{const t=s.filter(n=>n.enabled),r=t.length>0?t:s;k(r),B(n=>{var o;return n||((o=r[0])==null?void 0:o.id)||""})}).catch(()=>a({type:"error",message:"账号列表加载失败"}))},[]);const T=async(s=1)=>{if(!c){a({type:"error",message:"请先选择账号"});return}H(!0),a(null);try{const t=await $e(c,s,20),r=t.items||[];me(n=>s===1?r:[...n,...r]),he(!!t.next_page),ue(s),ge(!0),r.length===0&&s===1&&a({type:"error",message:"该账号没有可转卖的有效收藏"})}catch(t){a({type:"error",message:t instanceof Error?t.message:"收藏列表加载失败"})}finally{H(!1)}},se=l.useRef(!1);l.useEffect(()=>{!c||y!=="favorites"||j||f||se.current||(se.current=!0,T(1))},[c,y,j,f]);const te=async()=>{if(!c){a({type:"error",message:"请先选择账号"});return}if(!_.trim()){a({type:"error",message:"请输入搜索关键词"});return}K(!0),a(null);try{const s=await Ue(c,_.trim());be(s.items||[]),ye(!0),(s.items||[]).length===0&&a({type:"error",message:`没有搜到「${_.trim()}」相关商品`})}catch(s){a({type:"error",message:s instanceof Error?s.message:"搜索失败"})}finally{K(!1)}},ve=s=>{if(p.length<=1){a({type:"error",message:"至少保留一张图片"});return}b(t=>t.filter((r,n)=>n!==s))},we=s=>{s<=0||b(t=>{const r=[...t],[n]=r.splice(s,1);return[n,...r]})},ke=async()=>{const s=G.trim();if(!N){if(!/^https?:\/\//.test(s)){a({type:"error",message:"请输入以 http(s):// 开头的图片地址"});return}if(p.length>=9){a({type:"error",message:"最多 9 张图片"});return}L(!0);try{const t=await ce(s);if(!t){a({type:"error",message:"该图片地址无法加载(可能防盗链或已失效)"});return}b(r=>[...r,{url:s,...t}].slice(0,9)),q(""),D(!1),a({type:"success",message:"已添加图片"})}finally{L(!1)}}},Se=async(s,t)=>{if(!s||!s.length)return;const r=s[0];L(!0);try{const n=await qe(r),o=new URL(n.path,window.location.origin).href,w=await ce(o);if(!w){a({type:"error",message:"图片上传后无法加载,请重试"});return}if(t!=null)b(m=>m.map((Le,Pe)=>Pe===t?{url:o,...w}:Le)),a({type:"success",message:"图片已替换"});else{if(p.length>=9){a({type:"error",message:"最多 9 张图片"});return}b(m=>[...m,{url:o,...w}].slice(0,9)),a({type:"success",message:"图片已添加"})}/^(https?:\/\/)?(localhost|127\.0\.0\.1|192\.168\.)/.test(window.location.origin)&&a({type:"error",message:"当前访问地址非公网,闲鱼可能无法拉取上传的图片,建议通过公网域名操作"})}catch(n){a({type:"error",message:n instanceof Error?n.message:"图片上传失败"})}finally{L(!1),v.current&&(v.current.value=""),M.current=null}},_e=async()=>{if(!(!x||!c||P)){ee(!0);try{const s=await De({cookie_id:c,title:i.title,description:i.desc});if(!s.success){a({type:"error",message:s.message||"AI 优化失败,请重试"});return}const t=s.titles||[];Z(t),s.description&&s.description!==i.desc&&u(r=>({...r,desc:s.description})),a({type:"success",message:t.length?`AI 已生成 ${t.length} 个候选标题(点击选用),描述已同步优化`:"描述已优化"})}catch(s){a({type:"error",message:s instanceof Error?s.message:"AI 优化失败"})}finally{ee(!1)}}},Ie=async s=>{var t,r;if(!c){a({type:"error",message:"请先选择账号"});return}J(s),$(null),U(""),Z([]),D(!1),q(""),b((t=s.images)!=null&&t.length?s.images.map(n=>({url:n,width:1e3,height:1e3})):s.image?[{url:s.image,width:1e3,height:1e3}]:[]),u({...oe,title:s.title||"",price:(s.price||"").replace(/[^\d.]/g,"")}),X(!0);try{const o=(await Te({cookie_id:c,item_id:s.item_id})).item;$(o),(r=o.images)!=null&&r.length&&b(o.images.map(m=>({url:m.url,width:m.width||1e3,height:m.height||1e3})));const w=o.price!=null?String(o.price):"";u(m=>({...m,title
Line truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as se,r as l,aT as ae,j as e,l as te,e as K,aU as ne,aV as v,aW as q,S as le,ak as O,aX as ie,aY as re,n as c,aZ as ce,a_ as oe,a$ as de,b0 as pe,b1 as me,b2 as ue}from"./index-B6vXMTe7.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-d5h_DIWi.js";import{S as je}from"./save-DH-JrqiY.js";import{S as Q}from"./sparkles-CqzmPNd2.js";import{Z as L}from"./zap-CacyPsoN.js";import{E as w}from"./eye-off-BLAfRw6v.js";import{E as C}from"./eye-DrjE9to4.js";/**
|
||||
import{c as se,r as l,aT as ae,j as e,l as te,e as K,aU as ne,aV as v,aW as q,S as le,ak as O,aX as ie,aY as re,n as c,aZ as ce,a_ as oe,a$ as de,b0 as pe,b1 as me,b2 as ue}from"./index-DsODdDMf.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-CQHd7VNo.js";import{S as je}from"./save-1bfmWlQj.js";import{S as Q}from"./sparkles-CRcwNwKo.js";import{Z as L}from"./zap-T1zC1hkQ.js";import{E as w}from"./eye-off-BivEoqlz.js";import{E as C}from"./eye-DqWY05EP.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{r as l,j as e,U as h,e as $,S as j,aU as A,L as f,ak as L,bA as P,n as i,v as y,bB as R,bC as T,aZ as E,bD as _}from"./index-B6vXMTe7.js";import{a as I,S as N,E as B}from"./ui-d5h_DIWi.js";import{T as D}from"./trash-2-BXclSDej.js";const H=n=>{if(!n)return"-";const c=new Date(n.includes("T")?n:`${n.replace(" ","T")}Z`);return Number.isNaN(c.getTime())?n:c.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},M=()=>{const[n,c]=l.useState([]),[u,g]=l.useState(!0),[o,d]=l.useState(null),[w,p]=l.useState(null),[b,m]=l.useState(""),x=async()=>{g(!0);try{c(await P())}catch(t){i(`加载用户列表失败:${t.message}`,"error")}finally{g(!1)}};l.useEffect(()=>{x()},[]);const U=async t=>{if(o!==null)return;const s=t.is_active!==!1;if(!(s&&!await y(`禁用用户「${t.username}」?其所有在线会话将立即下线,且无法再登录。`,{title:"禁用用户",confirmLabel:"禁用",danger:!0}))){d(t.id);try{const a=await R(t.id,!s);i(a.message||"状态已更新","success"),await x()}catch(a){i(`操作失败:${a.message}`,"error")}finally{d(null)}}},C=async t=>{const[s,a]=E(b);if(!s){i(a,"warning");return}if(o===null){d(t.id);try{const r=await _(t.id,b);i(r.message||"密码已重置","success"),p(null),m("")}catch(r){i(`重置失败:${r.message}`,"error")}finally{d(null)}}},k=async t=>{if(o===null&&await y(`删除用户「${t.username}」?其名下的闲鱼账号、卡密、回复规则等数据将一并删除,不可恢复。`,{title:"删除用户",confirmLabel:"删除",danger:!0})){d(t.id);try{const s=await T(t.id);i(s.message||"用户已删除","success"),await x()}catch(s){i(`删除失败:${s.message}`,"error")}finally{d(null)}}};return e.jsxs("div",{className:"page-stack",children:[e.jsx(I,{title:"用户管理",description:"管理注册用户与登录权限。普通用户仅能操作分配给其名下的账号数据。",icon:h,actions:e.jsxs("button",{type:"button",onClick:()=>void x(),className:"ios-btn-secondary flex items-center gap-2 rounded-md px-4 py-2.5 text-sm",children:[e.jsx($,{className:`h-4 w-4 ${u?"animate-spin":""}`}),"刷新"]})}),e.jsxs("section",{className:"section-panel",children:[e.jsx(N,{title:"权限说明",icon:j}),e.jsxs("div",{className:"grid gap-3 p-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface-subtle)] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-bold text-[var(--text)]",children:[e.jsx(j,{className:"h-4 w-4 text-[#8a6300]"}),"管理员(admin)"]}),e.jsx("p",{className:"mt-1.5 text-xs leading-5 text-[var(--text-muted)]",children:"拥有全部权限:系统设置、通知与系统日志、用户管理,以及所有闲鱼账号和数据。"})]}),e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface-subtle)] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-bold text-[var(--text)]",children:[e.jsx(A,{className:"h-4 w-4 text-[var(--text-soft)]"}),"普通用户"]}),e.jsx("p",{className:"mt-1.5 text-xs leading-5 text-[var(--text-muted)]",children:"只能看到并操作自己名下的闲鱼账号、商品、订单与消息;侧栏不显示系统设置与用户管理,接口层也会拒绝其访问。"})]})]})]}),e.jsxs("section",{className:"section-panel",children:[e.jsx(N,{title:"用户列表",description:`共 ${n.length} 个用户`,icon:h}),e.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[n.map(t=>{const s=t.username==="admin",a=t.is_active===!1,r=o===t.id,v=w===t.id;return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--brand)] text-sm font-black text-[#2a2416]",children:t.username.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-sm font-bold text-[var(--text)]",children:t.username}),s&&e.jsx("span",{className:"rounded-full bg-[var(--brand)] px-2 py-0.5 text-[10px] font-bold text-[#2a2416]",children:"内置管理员"}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-bold ${a?"bg-red-50 text-red-600":"bg-emerald-50 text-emerald-600"}`,children:a?"已禁用":"正常"})]}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:t.email}),e.jsxs("p",{className:"mt-1 text-[11px] text-[var(--text-soft)]",children:[t.cookie_count??0," 个闲鱼账号 · ",t.card_count??0," 张卡密 · 注册于 ",H(t.created_at)]})]}),!s&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void U(t),disabled:r,className:a?"rounded-md bg-emerald-50 px-3 py-2 text-xs font-bold text-emerald-700 hover:bg-emerald-100 disabled:opacity-50":"rounded-md bg-amber-50 px-3 py-2 text-xs font-bolLine truncated
|
||||
import{r as l,j as e,U as h,e as $,S as j,aU as A,L as f,ak as L,bA as P,n as i,v as y,bB as R,bC as T,aZ as E,bD as _}from"./index-DsODdDMf.js";import{a as I,S as N,E as B}from"./ui-CQHd7VNo.js";import{T as D}from"./trash-2-CvZQL5SJ.js";const H=n=>{if(!n)return"-";const c=new Date(n.includes("T")?n:`${n.replace(" ","T")}Z`);return Number.isNaN(c.getTime())?n:c.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},M=()=>{const[n,c]=l.useState([]),[u,g]=l.useState(!0),[o,d]=l.useState(null),[w,p]=l.useState(null),[b,m]=l.useState(""),x=async()=>{g(!0);try{c(await P())}catch(t){i(`加载用户列表失败:${t.message}`,"error")}finally{g(!1)}};l.useEffect(()=>{x()},[]);const U=async t=>{if(o!==null)return;const s=t.is_active!==!1;if(!(s&&!await y(`禁用用户「${t.username}」?其所有在线会话将立即下线,且无法再登录。`,{title:"禁用用户",confirmLabel:"禁用",danger:!0}))){d(t.id);try{const a=await R(t.id,!s);i(a.message||"状态已更新","success"),await x()}catch(a){i(`操作失败:${a.message}`,"error")}finally{d(null)}}},C=async t=>{const[s,a]=E(b);if(!s){i(a,"warning");return}if(o===null){d(t.id);try{const r=await _(t.id,b);i(r.message||"密码已重置","success"),p(null),m("")}catch(r){i(`重置失败:${r.message}`,"error")}finally{d(null)}}},k=async t=>{if(o===null&&await y(`删除用户「${t.username}」?其名下的闲鱼账号、卡密、回复规则等数据将一并删除,不可恢复。`,{title:"删除用户",confirmLabel:"删除",danger:!0})){d(t.id);try{const s=await T(t.id);i(s.message||"用户已删除","success"),await x()}catch(s){i(`删除失败:${s.message}`,"error")}finally{d(null)}}};return e.jsxs("div",{className:"page-stack",children:[e.jsx(I,{title:"用户管理",description:"管理注册用户与登录权限。普通用户仅能操作分配给其名下的账号数据。",icon:h,actions:e.jsxs("button",{type:"button",onClick:()=>void x(),className:"ios-btn-secondary flex items-center gap-2 rounded-md px-4 py-2.5 text-sm",children:[e.jsx($,{className:`h-4 w-4 ${u?"animate-spin":""}`}),"刷新"]})}),e.jsxs("section",{className:"section-panel",children:[e.jsx(N,{title:"权限说明",icon:j}),e.jsxs("div",{className:"grid gap-3 p-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface-subtle)] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-bold text-[var(--text)]",children:[e.jsx(j,{className:"h-4 w-4 text-[#8a6300]"}),"管理员(admin)"]}),e.jsx("p",{className:"mt-1.5 text-xs leading-5 text-[var(--text-muted)]",children:"拥有全部权限:系统设置、通知与系统日志、用户管理,以及所有闲鱼账号和数据。"})]}),e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface-subtle)] p-3.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-bold text-[var(--text)]",children:[e.jsx(A,{className:"h-4 w-4 text-[var(--text-soft)]"}),"普通用户"]}),e.jsx("p",{className:"mt-1.5 text-xs leading-5 text-[var(--text-muted)]",children:"只能看到并操作自己名下的闲鱼账号、商品、订单与消息;侧栏不显示系统设置与用户管理,接口层也会拒绝其访问。"})]})]})]}),e.jsxs("section",{className:"section-panel",children:[e.jsx(N,{title:"用户列表",description:`共 ${n.length} 个用户`,icon:h}),e.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[n.map(t=>{const s=t.username==="admin",a=t.is_active===!1,r=o===t.id,v=w===t.id;return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--brand)] text-sm font-black text-[#2a2416]",children:t.username.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-sm font-bold text-[var(--text)]",children:t.username}),s&&e.jsx("span",{className:"rounded-full bg-[var(--brand)] px-2 py-0.5 text-[10px] font-bold text-[#2a2416]",children:"内置管理员"}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-bold ${a?"bg-red-50 text-red-600":"bg-emerald-50 text-emerald-600"}`,children:a?"已禁用":"正常"})]}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:t.email}),e.jsxs("p",{className:"mt-1 text-[11px] text-[var(--text-soft)]",children:[t.cookie_count??0," 个闲鱼账号 · ",t.card_count??0," 张卡密 · 注册于 ",H(t.created_at)]})]}),!s&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void U(t),disabled:r,className:a?"rounded-md bg-emerald-50 px-3 py-2 text-xs font-bold text-emerald-700 hover:bg-emerald-100 disabled:opacity-50":"rounded-md bg-amber-50 px-3 py-2 text-xs font-bolLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as t}from"./index-B6vXMTe7.js";/**
|
||||
import{c as t}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as o}from"./index-B6vXMTe7.js";/**
|
||||
import{c as o}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--gray-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--gray-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--gray-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relativeLine truncated
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--gray-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--gray-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--gray-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relativeLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CxcNMqU-.js","assets/ui-d5h_DIWi.js","assets/package-CSDxsYBE.js","assets/trending-up-BU9xAGFY.js","assets/activity-BTtvkBmV.js","assets/package-check-BXdM6afK.js","assets/AccountList-CvLosEBq.js","assets/check-DL81-py-.js","assets/sparkles-CqzmPNd2.js","assets/power-xEOwpRim.js","assets/trash-2-BXclSDej.js","assets/key-C3ZC9YGe.js","assets/eye-off-BLAfRw6v.js","assets/eye-DrjE9to4.js","assets/save-DH-JrqiY.js","assets/OrderList-DIjZ-21x.js","assets/plus-M91O_yID.js","assets/truck-TJpV8qJ4.js","assets/search-CcRo0a6D.js","assets/flower-2-IRuBbax2.js","assets/square-pen-zAhXskLp.js","assets/chevron-right-CQL8vgnL.js","assets/CardList-CPWOLiGW.js","assets/image-DY0F8hXj.js","assets/ItemList-CiYDDUUQ.js","assets/shield-alert-C73TDqA7.js","assets/power-off-C-Cynwt5.js","assets/settings-2-Dpu5P58d.js","assets/ProductAutomation-_T5BbTsB.js","assets/play-CJJP6ME8.js","assets/link-2-BDFLqg13.js","assets/AIReply-BPRDw1ZS.js","assets/message-square-text-D8XDdRdS.js","assets/Settings-aAeuroja.js","assets/zap-CacyPsoN.js","assets/Keywords-Bre3qaOd.js","assets/MessageManagement-hDdMPHoo.js","assets/send-CCwDPbrT.js","assets/NotificationsAndLogs-Dz2hQGJd.js","assets/pen-line-Clj2OF6I.js","assets/UserManagement-DIhwoqOv.js","assets/About-BCBvkV41.js","assets/BuyerInteraction-MU9YG7BL.js","assets/Resell-DhxjHD5X.js","assets/HotList-OWVSz1rj.js","assets/PeerShops-BsZrhX6d.js","assets/PriceWatch-BI7YGeOw.js"])))=>i.map(i=>d[i]);
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-BwyP74XQ.js","assets/ui-CQHd7VNo.js","assets/package-C5umlMc4.js","assets/trending-up-2bhyfwOI.js","assets/activity-C3vSFSwT.js","assets/package-check-DMYEV4p7.js","assets/AccountList-rd9ol5A3.js","assets/check-D0r7RhTo.js","assets/sparkles-CRcwNwKo.js","assets/power-BffuaJ6g.js","assets/trash-2-CvZQL5SJ.js","assets/key-B7TfiDhV.js","assets/eye-off-BivEoqlz.js","assets/eye-DqWY05EP.js","assets/save-1bfmWlQj.js","assets/OrderList-UNGYTnVo.js","assets/plus-fhLljyPf.js","assets/truck-BWE0A9OO.js","assets/search-sxbkAeV0.js","assets/flower-2-Qv1fS9dP.js","assets/square-pen-DR0-XdRq.js","assets/chevron-right-CJ-DrOxg.js","assets/CardList-CEXfmWno.js","assets/image-BPsEsLmt.js","assets/ItemList-Dg9Wv7M0.js","assets/shield-alert-JYWkaAgT.js","assets/power-off-DcIidedg.js","assets/settings-2-C_s9tppi.js","assets/ProductAutomation-DK_ysI0r.js","assets/play-DS4dwZmR.js","assets/link-2-DPJwJ3Cv.js","assets/AIReply-CwxPMo_y.js","assets/message-square-text-SsmtmT8O.js","assets/Settings-BtQEQL92.js","assets/zap-T1zC1hkQ.js","assets/Keywords-Bj3mRqWd.js","assets/MessageManagement-CxE0X0kv.js","assets/send-KQw7ZSlT.js","assets/NotificationsAndLogs-Cuzu5LxK.js","assets/pen-line-lDrHTQ2Z.js","assets/UserManagement-f1XrG4E3.js","assets/About-1p95l6vG.js","assets/BuyerInteraction-DNWEGtID.js","assets/Resell-CUUz7jou.js","assets/HotList-BtLo2o4Z.js","assets/PeerShops-ntZtIie8.js","assets/PriceWatch-CEQpXaBy.js"])))=>i.map(i=>d[i]);
|
||||
function xp(l,s){for(var c=0;c<s.length;c++){const r=s[c];if(typeof r!="string"&&!Array.isArray(r)){for(const f in r)if(f!=="default"&&!(f in l)){const m=Object.getOwnPropertyDescriptor(r,f);m&&Object.defineProperty(l,f,m.get?m:{enumerable:!0,get:()=>r[f]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))r(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function c(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function r(f){if(f.ep)return;f.ep=!0;const m=c(f);fetch(f.href,m)}})();function hh(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Ic={exports:{}},lu={};/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.js
|
||||
@@ -280,4 +280,4 @@ Error generating stack: `+n.message+`
|
||||
`);return h===-1?"":f.stack.slice(h+1)})();try{if(!r.stack)r.stack=m;else if(m){const h=m.indexOf(`
|
||||
`),p=h===-1?-1:m.indexOf(`
|
||||
`,h+1),v=p===-1?"":m.slice(p+1);String(r.stack).endsWith(v)||(r.stack+=`
|
||||
`+m)}}catch{}}throw r}}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=bn(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:m}=c;r!==void 0&&Ci.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean),legacyInterceptorReqResOrdering:ot.transitional(ot.boolean),advertiseZstdAcceptEncoding:ot.transitional(ot.boolean),validateStatusUndefinedResolves:ot.transitional(ot.boolean)},!1),f!=null&&(x.isFunction(f)?c.paramsSerializer={serialize:f}:Ci.assertOptions(f,{encode:ot.function,serialize:ot.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),Ci.assertOptions(c,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let h=m&&x.merge(m.common,m[c.method]);m&&x.forEach(["delete","get","head","post","put","patch","query","common"],W=>{delete m[W]}),c.headers=ft.concat(h,m);const p=[];let v=!0;this.interceptors.request.forEach(function(X){if(typeof X.runWhen=="function"&&X.runWhen(c)===!1)return;v=v&&X.synchronous;const Y=c.transitional||Er;Y&&Y.legacyInterceptorReqResOrdering?p.unshift(X.fulfilled,X.rejected):p.push(X.fulfilled,X.rejected)});const g=[];this.interceptors.response.forEach(function(X){g.push(X.fulfilled,X.rejected)});let A,N=0,B;if(!v){const W=[rr.bind(this),void 0];for(W.unshift(...p),W.push(...g),B=W.length,A=Promise.resolve(c);N<B;)A=A.then(W[N++],W[N++]);return A}B=p.length;let F=c;for(;N<B;){const W=p[N++],X=p[N++];try{F=W?W(F):F}catch(Y){if(!X){A=Promise.reject(Y);break}try{const C=X.call(this,Y);x.isThenable(C)&&(A=Promise.resolve(C).then(()=>rr.call(this,F)))}catch(C){A=Promise.reject(C)}break}}if(!A)try{A=rr.call(this,F)}catch(W){A=Promise.reject(W)}for(N=0,B=g.length;N<B;)A=A.then(g[N++],g[N++]);return A}getUri(s){s=bn(this.defaults,s);const c=Gh(s.baseURL,s.url,s.allowAbsoluteUrls,s);return Lh(c,s.params,s.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(s){yn.prototype[s]=function(c,r){return this.request(bn(r||{},{method:s,url:c,data:r&&x.hasOwnProp(r,"data")?r.data:void 0}))}});x.forEach(["post","put","patch","query"],function(s){function c(r){return function(m,h,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:h}))}}yn.prototype[s]=c(),s!=="query"&&(yn.prototype[s+"Form"]=c(!0))});let pv=class $h{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(m){c=m});const r=this;this.promise.then(f=>{if(!r._listeners)return;let m=r._listeners.length;for(;m-- >0;)r._listeners[m](f);r._listeners=null}),this.promise.then=f=>{let m;const h=new Promise(p=>{r.subscribe(p),m=p}).then(f);return h.cancel=function(){r.unsubscribe(m)},h},s(function(m,h,p){r.reason||(r.reason=new du(m,h,p),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new $h(function(f){s=f}),cancel:s}}};function gv(l){return function(c){return l.apply(null,c)}}function bv(l){return x.isObject(l)&&l.isAxiosError===!0}const pr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCe
Line truncated
|
||||
`+m)}}catch{}}throw r}}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=bn(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:m}=c;r!==void 0&&Ci.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean),legacyInterceptorReqResOrdering:ot.transitional(ot.boolean),advertiseZstdAcceptEncoding:ot.transitional(ot.boolean),validateStatusUndefinedResolves:ot.transitional(ot.boolean)},!1),f!=null&&(x.isFunction(f)?c.paramsSerializer={serialize:f}:Ci.assertOptions(f,{encode:ot.function,serialize:ot.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),Ci.assertOptions(c,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let h=m&&x.merge(m.common,m[c.method]);m&&x.forEach(["delete","get","head","post","put","patch","query","common"],W=>{delete m[W]}),c.headers=ft.concat(h,m);const p=[];let v=!0;this.interceptors.request.forEach(function(X){if(typeof X.runWhen=="function"&&X.runWhen(c)===!1)return;v=v&&X.synchronous;const Y=c.transitional||Er;Y&&Y.legacyInterceptorReqResOrdering?p.unshift(X.fulfilled,X.rejected):p.push(X.fulfilled,X.rejected)});const g=[];this.interceptors.response.forEach(function(X){g.push(X.fulfilled,X.rejected)});let A,N=0,B;if(!v){const W=[rr.bind(this),void 0];for(W.unshift(...p),W.push(...g),B=W.length,A=Promise.resolve(c);N<B;)A=A.then(W[N++],W[N++]);return A}B=p.length;let F=c;for(;N<B;){const W=p[N++],X=p[N++];try{F=W?W(F):F}catch(Y){if(!X){A=Promise.reject(Y);break}try{const C=X.call(this,Y);x.isThenable(C)&&(A=Promise.resolve(C).then(()=>rr.call(this,F)))}catch(C){A=Promise.reject(C)}break}}if(!A)try{A=rr.call(this,F)}catch(W){A=Promise.reject(W)}for(N=0,B=g.length;N<B;)A=A.then(g[N++],g[N++]);return A}getUri(s){s=bn(this.defaults,s);const c=Gh(s.baseURL,s.url,s.allowAbsoluteUrls,s);return Lh(c,s.params,s.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(s){yn.prototype[s]=function(c,r){return this.request(bn(r||{},{method:s,url:c,data:r&&x.hasOwnProp(r,"data")?r.data:void 0}))}});x.forEach(["post","put","patch","query"],function(s){function c(r){return function(m,h,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:h}))}}yn.prototype[s]=c(),s!=="query"&&(yn.prototype[s+"Form"]=c(!0))});let pv=class $h{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(m){c=m});const r=this;this.promise.then(f=>{if(!r._listeners)return;let m=r._listeners.length;for(;m-- >0;)r._listeners[m](f);r._listeners=null}),this.promise.then=f=>{let m;const h=new Promise(p=>{r.subscribe(p),m=p}).then(f);return h.cancel=function(){r.unsubscribe(m)},h},s(function(m,h,p){r.reason||(r.reason=new du(m,h,p),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new $h(function(f){s=f}),cancel:s}}};function gv(l){return function(c){return l.apply(null,c)}}function bv(l){return x.isObject(l)&&l.isAxiosError===!0}const pr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCe
Line truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as o}from"./index-B6vXMTe7.js";/**
|
||||
import{c as o}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as o}from"./index-B6vXMTe7.js";/**
|
||||
import{c as o}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{c as e}from"./index-B6vXMTe7.js";/**
|
||||
import{c as e}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-B6vXMTe7.js";/**
|
||||
import{c}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as W,j as e,L as $,aF as A,bY as H,X as R,r as x,b as z}from"./index-B6vXMTe7.js";/**
|
||||
import{c as W,j as e,L as $,aF as A,bZ as H,X as R,r as x,b as z}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as a}from"./index-B6vXMTe7.js";/**
|
||||
import{c as a}from"./index-DsODdDMf.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
+2
-2
@@ -24,8 +24,8 @@
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/static/assets/index-B6vXMTe7.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-AteK7Kef.css">
|
||||
<script type="module" crossorigin src="/static/assets/index-DsODdDMf.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-DJevgMfP.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -377,6 +377,14 @@ class XianyuSellerAPI:
|
||||
return result
|
||||
|
||||
last_ret = ret_list
|
||||
# 失败时把上游完整响应一起打出来。ret 里往往只有“发布失败,请稍后
|
||||
# 重试吧!”这类通用文案,真正的子错误码在 data 里;不打出来就只能
|
||||
# 猜是风控、配额还是字段不合法,每次都要靠再发一次来试。
|
||||
try:
|
||||
_data = json.dumps(result.get("data"), ensure_ascii=False)[:800]
|
||||
except Exception: # noqa: BLE001 - 日志兜底,绝不影响主流程
|
||||
_data = str(result.get("data"))[:800]
|
||||
logger.warning(f"【{self.cookie_id}】{api} 业务失败 ret={ret_list} data={_data}")
|
||||
if risk_control.is_risk_control_error("; ".join(ret_list)):
|
||||
guard.trip("; ".join(ret_list))
|
||||
raise SellerApiError(api, ret_list)
|
||||
|
||||
Reference in new issue
Block a user