v3.6.16: 商品分状态显示(在售/已下架/草稿三套互不混排)
问题: 商品与发货页显示34件, 实际在售只有14件——本地库把20件已下架商品 和在售混在同一个列表里, 页头/页签/下拉全部用 items.length 口径。 - 新增状态分段页签: 在售 14 / 已下架 20 / 草稿 (品牌黄高亮, 带计数) - 计数口径统一为 onSaleCount: 页头badge、商品页签、账号下拉全部改为在售数 - 空状态按状态区分文案(没有已下架商品/没有草稿/拉取中/拉取失败) - 草稿本地库没有概念, 切到草稿页签时才按账号现拉闲鱼(带scope去重守卫) - 后端新增 /items/xyh-list: 按闲鱼分组(在售/已下架/已售出/草稿)拉取, XianyuAutoAsync.get_item_list_info 增加 group_name 参数按名选分组, 账号没有该分组时返回明确提示而非报错
This commit is contained in:
1 parent
fea5aee0cb
commit
f3771c5a48
57 files changed
+477
-97
No files matched your search
+31
-9
@@ -11213,7 +11213,7 @@ class XianyuLive:
|
||||
items.append(item)
|
||||
return items
|
||||
|
||||
async def get_item_list_info(self, page_number=1, page_size=20, retry_count=0):
|
||||
async def get_item_list_info(self, page_number=1, page_size=20, retry_count=0, group_name=None):
|
||||
"""动态发现当前账号的在售分组并获取商品列表。"""
|
||||
if retry_count >= 4:
|
||||
return {'error': '获取商品信息失败,重试次数过多'}
|
||||
@@ -11315,7 +11315,8 @@ class XianyuLive:
|
||||
return res_json
|
||||
|
||||
try:
|
||||
item_group = getattr(self, '_item_list_group', None)
|
||||
# 指定 group_name 时强制走分组发现,不能复用上次选中的“在售”缓存
|
||||
item_group = None if group_name else getattr(self, '_item_list_group', None)
|
||||
if page_number == 1 or not item_group:
|
||||
discovery_response = await request_item_api({
|
||||
'needGroupInfo': True,
|
||||
@@ -11328,7 +11329,7 @@ class XianyuLive:
|
||||
error_msg = discovery_ret[0] if discovery_ret else '未知错误'
|
||||
if 'TOKEN' in str(error_msg).upper():
|
||||
await asyncio.sleep(0.5)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1, group_name=group_name)
|
||||
return {'error': f"商品分组发现失败: {error_msg}"}
|
||||
|
||||
# 用 `or []` 兜住显式 None:闲鱼对无分组账号有时省略这个键
|
||||
@@ -11348,8 +11349,28 @@ class XianyuLive:
|
||||
f"【{self.cookie_id}】商品分组发现: account={self.myid}, "
|
||||
f"groups={group_summary}"
|
||||
)
|
||||
item_group = self._select_item_group(groups)
|
||||
if not item_group:
|
||||
if group_name:
|
||||
item_group = next(
|
||||
(
|
||||
group for group in groups
|
||||
if isinstance(group, dict) and str(group.get('groupName')) == group_name
|
||||
),
|
||||
None,
|
||||
)
|
||||
if not item_group:
|
||||
available = [
|
||||
str(group.get('groupName')) for group in groups
|
||||
if isinstance(group, dict) and group.get('groupName')
|
||||
]
|
||||
return {
|
||||
'error': (
|
||||
f'闲鱼账号没有名为「{group_name}」的商品分组'
|
||||
f'(现有分组:{"、".join(available) or "无"})'
|
||||
)
|
||||
}
|
||||
else:
|
||||
item_group = self._select_item_group(groups)
|
||||
if not item_group and not group_name:
|
||||
# 没匹配到“在售”不代表拿不到商品:闲鱼可能改了分组文案,
|
||||
# 账号也可能只有自定义分组。这里退回“按商品数最多的分组”,
|
||||
# 真的一件商品都没有才如实返回空列表,而不是报成接口异常。
|
||||
@@ -11424,7 +11445,8 @@ class XianyuLive:
|
||||
confirmed=False,
|
||||
response_fields=sorted(discovery_data.keys()),
|
||||
)
|
||||
self._item_list_group = item_group
|
||||
if group_name is None:
|
||||
self._item_list_group = item_group
|
||||
|
||||
group_id = item_group.get('groupId')
|
||||
group_name = item_group.get('groupName', '在售')
|
||||
@@ -11442,7 +11464,7 @@ class XianyuLive:
|
||||
error_msg = response_ret[0] if response_ret else '未知错误'
|
||||
if 'TOKEN' in str(error_msg).upper():
|
||||
await asyncio.sleep(0.5)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1, group_name=group_name)
|
||||
return {'error': f"获取商品信息失败: {error_msg}"}
|
||||
|
||||
items_data = res_json.get('data', {})
|
||||
@@ -11510,11 +11532,11 @@ class XianyuLive:
|
||||
f"(第{retry_count + 1}次): {self._safe_str(e)}"
|
||||
)
|
||||
await asyncio.sleep(backoff)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1, group_name=group_name)
|
||||
except Exception as e:
|
||||
logger.error(f"商品信息API请求异常: {self._safe_str(e)}")
|
||||
await asyncio.sleep(0.5)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1)
|
||||
return await self.get_item_list_info(page_number, page_size, retry_count + 1, group_name=group_name)
|
||||
|
||||
async def get_all_items(self, page_size=20, max_pages=None):
|
||||
"""获取所有在售商品信息(自动分页)。"""
|
||||
|
||||
@@ -43,6 +43,7 @@ from app.routers.logistics_quote import create_logistics_quote_router
|
||||
from app.routers.logistics_agent import create_logistics_agent_router
|
||||
from app.routers.hotlist import create_hotlist_router
|
||||
from app.routers.peer_shops import create_peer_shops_router
|
||||
from app.routers.xyh_items import create_xyh_items_router
|
||||
from utils.qr_login import qr_login_manager
|
||||
from utils.xianyu_utils import trans_cookies
|
||||
from utils.image_utils import image_manager
|
||||
@@ -397,6 +398,7 @@ logger.info("已注册物流 Agent 路由")
|
||||
|
||||
app.include_router(create_hotlist_router(get_current_user, db_manager))
|
||||
app.include_router(create_peer_shops_router(get_current_user, db_manager))
|
||||
app.include_router(create_xyh_items_router(get_current_user, db_manager))
|
||||
logger.info("已注册实时热卖榜路由")
|
||||
|
||||
from app.routers.pricewatch import create_pricewatch_router, start_scheduler as start_pricewatch_scheduler
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
"""闲鱼实时商品:按状态分组列表(在售/已下架/已售出/草稿)与商品编辑。
|
||||
|
||||
分组数据来自 mtop.idle.web.xyh.item.list 的 itemGroupList(综合/在售/已售出/
|
||||
自定义分组,账号有已下架商品时会出现「已下架」组);草稿组同理按名匹配,
|
||||
闲鱼没开草稿分组时返回明确的空态提示而不是报错。
|
||||
|
||||
编辑走 mtop.idle.pc.idleitem.edit,报文结构与一键转卖发布
|
||||
(mtop.idle.pc.idleitem.publish)完全一致,额外带 itemId。
|
||||
"""
|
||||
import logging
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
from XianyuAutoAsync import XianyuLive
|
||||
from utils.xianyu_seller_api import SellerApiError, XianyuSellerAPI
|
||||
from app.routers.resell import (
|
||||
_build_publish_payload,
|
||||
_category_name,
|
||||
_detail_images,
|
||||
_money,
|
||||
_normalize_detail,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 前端固定选项卡(必须与闲鱼分组名逐字一致,拉取时按名匹配)
|
||||
XYH_STATUS_GROUPS = ("在售", "已下架", "已售出", "草稿")
|
||||
|
||||
|
||||
class XyhDetailRequest(BaseModel):
|
||||
cookie_id: str
|
||||
item_id: str
|
||||
|
||||
|
||||
class XyhEditRequest(BaseModel):
|
||||
cookie_id: str
|
||||
item_id: str
|
||||
title: str
|
||||
price: float
|
||||
quantity: int = 1
|
||||
delivery: str = "包邮"
|
||||
post_price: float = 0
|
||||
desc: str = ""
|
||||
images: Optional[List[Dict[str, Any]]] = None
|
||||
|
||||
|
||||
def create_xyh_items_router(
|
||||
get_current_user: Callable[..., Dict[str, Any]],
|
||||
db_manager: Any,
|
||||
) -> APIRouter:
|
||||
router = APIRouter()
|
||||
|
||||
def require_account(cookie_id: str, current_user: Dict[str, Any]) -> Dict[str, Any]:
|
||||
details = db_manager.get_cookie_details(cookie_id)
|
||||
if not details or details.get("user_id") != current_user["user_id"]:
|
||||
raise HTTPException(status_code=404, detail="账号不存在或无权限")
|
||||
if not details.get("value"):
|
||||
raise HTTPException(status_code=400, detail="账号 Cookie 为空,无法调用闲鱼接口")
|
||||
return details
|
||||
|
||||
async def call_buyer(
|
||||
cookie_id: str,
|
||||
cookies_str: str,
|
||||
api: str,
|
||||
payload: Dict[str, Any],
|
||||
spm_cnt: str = "a21ybx.item.0.0",
|
||||
version: str = "1.0",
|
||||
) -> Dict[str, Any]:
|
||||
client = XianyuSellerAPI(cookie_id, cookies_str)
|
||||
try:
|
||||
return await client._call_buyer(api, payload, spm_cnt=spm_cnt, version=version)
|
||||
except SellerApiError as exc:
|
||||
raise HTTPException(status_code=502, detail=str(exc)) from exc
|
||||
finally:
|
||||
await client.close()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 分组商品列表:在售 / 已下架 / 已售出 / 草稿
|
||||
# ------------------------------------------------------------------
|
||||
@router.get("/items/xyh-list")
|
||||
async def xyh_list(
|
||||
cookie_id: str,
|
||||
group_name: str = "在售",
|
||||
page: int = 1,
|
||||
current_user: Dict[str, Any] = Depends(get_current_user),
|
||||
):
|
||||
if group_name not in XYH_STATUS_GROUPS:
|
||||
raise HTTPException(status_code=400, detail=f"不支持的商品状态:{group_name}")
|
||||
details = require_account(cookie_id, current_user)
|
||||
instance = XianyuLive(
|
||||
cookies_str=details["value"],
|
||||
cookie_id=cookie_id,
|
||||
user_id=current_user["user_id"],
|
||||
)
|
||||
try:
|
||||
result = await instance.get_item_list_info(max(1, page), 20, group_name=group_name)
|
||||
finally:
|
||||
await instance.close_session()
|
||||
|
||||
if result.get("error"):
|
||||
# 分组不存在(如账号没有草稿分组)→ 200 空列表 + 提示,让前端显示空态
|
||||
error_text = str(result["error"])
|
||||
if "没有名为" in error_text:
|
||||
return {"success": True, "group_name": group_name, "page": page,
|
||||
"total": 0, "items": [], "notice": error_text}
|
||||
raise HTTPException(status_code=502, detail=error_text)
|
||||
|
||||
items: List[Dict[str, Any]] = []
|
||||
for it in result.get("items") or []:
|
||||
if not isinstance(it, dict) or not it.get("id"):
|
||||
continue
|
||||
items.append({
|
||||
"item_id": str(it.get("id") or ""),
|
||||
"item_title": it.get("title") or "未命名商品",
|
||||
"item_price": it.get("price") or "",
|
||||
"item_image": it.get("item_image") or "",
|
||||
"cookie_id": cookie_id,
|
||||
"xyh_status": group_name,
|
||||
})
|
||||
return {
|
||||
"success": True,
|
||||
"group_name": result.get("group_name") or group_name,
|
||||
"page": page,
|
||||
"total": result.get("total_count") or len(items),
|
||||
"items": items,
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 商品详情(编辑弹窗预填):字段与一键转卖预览一致 + 运费方式推断
|
||||
# ------------------------------------------------------------------
|
||||
def _infer_delivery(item_do: Dict[str, Any]) -> tuple[str, str]:
|
||||
"""从详情的 postFee 推断运费方式与一口价运费(元)。"""
|
||||
post_fee = item_do.get("postFee") or {}
|
||||
if not isinstance(post_fee, dict):
|
||||
return "包邮", ""
|
||||
if post_fee.get("canFreeShipping"):
|
||||
return "包邮", ""
|
||||
price_cent = post_fee.get("postPriceInCent")
|
||||
if price_cent:
|
||||
try:
|
||||
return "一口价", str(round(int(price_cent) / 100, 2))
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
if str(post_fee.get("templateId") or "") == "-100":
|
||||
return "按距离计费", ""
|
||||
return "无需邮寄", ""
|
||||
|
||||
@router.post("/items/xyh-detail")
|
||||
async def xyh_detail(
|
||||
req: XyhDetailRequest,
|
||||
current_user: Dict[str, Any] = Depends(get_current_user),
|
||||
):
|
||||
details = require_account(req.cookie_id, current_user)
|
||||
# 编辑页初始化数据(p_publish-index.js 用它预填),拿不到再回退商品详情
|
||||
data: Dict[str, Any] = {}
|
||||
try:
|
||||
edit_detail = await call_buyer(
|
||||
req.cookie_id,
|
||||
details["value"],
|
||||
"mtop.idle.pc.idleitem.editDetail",
|
||||
{"itemId": str(req.item_id)},
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
)
|
||||
data = edit_detail.get("data") or {}
|
||||
except HTTPException:
|
||||
data = {}
|
||||
# editDetail 结构可能不含 itemDO.title,拿不到就回退商品详情
|
||||
item_do = data.get("itemDO") if isinstance(data.get("itemDO"), dict) else {}
|
||||
if not item_do.get("title"):
|
||||
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",
|
||||
)
|
||||
data = result.get("data") or {}
|
||||
item = _normalize_detail(data)
|
||||
delivery, post_price = _infer_delivery(data.get("itemDO") or {})
|
||||
item["delivery"] = delivery
|
||||
item["post_price"] = post_price
|
||||
if not item.get("title"):
|
||||
raise HTTPException(status_code=502, detail="详情里没有标题,无法编辑该商品")
|
||||
return {"success": True, "item": item}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 提交编辑:与一键转卖同一套报文(_build_publish_payload)+ itemId
|
||||
# ------------------------------------------------------------------
|
||||
@router.post("/items/xyh-edit")
|
||||
async def xyh_edit(
|
||||
req: XyhEditRequest,
|
||||
current_user: Dict[str, Any] = Depends(get_current_user),
|
||||
):
|
||||
details = require_account(req.cookie_id, current_user)
|
||||
cookies_str = details["value"]
|
||||
|
||||
if not req.title.strip():
|
||||
raise HTTPException(status_code=400, detail="标题不能为空")
|
||||
try:
|
||||
price_cent = _money(req.price)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
# 1. 源详情:类目 / 标签 / 原价 / 未改动的图片兜底
|
||||
detail_result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.taobao.idle.pc.detail",
|
||||
{"itemId": str(req.item_id)},
|
||||
spm_cnt="a21ybx.detail.0.0",
|
||||
)
|
||||
detail = detail_result.get("data") or {}
|
||||
item_do = detail.get("itemDO") or {}
|
||||
images = _detail_images(item_do)
|
||||
if req.images:
|
||||
custom: List[Dict[str, Any]] = []
|
||||
for raw in req.images[:9]:
|
||||
if not isinstance(raw, dict):
|
||||
continue
|
||||
url = str(raw.get("url") or "").strip()
|
||||
if not url.startswith(("http://", "https://")):
|
||||
continue
|
||||
try:
|
||||
width = int(raw.get("width") or 1000)
|
||||
height = int(raw.get("height") or 1000)
|
||||
except (TypeError, ValueError):
|
||||
width, height = 1000, 1000
|
||||
custom.append({"url": url, "width": width, "height": height})
|
||||
if custom:
|
||||
images = custom
|
||||
if not images:
|
||||
raise HTTPException(status_code=400, detail="商品没有可用图片,无法保存")
|
||||
|
||||
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:
|
||||
raise HTTPException(status_code=400, detail="详情里没有类目信息,无法保存编辑")
|
||||
|
||||
# 2. 发布地址(与转卖一致,取账号默认)
|
||||
poi_result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.taobao.idle.local.poi.get",
|
||||
{"longitude": 116.4, "latitude": 39.9},
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
)
|
||||
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)
|
||||
if not selected:
|
||||
raise HTTPException(status_code=400, detail="账号未设置发布地址,请先在闲鱼 App 设置默认地址")
|
||||
|
||||
# 3. 组装报文(与一键转卖发布同一结构)+ itemId
|
||||
payload = _build_publish_payload(
|
||||
title=req.title.strip(),
|
||||
desc=(req.desc or "").strip() or (item_do.get("desc") or "").strip(),
|
||||
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=max(1, int(req.quantity or 1)),
|
||||
images=images,
|
||||
labels=labels,
|
||||
cat=cat,
|
||||
cat_name=cat_name,
|
||||
location=selected,
|
||||
original_price=item_do.get("originalPrice"),
|
||||
)
|
||||
# PC 编辑页(p_publish-index.js):有 itemId 走 edit,且
|
||||
# bizcode/publishScene 必须是 pcMainPublish,沿用发布的 mainPublish 会
|
||||
# 被服务端以 FAIL_BIZ_JSON_ERROR 拒绝(pyxianyu docs 实证)
|
||||
payload["itemId"] = str(req.item_id)
|
||||
payload["bizcode"] = "pcMainPublish"
|
||||
payload["publishScene"] = "pcMainPublish"
|
||||
|
||||
result = await call_buyer(
|
||||
req.cookie_id, cookies_str,
|
||||
"mtop.idle.pc.idleitem.edit",
|
||||
payload,
|
||||
spm_cnt="a21ybx.publish.0.0",
|
||||
)
|
||||
data = result.get("data") or {}
|
||||
edited_id = str(data.get("itemId") or req.item_id)
|
||||
return {
|
||||
"success": True,
|
||||
"item_id": edited_id,
|
||||
"url": f"https://www.goofish.com/item?id={edited_id}",
|
||||
"title": req.title.strip(),
|
||||
"price": req.price,
|
||||
}
|
||||
|
||||
return router
|
||||
@@ -266,6 +266,12 @@ const ItemList: React.FC = () => {
|
||||
[accountScopedItems],
|
||||
);
|
||||
|
||||
// 账号下拉里每个账号的在售数:口径与列表一致,下拉不再显示含下架的总数
|
||||
const onSaleCountOf = useCallback(
|
||||
(accountId: string) => items.filter(item => item.cookie_id === accountId && !isOffShelf(item) && !isDraft(item)).length,
|
||||
[items],
|
||||
);
|
||||
|
||||
// 闲鱼草稿:本地库无草稿概念,按账号实时从闲鱼拉取(xyh-list), account scope 变化时重拉。
|
||||
const [draftState, setDraftState] = useState<{
|
||||
scope: string;
|
||||
@@ -288,6 +294,8 @@ const ItemList: React.FC = () => {
|
||||
const scope = listAccountFilter || '__all__';
|
||||
const accountIds = listAccountFilter ? [listAccountFilter] : accounts.map(a => a.id);
|
||||
if (!accountIds.length) return;
|
||||
// 同一账号范围已经拉过就不重复打闲鱼接口(轮询/重渲染都会走到这里)
|
||||
if (draftState?.scope === scope) return;
|
||||
setDraftLoading(true);
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
@@ -331,6 +339,12 @@ const ItemList: React.FC = () => {
|
||||
}
|
||||
}, [listAccountFilter, accounts]);
|
||||
|
||||
// 切到草稿页签或换账号范围时才去闲鱼拉草稿(本地库没有草稿概念)
|
||||
useEffect(() => {
|
||||
if (statusFilter !== 'draft') return;
|
||||
void fetchDrafts();
|
||||
}, [statusFilter, fetchDrafts]);
|
||||
|
||||
const visibleItems = useMemo(() => {
|
||||
if (statusFilter === 'draft') return draftScopedItems;
|
||||
const base = accountScopedItems;
|
||||
@@ -750,14 +764,20 @@ const ItemList: React.FC = () => {
|
||||
title="商品与发货"
|
||||
description="同步在售商品并配置自动发货。"
|
||||
icon={Box}
|
||||
badge={<span className="status-badge status-badge-info">{items.length} 件商品</span>}
|
||||
badge={(
|
||||
<span className="status-badge status-badge-info">
|
||||
{statusFilter === 'on_sale' && `在售 ${onSaleCount} 件`}
|
||||
{statusFilter === 'off_shelf' && `已下架 ${offShelfCount} 件`}
|
||||
{statusFilter === 'draft' && `草稿 ${draftTotal ?? '—'} 件`}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
||||
<PageTabs
|
||||
value={activeSection}
|
||||
onChange={setActiveSection}
|
||||
items={[
|
||||
{ id: 'products', label: '商品与专属发货', icon: ShoppingBag, count: items.length },
|
||||
{ id: 'products', label: '商品与专属发货', icon: ShoppingBag, count: onSaleCount },
|
||||
{ id: 'rules', label: '通用发货规则', icon: ListChecks, count: genericRules.length },
|
||||
{ id: 'protection', label: '发货保护与黑名单', icon: ShieldAlert },
|
||||
]}
|
||||
@@ -789,30 +809,16 @@ const ItemList: React.FC = () => {
|
||||
}}
|
||||
aria-label="选择账号"
|
||||
>
|
||||
<option value="">全部账号({items.length})</option>
|
||||
<option value="">全部账号(在售 {onSaleCount})</option>
|
||||
{accounts.map(account => (
|
||||
<option key={account.id} value={account.id}>
|
||||
{accountNames.get(account.id)}({items.filter(i => i.cookie_id === account.id).length})
|
||||
{accountNames.get(account.id)}(在售 {onSaleCountOf(account.id)})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="text-xs text-gray-500">
|
||||
已配置专属发货 {configuredItemCount} 件
|
||||
</span>
|
||||
{offShelfCount > 0 && (
|
||||
<label className="flex cursor-pointer items-center gap-1.5 text-xs text-gray-500">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="h-3.5 w-3.5 cursor-pointer accent-brand-500"
|
||||
checked={statusFilter === 'off_shelf'}
|
||||
onChange={event => {
|
||||
setStatusFilter(event.target.checked ? 'off_shelf' : 'on_sale');
|
||||
setPage(1);
|
||||
}}
|
||||
/>
|
||||
显示已下架({offShelfCount})
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
@@ -847,6 +853,49 @@ const ItemList: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 状态分段:在售/已下架/草稿三套数据互不混排。
|
||||
本地库只有在售与下架,草稿要现拉闲鱼,故计数在拉取前显示为 — */}
|
||||
<div className="flex flex-wrap items-center gap-1 border-b border-gray-200 px-4 py-2" role="tablist" aria-label="商品状态">
|
||||
{([
|
||||
{ id: 'on_sale', label: '在售', count: onSaleCount },
|
||||
{ id: 'off_shelf', label: '已下架', count: offShelfCount },
|
||||
{ id: 'draft', label: '草稿', count: draftTotal },
|
||||
] as const).map(tab => {
|
||||
const active = statusFilter === tab.id;
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={() => {
|
||||
setStatusFilter(tab.id);
|
||||
setPage(1);
|
||||
}}
|
||||
className={`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-colors ${
|
||||
active
|
||||
? 'bg-[var(--brand)] font-semibold text-[var(--brand-ink)] shadow-sm'
|
||||
: 'text-gray-500 hover:bg-gray-100 hover:text-gray-700'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
<span className={`text-xs ${active ? 'text-[var(--brand-ink)]/70' : 'text-gray-400'}`}>
|
||||
{tab.id === 'draft' && draftTotal === null ? '—' : tab.count}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
{statusFilter === 'draft' && draftLoading && (
|
||||
<span className="ml-1 flex items-center gap-1 text-xs text-gray-400">
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
||||
正在从闲鱼拉取草稿…
|
||||
</span>
|
||||
)}
|
||||
{statusFilter === 'draft' && !draftLoading && draftNotice && (
|
||||
<span className="ml-1 text-xs text-gray-400">{draftNotice}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{visibleItems.length > 0 ? (
|
||||
<>
|
||||
{/* 各列用固定宽度而非 minmax 压缩:列宽足够时内容不再挤在一起,
|
||||
@@ -1103,8 +1152,22 @@ const ItemList: React.FC = () => {
|
||||
</>
|
||||
) : (
|
||||
<EmptyState
|
||||
title="暂无商品数据"
|
||||
description="先选择闲鱼账号同步在售商品,也可以手动添加商品并直接配置自动发货。"
|
||||
title={
|
||||
statusFilter === 'off_shelf' ? '没有已下架商品'
|
||||
: statusFilter === 'draft' ? '没有草稿'
|
||||
: '暂无商品数据'
|
||||
}
|
||||
description={
|
||||
statusFilter === 'off_shelf'
|
||||
? '该账号目前没有被下架的商品。下架的商品会从在售列表移出,同步后自动归到这里。'
|
||||
: statusFilter === 'draft'
|
||||
? draftLoading
|
||||
? '正在从闲鱼拉取草稿…'
|
||||
: draftState?.error
|
||||
? `草稿拉取失败:${draftState.error}`
|
||||
: '该账号在闲鱼上没有未发布的草稿。'
|
||||
: '先选择闲鱼账号同步在售商品,也可以手动添加商品并直接配置自动发货。'
|
||||
}
|
||||
icon={ShoppingBag}
|
||||
action={(
|
||||
<button type="button" onClick={openManualModal} className="ios-btn-secondary rounded-md px-4 py-2 text-sm">
|
||||
|
||||
@@ -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-IChzZLcq.js";import{P as B,a as U,E as D,S as o}from"./ui-DHCIdv_V.js";import{S as $}from"./save-m64KWfbE.js";import{M as E}from"./message-square-text-C6Er6xWp.js";import{E as G}from"./eye-off-DA35-r8G.js";import{E as J}from"./eye-BNO0yecz.js";import{P as C}from"./play-52JRVRYm.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-C6Y7HdB3.js";import{P as B,a as U,E as D,S as o}from"./ui-Dh615-z8.js";import{S as $}from"./save-C5DQBwo1.js";import{M as E}from"./message-square-text-DbxdYCPP.js";import{E as G}from"./eye-off-DqZjZWJp.js";import{E as J}from"./eye-BXgO1egk.js";import{P as C}from"./play-B67lJrJT.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-IChzZLcq.js";import{a as u,E as y}from"./ui-DHCIdv_V.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-C6Y7HdB3.js";import{a as u,E as y}from"./ui-Dh615-z8.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-IChzZLcq.js";import{P as js,a as Ns,E as _s}from"./ui-DHCIdv_V.js";import{C as Z}from"./check-6Gro50Mh.js";import{S as ws}from"./sparkles-B5X13VUJ.js";import{P as vs,a as ks}from"./power-ZOn3B5wN.js";import{T as Ss}from"./trash-2-CnOVC8WZ.js";import{K as Cs}from"./key-BRO3zsxh.js";import{E as As}from"./eye-off-DA35-r8G.js";import{E as Is}from"./eye-BNO0yecz.js";import{S as $e}from"./save-m64KWfbE.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-C6Y7HdB3.js";import{P as js,a as Ns,E as _s}from"./ui-Dh615-z8.js";import{C as Z}from"./check--qTdUCr3.js";import{S as ws}from"./sparkles-CczcRRJP.js";import{P as vs,a as ks}from"./power-WuQyd1QF.js";import{T as Ss}from"./trash-2-BG9PyYJR.js";import{K as Cs}from"./key-CnYS625y.js";import{E as As}from"./eye-off-DqZjZWJp.js";import{E as Is}from"./eye-BXgO1egk.js";import{S as $e}from"./save-C5DQBwo1.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-IChzZLcq.js";import{P as D,a as R,N as z,S as d}from"./ui-DHCIdv_V.js";import{S as G}from"./save-m64KWfbE.js";import{S as O}from"./shield-alert-ob02IPrt.js";import{F as U}from"./flower-2-DPAmZVRG.js";import{M as q}from"./message-square-text-C6Er6xWp.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-C6Y7HdB3.js";import{P as D,a as R,N as z,S as d}from"./ui-Dh615-z8.js";import{S as G}from"./save-C5DQBwo1.js";import{S as O}from"./shield-alert-BSaySGHY.js";import{F as U}from"./flower-2-CSgAnLCK.js";import{M as q}from"./message-square-text-DbxdYCPP.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-IChzZLcq.js";import{a as pe,S as xe,E as B}from"./ui-DHCIdv_V.js";import{P as U}from"./plus-hTzuza9d.js";import{S as he}from"./square-pen-BOlWgFhh.js";import{T as ye}from"./trash-2-CnOVC8WZ.js";import{P as Z}from"./package-3qqwOYvH.js";import{S as ue}from"./save-m64KWfbE.js";import{I as q}from"./image-BCD-eej2.js";import{P as be}from"./package-check-FQzJ-066.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-C6Y7HdB3.js";import{a as pe,S as xe,E as B}from"./ui-Dh615-z8.js";import{P as U}from"./plus-BZHhM3Ok.js";import{S as he}from"./square-pen-ptW8MQaM.js";import{T as ye}from"./trash-2-BG9PyYJR.js";import{P as Z}from"./package-DjIVaNpE.js";import{S as ue}from"./save-C5DQBwo1.js";import{I as q}from"./image-DkNS6I4I.js";import{P as be}from"./package-check-C8PHQCAA.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-IChzZLcq.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-DHCIdv_V.js";import{P as Ro}from"./package-3qqwOYvH.js";import{T as Lh}from"./trending-up-BDgJo2q2.js";import{A as Xb}from"./activity-CRI26G7w.js";import{P as Zb}from"./package-check-FQzJ-066.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-C6Y7HdB3.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-Dh615-z8.js";import{P as Ro}from"./package-DjIVaNpE.js";import{T as Lh}from"./trending-up-BR0vQ8dC.js";import{A as Xb}from"./activity-CV-Hy1l6.js";import{P as Zb}from"./package-check-C8PHQCAA.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-IChzZLcq.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-C6Y7HdB3.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-IChzZLcq.js";import{P as F,a as U,N as q,b as z,E as Q}from"./ui-DHCIdv_V.js";import{T as R}from"./trending-up-BDgJo2q2.js";import{P as V}from"./package-3qqwOYvH.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,bO as H,bP as O,j as e,bQ as S,L as y,e as A,E as B}from"./index-C6Y7HdB3.js";import{P as F,a as U,N as q,b as z,E as Q}from"./ui-Dh615-z8.js";import{T as R}from"./trending-up-BR0vQ8dC.js";import{P as V}from"./package-DjIVaNpE.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
|
||||
Vendored
-16
@@ -1,16 +0,0 @@
|
||||
import{c as Se,r,ae as ws,af as Ke,n as w,j as e,e as Ce,X as ie,L as G,ag as ks,ah as Ss,ai as Cs,v as ye,aj as Is,ak as qe,b as xe,al as ve,am as we,an as $s,ao as Ms,ap as Ds,aq as ss,ar as Oe,o as Ve,h as _e,a8 as He,as as Xe,at as Ne,w as Fs,au as Ps,av as Ge,aw as Qe,ax as Es,ay as Bs,az as Rs,aA as Ls}from"./index-IChzZLcq.js";import{E as ne,S as ke,P as We,a as Ts,b as zs,N as Us}from"./ui-DHCIdv_V.js";import{S as pe}from"./shield-alert-ob02IPrt.js";import{S as he}from"./save-m64KWfbE.js";import{T as ge}from"./trash-2-CnOVC8WZ.js";import{P as ue}from"./plus-hTzuza9d.js";import{P as Ks}from"./power-off-D8Ea3WwY.js";import{a as qs,P as Os}from"./power-ZOn3B5wN.js";import{P as ts}from"./package-check-FQzJ-066.js";import{S as Je}from"./sparkles-B5X13VUJ.js";import{S as Vs}from"./settings-2-B-NwJM90.js";import{S as Hs}from"./square-pen-BOlWgFhh.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 Xs=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Gs=Se("list-checks",Xs);/**
|
||||
* @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 Qs=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]],Ye=Se("scan-line",Qs);/**
|
||||
* @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 Ws=[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]],Ze=Se("user-round-x",Ws),Js=({accounts:o=[],items:u=[],selectedAccount:x="",onSelectedAccountChange:_})=>{const[k,S]=r.useState([]),[T,y]=r.useState([]),[C,M]=r.useState(!1),[D,E]=r.useState(""),[g,m]=r.useState({scope:"account",buyer_id:"",buyer_nick:"",item_id:"",reason:""}),h=r.useMemo(()=>u.filter(t=>t.cookie_id===x),[u,x]);r.useEffect(()=>{x&&F()},[x]);const F=async()=>{if(x){M(!0);try{const[t,a]=await Promise.all([ws(x),Ke(x)]);S(t),y(a)}catch(t){w(`加载发货保护配置失败:${t.message}`)}finally{M(!1)}}},N=(t,a)=>{S(c=>c.map(f=>f.rule_code===t?{...f,...a,only_card_after_close:a.auto_close_order===!1?!1:a.only_card_after_close??f.only_card_after_close}:f))},q=async t=>{E(t.rule_code);try{const a=await ks(x,t.rule_code,{enabled:t.enabled,priority:t.priority,block_reason:t.block_reason,auto_close_order:t.auto_close_order,only_card_after_close:t.only_card_after_close,excluded_item_ids:t.excluded_item_ids,config:t.config});N(t.rule_code,a),w(`“${t.rule_name}”已保存`)}catch(a){w(`保存失败:${a.message}`)}finally{E("")}},Q=async()=>{if(!g.buyer_id.trim()){w("请输入买家 ID");return}if(g.scope==="item"&&!g.item_id){w("请选择黑名单生效的商品");return}try{await Ss({account_id:g.scope==="global"?void 0:x,buyer_id:g.buyer_id.trim(),buyer_nick:g.buyer_nick.trim(),item_id:g.scope==="item"?g.item_id:void 0,reason:g.reason.trim(),is_enabled:!0}),m({scope:g.scope,buyer_id:"",buyer_nick:"",item_id:"",reason:""}),y(await Ke(x))}catch(t){w(`添加失败:${t.message}`)}},O=async t=>{try{const a=await Cs(t.id,{is_enabled:!t.is_enabled});y(c=>c.map(f=>f.id===t.id?a:f))}catch(a){w(`更新失败:${a.message}`)}},W=async t=>{if(await ye(`确认移除买家 ${t.buyer_nick||t.buyer_id}?`))try{await Is(t.id),y(a=>a.filter(c=>c.id!==t.id))}catch(a){w(`删除失败:${a.message}`)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"toolbar",children:[e.jsxs("div",{className:"toolbar__group w-full sm:w-auto",children:[e.jsx("label",{htmlFor:"protection-account",className:"text-xs font-bold text-gray-600",children:"应用账号"}),e.jsxs("select",{id:"protection-account",value:x,onChange:t=>_==null?void 0:_(t.target.value),className:"ios-input w-full rounded-md px-3 py-2.5 text-sm sm:min-w-72",children:[e.jsx("option",{value:"",children:"请选择账号"}),o.map(t=>e.jsx("option",{value:t.id,children:t.nickname||t.remark||t.id},t.id))]})]}),e.jsxs("button",{type:"button",onClick:()=>void F(),disabled:!x||C,className:"ios-btn-secondary flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm disabled:opacity-50",children:[e.jsx(Ce,{className:`h-4 w-4 ${C?"animate-spin":""}`}),"刷新"]})]}),x?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"section-panel",children:[e.jsx(ke,{title:"发货拦截规则",description:"规则按优先级判定,可对指定商品设置排除项。",icon:pe}),e.jsxs("div",{className:"divide-y divide-gray-100 px-4",children:[k.map(t=>e.jsxs("div",{className:"grid gap-4 py-5 xl:grid-cols-[minmax(230px,1fr)_minmax(360px,1.5fr)_44px] xl:items-start",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":t.enabled,onClick:()=>N(t.rule_code,{enabled:!t.enabled}),className:`relative h-6 w-11 rounded-full transition-colors ${t.enabled?"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 ${t.enabled?"translate-x-5":"translate-x-0"}`})}),e.jsx("span",{className:"font-bold text-gray-900",children:t.rule_name})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-gray-500",children:t.rule_description})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-[100px_1fr]",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["优先级",e.jsx("input",{type:"number",min:0,max:999,value:t.priority,onChange:a=>N(t.rule_code,{priority:Number(a.target.value)}),className:"mt-1 w-full rounded-md border border-gray-200 px-2 py-2 text-sm"})]}),e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["命中后发送给买家的提示",e.jsx("input",{value:t.block_reason,onChange:a=>N(t.rule_code,{block_reason:a.target.value}),placeholder:"留空则只停止发货",className:"mt-1 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-normal"})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 sm:col-span-2",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["命中后处理",e.jsxs("span",{className:"mt-2 flex items-center gap-2 font-medium text-gray-700",children:[e.jsx("input",{type:"checkbox",checked:t.autoLine truncated
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
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-C6Y7HdB3.js";import{E as re,S as $e,P as es,a as Vs,b as Hs,N as Xs}from"./ui-Dh615-z8.js";import{S as ue}from"./shield-alert-BSaySGHY.js";import{S as ge}from"./save-C5DQBwo1.js";import{T as ye}from"./trash-2-BG9PyYJR.js";import{P as he}from"./plus-BZHhM3Ok.js";import{P as Gs}from"./power-off-CcqbyexD.js";import{a as Qs,P as Ws}from"./power-WuQyd1QF.js";import{P as rs}from"./package-check-C8PHQCAA.js";import{S as ss}from"./sparkles-CczcRRJP.js";import{S as Js}from"./settings-2-DYoajNQY.js";import{S as Ys}from"./square-pen-ptW8MQaM.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 Zs=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],As=Me("list-checks",Zs);/**
|
||||
* @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 et=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]],ts=Me("scan-line",et);/**
|
||||
* @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 st=[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]],as=Me("user-round-x",st),tt=({accounts:c=[],items:u=[],selectedAccount:x="",onSelectedAccountChange:_})=>{const[C,I]=r.useState([]),[U,y]=r.useState([]),[$,F]=r.useState(!1),[P,R]=r.useState(""),[g,m]=r.useState({scope:"account",buyer_id:"",buyer_nick:"",item_id:"",reason:""}),h=r.useMemo(()=>u.filter(t=>t.cookie_id===x),[u,x]);r.useEffect(()=>{x&&E()},[x]);const E=async()=>{if(x){F(!0);try{const[t,a]=await Promise.all([Ms(x),Xe(x)]);I(t),y(a)}catch(t){k(`加载发货保护配置失败:${t.message}`)}finally{F(!1)}}},N=(t,a)=>{I(o=>o.map(f=>f.rule_code===t?{...f,...a,only_card_after_close:a.auto_close_order===!1?!1:a.only_card_after_close??f.only_card_after_close}:f))},V=async t=>{R(t.rule_code);try{const a=await Ds(x,t.rule_code,{enabled:t.enabled,priority:t.priority,block_reason:t.block_reason,auto_close_order:t.auto_close_order,only_card_after_close:t.only_card_after_close,excluded_item_ids:t.excluded_item_ids,config:t.config});N(t.rule_code,a),k(`“${t.rule_name}”已保存`)}catch(a){k(`保存失败:${a.message}`)}finally{R("")}},J=async()=>{if(!g.buyer_id.trim()){k("请输入买家 ID");return}if(g.scope==="item"&&!g.item_id){k("请选择黑名单生效的商品");return}try{await Fs({account_id:g.scope==="global"?void 0:x,buyer_id:g.buyer_id.trim(),buyer_nick:g.buyer_nick.trim(),item_id:g.scope==="item"?g.item_id:void 0,reason:g.reason.trim(),is_enabled:!0}),m({scope:g.scope,buyer_id:"",buyer_nick:"",item_id:"",reason:""}),y(await Xe(x))}catch(t){k(`添加失败:${t.message}`)}},H=async t=>{try{const a=await Ps(t.id,{is_enabled:!t.is_enabled});y(o=>o.map(f=>f.id===t.id?a:f))}catch(a){k(`更新失败:${a.message}`)}},Y=async t=>{if(await be(`确认移除买家 ${t.buyer_nick||t.buyer_id}?`))try{await Es(t.id),y(a=>a.filter(o=>o.id!==t.id))}catch(a){k(`删除失败:${a.message}`)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"toolbar",children:[e.jsxs("div",{className:"toolbar__group w-full sm:w-auto",children:[e.jsx("label",{htmlFor:"protection-account",className:"text-xs font-bold text-gray-600",children:"应用账号"}),e.jsxs("select",{id:"protection-account",value:x,onChange:t=>_==null?void 0:_(t.target.value),className:"ios-input w-full rounded-md px-3 py-2.5 text-sm sm:min-w-72",children:[e.jsx("option",{value:"",children:"请选择账号"}),c.map(t=>e.jsx("option",{value:t.id,children:t.nickname||t.remark||t.id},t.id))]})]}),e.jsxs("button",{type:"button",onClick:()=>void E(),disabled:!x||$,className:"ios-btn-secondary flex items-center justify-center gap-2 rounded-md px-4 py-2.5 text-sm disabled:opacity-50",children:[e.jsx(De,{className:`h-4 w-4 ${$?"animate-spin":""}`}),"刷新"]})]}),x?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"section-panel",children:[e.jsx($e,{title:"发货拦截规则",description:"规则按优先级判定,可对指定商品设置排除项。",icon:ue}),e.jsxs("div",{className:"divide-y divide-gray-100 px-4",children:[C.map(t=>e.jsxs("div",{className:"grid gap-4 py-5 xl:grid-cols-[minmax(230px,1fr)_minmax(360px,1.5fr)_44px] xl:items-start",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":t.enabled,onClick:()=>N(t.rule_code,{enabled:!t.enabled}),className:`relative h-6 w-11 rounded-full transition-colors ${t.enabled?"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 ${t.enabled?"translate-x-5":"translate-x-0"}`})}),e.jsx("span",{className:"font-bold text-gray-900",children:t.rule_name})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-gray-500",children:t.rule_description})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-[100px_1fr]",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["优先级",e.jsx("input",{type:"number",min:0,max:999,value:t.priority,onChange:a=>N(t.rule_code,{priority:Number(a.target.value)}),className:"mt-1 w-full rounded-md border border-gray-200 px-2 py-2 text-sm"})]}),e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["命中后发送给买家的提示",e.jsx("input",{value:t.block_reason,onChange:a=>N(t.rule_code,{block_reason:a.target.value}),placeholder:"留空则只停止发货",className:"mt-1 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-normal"})]}),e.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 sm:col-span-2",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600",children:["命中后处理",e.jsxs("span",{className:"mt-2 flex items-center gap-2 font-medium text-gray-700",children:[e.jsx("input",{type:"checkbox",checked:t.autoLine truncated
|
||||
@@ -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-IChzZLcq.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-DHCIdv_V.js";import{T}from"./truck-eLsCuQDz.js";import{K as W}from"./key-BRO3zsxh.js";import{P as Te}from"./plus-hTzuza9d.js";import{P as $,a as $e}from"./power-ZOn3B5wN.js";import{T as A}from"./trash-2-CnOVC8WZ.js";import{P as Ae}from"./power-off-D8Ea3WwY.js";import{S as K}from"./save-m64KWfbE.js";import{S as Ke}from"./sparkles-B5X13VUJ.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-C6Y7HdB3.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-Dh615-z8.js";import{T}from"./truck-Cz_KAtqT.js";import{K as W}from"./key-CnYS625y.js";import{P as Te}from"./plus-BZHhM3Ok.js";import{P as $,a as $e}from"./power-WuQyd1QF.js";import{T as A}from"./trash-2-BG9PyYJR.js";import{P as Ae}from"./power-off-CcqbyexD.js";import{S as K}from"./save-C5DQBwo1.js";import{S as Ke}from"./sparkles-CczcRRJP.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-IChzZLcq.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-DHCIdv_V.js";import{S as Z}from"./settings-2-B-NwJM90.js";import{S as $t}from"./search-D1CHR5V5.js";import{P as Tt}from"./package-3qqwOYvH.js";import{I as Rt}from"./image-BCD-eej2.js";import{Z as Et}from"./zap-CQAFaWUI.js";import{S as Lt}from"./send-Db002WMI.js";import{P as Le}from"./plus-hTzuza9d.js";import{T as Ue}from"./trash-2-CnOVC8WZ.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-C6Y7HdB3.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-Dh615-z8.js";import{S as Z}from"./settings-2-DYoajNQY.js";import{S as $t}from"./search-DbZW8Se5.js";import{P as Tt}from"./package-DjIVaNpE.js";import{I as Rt}from"./image-DkNS6I4I.js";import{Z as Et}from"./zap-BAb90aFH.js";import{S as Lt}from"./send-CTCS9sD8.js";import{P as Le}from"./plus-BZHhM3Ok.js";import{T as Ue}from"./trash-2-BG9PyYJR.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-IChzZLcq.js";import{a as vt,b as wt,S as E,E as L}from"./ui-DHCIdv_V.js";import{L as ae}from"./link-2-CYVpjq_H.js";import{S as le}from"./shield-alert-ob02IPrt.js";import{A as ne}from"./activity-CRI26G7w.js";import{P as $e}from"./plus-hTzuza9d.js";import{P as Ee}from"./pen-line-27OudxQx.js";import{T as ie}from"./trash-2-CnOVC8WZ.js";import{S as kt}from"./send-Db002WMI.js";import{C as Ct,a as St}from"./chevron-right-DwOZeQi3.js";import{S as Le}from"./save-m64KWfbE.js";import{C as _t}from"./check-6Gro50Mh.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-C6Y7HdB3.js";import{a as vt,b as wt,S as E,E as L}from"./ui-Dh615-z8.js";import{L as ae}from"./link-2-CUR4V6rB.js";import{S as le}from"./shield-alert-BSaySGHY.js";import{A as ne}from"./activity-CV-Hy1l6.js";import{P as $e}from"./plus-BZHhM3Ok.js";import{P as Ee}from"./pen-line-B2U8YMna.js";import{T as ie}from"./trash-2-BG9PyYJR.js";import{S as kt}from"./send-CTCS9sD8.js";import{C as Ct,a as St}from"./chevron-right-zTm23uAy.js";import{S as Le}from"./save-C5DQBwo1.js";import{C as _t}from"./check--qTdUCr3.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-IChzZLcq.js";import{a as As,b as $s,E as Rs}from"./ui-DHCIdv_V.js";import{P as qs}from"./plus-hTzuza9d.js";import{T as De}from"./truck-eLsCuQDz.js";import{S as Ts}from"./search-D1CHR5V5.js";import{P as Y}from"./package-check-FQzJ-066.js";import{F as zs}from"./flower-2-DPAmZVRG.js";import{E as Vs}from"./eye-BNO0yecz.js";import{S as Hs}from"./square-pen-BOlWgFhh.js";import{T as Js}from"./trash-2-CnOVC8WZ.js";import{C as Ws,a as Bs}from"./chevron-right-DwOZeQi3.js";import{S as Fe}from"./save-m64KWfbE.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-C6Y7HdB3.js";import{a as As,b as $s,E as Rs}from"./ui-Dh615-z8.js";import{P as qs}from"./plus-BZHhM3Ok.js";import{T as De}from"./truck-Cz_KAtqT.js";import{S as Ts}from"./search-DbZW8Se5.js";import{P as Y}from"./package-check-C8PHQCAA.js";import{F as zs}from"./flower-2-CSgAnLCK.js";import{E as Vs}from"./eye-BXgO1egk.js";import{S as Hs}from"./square-pen-ptW8MQaM.js";import{T as Js}from"./trash-2-BG9PyYJR.js";import{C as Ws,a as Bs}from"./chevron-right-zTm23uAy.js";import{S as Fe}from"./save-C5DQBwo1.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-IChzZLcq.js";import{P as Z,a as ee,N as te,E as D}from"./ui-DHCIdv_V.js";import{S as K}from"./sparkles-B5X13VUJ.js";import{P as se}from"./package-3qqwOYvH.js";import{S as re}from"./search-D1CHR5V5.js";import{T as ae}from"./trending-up-BDgJo2q2.js";/**
|
||||
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-C6Y7HdB3.js";import{P as Z,a as ee,N as te,E as D}from"./ui-Dh615-z8.js";import{S as K}from"./sparkles-CczcRRJP.js";import{P as se}from"./package-DjIVaNpE.js";import{S as re}from"./search-DbZW8Se5.js";import{T as ae}from"./trending-up-BR0vQ8dC.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 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-IChzZLcq.js";import{P as Z,a as Ne,N as R,E as J}from"./ui-DHCIdv_V.js";import{P as fe}from"./plus-hTzuza9d.js";import{P as Q}from"./play-52JRVRYm.js";import{P as we}from"./pen-line-27OudxQx.js";import{T as ke}from"./trash-2-CnOVC8WZ.js";import{S as U}from"./search-D1CHR5V5.js";/**
|
||||
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-C6Y7HdB3.js";import{P as Z,a as Ne,N as R,E as J}from"./ui-Dh615-z8.js";import{P as fe}from"./plus-BZHhM3Ok.js";import{P as Q}from"./play-B67lJrJT.js";import{P as we}from"./pen-line-B2U8YMna.js";import{T as ke}from"./trash-2-BG9PyYJR.js";import{S as U}from"./search-DbZW8Se5.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 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-IChzZLcq.js";import{P as Ie,a as Ae,b as Ee,S as _,E as N,N as ze}from"./ui-DHCIdv_V.js";import{S as C}from"./search-D1CHR5V5.js";import{T as v}from"./trash-2-CnOVC8WZ.js";import{S as z}from"./save-m64KWfbE.js";import{P as X}from"./play-52JRVRYm.js";import{P as Te}from"./package-check-FQzJ-066.js";import{L as Be}from"./link-2-CYVpjq_H.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-C6Y7HdB3.js";import{P as Ie,a as Ae,b as Ee,S as _,E as N,N as ze}from"./ui-Dh615-z8.js";import{S as C}from"./search-DbZW8Se5.js";import{T as v}from"./trash-2-BG9PyYJR.js";import{S as z}from"./save-C5DQBwo1.js";import{P as X}from"./play-B67lJrJT.js";import{P as Te}from"./package-check-C8PHQCAA.js";import{L as Be}from"./link-2-CUR4V6rB.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c as Fe,r,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-IChzZLcq.js";import{a as ze,N as Be,b as He,E as ne}from"./ui-DHCIdv_V.js";import{S as F}from"./search-D1CHR5V5.js";import{P as Oe}from"./plus-hTzuza9d.js";import{S as Ke}from"./sparkles-B5X13VUJ.js";import{P as We}from"./package-3qqwOYvH.js";/**
|
||||
import{c as Fe,r,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-C6Y7HdB3.js";import{a as ze,N as Be,b as He,E as ne}from"./ui-Dh615-z8.js";import{S as F}from"./search-DbZW8Se5.js";import{P as Oe}from"./plus-BZHhM3Ok.js";import{S as Ke}from"./sparkles-CczcRRJP.js";import{P as We}from"./package-DjIVaNpE.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
@@ -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-IChzZLcq.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-DHCIdv_V.js";import{S as je}from"./save-m64KWfbE.js";import{S as Q}from"./sparkles-B5X13VUJ.js";import{Z as L}from"./zap-CQAFaWUI.js";import{E as w}from"./eye-off-DA35-r8G.js";import{E as C}from"./eye-BNO0yecz.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-C6Y7HdB3.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-Dh615-z8.js";import{S as je}from"./save-C5DQBwo1.js";import{S as Q}from"./sparkles-CczcRRJP.js";import{Z as L}from"./zap-BAb90aFH.js";import{E as w}from"./eye-off-DqZjZWJp.js";import{E as C}from"./eye-BXgO1egk.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-IChzZLcq.js";import{a as I,S as N,E as B}from"./ui-DHCIdv_V.js";import{T as D}from"./trash-2-CnOVC8WZ.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-C6Y7HdB3.js";import{a as I,S as N,E as B}from"./ui-Dh615-z8.js";import{T as D}from"./trash-2-BG9PyYJR.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-IChzZLcq.js";/**
|
||||
import{c as t}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as o}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.js";/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
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-R20Ph_el.js","assets/ui-DHCIdv_V.js","assets/package-3qqwOYvH.js","assets/trending-up-BDgJo2q2.js","assets/activity-CRI26G7w.js","assets/package-check-FQzJ-066.js","assets/AccountList-CC8hRCM2.js","assets/check-6Gro50Mh.js","assets/sparkles-B5X13VUJ.js","assets/power-ZOn3B5wN.js","assets/trash-2-CnOVC8WZ.js","assets/key-BRO3zsxh.js","assets/eye-off-DA35-r8G.js","assets/eye-BNO0yecz.js","assets/save-m64KWfbE.js","assets/OrderList-DnNov42V.js","assets/plus-hTzuza9d.js","assets/truck-eLsCuQDz.js","assets/search-D1CHR5V5.js","assets/flower-2-DPAmZVRG.js","assets/square-pen-BOlWgFhh.js","assets/chevron-right-DwOZeQi3.js","assets/CardList-DaeMtjqS.js","assets/image-BCD-eej2.js","assets/ItemList-DpqEi6Ob.js","assets/shield-alert-ob02IPrt.js","assets/power-off-D8Ea3WwY.js","assets/settings-2-B-NwJM90.js","assets/ProductAutomation-ByBZohdg.js","assets/play-52JRVRYm.js","assets/link-2-CYVpjq_H.js","assets/AIReply-C49hHlXg.js","assets/message-square-text-C6Er6xWp.js","assets/Settings-BKqYYBIp.js","assets/zap-CQAFaWUI.js","assets/Keywords-DYO7Z25o.js","assets/MessageManagement-BX9e9TqW.js","assets/send-Db002WMI.js","assets/NotificationsAndLogs-DvXsPImX.js","assets/pen-line-27OudxQx.js","assets/UserManagement-WEnM8-3J.js","assets/About-DCjjMMTu.js","assets/BuyerInteraction-BJEwndHV.js","assets/Resell-C3EooCYv.js","assets/HotList-BwqIdE0Z.js","assets/PeerShops-CypJHQVt.js","assets/PriceWatch-Db4Gwt9m.js"])))=>i.map(i=>d[i]);
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-r6bLPRiz.js","assets/ui-Dh615-z8.js","assets/package-DjIVaNpE.js","assets/trending-up-BR0vQ8dC.js","assets/activity-CV-Hy1l6.js","assets/package-check-C8PHQCAA.js","assets/AccountList-jdp7_cFb.js","assets/check--qTdUCr3.js","assets/sparkles-CczcRRJP.js","assets/power-WuQyd1QF.js","assets/trash-2-BG9PyYJR.js","assets/key-CnYS625y.js","assets/eye-off-DqZjZWJp.js","assets/eye-BXgO1egk.js","assets/save-C5DQBwo1.js","assets/OrderList-CMlmoGwo.js","assets/plus-BZHhM3Ok.js","assets/truck-Cz_KAtqT.js","assets/search-DbZW8Se5.js","assets/flower-2-CSgAnLCK.js","assets/square-pen-ptW8MQaM.js","assets/chevron-right-zTm23uAy.js","assets/CardList-BeNoktSc.js","assets/image-DkNS6I4I.js","assets/ItemList-Du75o4x-.js","assets/shield-alert-BSaySGHY.js","assets/power-off-CcqbyexD.js","assets/settings-2-DYoajNQY.js","assets/ProductAutomation-BTRBUe6v.js","assets/play-B67lJrJT.js","assets/link-2-CUR4V6rB.js","assets/AIReply-Dsfaod73.js","assets/message-square-text-DbxdYCPP.js","assets/Settings-CgkuCQg8.js","assets/zap-BAb90aFH.js","assets/Keywords-BPlwSBj7.js","assets/MessageManagement-CJJfjP2Z.js","assets/send-CTCS9sD8.js","assets/NotificationsAndLogs-DX1qmLDY.js","assets/pen-line-B2U8YMna.js","assets/UserManagement-93cH0Rs5.js","assets/About-DH_fUK9S.js","assets/BuyerInteraction-0rmlMue9.js","assets/Resell-eqQKBhXl.js","assets/HotList-DMnVJNpG.js","assets/PeerShops-Iz71xL1V.js","assets/PriceWatch-B4ja8BGi.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 y of m.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&r(y)}).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 y===-1?"":f.stack.slice(y+1)})();try{if(!r.stack)r.stack=m;else if(m){const y=m.indexOf(`
|
||||
`),p=y===-1?-1:m.indexOf(`
|
||||
`,y+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 y=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(y,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,y,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:y}))}}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 y=new Promise(p=>{r.subscribe(p),m=p}).then(f);return y.cancel=function(){r.unsubscribe(m)},y},s(function(m,y,p){r.reason||(r.reason=new du(m,y,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 y=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(y,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,y,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:y}))}}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 y=new Promise(p=>{r.subscribe(p),m=p}).then(f);return y.cancel=function(){r.unsubscribe(m)},y},s(function(m,y,p){r.reason||(r.reason=new du(m,y,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
|
||||
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
|
||||
@@ -1,4 +1,4 @@
|
||||
import{c}from"./index-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as o}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as o}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as e}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c}from"./index-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
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-C6Y7HdB3.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-IChzZLcq.js";/**
|
||||
import{c as a}from"./index-C6Y7HdB3.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-IChzZLcq.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-D3PEF3ay.css">
|
||||
<script type="module" crossorigin src="/static/assets/index-C6Y7HdB3.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-AteK7Kef.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Reference in new issue
Block a user