1 Commits
Author SHA1 Message Date
jinghui b0021953f5 feat: 躺赚鱼 v3.6.4 —— 价格监控换行 + 邮件通知复用系统设置
- 价格监控页超长文本改 break-words 自动换行(规则/关键词/最近一次列 + 历史弹窗),
  消除单行撑宽导致的横向滚动条
- 邮件通知渠道 SMTP 四项改为可留空,发送阶段自动回退「系统设置 → 邮件服务」,
  只需填接收邮箱;去掉强制 587 默认端口
- 「未配置 price_watch 事件的通知渠道」报错改为可操作指引(通知与日志页勾选价格监控)
- email 渠道必填校验收窄为仅接收邮箱

验证:端到端 _run_rule notified=True 邮件真实发出;生产日志 00:25 通知=成功;
CSS break-words 与新提示文案均进构建产物;测试脏数据已清理。
2026-11-16 02:00:11 +08:00
56 changed files with 157 additions and 84 deletions

No files matched your search

+29
View File
@@ -4,6 +4,35 @@
---
## 2026-11-16 · v3.6.4
### ✨ 新功能
- **邮件通知渠道支持复用「系统设置 → 邮件服务」**:渠道表单里 SMTP 服务器/端口/发件邮箱/授权码四项均可留空,
留空时发送阶段自动回退系统设置里已配置的 SMTP,**只需填接收邮箱**即可发通知
(前端四项已标注「留空则使用系统设置…」提示,去掉了原来强制的 587 端口默认值)
### 🐛 修复
- **价格监控页超长数据显示换行**:「规则/关键词/最近一次」列及历史记录弹窗里的商品标题
原为 `truncate`(单行不换行,长标题把表格撑出横向滚动条),改为 `break-words` 自动换行完整显示
(Tailwind 已生成 `overflow-wrap:break-word`,构建产物 PriceWatch-BuHp31pO.js 已含新类)
- **价格监控通知失败提示改为可操作的指引**:原「未配置 price_watch 事件的通知渠道」
→「未配置价格监控通知:请到「通知与日志」页新增/编辑规则,选择该账号与通知渠道,并在事件里勾选「价格监控」」
- **通知渠道必填校验收窄**:email 渠道原要求 SMTP 五项全必填(留空直接报「渠道配置无效」),
现在仅接收邮箱必填;SMTP 端口留空时跳过端口校验,发送阶段由系统设置兜底
### ✅ 验证
- **通知链路端到端**:容器内打桩搜索跑完整 `_run_rule`(规则未指定账号、走自动选号)→
`notified=True notify_error=''`,邮件真实发出;生产日志亦有 `00:25:07 价格监控[平板] 通知=成功`
- **邮件渠道回退**:只填 `{"recipient_email": ...}` 调用 `sender.send` → 日志显示读取了
smtp_server/smtp_port/smtp_user/smtp_password/smtp_use_tls/smtp_use_ssl 六项系统设置后发送成功
- **CSS/产物**:`break-words{overflow-wrap:break-word}` 已进样式表,新提示文案已进 NotificationsAndLogs 产物
- 测试产生的 3 条探测记录与规则状态已清理还原
---
## 2026-11-16 · v3.6.3
### 🐛 修复
+4 -1
View File
@@ -449,7 +449,10 @@ async def _notify(rule: Dict[str, Any], record: Dict[str, Any],
) if cookie_id else []
enabled = [n for n in notifications if n.get("enabled", True)]
if not enabled:
return False, "未配置 price_watch 事件的通知渠道"
return False, (
"未配置价格监控通知:请到「通知与日志」页新增/编辑规则,"
"选择该账号与通知渠道,并在事件里勾选「价格监控」"
)
message = _build_message(rule, record)
sender = NotificationSender()
+16 -8
View File
@@ -11,7 +11,10 @@ NOTIFICATION_CHANNEL_REQUIRED_FIELDS = {
"dingtalk": ("webhook_url",),
"feishu": ("webhook_url",),
"bark": ("device_key",),
"email": ("smtp_server", "smtp_port", "email_user", "email_password", "recipient_email"),
# 邮件渠道的 SMTP 四项允许留空:留空时发送阶段自动回退到
# 「系统设置 → 邮件服务」里已配置的 SMTP(smtp_server 等),
# 只有接收邮箱是必需的。
"email": ("recipient_email",),
"webhook": ("webhook_url",),
"wechat": ("webhook_url",),
"telegram": ("bot_token", "chat_id"),
@@ -76,13 +79,18 @@ def validate_channel_config(channel_type: Any, config: Any) -> tuple[str, dict[s
)
if normalized_type == "email":
try:
smtp_port = int(config_data["smtp_port"])
except (TypeError, ValueError) as exc:
raise NotificationChannelConfigError("SMTP 端口必须是数字") from exc
if not 1 <= smtp_port <= 65535:
raise NotificationChannelConfigError("SMTP 端口必须在 1-65535 之间")
config_data["smtp_port"] = smtp_port
smtp_port = config_data.get("smtp_port")
if _is_blank(smtp_port):
# 未填端口:发送阶段会用系统设置里的 SMTP 配置兜底,这里跳过校验
config_data.pop("smtp_port", None)
else:
try:
smtp_port = int(smtp_port)
except (TypeError, ValueError) as exc:
raise NotificationChannelConfigError("SMTP 端口必须是数字") from exc
if not 1 <= smtp_port <= 65535:
raise NotificationChannelConfigError("SMTP 端口必须在 1-65535 之间")
config_data["smtp_port"] = smtp_port
if normalized_type == "webhook":
http_method = str(config_data.get("http_method", "POST")).strip().upper()
+33
View File
@@ -369,6 +369,39 @@ class NotificationSender:
@staticmethod
def _send_email_sync(config: dict[str, Any], message: str) -> None:
# 邮件渠道的 SMTP 四项允许留空:留空时回退「系统设置 → 邮件服务」
# 里已配置的 SMTP,用户只需在渠道里填接收邮箱。
if any(
not str(config.get(key) or "").strip()
for key in ("smtp_server", "smtp_port", "email_user", "email_password")
):
try:
from app.db_manager import db_manager
merged = dict(config)
for cfg_key, setting_key in (
("smtp_server", "smtp_server"),
("smtp_port", "smtp_port"),
("email_user", "smtp_user"),
("email_password", "smtp_password"),
("smtp_use_tls", "smtp_use_tls"),
("smtp_use_ssl", "smtp_use_ssl"),
):
if not str(merged.get(cfg_key) or "").strip():
value = db_manager.get_system_setting(setting_key)
if value is not None and str(value).strip():
merged[cfg_key] = value
# 系统设置里布尔是 "true"/"false" 字符串,bool("false") 为 True,需显式转换
for bool_key in ("smtp_use_tls", "smtp_use_ssl"):
if bool_key in merged and not isinstance(merged[bool_key], bool):
merged[bool_key] = (
str(merged[bool_key]).strip().lower() in ("1", "true", "yes", "on")
)
config = merged
except Exception:
# 回退失败则保持原配置,让后续索引抛出原有错误
pass
email = EmailMessage()
email["Subject"] = _EMAIL_SUBJECT
email["From"] = str(config["email_user"])
+6 -6
View File
@@ -96,13 +96,13 @@ const CHANNEL_DEFINITIONS: Record<NotificationChannelType, ChannelDefinition> =
email: {
label: '邮件',
fields: [
{ key: 'smtp_server', label: 'SMTP 服务器', placeholder: 'smtp.example.com' },
{ key: 'smtp_port', label: 'SMTP 端口', type: 'number' },
{ key: 'email_user', label: '发件邮箱' },
{ key: 'email_password', label: '邮箱密码或授权码', type: 'password' },
{ key: 'recipient_email', label: '接收邮箱' },
{ key: 'smtp_server', label: 'SMTP 服务器', placeholder: '留空则使用「系统设置 → 邮件服务」', optional: true },
{ key: 'smtp_port', label: 'SMTP 端口', type: 'number', placeholder: '留空则使用系统设置(如 465)', optional: true },
{ key: 'email_user', label: '发件邮箱', placeholder: '留空则使用系统设置的发件邮箱', optional: true },
{ key: 'email_password', label: '邮箱密码或授权码', type: 'password', placeholder: '留空则使用系统设置的授权码', optional: true },
{ key: 'recipient_email', label: '接收邮箱', placeholder: '必填,通知发到这个邮箱' },
],
defaults: { smtp_port: 587 },
defaults: {},
},
webhook: {
label: 'Webhook',
+5 -5
View File
@@ -387,10 +387,10 @@ export default function PriceWatch() {
<tr key={rule.id}>
<td data-label="规则">
<div className="min-w-0">
<div className="truncate font-medium text-[var(--text-primary)]" title={rule.name}>
<div className="break-words font-medium text-[var(--text-primary)]" title={rule.name}>
{rule.name}
</div>
<div className="truncate text-xs text-[var(--text-muted)]" title={rule.keyword}>
<div className="break-words text-xs text-[var(--text-muted)]" title={rule.keyword}>
关键词:{rule.keyword}
</div>
<div className="mt-1 flex flex-wrap items-center gap-2 text-xs">
@@ -473,7 +473,7 @@ export default function PriceWatch() {
<Bell className="h-3 w-3 text-[var(--brand-primary)]" aria-label="已通知" />
) : null}
</div>
<div className="truncate text-xs text-[var(--text-muted)]" title={rec.lowest_title ?? ''}>
<div className="break-words text-xs text-[var(--text-muted)]" title={rec.lowest_title ?? ''}>
{rec.lowest_title}
</div>
<div className="text-xs text-[var(--text-muted)]">
@@ -952,13 +952,13 @@ export default function PriceWatch() {
href={rec.lowest_url}
target="_blank"
rel="noreferrer"
className="block max-w-[380px] truncate text-sm text-[var(--brand-primary)] hover:underline"
className="block max-w-[380px] break-words text-sm text-[var(--brand-primary)] hover:underline"
title={rec.lowest_title ?? ''}
>
{rec.lowest_title || '(无标题)'}
</a>
) : (
<span className="block max-w-[380px] truncate text-sm text-[var(--text-muted)]">
<span className="block max-w-[380px] break-words text-sm text-[var(--text-muted)]">
{rec.lowest_title || '—'}
</span>
)}
@@ -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,aD as q,S,K as z,aQ as B}from"./index-Bv-jXdOf.js";import{P as F,a as U,E as D,S as o}from"./ui-DsDuWr9N.js";import{S as Q}from"./save-0PTf3nGc.js";import{M as E}from"./message-square-text-A6-FBXDf.js";import{E as $}from"./eye-off-CxE9voxA.js";import{E as G}from"./eye-Bf7DwUjO.js";import{P as C}from"./play-Qs4dEPE9.js";const I="https://ai.88531.cn/v1",J="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 z(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 B(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(F,{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(Q,{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:J,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,aD as q,S,K as z,aQ as B}from"./index-yXsHlw2l.js";import{P as F,a as U,E as D,S as o}from"./ui-Bd6cYCDb.js";import{S as Q}from"./save-DO8G23LU.js";import{M as E}from"./message-square-text-Bi3-Jind.js";import{E as $}from"./eye-off-BCy4micf.js";import{E as G}from"./eye-Ck_8jzF-.js";import{P as C}from"./play-C8ft7DCr.js";const I="https://ai.88531.cn/v1",J="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 z(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 B(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(F,{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(Q,{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:J,target:"_blank",rel:"norefLine truncated
@@ -1,4 +1,4 @@
import{c as m,r as n,j as e,bC as g,e as b,O as j,E as l,aD as f,U as N,aT as u,aU as o,bD as y}from"./index-Bv-jXdOf.js";import{a as w,E as _}from"./ui-DsDuWr9N.js";/**
import{c as m,r as n,j as e,bC as g,e as b,O as j,E as l,aD as f,U as N,aT as u,aU as o,bD as y}from"./index-yXsHlw2l.js";import{a as w,E as _}from"./ui-Bd6cYCDb.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
import{c as J,r as n,j as e,U as be,B as T,M as Qe,L as k,S as Y,e as fe,k as Be,b as $,X as L,l as De,m as U,o as Oe,p as Ke,q as Ye,s as He,t as Je,n as c,u as ye,v as je,w as Ve,x as Xe,y as Ge,z as Ze,A as es,D as ss,F as ts,G as as,H as rs,I as ls,J as ns,K as is}from"./index-Bv-jXdOf.js";import{P as os,a as ds,E as cs}from"./ui-DsDuWr9N.js";import{C as H}from"./check-CY3uIA9x.js";import{S as ms}from"./sparkles-CKxl3Qic.js";import{P as xs,a as us}from"./power-Buu1SqwC.js";import{T as hs}from"./trash-2-B0ysq8Ym.js";import{K as ps}from"./key-B_-6jyLh.js";import{E as gs}from"./eye-off-CxE9voxA.js";import{E as bs}from"./eye-Bf7DwUjO.js";import{S as Ne}from"./save-0PTf3nGc.js";/**
import{c as J,r as n,j as e,U as be,B as T,M as Qe,L as k,S as Y,e as fe,k as Be,b as $,X as L,l as De,m as U,o as Oe,p as Ke,q as Ye,s as He,t as Je,n as c,u as ye,v as je,w as Ve,x as Xe,y as Ge,z as Ze,A as es,D as ss,F as ts,G as as,H as rs,I as ls,J as ns,K as is}from"./index-yXsHlw2l.js";import{P as os,a as ds,E as cs}from"./ui-Bd6cYCDb.js";import{C as H}from"./check-BdELeRHJ.js";import{S as ms}from"./sparkles-C9KMz6ZO.js";import{P as xs,a as us}from"./power-O0_RocC0.js";import{T as hs}from"./trash-2-JDY5JN6p.js";import{K as ps}from"./key-BwBqeFSP.js";import{E as gs}from"./eye-off-BCy4micf.js";import{E as bs}from"./eye-Ck_8jzF-.js";import{S as Ne}from"./save-DO8G23LU.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1 +1 @@
import{r as n,j as e,P as C,e as E,aR as P,Q as $,o as B,n as i,aW as H,bE as M}from"./index-Bv-jXdOf.js";import{P as R,a as D,N as z,S as d}from"./ui-DsDuWr9N.js";import{S as O}from"./save-0PTf3nGc.js";import{S as U}from"./shield-alert-D9azMpPj.js";import{F as W}from"./flower-2-DCghnFkQ.js";import{M as q}from"./message-square-text-A6-FBXDf.js";const r=200,A="宝贝收到了,很满意,感谢老板,欢迎下次再来!",G="亲,感谢支持!有任何问题随时找我~",I={auto_rate_enabled:"评价买家",auto_flower_enabled:"索要小红花",auto_thanks_enabled:"收货致谢",auto_receive_flower_enabled:"自动收下小红花"},K=[{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,T]=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}),T(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(R,{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(D,{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(E,{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(O,{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:U}),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} ${I[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,P as C,e as E,aR as P,Q as $,o as B,n as i,aW as H,bE as M}from"./index-yXsHlw2l.js";import{P as R,a as D,N as z,S as d}from"./ui-Bd6cYCDb.js";import{S as O}from"./save-DO8G23LU.js";import{S as U}from"./shield-alert-k2hqHZMa.js";import{F as W}from"./flower-2-M-vECWnq.js";import{M as q}from"./message-square-text-Bi3-Jind.js";const r=200,A="宝贝收到了,很满意,感谢老板,欢迎下次再来!",G="亲,感谢支持!有任何问题随时找我~",I={auto_rate_enabled:"评价买家",auto_flower_enabled:"索要小红花",auto_thanks_enabled:"收货致谢",auto_receive_flower_enabled:"自动收下小红花"},K=[{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,T]=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}),T(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(R,{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(D,{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(E,{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(O,{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:U}),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} ${I[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,a5 as re,n as j,a6 as de,a7 as M,a8 as G,b as z,a9 as H,v as Y,aa as ce,ab as oe,ac as me}from"./index-Bv-jXdOf.js";import{a as pe,S as xe,E as B}from"./ui-DsDuWr9N.js";import{P as U}from"./plus-CPcSzYSi.js";import{S as he}from"./square-pen-C2r7bTuu.js";import{T as ye}from"./trash-2-B0ysq8Ym.js";import{P as Z}from"./package-nIFuhixh.js";import{S as ue}from"./save-0PTf3nGc.js";import{I as q}from"./image-CidyAfuY.js";import{P as be}from"./package-check-BvQeh0sv.js";/**
import{c as P,r as m,j as e,X as D,a5 as re,n as j,a6 as de,a7 as M,a8 as G,b as z,a9 as H,v as Y,aa as ce,ab as oe,ac as me}from"./index-yXsHlw2l.js";import{a as pe,S as xe,E as B}from"./ui-Bd6cYCDb.js";import{P as U}from"./plus-CLs0ecUi.js";import{S as he}from"./square-pen-DM5oSpoM.js";import{T as ye}from"./trash-2-JDY5JN6p.js";import{P as Z}from"./package-DnP4L_pq.js";import{S as ue}from"./save-DO8G23LU.js";import{I as q}from"./image-DDvYdWSm.js";import{P as be}from"./package-check-Cllv6WsG.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-Bv-jXdOf.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-DsDuWr9N.js";import{P as Ro}from"./package-nIFuhixh.js";import{T as Lh}from"./trending-up-DuUK2UAf.js";import{A as Xb}from"./activity-6q-JZDEZ.js";import{P as Zb}from"./package-check-BvQeh0sv.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-yXsHlw2l.js";import{P as Yb,a as Gb,b as Vb,S as qb,E as Ii}from"./ui-Bd6cYCDb.js";import{P as Ro}from"./package-DnP4L_pq.js";import{T as Lh}from"./trending-up-DnrIn-A5.js";import{A as Xb}from"./activity-3SEBjsJp.js";import{P as Zb}from"./package-check-Cllv6WsG.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1 +1 @@
import{r as n,bK as H,bL as A,j as e,bM as S,L as y,e as B,E as F}from"./index-Bv-jXdOf.js";import{P as O,a as U,N as q,b as z,E as K}from"./ui-DsDuWr9N.js";import{T as L}from"./trending-up-DuUK2UAf.js";import{P as V}from"./package-nIFuhixh.js";const W=2500,R=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({}),[$,M]=n.useState([]),[d,P]=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||{}),M(a.categories||[]),s!=null&&s.silent||i(!1),Object.values(a.boards||{}).some(x=>x.refreshing)?E():w()}catch(a){s!=null&&s.silent||(i(!1),f({type:"error",message:a.message||"榜单加载失败"}))}},[]),E=n.useCallback(()=>{g.current||(g.current=setInterval(()=>{b({silent:!0})},W))},[b]);n.useEffect(()=>(b(),w),[b,w]),n.useEffect(()=>{if(h<=0)return;const s=setInterval(()=>_(a=>a<=1?0:a-1),1e3);return()=>clearInterval(s)},[h]);const t=o[d];n.useEffect(()=>{const s=o[d];!s||r||s.refreshing||s.items.length>0||s.cooldown_remaining>0||N(d)},[d,r,o]);const N=async s=>{if(!u){k(!0);try{const a=await A(s);a.started?(f({type:"info",message:a.categories&&a.categories.length>1?"已开始刷新全部类目,完成后自动更新。":"已开始抓取,十几秒后榜单自动刷新。"}),E()):a.reason==="cooldown"?f({type:"error",message:a.message||"刷新过于频繁,请稍后再试"}):f({type:"info",message:a.message||"已有刷新任务进行中"})}catch(a){f({type:"error",message:a.message||"刷新触发失败"})}finally{k(!1)}}};n.useEffect(()=>{t&&t.cooldown_remaining>0&&_(t.cooldown_remaining)},[t]);const T=n.useMemo(()=>$.map(s=>{var a;return{id:s.id,label:s.name,count:(a=o[s.id])==null?void 0:a.items.length}}),[$,o]),C=n.useMemo(()=>{if(!t)return[];const s={};return(t.items||[]).forEach(l=>{(l.keywords||[]).forEach(x=>{const p=s[x]||(s[x]={hits:0,want:0});p.hits+=1,p.want+=l.want_count||0})}),(t.keywords&&t.keywords.length?t.keywords:Object.keys(s)).map(l=>{var x,p;return{kw:l,hits:((x=s[l])==null?void 0:x.hits)||0,want:((p=s[l])==null?void 0:p.want)||0}}).sort((l,x)=>x.want-l.want)},[t]),m=!!(t!=null&&t.refreshing),c=t==null?void 0:t.progress,D=t!=null&&t.updated_at?Y(t.updated_at*1e3):"尚未生成";return r?e.jsx(O,{label:"正在加载热卖榜"}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(U,{title:"实时热卖榜",description:"按「想要人数」排序的全网热卖商品,数据来自闲鱼实时搜索聚合。",icon: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(B,{className:"h-4 w-4"}),"全部刷新"]}),e.jsxs("button",{type:"button",className:"ios-btn-primary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N(d),disabled:u||m||h>0,children:[m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(L,{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:P,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,bK as H,bL as A,j as e,bM as S,L as y,e as B,E as F}from"./index-yXsHlw2l.js";import{P as O,a as U,N as q,b as z,E as K}from"./ui-Bd6cYCDb.js";import{T as L}from"./trending-up-DnrIn-A5.js";import{P as V}from"./package-DnP4L_pq.js";const W=2500,R=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({}),[$,M]=n.useState([]),[d,P]=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||{}),M(a.categories||[]),s!=null&&s.silent||i(!1),Object.values(a.boards||{}).some(x=>x.refreshing)?E():w()}catch(a){s!=null&&s.silent||(i(!1),f({type:"error",message:a.message||"榜单加载失败"}))}},[]),E=n.useCallback(()=>{g.current||(g.current=setInterval(()=>{b({silent:!0})},W))},[b]);n.useEffect(()=>(b(),w),[b,w]),n.useEffect(()=>{if(h<=0)return;const s=setInterval(()=>_(a=>a<=1?0:a-1),1e3);return()=>clearInterval(s)},[h]);const t=o[d];n.useEffect(()=>{const s=o[d];!s||r||s.refreshing||s.items.length>0||s.cooldown_remaining>0||N(d)},[d,r,o]);const N=async s=>{if(!u){k(!0);try{const a=await A(s);a.started?(f({type:"info",message:a.categories&&a.categories.length>1?"已开始刷新全部类目,完成后自动更新。":"已开始抓取,十几秒后榜单自动刷新。"}),E()):a.reason==="cooldown"?f({type:"error",message:a.message||"刷新过于频繁,请稍后再试"}):f({type:"info",message:a.message||"已有刷新任务进行中"})}catch(a){f({type:"error",message:a.message||"刷新触发失败"})}finally{k(!1)}}};n.useEffect(()=>{t&&t.cooldown_remaining>0&&_(t.cooldown_remaining)},[t]);const T=n.useMemo(()=>$.map(s=>{var a;return{id:s.id,label:s.name,count:(a=o[s.id])==null?void 0:a.items.length}}),[$,o]),C=n.useMemo(()=>{if(!t)return[];const s={};return(t.items||[]).forEach(l=>{(l.keywords||[]).forEach(x=>{const p=s[x]||(s[x]={hits:0,want:0});p.hits+=1,p.want+=l.want_count||0})}),(t.keywords&&t.keywords.length?t.keywords:Object.keys(s)).map(l=>{var x,p;return{kw:l,hits:((x=s[l])==null?void 0:x.hits)||0,want:((p=s[l])==null?void 0:p.want)||0}}).sort((l,x)=>x.want-l.want)},[t]),m=!!(t!=null&&t.refreshing),c=t==null?void 0:t.progress,D=t!=null&&t.updated_at?Y(t.updated_at*1e3):"尚未生成";return r?e.jsx(O,{label:"正在加载热卖榜"}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(U,{title:"实时热卖榜",description:"按「想要人数」排序的全网热卖商品,数据来自闲鱼实时搜索聚合。",icon: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(B,{className:"h-4 w-4"}),"全部刷新"]}),e.jsxs("button",{type:"button",className:"ios-btn-primary flex items-center gap-1.5 rounded-md px-3 py-2 text-sm",onClick:()=>void N(d),disabled:u||m||h>0,children:[m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):e.jsx(L,{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:P,items:T,ariaLabel:"热卖榜类目"})}),m&&e.jsx("div",{className:"section-panel",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm text-[var(--text-soft)]",children:[e.jsx(y,{className:"h-4 w-4 animate-spin text-[#ff4400]"}),e.jsxs("span",{children:["正在抓取「",(c==null?void 0:c.keyword)||"…","」",c&&c.total>0?`(${Math.min(c.done+1,c.total)}/${c.total})`:""]}),c&&c.total>0&&e.jsx("span",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-subtle)]",children:e.jsx("span",{className:"block h-full rounded-full bg-[#ff4400] transition-all",style:{width:`${Math.round(c.Line truncated
@@ -1,4 +1,4 @@
import{c as _e,r,ad as fs,ae as Ee,n as w,j as e,e as ve,X as ee,L as V,af as js,ag as Ns,ah as _s,v as xe,ai as vs,aj as Be,b as re,ak as fe,al as je,am as ws,an as ks,ao as Qe,ap as Re,o as Te,h as ye,a7 as Le,aq as ze,ar as be,w as Ss,as as Cs,at as Ue,au as Ke,av as Is,aw as $s,ax as Ms,ay as Ds}from"./index-Bv-jXdOf.js";import{E as se,S as Ne,P as qe,a as Fs,b as Ps,N as Es}from"./ui-DsDuWr9N.js";import{S as de}from"./shield-alert-D9azMpPj.js";import{S as ce}from"./save-0PTf3nGc.js";import{T as me}from"./trash-2-B0ysq8Ym.js";import{P as oe}from"./plus-CPcSzYSi.js";import{P as Bs}from"./power-off-CNY2Dc3p.js";import{a as Rs,P as Ts}from"./power-Buu1SqwC.js";import{P as We}from"./package-check-BvQeh0sv.js";import{S as Oe}from"./sparkles-CKxl3Qic.js";import{S as Ls}from"./settings-2-DllIA6Ld.js";import{S as zs}from"./square-pen-C2r7bTuu.js";/**
import{c as _e,r,ad as fs,ae as Ee,n as w,j as e,e as ve,X as ee,L as V,af as js,ag as Ns,ah as _s,v as xe,ai as vs,aj as Be,b as re,ak as fe,al as je,am as ws,an as ks,ao as Qe,ap as Re,o as Te,h as ye,a7 as Le,aq as ze,ar as be,w as Ss,as as Cs,at as Ue,au as Ke,av as Is,aw as $s,ax as Ms,ay as Ds}from"./index-yXsHlw2l.js";import{E as se,S as Ne,P as qe,a as Fs,b as Ps,N as Es}from"./ui-Bd6cYCDb.js";import{S as de}from"./shield-alert-k2hqHZMa.js";import{S as ce}from"./save-DO8G23LU.js";import{T as me}from"./trash-2-JDY5JN6p.js";import{P as oe}from"./plus-CLs0ecUi.js";import{P as Bs}from"./power-off-BOTEWylJ.js";import{a as Rs,P as Ts}from"./power-O0_RocC0.js";import{P as We}from"./package-check-Cllv6WsG.js";import{S as Oe}from"./sparkles-C9KMz6ZO.js";import{S as Ls}from"./settings-2-DMbkrkoU.js";import{S as zs}from"./square-pen-DM5oSpoM.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1 +1 @@
import{r as i,o as J,b1 as fe,aq as Ne,a7 as ve,b2 as we,j as e,M as R,B as P,e as Q,b as E,X as F,v as k,b3 as _e,n as t,ak as V,al as ke,b4 as Se,b5 as Ce,b6 as De,b7 as Re,b8 as Pe}from"./index-Bv-jXdOf.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-DsDuWr9N.js";import{T}from"./truck-bFA9lKUP.js";import{K as W}from"./key-B_-6jyLh.js";import{P as Te}from"./plus-CPcSzYSi.js";import{P as $,a as $e}from"./power-Buu1SqwC.js";import{T as A}from"./trash-2-B0ysq8Ym.js";import{P as Ae}from"./power-off-CNY2Dc3p.js";import{S as K}from"./save-0PTf3nGc.js";import{S as Ke}from"./sparkles-CKxl3Qic.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,q]=i.useState(null),[c,N]=i.useState({keyword:"",reply_content:""}),[C,ee]=i.useState([]),[se,ae]=i.useState([]),[te,u]=i.useState(!1),[v,z]=i.useState(null),[r,o]=i.useState({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),[H,le]=i.useState({}),[ie,g]=i.useState(!1),[Le,O]=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")z(null),o({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),u(!0);else if(y==="reply")q(null),N({keyword:"",reply_content:""}),h(!0);else{if(!d)return;G(d)}},G=async s=>{try{const a=await Se(s);O(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),O(null),m({cookie_id:s,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),g(!0)}},de=s=>{y==="reply"&&(q(s),N({keyword:s.keyword,reply_content:s.reply_content}),h(!0))},ce=s=>{z(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(H).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,b1 as fe,aq as Ne,a7 as ve,b2 as we,j as e,M as R,B as P,e as Q,b as E,X as F,v as k,b3 as _e,n as t,ak as V,al as ke,b4 as Se,b5 as Ce,b6 as De,b7 as Re,b8 as Pe}from"./index-yXsHlw2l.js";import{a as Ee,b as Fe,E as S,P as Me,S as M}from"./ui-Bd6cYCDb.js";import{T}from"./truck-D5pa9aSE.js";import{K as W}from"./key-BwBqeFSP.js";import{P as Te}from"./plus-CLs0ecUi.js";import{P as $,a as $e}from"./power-O0_RocC0.js";import{T as A}from"./trash-2-JDY5JN6p.js";import{P as Ae}from"./power-off-BOTEWylJ.js";import{S as K}from"./save-DO8G23LU.js";import{S as Ke}from"./sparkles-C9KMz6ZO.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,q]=i.useState(null),[c,N]=i.useState({keyword:"",reply_content:""}),[C,ee]=i.useState([]),[se,ae]=i.useState([]),[te,u]=i.useState(!1),[v,z]=i.useState(null),[r,o]=i.useState({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),[H,le]=i.useState({}),[ie,g]=i.useState(!1),[Le,O]=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")z(null),o({keyword:"",cookie_id:"",card_id:"",description:"",enabled:!0}),u(!0);else if(y==="reply")q(null),N({keyword:"",reply_content:""}),h(!0);else{if(!d)return;G(d)}},G=async s=>{try{const a=await Se(s);O(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),O(null),m({cookie_id:s,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),g(!0)}},de=s=>{y==="reply"&&(q(s),N({keyword:s.keyword,reply_content:s.reply_content}),h(!0))},ce=s=>{z(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(H).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,4 +1,4 @@
import{c as We,r as n,aV as mt,o as xt,n as u,h as ut,b9 as ht,ba as ft,j as t,e as $e,L as U,bb as pt,X as gt,bc as bt,bd as jt,be as yt,aS as vt,bf as wt,bg as Nt,bh as kt,bi as St,v as Te,bj as Ct,bk as Mt}from"./index-Bv-jXdOf.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-DsDuWr9N.js";import{S as Z}from"./settings-2-DllIA6Ld.js";import{S as $t}from"./search-Bb5I8BnO.js";import{P as Tt}from"./package-nIFuhixh.js";import{I as Rt}from"./image-CidyAfuY.js";import{Z as Et}from"./zap-D2daIz-5.js";import{S as Lt}from"./send-D1j5er8X.js";import{P as Le}from"./plus-CPcSzYSi.js";import{T as Ue}from"./trash-2-B0ysq8Ym.js";/**
import{c as We,r as n,aV as mt,o as xt,n as u,h as ut,b9 as ht,ba as ft,j as t,e as $e,L as U,bb as pt,X as gt,bc as bt,bd as jt,be as yt,aS as vt,bf as wt,bg as Nt,bh as kt,bi as St,v as Te,bj as Ct,bk as Mt}from"./index-yXsHlw2l.js";import{I as Re,c as _t,S as Ee,E as It}from"./ui-Bd6cYCDb.js";import{S as Z}from"./settings-2-DMbkrkoU.js";import{S as $t}from"./search-B68c7FZ_.js";import{P as Tt}from"./package-DnP4L_pq.js";import{I as Rt}from"./image-DDvYdWSm.js";import{Z as Et}from"./zap-DBSpJH5d.js";import{S as Lt}from"./send-3EIq6ti9.js";import{P as Le}from"./plus-CLs0ecUi.js";import{T as Ue}from"./trash-2-JDY5JN6p.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
+1
View File
@@ -0,0 +1 @@
import{r as l,j as t,bb as $,e as ee,L as te,aD as ot,C as ct,X as Se,o as dt,bl as mt,bm as xt,bn as pt,n as o,bo as ut,bp as ht,bq as _e,v as se,br as yt,bs as Re,bt,bu as gt,bv as ft,bw as jt,bx as Nt}from"./index-yXsHlw2l.js";import{a as vt,b as wt,S as E,E as L}from"./ui-Bd6cYCDb.js";import{L as ae}from"./link-2-B9BQGe0y.js";import{S as le}from"./shield-alert-k2hqHZMa.js";import{A as ne}from"./activity-3SEBjsJp.js";import{P as $e}from"./plus-CLs0ecUi.js";import{P as Ee}from"./pen-line-CUcNzmX9.js";import{T as ie}from"./trash-2-JDY5JN6p.js";import{S as kt}from"./send-3EIq6ti9.js";import{C as Ct,a as St}from"./chevron-right-DcRojwVd.js";import{S as Le}from"./save-DO8G23LU.js";import{C as _t}from"./check-BdELeRHJ.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=>a.id=Line truncated
-1
View File
@@ -1 +0,0 @@
import{r as l,j as t,bb as $,e as ee,L as te,aD as ot,C as ct,X as Se,o as dt,bl as mt,bm as xt,bn as pt,n as o,bo as ut,bp as ht,bq as _e,v as se,br as yt,bs as Re,bt,bu as gt,bv as ft,bw as jt,bx as Nt}from"./index-Bv-jXdOf.js";import{a as vt,b as wt,S as E,E as L}from"./ui-DsDuWr9N.js";import{L as ae}from"./link-2-CCl91EwU.js";import{S as le}from"./shield-alert-D9azMpPj.js";import{A as ne}from"./activity-6q-JZDEZ.js";import{P as $e}from"./plus-CPcSzYSi.js";import{P as Ee}from"./pen-line-BYMwCQU2.js";import{T as ie}from"./trash-2-B0ysq8Ym.js";import{S as kt}from"./send-D1j5er8X.js";import{C as Ct,a as St}from"./chevron-right-CHikxycD.js";import{S as Le}from"./save-0PTf3nGc.js";import{C as _t}from"./check-CY3uIA9x.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:"smtp.example.com"},{key:"smtp_port",label:"SMTP 端口",type:"number"},{key:"email_user",label:"发件邮箱"},{key:"email_password",label:"邮箱密码或授权码",type:"password"},{key:"recipient_email",label:"接收邮箱"}],defaults:{smtp_port:587}},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=>a.id===e))==null?void 0:s.label)||e},Xe=e=>!e.event_types||e.event_types.length===0?"全部事件":e.event_types.map(Ke).join("、"),Qe=me.length>0?me:Array.from(new Set(f.map(e=>e.priority))).map(e=>({id:e,label:e==="critical"?"关键":e==="warning"?"重要":"一般"})),Ve=()=>{var e;yeLine truncated
@@ -1,4 +1,4 @@
import{c as Re,r as l,h as ys,N as js,j as e,e as $,O as fs,E as vs,P as Ns,b as N,X as _,o as _s,Q as ws,T as Me,V as ks,W as Ss,n,Y as Cs,v as Pe,Z as Os,_ as Es,$ as Ls,a0 as Is,a1 as Ms,a2 as Ps,a3 as Ds,a4 as Fs}from"./index-Bv-jXdOf.js";import{a as As,b as $s,E as Rs}from"./ui-DsDuWr9N.js";import{P as qs}from"./plus-CPcSzYSi.js";import{T as De}from"./truck-bFA9lKUP.js";import{S as Ts}from"./search-Bb5I8BnO.js";import{P as Y}from"./package-check-BvQeh0sv.js";import{F as zs}from"./flower-2-DCghnFkQ.js";import{E as Vs}from"./eye-Bf7DwUjO.js";import{S as Hs}from"./square-pen-C2r7bTuu.js";import{T as Js}from"./trash-2-B0ysq8Ym.js";import{C as Ws,a as Bs}from"./chevron-right-CHikxycD.js";import{S as Fe}from"./save-0PTf3nGc.js";/**
import{c as Re,r as l,h as ys,N as js,j as e,e as $,O as fs,E as vs,P as Ns,b as N,X as _,o as _s,Q as ws,T as Me,V as ks,W as Ss,n,Y as Cs,v as Pe,Z as Os,_ as Es,$ as Ls,a0 as Is,a1 as Ms,a2 as Ps,a3 as Ds,a4 as Fs}from"./index-yXsHlw2l.js";import{a as As,b as $s,E as Rs}from"./ui-Bd6cYCDb.js";import{P as qs}from"./plus-CLs0ecUi.js";import{T as De}from"./truck-D5pa9aSE.js";import{S as Ts}from"./search-B68c7FZ_.js";import{P as Y}from"./package-check-Cllv6WsG.js";import{F as zs}from"./flower-2-M-vECWnq.js";import{E as Vs}from"./eye-Ck_8jzF-.js";import{S as Hs}from"./square-pen-DM5oSpoM.js";import{T as Js}from"./trash-2-JDY5JN6p.js";import{C as Ws,a as Bs}from"./chevron-right-DcRojwVd.js";import{S as Fe}from"./save-DO8G23LU.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
+16
View File
@@ -0,0 +1,16 @@
import{c as A,r as n,bN as oe,bO as me,j as e,bP as q,e as M,X as Q,bQ as xe,aD as pe,bR as he,bS as ue,bT as be,bU as je,bV as ge,bW as ve}from"./index-yXsHlw2l.js";import{P as U,a as ye,N as E,E as V}from"./ui-Bd6cYCDb.js";import{P as Ne}from"./plus-CLs0ecUi.js";import{P as _e}from"./play-C8ft7DCr.js";import{P as fe}from"./pen-line-CUcNzmX9.js";import{T as we}from"./trash-2-JDY5JN6p.js";import{S as X}from"./search-B68c7FZ_.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 ke=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],R=A("bell",ke);/**
* @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 Ce=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Se=A("clock-3",Ce);/**
* @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 Pe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],$e=A("history",Pe),Me=2500,x=t=>t==null?"—":`¥${Number(t).toLocaleString("zh-CN",{maximumFractionDigits:2})}`,I=()=>Math.floor(Date.now()/1e3),L=t=>{if(!t||t<=0)return"—";const i=Math.floor(t);return i<60?`${i} 秒前`:i<3600?`${Math.floor(i/60)} 分钟前`:i<86400?`${Math.floor(i/3600)} 小时前`:`${Math.floor(i/86400)} 天前`},Ee=t=>t==null||t<0?"已停用":t<60?`${Math.max(0,Math.round(t))} 秒后`:t<3600?`${Math.floor(t/60)} 分钟后`:`${Math.floor(t/3600)} 小时后`,k=t=>{const i=t.trim();if(i==="")return null;const h=Number(i);return Number.isFinite(h)&&h>=0?h:null},J={name:"",keyword:"",min_price:"",max_price:"",target_price:"",interval_minutes:"30",pages:"2",enabled:!0,cookie_id:"",min_seller_credit:"",min_seller_deals:"",ai_precise:!1},Re=t=>({name:t.name,keyword:t.keyword,min_price:t.min_price===null?"":String(t.min_price),max_price:t.max_price===null?"":String(t.max_price),target_price:t.target_price===null?"":String(t.target_price),interval_minutes:String(t.interval_minutes),pages:String(t.pages||2),enabled:t.enabled!==!1,cookie_id:t.cookie_id||"",min_seller_credit:t.min_seller_credit||"",min_seller_deals:t.min_seller_deals!=null?String(t.min_seller_deals):"",ai_precise:!!t.ai_precise}),Z=t=>{const i=t.keyword.trim();if(!i)return{input:null,error:"请填写搜索关键词"};const h=t.name.trim()||i,v=k(t.min_price),m=k(t.max_price);if(v!==null&&m!==null&&v>m)return{input:null,error:"最低价不能大于最高价"};const g=k(t.target_price);if(g!==null&&m!==null&&g>m)return{input:null,error:"目标价不能高于最高价"};const u=Number(t.interval_minutes);if(!Number.isFinite(u)||u<5)return{input:null,error:"检查间隔至少 5 分钟"};const c=Number(t.pages);return!Number.isFinite(c)||c<1||c>5?{input:null,error:"每轮页数取 1~5"}:{input:{name:h,keyword:i,min_price:v,max_price:m,target_price:g,interval_minutes:Math.round(u),pages:Math.round(c),enabled:t.enabled,cookie_id:t.cookie_id||null,min_seller_credit:t.min_seller_credit||null,min_seller_deals:k(t.min_seller_deals),ai_precise:t.ai_precise}}};function He(){const[t,i]=n.useState([]),[h,v]=n.useState(!0),[m,g]=n.useState(""),[u,c]=n.useState(null),[ee,F]=n.useState([]),[se,y]=n.useState(!1),[N,D]=n.useState(null),[l,d]=n.useState(J),[T,O]=n.useState(!1),[H,_]=n.useState(""),[C,B]=n.useState(!1),[o,f]=n.useState(null),[Y,b]=n.useState(""),[S,z]=n.useState(null),[G,P]=n.useState([]),[te,K]=n.useState(!1),w=n.useRef(new Set),p=n.useCallback(async()=>{try{const r=(await oe()).rules??[];i(r),g("");const a=new Set;for(const j of r)j.running&&a.add(j.id);const $=[...w.current].filter(j=>!a.has(j));w.current=a,$.length&&p()}catch(s){g(s instanceof Error?s.message:"加载失败")}finally{v(!1)}},[]);n.useEffect(()=>{p(),me().then(r=>F(r.cookies??[])).catch(()=>F([]));const s=setInterval(()=>void p(),Me);return()=>clearInterval(s)},[p]);const ae=()=>{D(null),d(J),f(null),b(""),_(""),y(!0)},re=s=>{D(s.id),d(Re(s)),f(null),b(""),_(""),y(!0)},le=async()=>{const{input:s,error:r}=Z(l);if(!s){b(r??"参数有误");return}B(!0),b(""),f(null);try{const a=await he({keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,pages:s.pages,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise});f(a),a.error?b(a.error):a.lowest||b("没搜到符合条件的商品,换个关键词或放宽价格区间试试")}catch(a){b(a instanceof Error?a.message:"试搜失败")}finally{B(!1)}},ne=async()=>{const{input:s,error:r}=Z(l);if(!s){_(r??"参数有误");return}O(!0),_("");try{N===null?await ue(s):await be(N,s),y(!1),c({type:"info",message:N===null?"规则已创建,可以立即检查一次":"规则已保存"}),await p()}catch(a){_(a instanceof Error?a.message:"保存失败")}finally{O(!1)}},ie=async s=>{w.current.add(s.id),c(null);try{const r=await je(s.id);if(!r.started)c({type:"info",message:r.message??"任务未启动"});else if(r.record){const a=r.record.lowest_price;a==null?c({type:"warning",message:`「${s.name}」没搜到可比价的商品(已记录一次空结果)`}):r.notified?c({type:"success",message:`已找到最低价 ${x(a)},通知已发送(${r.notify_reason||"命中"})`}):c({type:"info",message:`本次最低价 ${x(a)}(${r.notify_reason||"未触发通知"})`}),r.notify_error&&c({type:"error",message:`通知发送失败:${r.notify_error}`})}}catch(r){c({type:"error",message:r instanceof Error?r.message:"检查失败"})}finally{w.current.delete(s.id),await p()}},ce=async s=>{if(window.confirm(`删除监控规则「${s.name}」?检查历史会一并删除。`))try{await ge(s.id),c({type:"info",message:"规则已删除"}),await p()}catch(r){c({type:"error",message:r instanceof Error?r.message:"删除失败"})}},de=async s=>{z(s),K(!0),P([]);try{const r=await ve(s.id,50);P(r.records??[])}catchLine truncated
-16
View File
@@ -1,16 +0,0 @@
import{c as A,r as n,bN as oe,bO as me,j as e,bP as q,e as M,X as Q,bQ as xe,aD as pe,bR as he,bS as ue,bT as be,bU as je,bV as ge,bW as ve}from"./index-Bv-jXdOf.js";import{P as U,a as ye,N as E,E as V}from"./ui-DsDuWr9N.js";import{P as Ne}from"./plus-CPcSzYSi.js";import{P as _e}from"./play-Qs4dEPE9.js";import{P as fe}from"./pen-line-BYMwCQU2.js";import{T as we}from"./trash-2-B0ysq8Ym.js";import{S as X}from"./search-Bb5I8BnO.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 ke=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],R=A("bell",ke);/**
* @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 Ce=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Se=A("clock-3",Ce);/**
* @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 Pe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],$e=A("history",Pe),Me=2500,x=t=>t==null?"—":`¥${Number(t).toLocaleString("zh-CN",{maximumFractionDigits:2})}`,I=()=>Math.floor(Date.now()/1e3),L=t=>{if(!t||t<=0)return"—";const i=Math.floor(t);return i<60?`${i} 秒前`:i<3600?`${Math.floor(i/60)} 分钟前`:i<86400?`${Math.floor(i/3600)} 小时前`:`${Math.floor(i/86400)} 天前`},Ee=t=>t==null||t<0?"已停用":t<60?`${Math.max(0,Math.round(t))} 秒后`:t<3600?`${Math.floor(t/60)} 分钟后`:`${Math.floor(t/3600)} 小时后`,k=t=>{const i=t.trim();if(i==="")return null;const h=Number(i);return Number.isFinite(h)&&h>=0?h:null},J={name:"",keyword:"",min_price:"",max_price:"",target_price:"",interval_minutes:"30",pages:"2",enabled:!0,cookie_id:"",min_seller_credit:"",min_seller_deals:"",ai_precise:!1},Re=t=>({name:t.name,keyword:t.keyword,min_price:t.min_price===null?"":String(t.min_price),max_price:t.max_price===null?"":String(t.max_price),target_price:t.target_price===null?"":String(t.target_price),interval_minutes:String(t.interval_minutes),pages:String(t.pages||2),enabled:t.enabled!==!1,cookie_id:t.cookie_id||"",min_seller_credit:t.min_seller_credit||"",min_seller_deals:t.min_seller_deals!=null?String(t.min_seller_deals):"",ai_precise:!!t.ai_precise}),Z=t=>{const i=t.keyword.trim();if(!i)return{input:null,error:"请填写搜索关键词"};const h=t.name.trim()||i,v=k(t.min_price),m=k(t.max_price);if(v!==null&&m!==null&&v>m)return{input:null,error:"最低价不能大于最高价"};const g=k(t.target_price);if(g!==null&&m!==null&&g>m)return{input:null,error:"目标价不能高于最高价"};const u=Number(t.interval_minutes);if(!Number.isFinite(u)||u<5)return{input:null,error:"检查间隔至少 5 分钟"};const c=Number(t.pages);return!Number.isFinite(c)||c<1||c>5?{input:null,error:"每轮页数取 1~5"}:{input:{name:h,keyword:i,min_price:v,max_price:m,target_price:g,interval_minutes:Math.round(u),pages:Math.round(c),enabled:t.enabled,cookie_id:t.cookie_id||null,min_seller_credit:t.min_seller_credit||null,min_seller_deals:k(t.min_seller_deals),ai_precise:t.ai_precise}}};function He(){const[t,i]=n.useState([]),[h,v]=n.useState(!0),[m,g]=n.useState(""),[u,c]=n.useState(null),[ee,F]=n.useState([]),[se,y]=n.useState(!1),[N,D]=n.useState(null),[l,d]=n.useState(J),[T,O]=n.useState(!1),[H,_]=n.useState(""),[C,B]=n.useState(!1),[o,f]=n.useState(null),[Y,b]=n.useState(""),[S,z]=n.useState(null),[G,P]=n.useState([]),[te,K]=n.useState(!1),w=n.useRef(new Set),p=n.useCallback(async()=>{try{const r=(await oe()).rules??[];i(r),g("");const a=new Set;for(const j of r)j.running&&a.add(j.id);const $=[...w.current].filter(j=>!a.has(j));w.current=a,$.length&&p()}catch(s){g(s instanceof Error?s.message:"加载失败")}finally{v(!1)}},[]);n.useEffect(()=>{p(),me().then(r=>F(r.cookies??[])).catch(()=>F([]));const s=setInterval(()=>void p(),Me);return()=>clearInterval(s)},[p]);const ae=()=>{D(null),d(J),f(null),b(""),_(""),y(!0)},re=s=>{D(s.id),d(Re(s)),f(null),b(""),_(""),y(!0)},le=async()=>{const{input:s,error:r}=Z(l);if(!s){b(r??"参数有误");return}B(!0),b(""),f(null);try{const a=await he({keyword:s.keyword,min_price:s.min_price,max_price:s.max_price,pages:s.pages,cookie_id:s.cookie_id,min_seller_credit:s.min_seller_credit,min_seller_deals:s.min_seller_deals,ai_precise:s.ai_precise});f(a),a.error?b(a.error):a.lowest||b("没搜到符合条件的商品,换个关键词或放宽价格区间试试")}catch(a){b(a instanceof Error?a.message:"试搜失败")}finally{B(!1)}},ne=async()=>{const{input:s,error:r}=Z(l);if(!s){_(r??"参数有误");return}O(!0),_("");try{N===null?await ue(s):await be(N,s),y(!1),c({type:"info",message:N===null?"规则已创建,可以立即检查一次":"规则已保存"}),await p()}catch(a){_(a instanceof Error?a.message:"保存失败")}finally{O(!1)}},ie=async s=>{w.current.add(s.id),c(null);try{const r=await je(s.id);if(!r.started)c({type:"info",message:r.message??"任务未启动"});else if(r.record){const a=r.record.lowest_price;a==null?c({type:"warning",message:`「${s.name}」没搜到可比价的商品(已记录一次空结果)`}):r.notified?c({type:"success",message:`已找到最低价 ${x(a)},通知已发送(${r.notify_reason||"命中"})`}):c({type:"info",message:`本次最低价 ${x(a)}(${r.notify_reason||"未触发通知"})`}),r.notify_error&&c({type:"error",message:`通知发送失败:${r.notify_error}`})}}catch(r){c({type:"error",message:r instanceof Error?r.message:"检查失败"})}finally{w.current.delete(s.id),await p()}},ce=async s=>{if(window.confirm(`删除监控规则「${s.name}」?检查历史会一并删除。`))try{await ge(s.id),c({type:"info",message:"规则已删除"}),await p()}catch(r){c({type:"error",message:r instanceof Error?r.message:"删除失败"})}},de=async s=>{z(s),K(!0),P([]);try{const r=await ve(s.id,50);P(r.records??[])}catchLine truncated
@@ -1,4 +1,4 @@
import{c as H,r as c,j as e,az as J,e as ye,S as ge,E as be,L as j,aA as je,aB as _e,aC as Ne,aD as ve,X as O,o as fe,aE as we,aF as ke,aG as Ce,aH as U,n as r,v as z,aI as $e,aJ as Se,aK as Pe,aL as De,aM as Re,aN as Fe,aO as Me,aP as Le}from"./index-Bv-jXdOf.js";import{P as Ie,a as Ae,b as ze,S as _,E as N,N as Ee}from"./ui-DsDuWr9N.js";import{S as C}from"./search-Bb5I8BnO.js";import{T as v}from"./trash-2-B0ysq8Ym.js";import{S as E}from"./save-0PTf3nGc.js";import{P as X}from"./play-Qs4dEPE9.js";import{P as Te}from"./package-check-BvQeh0sv.js";import{L as Be}from"./link-2-CCl91EwU.js";/**
import{c as H,r as c,j as e,az as J,e as ye,S as ge,E as be,L as j,aA as je,aB as _e,aC as Ne,aD as ve,X as O,o as fe,aE as we,aF as ke,aG as Ce,aH as U,n as r,v as z,aI as $e,aJ as Se,aK as Pe,aL as De,aM as Re,aN as Fe,aO as Me,aP as Le}from"./index-yXsHlw2l.js";import{P as Ie,a as Ae,b as ze,S as _,E as N,N as Ee}from"./ui-Bd6cYCDb.js";import{S as C}from"./search-B68c7FZ_.js";import{T as v}from"./trash-2-JDY5JN6p.js";import{S as E}from"./save-DO8G23LU.js";import{P as X}from"./play-C8ft7DCr.js";import{P as Te}from"./package-check-Cllv6WsG.js";import{L as Be}from"./link-2-B9BQGe0y.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
import{c as oe,r as a,o as de,j as e,bF as G,L as p,b as me,X as xe,E as ue,bG as he,bH as pe,bI as ge,bJ as fe}from"./index-Bv-jXdOf.js";import{a as je,N as be,b as ye,E as J}from"./ui-DsDuWr9N.js";import{S as N}from"./search-Bb5I8BnO.js";import{P as ve}from"./package-nIFuhixh.js";/**
import{c as oe,r as a,o as de,j as e,bF as G,L as p,b as me,X as xe,E as ue,bG as he,bH as pe,bI as ge,bJ as fe}from"./index-yXsHlw2l.js";import{a as je,N as be,b as ye,E as J}from"./ui-Bd6cYCDb.js";import{S as N}from"./search-B68c7FZ_.js";import{P as ve}from"./package-DnP4L_pq.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,aR as ae,j as e,l as te,e as K,aS as ne,aT as v,aU as q,S as le,aj as O,aV as ie,aW as re,n as c,aX as ce,aY as oe,aZ as de,a_ as pe,a$ as me,b0 as ue}from"./index-Bv-jXdOf.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-DsDuWr9N.js";import{S as je}from"./save-0PTf3nGc.js";import{S as Q}from"./sparkles-CKxl3Qic.js";import{Z as R}from"./zap-D2daIz-5.js";import{E as w}from"./eye-off-CxE9voxA.js";import{E as C}from"./eye-Bf7DwUjO.js";/**
import{c as se,r as l,aR as ae,j as e,l as te,e as K,aS as ne,aT as v,aU as q,S as le,aj as O,aV as ie,aW as re,n as c,aX as ce,aY as oe,aZ as de,a_ as pe,a$ as me,b0 as ue}from"./index-yXsHlw2l.js";import{P as xe,a as he,b as ge,S as p,N as ye}from"./ui-Bd6cYCDb.js";import{S as je}from"./save-DO8G23LU.js";import{S as Q}from"./sparkles-C9KMz6ZO.js";import{Z as R}from"./zap-DBSpJH5d.js";import{E as w}from"./eye-off-BCy4micf.js";import{E as C}from"./eye-Ck_8jzF-.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1 +1 @@
import{r as l,j as e,U as h,e as $,S as j,aS as A,L as f,aj as L,by as P,n as i,v as y,bz as R,bA as T,aX as E,bB as _}from"./index-Bv-jXdOf.js";import{a as I,S as N,E as B}from"./ui-DsDuWr9N.js";import{T as z}from"./trash-2-B0ysq8Ym.js";const D=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"})},X=()=>{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)}}},S=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)}}},C=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," 张卡密 · 注册于 ",D(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,aS as A,L as f,aj as L,by as P,n as i,v as y,bz as R,bA as T,aX as E,bB as _}from"./index-yXsHlw2l.js";import{a as I,S as N,E as B}from"./ui-Bd6cYCDb.js";import{T as z}from"./trash-2-JDY5JN6p.js";const D=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"})},X=()=>{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)}}},S=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)}}},C=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," 张卡密 · 注册于 ",D(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-Bv-jXdOf.js";/**
import{c as t}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as o}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-B3AceNzE.js","assets/ui-DsDuWr9N.js","assets/package-nIFuhixh.js","assets/trending-up-DuUK2UAf.js","assets/activity-6q-JZDEZ.js","assets/package-check-BvQeh0sv.js","assets/AccountList-lcR2ysqJ.js","assets/check-CY3uIA9x.js","assets/sparkles-CKxl3Qic.js","assets/power-Buu1SqwC.js","assets/trash-2-B0ysq8Ym.js","assets/key-B_-6jyLh.js","assets/eye-off-CxE9voxA.js","assets/eye-Bf7DwUjO.js","assets/save-0PTf3nGc.js","assets/OrderList-Bnb8qdVY.js","assets/plus-CPcSzYSi.js","assets/truck-bFA9lKUP.js","assets/search-Bb5I8BnO.js","assets/flower-2-DCghnFkQ.js","assets/square-pen-C2r7bTuu.js","assets/chevron-right-CHikxycD.js","assets/CardList-DD89wc2k.js","assets/image-CidyAfuY.js","assets/ItemList-DeItdLDn.js","assets/shield-alert-D9azMpPj.js","assets/power-off-CNY2Dc3p.js","assets/settings-2-DllIA6Ld.js","assets/ProductAutomation-CWxMYbLu.js","assets/play-Qs4dEPE9.js","assets/link-2-CCl91EwU.js","assets/AIReply-BzKan2pR.js","assets/message-square-text-A6-FBXDf.js","assets/Settings-B2fZ-367.js","assets/zap-D2daIz-5.js","assets/Keywords-lTpecuPZ.js","assets/MessageManagement-DLMB1n-M.js","assets/send-D1j5er8X.js","assets/NotificationsAndLogs-CiIINjYG.js","assets/pen-line-BYMwCQU2.js","assets/UserManagement-BtRqrcWu.js","assets/About-UIQrRND_.js","assets/BuyerInteraction-CTo-GRbk.js","assets/Resell-XxgRl8W5.js","assets/HotList-CeF3_sJ2.js","assets/PriceWatch-Dn8eCiBz.js"])))=>i.map(i=>d[i]);
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DFiKA_hW.js","assets/ui-Bd6cYCDb.js","assets/package-DnP4L_pq.js","assets/trending-up-DnrIn-A5.js","assets/activity-3SEBjsJp.js","assets/package-check-Cllv6WsG.js","assets/AccountList-DR8TEh4Y.js","assets/check-BdELeRHJ.js","assets/sparkles-C9KMz6ZO.js","assets/power-O0_RocC0.js","assets/trash-2-JDY5JN6p.js","assets/key-BwBqeFSP.js","assets/eye-off-BCy4micf.js","assets/eye-Ck_8jzF-.js","assets/save-DO8G23LU.js","assets/OrderList-B20WOM1L.js","assets/plus-CLs0ecUi.js","assets/truck-D5pa9aSE.js","assets/search-B68c7FZ_.js","assets/flower-2-M-vECWnq.js","assets/square-pen-DM5oSpoM.js","assets/chevron-right-DcRojwVd.js","assets/CardList-CwkUTXZz.js","assets/image-DDvYdWSm.js","assets/ItemList-PgsDVJt3.js","assets/shield-alert-k2hqHZMa.js","assets/power-off-BOTEWylJ.js","assets/settings-2-DMbkrkoU.js","assets/ProductAutomation-CVNiechI.js","assets/play-C8ft7DCr.js","assets/link-2-B9BQGe0y.js","assets/AIReply-D2RLnaVk.js","assets/message-square-text-Bi3-Jind.js","assets/Settings-B6uxhLXh.js","assets/zap-DBSpJH5d.js","assets/Keywords-B3_cp3H5.js","assets/MessageManagement-D7UaUK0v.js","assets/send-3EIq6ti9.js","assets/NotificationsAndLogs-AX9S3uOF.js","assets/pen-line-CUcNzmX9.js","assets/UserManagement-CLRKxUfZ.js","assets/About-BnF4rGWF.js","assets/BuyerInteraction-B7a0Ujip.js","assets/Resell-BY31ErQA.js","assets/HotList-CQWl3h1q.js","assets/PriceWatch-BuHp31pO.js"])))=>i.map(i=>d[i]);
function xp(l,s){for(var c=0;c<s.length;c++){const r=s[c];if(typeof r!="string"&&!Array.isArray(r)){for(const f in r)if(f!=="default"&&!(f in l)){const m=Object.getOwnPropertyDescriptor(r,f);m&&Object.defineProperty(l,f,m.get?m:{enumerable:!0,get:()=>r[f]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))r(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function c(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function r(f){if(f.ep)return;f.ep=!0;const m=c(f);fetch(f.href,m)}})();function hh(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Ic={exports:{}},lu={};/**
* @license React
* react-jsx-runtime.production.js
@@ -270,4 +270,4 @@ Error generating stack: `+n.message+`
`);return h===-1?"":f.stack.slice(h+1)})();try{if(!r.stack)r.stack=m;else if(m){const h=m.indexOf(`
`),p=h===-1?-1:m.indexOf(`
`,h+1),v=p===-1?"":m.slice(p+1);String(r.stack).endsWith(v)||(r.stack+=`
`+m)}}catch{}}throw r}}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=bn(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:m}=c;r!==void 0&&Ci.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean),legacyInterceptorReqResOrdering:ot.transitional(ot.boolean),advertiseZstdAcceptEncoding:ot.transitional(ot.boolean),validateStatusUndefinedResolves:ot.transitional(ot.boolean)},!1),f!=null&&(x.isFunction(f)?c.paramsSerializer={serialize:f}:Ci.assertOptions(f,{encode:ot.function,serialize:ot.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),Ci.assertOptions(c,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let h=m&&x.merge(m.common,m[c.method]);m&&x.forEach(["delete","get","head","post","put","patch","query","common"],W=>{delete m[W]}),c.headers=ft.concat(h,m);const p=[];let v=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(c)===!1)return;v=v&&V.synchronous;const Y=c.transitional||Er;Y&&Y.legacyInterceptorReqResOrdering?p.unshift(V.fulfilled,V.rejected):p.push(V.fulfilled,V.rejected)});const g=[];this.interceptors.response.forEach(function(V){g.push(V.fulfilled,V.rejected)});let A,N=0,q;if(!v){const W=[rr.bind(this),void 0];for(W.unshift(...p),W.push(...g),q=W.length,A=Promise.resolve(c);N<q;)A=A.then(W[N++],W[N++]);return A}q=p.length;let F=c;for(;N<q;){const W=p[N++],V=p[N++];try{F=W?W(F):F}catch(Y){if(!V){A=Promise.reject(Y);break}try{const C=V.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,q=g.length;N<q;)A=A.then(g[N++],g[N++]);return A}getUri(s){s=bn(this.defaults,s);const c=Gh(s.baseURL,s.url,s.allowAbsoluteUrls,s);return Lh(c,s.params,s.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(s){yn.prototype[s]=function(c,r){return this.request(bn(r||{},{method:s,url:c,data:r&&x.hasOwnProp(r,"data")?r.data:void 0}))}});x.forEach(["post","put","patch","query"],function(s){function c(r){return function(m,h,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:h}))}}yn.prototype[s]=c(),s!=="query"&&(yn.prototype[s+"Form"]=c(!0))});let dv=class $h{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(m){c=m});const r=this;this.promise.then(f=>{if(!r._listeners)return;let m=r._listeners.length;for(;m-- >0;)r._listeners[m](f);r._listeners=null}),this.promise.then=f=>{let m;const h=new Promise(p=>{r.subscribe(p),m=p}).then(f);return h.cancel=function(){r.unsubscribe(m)},h},s(function(m,h,p){r.reason||(r.reason=new du(m,h,p),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new $h(function(f){s=f}),cancel:s}}};function mv(l){return function(c){return l.apply(null,c)}}function hv(l){return x.isObject(l)&&l.isAxiosError===!0}const pr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCe Line truncated
`+m)}}catch{}}throw r}}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=bn(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:m}=c;r!==void 0&&Ci.assertOptions(r,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean),legacyInterceptorReqResOrdering:ot.transitional(ot.boolean),advertiseZstdAcceptEncoding:ot.transitional(ot.boolean),validateStatusUndefinedResolves:ot.transitional(ot.boolean)},!1),f!=null&&(x.isFunction(f)?c.paramsSerializer={serialize:f}:Ci.assertOptions(f,{encode:ot.function,serialize:ot.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),Ci.assertOptions(c,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let h=m&&x.merge(m.common,m[c.method]);m&&x.forEach(["delete","get","head","post","put","patch","query","common"],W=>{delete m[W]}),c.headers=ft.concat(h,m);const p=[];let v=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(c)===!1)return;v=v&&V.synchronous;const Y=c.transitional||Er;Y&&Y.legacyInterceptorReqResOrdering?p.unshift(V.fulfilled,V.rejected):p.push(V.fulfilled,V.rejected)});const g=[];this.interceptors.response.forEach(function(V){g.push(V.fulfilled,V.rejected)});let A,N=0,q;if(!v){const W=[rr.bind(this),void 0];for(W.unshift(...p),W.push(...g),q=W.length,A=Promise.resolve(c);N<q;)A=A.then(W[N++],W[N++]);return A}q=p.length;let F=c;for(;N<q;){const W=p[N++],V=p[N++];try{F=W?W(F):F}catch(Y){if(!V){A=Promise.reject(Y);break}try{const C=V.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,q=g.length;N<q;)A=A.then(g[N++],g[N++]);return A}getUri(s){s=bn(this.defaults,s);const c=Gh(s.baseURL,s.url,s.allowAbsoluteUrls,s);return Lh(c,s.params,s.paramsSerializer)}};x.forEach(["delete","get","head","options"],function(s){yn.prototype[s]=function(c,r){return this.request(bn(r||{},{method:s,url:c,data:r&&x.hasOwnProp(r,"data")?r.data:void 0}))}});x.forEach(["post","put","patch","query"],function(s){function c(r){return function(m,h,p){return this.request(bn(p||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:m,data:h}))}}yn.prototype[s]=c(),s!=="query"&&(yn.prototype[s+"Form"]=c(!0))});let dv=class $h{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(m){c=m});const r=this;this.promise.then(f=>{if(!r._listeners)return;let m=r._listeners.length;for(;m-- >0;)r._listeners[m](f);r._listeners=null}),this.promise.then=f=>{let m;const h=new Promise(p=>{r.subscribe(p),m=p}).then(f);return h.cancel=function(){r.unsubscribe(m)},h},s(function(m,h,p){r.reason||(r.reason=new du(m,h,p),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new $h(function(f){s=f}),cancel:s}}};function mv(l){return function(c){return l.apply(null,c)}}function hv(l){return x.isObject(l)&&l.isAxiosError===!0}const pr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCe Line truncated
@@ -1,4 +1,4 @@
import{c}from"./index-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as o}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as o}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as e}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c}from"./index-yXsHlw2l.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 $,aD as A,bQ as H,X as R,r as x,b as z}from"./index-Bv-jXdOf.js";/**
import{c as W,j as e,L as $,aD as A,bQ as H,X as R,r as x,b as z}from"./index-yXsHlw2l.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-Bv-jXdOf.js";/**
import{c as a}from"./index-yXsHlw2l.js";/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
+1 -1
View File
@@ -24,7 +24,7 @@
}
})();
</script>
<script type="module" crossorigin src="/static/assets/index-Bv-jXdOf.js"></script>
<script type="module" crossorigin src="/static/assets/index-yXsHlw2l.js"></script>
<link rel="stylesheet" crossorigin href="/static/assets/index-D8Uzfrf4.css">
</head>
<body>