新增:自动化规则支持拍下未付款自动改价
- 新增 order_created 触发器,识别买家拍下待付款交易卡片 - 新增 MTOP 订单改价接口 mtop.taobao.idle.trade.user.adjust.price(含 token 重签与凭证恢复) - 新增 adjust_price 自动化动作,目标价格按整数分校验与执行,错误按三态收口 - 应用层规则校验限定改价动作只用于拍下未付款规则,可附带买家提醒文案 - 前端规则页新增拍下改价类型、目标价格与可选提醒编辑器
This commit is contained in:
1 parent
c3020bde09
commit
7c4a944b43
39 files changed
+1218
-160
No files matched your search
@@ -152,6 +152,7 @@ export const updateShippingRule = async (rule: Partial<ShippingRule>): Promise<O
|
||||
const triggerType = rule.trigger_type || 'order_paid';
|
||||
// triggerName 触发名称,用于当前 API 处理流程。
|
||||
const triggerName: Record<string, string> = {
|
||||
order_created: '拍下未付款自动改价',
|
||||
order_paid: '付款后自动发货',
|
||||
buyer_reviewed: '评价后发送赠品',
|
||||
review_missing_timeout: '超时未评价求评价',
|
||||
|
||||
@@ -4,6 +4,7 @@ Bot,
|
||||
CheckCircle2,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
CircleDollarSign,
|
||||
Clock3,
|
||||
Edit,
|
||||
Layers3,
|
||||
@@ -25,7 +26,7 @@ import { useRulesData } from '../hooks';
|
||||
import { filterAutomationIssues } from '../issueState';
|
||||
import { useRuleActions } from '../ruleActions';
|
||||
import type { AutomationTriggerType,RulesProps,RulesTab } from '../types';
|
||||
import { accentClasses,accountLabel,actionSummary,buildReviewConfig,cardActionsForTrigger,statusPill,triggerMeta,triggerOrder } from '../utils';
|
||||
import { accentClasses,accountLabel,actionSummary,adjustPriceTarget,buildReviewConfig,cardActionsForTrigger,statusPill,triggerMeta,triggerOrder } from '../utils';
|
||||
|
||||
// Rules 是规则 feature 在旧页面目录下保留的兼容入口组件。
|
||||
const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHandled }) => {
|
||||
@@ -105,7 +106,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
editingAutomationRule, setEditingAutomationRule,
|
||||
editingReplyRule, setEditingReplyRule, defaultForm, setDefaultForm, selectedRuleItem, isMultiSpecRule, currentTrigger,
|
||||
currentMeta, reviewConfig, displayVariants, openAutomationRule, openNewAutomationRule, handleTriggerChange,
|
||||
handleAutomationItemChange, updateVariant, appendDeliveryContent, handleSaveAutomationRule, handleDeleteAutomation,
|
||||
handleAutomationItemChange, updateVariant, updateAdjustPriceTarget, updateAdjustPriceNotifyText, appendDeliveryContent, handleSaveAutomationRule, handleDeleteAutomation,
|
||||
handleToggleAutomation, handleResolveRunIssue, handleResolveDeferredIssue, handleAddReplyRule, handleSaveReplyRule,
|
||||
handleDeleteReply, openDefaultReplyModal, handleSaveDefaultReply, handleDeleteDefaultReply, handleClearDefaultReplyRecords,
|
||||
} = ruleActions;
|
||||
@@ -722,7 +723,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{selectedRuleItem && currentTrigger !== 'review_missing_timeout' && (
|
||||
{selectedRuleItem && currentTrigger !== 'review_missing_timeout' && currentTrigger !== 'order_created' && (
|
||||
<div className="mt-4 rounded-2xl bg-gray-50 border border-gray-100 p-4">
|
||||
<div className="flex flex-wrap items-center gap-2 mb-2">
|
||||
<span className="px-3 py-1.5 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold">{selectedRuleItem.item_title || selectedRuleItem.item_id}</span>
|
||||
@@ -738,7 +739,43 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
)}
|
||||
</section>
|
||||
|
||||
{currentTrigger !== 'review_missing_timeout' ? (
|
||||
{currentTrigger === 'order_created' ? (
|
||||
<section className="bg-white rounded-3xl border border-gray-100 p-5">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<CircleDollarSign className="w-5 h-5 text-violet-600" />
|
||||
<h4 className="font-black text-gray-900">改价设置</h4>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-bold text-gray-700 mb-2">目标价格(元)</label>
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
value={adjustPriceTarget(editingAutomationRule.actions)}
|
||||
onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => updateAdjustPriceTarget(event.target.value)}
|
||||
placeholder="例如:9.9"
|
||||
className="w-full ios-input px-4 py-3 rounded-xl"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-2">买家拍下未付款后,系统会把该笔订单价格修改为此金额(0.01 - 1000000 元,最多两位小数)。</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-bold text-gray-700 mb-2">改价后提醒买家(可选)</label>
|
||||
<textarea
|
||||
value={editingAutomationRule.actions?.find(/* 当前回调处理集合中的单个元素。 */ action => action.action_type === 'send_text')?.message_template || ''}
|
||||
onChange={/* 当前回调处理用户交互或异步状态变化。 */ event => updateAdjustPriceNotifyText(event.target.value)}
|
||||
placeholder="例如:已为您改好价格,请尽快支付哦~"
|
||||
className="w-full ios-input px-4 py-3 rounded-xl h-24 resize-none"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-2">留空则只改价不发送消息。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 rounded-2xl bg-violet-50 border border-violet-100 p-4">
|
||||
<p className="text-xs leading-5 text-violet-700">
|
||||
改价仅对买家尚未付款的订单生效;订单已付款、已关闭或平台限制改价时任务会记录失败原因。建议配合商品说明引导买家「先拍下再等改价」。
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
) : currentTrigger !== 'review_missing_timeout' ? (
|
||||
<section className="bg-white rounded-3xl border border-gray-100 p-5">
|
||||
<div className="flex items-start justify-between gap-4 mb-4">
|
||||
<div>
|
||||
|
||||
@@ -110,6 +110,44 @@ describe('useRuleActions', /* 当前回调验证规则页面动作协调器的
|
||||
hook.unmount();
|
||||
});
|
||||
|
||||
test('拍下改价规则校验目标价格并剔除空提醒动作', /* 当前回调验证拍下改价草稿与保存边界。 */ async () => {
|
||||
// hook 是规则动作 Hook 的真实 React 状态实例。
|
||||
const hook = renderHook(() => useRuleActionsHarness());
|
||||
act(/* 当前回调打开拍下改价规则弹窗。 */ () => hook.result.current.openNewAutomationRule('order_created'));
|
||||
expect(hook.result.current.editingAutomationRule?.variants).toEqual([]);
|
||||
|
||||
// 目标价格为空时保存被拒绝且不触达接口。
|
||||
await act(/* 当前回调执行空价格保存。 */ async () => hook.result.current.handleSaveAutomationRule());
|
||||
expect(updateShippingMock).not.toHaveBeenCalled();
|
||||
|
||||
act(/* 当前回调写入合法目标价格。 */ () => hook.result.current.updateAdjustPriceTarget('9.9'));
|
||||
act(/* 当前回调写入空白提醒文案。 */ () => hook.result.current.updateAdjustPriceNotifyText(' '));
|
||||
await act(/* 当前回调执行拍下改价保存。 */ async () => hook.result.current.handleSaveAutomationRule());
|
||||
expect(updateShippingMock).toHaveBeenCalledWith(expect.objectContaining({
|
||||
trigger_type: 'order_created',
|
||||
variants: [],
|
||||
actions: [expect.objectContaining({ action_type: 'adjust_price', config_json: '{"target_price":"9.9"}' })],
|
||||
}));
|
||||
hook.unmount();
|
||||
});
|
||||
|
||||
test('拍下改价规则保存带文案的可选提醒动作', /* 当前回调验证改价提醒文案的保存。 */ async () => {
|
||||
// hook 是规则动作 Hook 的真实 React 状态实例。
|
||||
const hook = renderHook(() => useRuleActionsHarness());
|
||||
act(/* 当前回调打开拍下改价规则弹窗。 */ () => hook.result.current.openNewAutomationRule('order_created'));
|
||||
act(/* 当前回调写入合法目标价格。 */ () => hook.result.current.updateAdjustPriceTarget('12'));
|
||||
act(/* 当前回调写入买家提醒文案。 */ () => hook.result.current.updateAdjustPriceNotifyText('已改价,请支付'));
|
||||
await act(/* 当前回调执行拍下改价保存。 */ async () => hook.result.current.handleSaveAutomationRule());
|
||||
expect(updateShippingMock).toHaveBeenCalledWith(expect.objectContaining({
|
||||
trigger_type: 'order_created',
|
||||
actions: [
|
||||
expect.objectContaining({ action_type: 'adjust_price', config_json: '{"target_price":"12"}' }),
|
||||
expect.objectContaining({ action_type: 'send_text', message_template: '已改价,请支付' }),
|
||||
],
|
||||
}));
|
||||
hook.unmount();
|
||||
});
|
||||
|
||||
test('关键词和默认回复动作分别读取、保存并刷新', /* 当前回调验证两个回复页签的动作边界。 */ async () => {
|
||||
// hook 是规则动作 Hook 的真实 React 状态实例。
|
||||
const hook = renderHook(() => useRuleActionsHarness());
|
||||
|
||||
@@ -16,7 +16,7 @@ updateShippingRule,
|
||||
} from './api';
|
||||
import { finishRuleSubmission,idleRuleSubmitState,startRuleSubmission,type RuleSubmitState } from './interactionState';
|
||||
import type { AutomationTriggerType,Card,DefaultReplyForm,Item,ReplyRule,RulesProps,RulesTab,ShippingRule,ShippingVariant } from './types';
|
||||
import { boolFlag,buildReviewConfig,cardActionsForTrigger,defaultRuleName,emptyVariant,parseJSONObject,shouldReplaceGeneratedName,triggerMeta } from './utils';
|
||||
import { adjustPriceTarget,boolFlag,buildAdjustPriceConfig,buildReviewConfig,cardActionsForTrigger,defaultRuleName,emptyVariant,isValidAdjustPrice,parseJSONObject,shouldReplaceGeneratedName,triggerMeta } from './utils';
|
||||
|
||||
// RuleActionsOptions 描述规则动作协调器依赖的页面数据、刷新函数和外部联动目标。
|
||||
export interface RuleActionsOptions {
|
||||
@@ -106,6 +106,10 @@ export interface RuleActionsState {
|
||||
handleAutomationItemChange: (itemID: string) => void;
|
||||
// updateVariant 更新指定发货规格的字段。
|
||||
updateVariant: (index: number, patch: Partial<ShippingVariant>) => void;
|
||||
// updateAdjustPriceTarget 更新拍下改价草稿的目标价格。
|
||||
updateAdjustPriceTarget: (targetPrice: string) => void;
|
||||
// updateAdjustPriceNotifyText 更新拍下改价草稿的可选买家提醒文案。
|
||||
updateAdjustPriceNotifyText: (text: string) => void;
|
||||
// appendDeliveryContent 追加一行发货规格。
|
||||
appendDeliveryContent: () => void;
|
||||
// handleSaveAutomationRule 保存当前自动化规则。
|
||||
@@ -198,7 +202,7 @@ export const useRuleActions = ({
|
||||
name: defaultRuleName(trigger, itemLabel), trigger_type: trigger, cookie_id: cookieID, item_id: itemID,
|
||||
item_title: item?.item_title || '', item_keyword: itemLabel, card_group_id: 0, priority: 100, enabled: true,
|
||||
config_json: trigger === 'review_missing_timeout' ? buildReviewConfig() : '{}', actions: cardActionsForTrigger(trigger),
|
||||
variants: trigger === 'review_missing_timeout' ? [] : [emptyVariant()],
|
||||
variants: trigger === 'review_missing_timeout' || trigger === 'order_created' ? [] : [emptyVariant()],
|
||||
};
|
||||
}, [items, selectedAccountId]);
|
||||
|
||||
@@ -211,7 +215,7 @@ export const useRuleActions = ({
|
||||
trigger_type: trigger,
|
||||
config_json: trigger === 'review_missing_timeout' ? buildReviewConfig(rule.config_json) : (rule.config_json || '{}'),
|
||||
actions: rule.actions?.length ? rule.actions.map(/* 当前回调复制自动化动作。 */ action => ({ ...action })) : cardActionsForTrigger(trigger, rule.card_group_id),
|
||||
variants: rule.variants?.length ? rule.variants.map(/* 当前回调复制发货规格。 */ variant => ({ ...variant })) : (trigger === 'review_missing_timeout' ? [] : [emptyVariant()]),
|
||||
variants: rule.variants?.length ? rule.variants.map(/* 当前回调复制发货规格。 */ variant => ({ ...variant })) : (trigger === 'review_missing_timeout' || trigger === 'order_created' ? [] : [emptyVariant()]),
|
||||
});
|
||||
setShowAutomationModal(true);
|
||||
}, []);
|
||||
@@ -288,7 +292,7 @@ export const useRuleActions = ({
|
||||
name: shouldReplaceGeneratedName(editingAutomationRule.name) ? defaultRuleName(trigger, itemLabel) : editingAutomationRule.name,
|
||||
card_group_id: currentCardID, config_json: trigger === 'review_missing_timeout' ? buildReviewConfig(editingAutomationRule.config_json) : '{}',
|
||||
actions: cardActionsForTrigger(trigger, currentCardID),
|
||||
variants: trigger === 'review_missing_timeout' ? [] : (editingAutomationRule.variants?.length ? editingAutomationRule.variants : [{ ...emptyVariant(), card_id: currentCardID }]),
|
||||
variants: trigger === 'review_missing_timeout' || trigger === 'order_created' ? [] : (editingAutomationRule.variants?.length ? editingAutomationRule.variants : [{ ...emptyVariant(), card_id: currentCardID }]),
|
||||
});
|
||||
}, [editingAutomationRule, selectedRuleItem]);
|
||||
|
||||
@@ -313,6 +317,35 @@ export const useRuleActions = ({
|
||||
setEditingAutomationRule({ ...editingAutomationRule, variants: next, card_group_id: next[0]?.card_id || 0 });
|
||||
}, [displayVariants, editingAutomationRule]);
|
||||
|
||||
// updateAdjustPriceTarget 更新拍下改价草稿中的目标价格。
|
||||
const updateAdjustPriceTarget = useCallback(/* adjustPriceAction 更新改价目标价格。 */ (targetPrice: string) => {
|
||||
if (!editingAutomationRule) return;
|
||||
// baseActions 保存至少包含改价动作的当前动作列表。
|
||||
const baseActions = editingAutomationRule.actions?.some(/* 当前回调查找改价动作。 */ action => action.action_type === 'adjust_price')
|
||||
? editingAutomationRule.actions
|
||||
: cardActionsForTrigger('order_created');
|
||||
setEditingAutomationRule({
|
||||
...editingAutomationRule,
|
||||
actions: baseActions.map(/* 当前回调把新目标价格写入改价动作配置。 */ action =>
|
||||
action.action_type === 'adjust_price' ? { ...action, config_json: buildAdjustPriceConfig(targetPrice) } : action),
|
||||
});
|
||||
}, [editingAutomationRule]);
|
||||
|
||||
// updateAdjustPriceNotifyText 更新拍下改价草稿中的可选买家提醒文案。
|
||||
const updateAdjustPriceNotifyText = useCallback(/* adjustNotifyAction 更新改价提醒文案。 */ (text: string) => {
|
||||
if (!editingAutomationRule) return;
|
||||
// actions 保存当前动作列表副本。
|
||||
const actions = (editingAutomationRule.actions || []).slice();
|
||||
// textIndex 是可选提醒动作在列表中的位置。
|
||||
const textIndex = actions.findIndex(/* 当前回调查找提醒文案动作。 */ action => action.action_type === 'send_text');
|
||||
if (textIndex >= 0) {
|
||||
actions[textIndex] = { ...actions[textIndex], message_template: text };
|
||||
} else {
|
||||
actions.push({ action_type: 'send_text', message_template: text, enabled: true, sort_order: actions.length + 1 });
|
||||
}
|
||||
setEditingAutomationRule({ ...editingAutomationRule, actions });
|
||||
}, [editingAutomationRule]);
|
||||
|
||||
// appendDeliveryContent 在规格编辑器末尾追加一行。
|
||||
const appendDeliveryContent = useCallback(/* appendVariantAction 追加规则规格。 */ () => {
|
||||
if (!editingAutomationRule) return;
|
||||
@@ -332,7 +365,7 @@ export const useRuleActions = ({
|
||||
if (!editingAutomationRule.cookie_id) return alert('请选择账号');
|
||||
// variants 保存当前规格列表。
|
||||
const variants = editingAutomationRule.variants?.length ? editingAutomationRule.variants : [];
|
||||
if (trigger !== 'review_missing_timeout') {
|
||||
if (trigger !== 'review_missing_timeout' && trigger !== 'order_created') {
|
||||
if (!variants.length || variants.some(/* 当前回调校验卡密组是否已选择。 */ variant => !variant.card_id)) return alert(trigger === 'buyer_reviewed' ? '请选择评价赠品卡密库存' : '请选择发货卡密库存');
|
||||
if (isMultiSpecRule && variants.some(/* 当前回调校验多规格字段。 */ variant => !variant.spec_name.trim() || !variant.spec_value.trim())) return alert('多规格商品必须填写每一行的规格名称和规格值');
|
||||
}
|
||||
@@ -341,13 +374,19 @@ export const useRuleActions = ({
|
||||
const text = editingAutomationRule.actions?.find(/* 当前回调查找求评价文案动作。 */ action => action.action_type === 'send_text')?.message_template || '';
|
||||
if (!text.trim()) return alert('请填写求评价文案');
|
||||
}
|
||||
// saveActions 保存实际提交的动作列表;拍下改价规则会剔除未填写文案的可选提醒动作。
|
||||
let saveActions = editingAutomationRule.actions?.length ? editingAutomationRule.actions : cardActionsForTrigger(trigger, editingAutomationRule.card_group_id || 0);
|
||||
if (trigger === 'order_created') {
|
||||
if (!isValidAdjustPrice(adjustPriceTarget(saveActions))) return alert('请填写 0.01 到 1000000 元、最多两位小数的目标价格');
|
||||
saveActions = saveActions.filter(/* 当前回调剔除空文案的可选提醒动作。 */ action => action.action_type !== 'send_text' || Boolean(action.message_template?.trim()));
|
||||
}
|
||||
// saveVariants 保存归一化后的发货规格。
|
||||
const saveVariants = trigger === 'review_missing_timeout' ? [] : variants.map(/* 当前回调归一化发货规格字段。 */ variant => ({ ...variant, spec_name: isMultiSpecRule ? variant.spec_name.trim() : '', spec_value: isMultiSpecRule ? variant.spec_value.trim() : '', delivery_count: Math.max(1, Number(variant.delivery_count) || 1), enabled: variant.enabled !== false }));
|
||||
const saveVariants = trigger === 'review_missing_timeout' || trigger === 'order_created' ? [] : variants.map(/* 当前回调归一化发货规格字段。 */ variant => ({ ...variant, spec_name: isMultiSpecRule ? variant.spec_name.trim() : '', spec_value: isMultiSpecRule ? variant.spec_value.trim() : '', delivery_count: Math.max(1, Number(variant.delivery_count) || 1), enabled: variant.enabled !== false }));
|
||||
setAutomationSubmitState(startRuleSubmission(automationSubmitState));
|
||||
// succeeded 记录保存是否成功。
|
||||
let succeeded = false;
|
||||
try {
|
||||
await updateShippingRule({ ...editingAutomationRule, trigger_type: trigger, name: (editingAutomationRule.name || '').trim() || defaultRuleName(trigger, selectedRuleItem?.item_title || editingAutomationRule.item_id || ''), config_json: trigger === 'review_missing_timeout' ? buildReviewConfig(editingAutomationRule.config_json) : (editingAutomationRule.config_json || '{}'), actions: editingAutomationRule.actions?.length ? editingAutomationRule.actions : cardActionsForTrigger(trigger, saveVariants[0]?.card_id || editingAutomationRule.card_group_id || 0), variants: saveVariants });
|
||||
await updateShippingRule({ ...editingAutomationRule, trigger_type: trigger, name: (editingAutomationRule.name || '').trim() || defaultRuleName(trigger, selectedRuleItem?.item_title || editingAutomationRule.item_id || ''), config_json: trigger === 'review_missing_timeout' ? buildReviewConfig(editingAutomationRule.config_json) : (editingAutomationRule.config_json || '{}'), actions: trigger === 'order_created' ? saveActions : (editingAutomationRule.actions?.length ? editingAutomationRule.actions : cardActionsForTrigger(trigger, saveVariants[0]?.card_id || editingAutomationRule.card_group_id || 0)), variants: saveVariants });
|
||||
setShowAutomationModal(false);
|
||||
await Promise.all([loadAutomationRules(), loadReferenceData()]);
|
||||
alert('保存成功');
|
||||
@@ -451,7 +490,7 @@ export const useRuleActions = ({
|
||||
automationSubmitState, replySubmitState, defaultReplySubmitState, editingAutomationRule, setEditingAutomationRule,
|
||||
editingReplyRule, setEditingReplyRule, defaultForm, setDefaultForm, selectedRuleItem, isMultiSpecRule, currentTrigger,
|
||||
currentMeta, reviewConfig, displayVariants, buildAutomationDraft, openAutomationRule, openNewAutomationRule,
|
||||
handleTriggerChange, handleAutomationItemChange, updateVariant, appendDeliveryContent, handleSaveAutomationRule,
|
||||
handleTriggerChange, handleAutomationItemChange, updateVariant, updateAdjustPriceTarget, updateAdjustPriceNotifyText, appendDeliveryContent, handleSaveAutomationRule,
|
||||
handleDeleteAutomation, handleToggleAutomation, handleResolveRunIssue, handleResolveDeferredIssue, handleAddReplyRule,
|
||||
handleSaveReplyRule, handleDeleteReply, openDefaultReplyModal, handleSaveDefaultReply, handleDeleteDefaultReply,
|
||||
handleClearDefaultReplyRecords,
|
||||
|
||||
@@ -68,7 +68,7 @@ export interface TriggerMeta {
|
||||
// flow 是该触发类型的步骤摘要。
|
||||
flow: string[];
|
||||
// accent 是页面使用的主题色名称。
|
||||
accent: 'blue' | 'emerald' | 'amber';
|
||||
accent: 'blue' | 'emerald' | 'amber' | 'violet';
|
||||
// icon 是触发类型对应的图标组件。
|
||||
icon: ElementType;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,14 @@ import {
|
||||
accentClasses,
|
||||
accountLabel,
|
||||
actionSummary,
|
||||
adjustPriceTarget,
|
||||
boolFlag,
|
||||
buildAdjustPriceConfig,
|
||||
buildReviewConfig,
|
||||
cardActionsForTrigger,
|
||||
defaultRuleName,
|
||||
emptyVariant,
|
||||
isValidAdjustPrice,
|
||||
parseJSONObject,
|
||||
shouldReplaceGeneratedName,
|
||||
statusPill,
|
||||
@@ -49,10 +52,13 @@ describe('规则工具函数', /* 当前回调处理规则配置和展示状态
|
||||
expect(shouldReplaceGeneratedName('我自定义的规则')).toBe(false);
|
||||
});
|
||||
|
||||
test('创建三类触发器的默认动作链', /* 当前回调处理规则配置和展示状态。 */ () => {
|
||||
test('创建各类触发器的默认动作链', /* 当前回调处理规则配置和展示状态。 */ () => {
|
||||
expect(cardActionsForTrigger('review_missing_timeout')).toEqual([{
|
||||
action_type: 'send_text', message_template: '亲,商品使用满意的话,麻烦给个评价,谢谢~', enabled: true, sort_order: 1,
|
||||
}]);
|
||||
expect(cardActionsForTrigger('order_created')).toEqual([{
|
||||
action_type: 'adjust_price', config_json: '{"target_price":""}', enabled: true, sort_order: 1,
|
||||
}]);
|
||||
expect(cardActionsForTrigger('order_paid', 7)).toEqual([
|
||||
{ action_type: 'send_card', card_id: 7, delivery_count: 1, enabled: true, sort_order: 1 },
|
||||
{ action_type: 'confirm_shipment', enabled: true, sort_order: 2 },
|
||||
@@ -62,6 +68,23 @@ describe('规则工具函数', /* 当前回调处理规则配置和展示状态
|
||||
]);
|
||||
});
|
||||
|
||||
test('校验并读取拍下改价的目标价格', /* 当前回调处理规则配置和展示状态。 */ () => {
|
||||
expect(buildAdjustPriceConfig(' 9.9 ')).toBe('{"target_price":"9.9"}');
|
||||
expect(adjustPriceTarget([{ action_type: 'adjust_price', config_json: '{"target_price":"12.5"}', enabled: true }])).toBe('12.5');
|
||||
expect(adjustPriceTarget([{ action_type: 'send_text', message_template: 'x', enabled: true }])).toBe('');
|
||||
expect(adjustPriceTarget()).toBe('');
|
||||
expect(isValidAdjustPrice('9.9')).toBe(true);
|
||||
expect(isValidAdjustPrice('0.01')).toBe(true);
|
||||
expect(isValidAdjustPrice('1000000')).toBe(true);
|
||||
expect(isValidAdjustPrice('0')).toBe(false);
|
||||
expect(isValidAdjustPrice('')).toBe(false);
|
||||
expect(isValidAdjustPrice('1.234')).toBe(false);
|
||||
expect(isValidAdjustPrice('abc')).toBe(false);
|
||||
expect(isValidAdjustPrice('1000000.01')).toBe(false);
|
||||
expect(actionSummary(rule({ trigger_type: 'order_created', actions: [{ action_type: 'adjust_price', config_json: '{"target_price":"9.9"}', enabled: true }] }))).toBe('拍下后改价为 ¥9.9');
|
||||
expect(actionSummary(rule({ trigger_type: 'order_created', actions: [] }))).toBe('未配置目标价格');
|
||||
});
|
||||
|
||||
test('汇总动作、主题样式和布尔标志', /* 当前回调处理规则配置和展示状态。 */ () => {
|
||||
expect(actionSummary(rule({ trigger_type: 'review_missing_timeout', actions: [{ action_type: 'send_text', message_template: '请评价', enabled: true }] }))).toBe('请评价');
|
||||
expect(actionSummary(rule({ trigger_type: 'review_missing_timeout', actions: [] }))).toBe('发送求评价文案');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Clock3,Gift,PackageCheck } from 'lucide-react';
|
||||
import { CircleDollarSign,Clock3,Gift,PackageCheck } from 'lucide-react';
|
||||
import type {
|
||||
AccountDetail,
|
||||
AutomationAction,
|
||||
@@ -10,6 +10,14 @@ import type { TriggerMeta } from './types';
|
||||
|
||||
// triggerMeta 是自动化触发类型的统一展示元数据,供列表和编辑器复用。
|
||||
export const triggerMeta: Record<AutomationTriggerType, TriggerMeta> = {
|
||||
order_created: {
|
||||
label: '拍下未付款自动改价',
|
||||
shortLabel: '拍下改价',
|
||||
description: '买家拍下商品未付款时,把该笔待付款订单的价格自动修改为目标价格。',
|
||||
flow: ['拍下待付款卡片', '匹配商品规则', '修改订单价格', '可选提醒买家'],
|
||||
accent: 'violet',
|
||||
icon: CircleDollarSign,
|
||||
},
|
||||
order_paid: {
|
||||
label: '付款后自动发货',
|
||||
shortLabel: '自动发货',
|
||||
@@ -37,7 +45,7 @@ export const triggerMeta: Record<AutomationTriggerType, TriggerMeta> = {
|
||||
};
|
||||
|
||||
// triggerOrder 固定自动化类型在创建面板和筛选器中的排序。
|
||||
export const triggerOrder: AutomationTriggerType[] = ['order_paid', 'buyer_reviewed', 'review_missing_timeout'];
|
||||
export const triggerOrder: AutomationTriggerType[] = ['order_paid', 'order_created', 'buyer_reviewed', 'review_missing_timeout'];
|
||||
|
||||
// reviewRequestText 是超时未评价规则的默认提醒文案。
|
||||
export const reviewRequestText = '亲,商品使用满意的话,麻烦给个评价,谢谢~';
|
||||
@@ -95,8 +103,39 @@ export const shouldReplaceGeneratedName = (name?: string) => {
|
||||
);
|
||||
};
|
||||
|
||||
// buildAdjustPriceConfig 把目标价格文本序列化为改价动作配置 JSON。
|
||||
export const buildAdjustPriceConfig = (targetPrice: string) => JSON.stringify({ target_price: targetPrice.trim() });
|
||||
|
||||
// adjustPriceTarget 从动作列表读取改价动作的目标价格文本。
|
||||
export const adjustPriceTarget = (actions?: AutomationAction[]): string => {
|
||||
// action 是动作列表中的改价动作。
|
||||
const action = (actions || []).find(
|
||||
// 改价动作匹配器只查找订单改价类型。
|
||||
candidate => candidate.action_type === 'adjust_price',
|
||||
);
|
||||
return String(parseJSONObject(action?.config_json).target_price ?? '');
|
||||
};
|
||||
|
||||
// isValidAdjustPrice 校验目标价格是否为 0.01 到 1000000 元、最多两位小数的金额。
|
||||
export const isValidAdjustPrice = (raw: string): boolean => {
|
||||
// trimmed 是去掉首尾空白后的金额文本。
|
||||
const trimmed = raw.trim();
|
||||
if (!/^\d+(\.\d{1,2})?$/.test(trimmed)) return false;
|
||||
// cents 是金额折算出的整数分。
|
||||
const cents = Math.round(Number(trimmed) * 100);
|
||||
return cents >= 1 && cents <= 100000000;
|
||||
};
|
||||
|
||||
// cardActionsForTrigger 根据触发类型创建默认动作链。
|
||||
export const cardActionsForTrigger = (trigger: AutomationTriggerType, cardID = 0): AutomationAction[] => {
|
||||
if (trigger === 'order_created') {
|
||||
return [{
|
||||
action_type: 'adjust_price',
|
||||
config_json: buildAdjustPriceConfig(''),
|
||||
enabled: true,
|
||||
sort_order: 1,
|
||||
}];
|
||||
}
|
||||
if (trigger === 'review_missing_timeout') {
|
||||
return [{
|
||||
action_type: 'send_text',
|
||||
@@ -123,6 +162,11 @@ export const cardActionsForTrigger = (trigger: AutomationTriggerType, cardID = 0
|
||||
|
||||
// actionSummary 将规则动作转换成列表中的简短摘要。
|
||||
export const actionSummary = (rule: ShippingRule) => {
|
||||
if (rule.trigger_type === 'order_created') {
|
||||
// target 是规则配置的改价目标价格。
|
||||
const target = adjustPriceTarget(rule.actions);
|
||||
return target ? `拍下后改价为 ¥${target}` : '未配置目标价格';
|
||||
}
|
||||
if (rule.trigger_type === 'review_missing_timeout') {
|
||||
return rule.actions?.find(
|
||||
// 文案动作匹配器只查找发送文字动作。
|
||||
@@ -148,6 +192,7 @@ export const accentClasses = (accent: TriggerMeta['accent'], selected = false) =
|
||||
blue: selected ? 'border-blue-500 bg-blue-50 text-blue-700' : 'border-blue-100 bg-blue-50/60 text-blue-700 hover:border-blue-300',
|
||||
emerald: selected ? 'border-emerald-500 bg-emerald-50 text-emerald-700' : 'border-emerald-100 bg-emerald-50/60 text-emerald-700 hover:border-emerald-300',
|
||||
amber: selected ? 'border-amber-500 bg-amber-50 text-amber-700' : 'border-amber-100 bg-amber-50/60 text-amber-700 hover:border-amber-300',
|
||||
violet: selected ? 'border-violet-500 bg-violet-50 text-violet-700' : 'border-violet-100 bg-violet-50/60 text-violet-700 hover:border-violet-300',
|
||||
};
|
||||
return map[accent] || map.blue;
|
||||
};
|
||||
|
||||
@@ -326,8 +326,8 @@ export interface Item {
|
||||
is_multi_qty_ship?: number | boolean;
|
||||
}
|
||||
|
||||
export type AutomationTriggerType = 'order_paid' | 'buyer_reviewed' | 'review_missing_timeout';
|
||||
export type AutomationActionType = 'confirm_shipment' | 'send_card' | 'send_text';
|
||||
export type AutomationTriggerType = 'order_created' | 'order_paid' | 'buyer_reviewed' | 'review_missing_timeout';
|
||||
export type AutomationActionType = 'confirm_shipment' | 'send_card' | 'send_text' | 'adjust_price';
|
||||
|
||||
// Rules
|
||||
export interface ShippingRule {
|
||||
|
||||
@@ -89,6 +89,11 @@ func (f *fakeMtop) FetchUserProfile(context.Context, string) (*mtop.UserProfileR
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 满足 MTOP 客户端接口,账号管理测试不关心订单改价。
|
||||
func (f *fakeMtop) AdjustOrderPriceContext(context.Context, string, string, int64) (bool, []string, string, error) {
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// ConsignContext 封装Consign上下文业务协调。
|
||||
func (f *fakeMtop) ConsignContext(context.Context, string, string) (bool, []string, string, error) {
|
||||
return false, nil, "", nil
|
||||
|
||||
@@ -55,6 +55,11 @@ func (f *orderRuntimeMTopFake) ConsignContext(ctx context.Context, cookies, orde
|
||||
return f.consign(ctx, cookies, orderID)
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 满足基础 MTOP 客户端接口但不参与订单测试。
|
||||
func (f *orderRuntimeMTopFake) AdjustOrderPriceContext(context.Context, string, string, int64) (bool, []string, string, error) {
|
||||
return false, nil, "", errors.New("订单测试未预期改价请求")
|
||||
}
|
||||
|
||||
// FetchItemsPage 满足基础 MTOP 客户端接口但不参与订单测试。
|
||||
func (f *orderRuntimeMTopFake) FetchItemsPage(context.Context, string, int, int) (*mtop.ItemListResult, error) {
|
||||
return nil, errors.New("订单测试未预期商品分页请求")
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -14,6 +15,9 @@ var ErrRuleNotFound = errors.New("自动化规则不存在")
|
||||
// ErrRuleActive 表示规则仍有待处理运行,不能直接删除。
|
||||
var ErrRuleActive = errors.New("规则仍有待处理的自动化运行")
|
||||
|
||||
// TriggerOrderCreated 表示买家拍下未付款触发器。
|
||||
const TriggerOrderCreated = "order_created"
|
||||
|
||||
// TriggerOrderPaid 表示付款后触发器。
|
||||
const TriggerOrderPaid = "order_paid"
|
||||
|
||||
@@ -32,6 +36,9 @@ const ActionSendCard = "send_card"
|
||||
// ActionSendText 表示发送文本动作。
|
||||
const ActionSendText = "send_text"
|
||||
|
||||
// ActionAdjustPrice 表示把待付款订单价格修改为目标价格的动作。
|
||||
const ActionAdjustPrice = "adjust_price"
|
||||
|
||||
// ActionDraft 是 HTTP/应用边界使用的自动化动作输入。
|
||||
type ActionDraft struct {
|
||||
// ActionType 是动作类型。
|
||||
@@ -268,7 +275,7 @@ func (s *RuleService) Normalize(ctx context.Context, userID int64, draft RuleDra
|
||||
draft.ItemID = strings.TrimSpace(draft.ItemID)
|
||||
draft.Name = strings.TrimSpace(draft.Name)
|
||||
draft.TriggerType = strings.TrimSpace(draft.TriggerType)
|
||||
if draft.TriggerType != TriggerOrderPaid && draft.TriggerType != TriggerBuyerReviewed && draft.TriggerType != TriggerReviewMissingTimeout {
|
||||
if draft.TriggerType != TriggerOrderCreated && draft.TriggerType != TriggerOrderPaid && draft.TriggerType != TriggerBuyerReviewed && draft.TriggerType != TriggerReviewMissingTimeout {
|
||||
return RuleInput{}, errors.New("不支持的触发类型")
|
||||
}
|
||||
// owned 表示账号是否归当前用户所有;err 表示归属查询失败。
|
||||
@@ -303,16 +310,40 @@ func (s *RuleService) Normalize(ctx context.Context, userID int64, draft RuleDra
|
||||
if draft.Name == "" {
|
||||
draft.Name = defaultRuleName(draft.TriggerType, draft.ItemID)
|
||||
}
|
||||
// actions 保存规范化后的动作;三个布尔值记录启用动作类型,供规则完整性校验使用。
|
||||
actions := make([]ActionInput, 0, len(draft.Actions))
|
||||
// actions 是规范化后的动作列表;flags 汇总启用动作类型,供触发类型组合校验使用。
|
||||
actions, flags, actionsErr := s.normalizeDraftActions(ctx, userID, draft.Actions)
|
||||
if actionsErr != nil {
|
||||
return RuleInput{}, actionsErr
|
||||
}
|
||||
// combinationErr 表示触发类型与启用动作组合不满足业务约束。
|
||||
if combinationErr := validateTriggerActionCombination(draft.TriggerType, flags); combinationErr != nil {
|
||||
return RuleInput{}, combinationErr
|
||||
}
|
||||
return RuleInput{UserID: userID, CookieID: draft.CookieID, ItemID: draft.ItemID, Name: draft.Name,
|
||||
TriggerType: draft.TriggerType, Enabled: draft.Enabled, Priority: draft.Priority,
|
||||
ConfigJSON: draft.ConfigJSON, Actions: actions}, nil
|
||||
}
|
||||
|
||||
// ruleActionFlags 汇总规则草稿中各类启用动作的存在情况,供触发类型组合校验使用。
|
||||
type ruleActionFlags struct {
|
||||
// hasSendCard 表示是否存在启用的发卡动作。
|
||||
hasSendCard := false
|
||||
hasSendCard bool
|
||||
// hasSendText 表示是否存在启用的文本动作。
|
||||
hasSendText := false
|
||||
hasSendText bool
|
||||
// hasConfirmShipment 表示是否存在启用的确认发货动作。
|
||||
hasConfirmShipment := false
|
||||
hasConfirmShipment bool
|
||||
// hasAdjustPrice 表示是否存在启用的订单改价动作。
|
||||
hasAdjustPrice bool
|
||||
}
|
||||
|
||||
// normalizeDraftActions 逐个校验并规范化规则草稿中的动作,同时汇总启用动作类型标志。
|
||||
func (s *RuleService) normalizeDraftActions(ctx context.Context, userID int64, draftActions []ActionDraft) ([]ActionInput, ruleActionFlags, error) {
|
||||
// actions 保存规范化后的动作;flags 记录启用动作类型,供规则完整性校验使用。
|
||||
actions := make([]ActionInput, 0, len(draftActions))
|
||||
// flags 汇总当前草稿中启用的动作类型。
|
||||
var flags ruleActionFlags
|
||||
// index 是当前动作在草稿中的位置;draftAction 是待校验和规范化的动作。
|
||||
for index, draftAction := range draft.Actions {
|
||||
for index, draftAction := range draftActions {
|
||||
// enabled 表示当前动作是否参与运行;未提供时默认启用。
|
||||
enabled := true
|
||||
if draftAction.Enabled != nil {
|
||||
@@ -321,71 +352,102 @@ func (s *RuleService) Normalize(ctx context.Context, userID int64, draft RuleDra
|
||||
draftAction.ActionType = strings.TrimSpace(draftAction.ActionType)
|
||||
switch draftAction.ActionType {
|
||||
case ActionConfirmShipment:
|
||||
hasConfirmShipment = hasConfirmShipment || enabled
|
||||
flags.hasConfirmShipment = flags.hasConfirmShipment || enabled
|
||||
case ActionSendCard:
|
||||
if draftAction.CardID <= 0 {
|
||||
return RuleInput{}, errors.New("发送卡密动作必须选择卡密组")
|
||||
// cardErr 表示卡密选择缺失、读取失败或类型不支持。
|
||||
if cardErr := s.validateSendCardAction(ctx, userID, draftAction); cardErr != nil {
|
||||
return nil, flags, cardErr
|
||||
}
|
||||
// card 是归属校验通过的卡密摘要;cardErr 表示卡密读取或归属校验失败。
|
||||
card, cardErr := s.ownership.GetCard(ctx, userID, draftAction.CardID)
|
||||
if cardErr != nil {
|
||||
if !errors.Is(cardErr, ErrRuleNotFound) {
|
||||
return RuleInput{}, cardErr
|
||||
}
|
||||
return RuleInput{}, errors.New("卡密组不存在或不属于当前用户")
|
||||
}
|
||||
if card.Type == "api" {
|
||||
return RuleInput{}, errors.New("API 卡密暂不支持自动发货,请选择文本、批量数据或图片卡密")
|
||||
}
|
||||
hasSendCard = hasSendCard || enabled
|
||||
flags.hasSendCard = flags.hasSendCard || enabled
|
||||
case ActionSendText:
|
||||
if strings.TrimSpace(draftAction.MessageTemplate) == "" {
|
||||
return RuleInput{}, errors.New("发送文本动作必须填写文案")
|
||||
return nil, flags, errors.New("发送文本动作必须填写文案")
|
||||
}
|
||||
hasSendText = hasSendText || enabled
|
||||
flags.hasSendText = flags.hasSendText || enabled
|
||||
case ActionAdjustPrice:
|
||||
// priceErr 表示改价动作目标价格缺失或格式非法。
|
||||
if priceErr := validateAdjustPriceConfig(draftAction.ConfigJSON); priceErr != nil {
|
||||
return nil, flags, priceErr
|
||||
}
|
||||
flags.hasAdjustPrice = flags.hasAdjustPrice || enabled
|
||||
default:
|
||||
return RuleInput{}, errors.New("不支持的动作类型")
|
||||
return nil, flags, errors.New("不支持的动作类型")
|
||||
}
|
||||
if draftAction.DeliveryCount <= 0 {
|
||||
draftAction.DeliveryCount = 1
|
||||
}
|
||||
if draftAction.DelaySeconds < 0 || draftAction.DelaySeconds > 3600 {
|
||||
return RuleInput{}, errors.New("动作延时必须在 0 到 3600 秒之间")
|
||||
return nil, flags, errors.New("动作延时必须在 0 到 3600 秒之间")
|
||||
}
|
||||
if draftAction.ConfigJSON == "" {
|
||||
draftAction.ConfigJSON = "{}"
|
||||
}
|
||||
if !isJSONObject(draftAction.ConfigJSON) {
|
||||
return RuleInput{}, errors.New("动作配置必须是 JSON 对象")
|
||||
return nil, flags, errors.New("动作配置必须是 JSON 对象")
|
||||
}
|
||||
actions = append(actions, ActionInput{ActionType: draftAction.ActionType, CardID: draftAction.CardID,
|
||||
DeliveryCount: draftAction.DeliveryCount, MessageTemplate: draftAction.MessageTemplate,
|
||||
DelaySeconds: draftAction.DelaySeconds, ConfigJSON: draftAction.ConfigJSON, Enabled: enabled,
|
||||
SortOrder: firstRuleNonZero(draftAction.SortOrder, index+1)})
|
||||
}
|
||||
switch draft.TriggerType {
|
||||
return actions, flags, nil
|
||||
}
|
||||
|
||||
// validateSendCardAction 校验发卡动作的卡密选择、归属和类型限制。
|
||||
func (s *RuleService) validateSendCardAction(ctx context.Context, userID int64, draftAction ActionDraft) error {
|
||||
if draftAction.CardID <= 0 {
|
||||
return errors.New("发送卡密动作必须选择卡密组")
|
||||
}
|
||||
// card 是归属校验通过的卡密摘要;cardErr 表示卡密读取或归属校验失败。
|
||||
card, cardErr := s.ownership.GetCard(ctx, userID, draftAction.CardID)
|
||||
if cardErr != nil {
|
||||
if !errors.Is(cardErr, ErrRuleNotFound) {
|
||||
return cardErr
|
||||
}
|
||||
return errors.New("卡密组不存在或不属于当前用户")
|
||||
}
|
||||
if card.Type == "api" {
|
||||
return errors.New("API 卡密暂不支持自动发货,请选择文本、批量数据或图片卡密")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateTriggerActionCombination 校验触发类型允许的动作组合和必需动作。
|
||||
func validateTriggerActionCombination(triggerType string, flags ruleActionFlags) error {
|
||||
switch triggerType {
|
||||
case TriggerOrderCreated:
|
||||
if flags.hasConfirmShipment || flags.hasSendCard {
|
||||
return errors.New("拍下未付款规则只能包含改价和文本动作")
|
||||
}
|
||||
if !flags.hasAdjustPrice {
|
||||
return errors.New("拍下未付款规则至少需要一个已启用的改价动作")
|
||||
}
|
||||
case TriggerOrderPaid:
|
||||
if !hasSendCard {
|
||||
return RuleInput{}, errors.New("付款后自动发货至少需要一个已启用的发送卡密动作")
|
||||
if flags.hasAdjustPrice {
|
||||
return errors.New("改价动作只能用于拍下未付款规则")
|
||||
}
|
||||
if !flags.hasSendCard {
|
||||
return errors.New("付款后自动发货至少需要一个已启用的发送卡密动作")
|
||||
}
|
||||
case TriggerBuyerReviewed:
|
||||
if hasConfirmShipment {
|
||||
return RuleInput{}, errors.New("评价后规则不能包含确认发货动作")
|
||||
if flags.hasConfirmShipment {
|
||||
return errors.New("评价后规则不能包含确认发货动作")
|
||||
}
|
||||
if !hasSendCard && !hasSendText {
|
||||
return RuleInput{}, errors.New("评价后规则至少需要一个已启用的发送动作")
|
||||
if flags.hasAdjustPrice {
|
||||
return errors.New("改价动作只能用于拍下未付款规则")
|
||||
}
|
||||
if !flags.hasSendCard && !flags.hasSendText {
|
||||
return errors.New("评价后规则至少需要一个已启用的发送动作")
|
||||
}
|
||||
case TriggerReviewMissingTimeout:
|
||||
if hasConfirmShipment || hasSendCard {
|
||||
return RuleInput{}, errors.New("求评价规则只能发送文本")
|
||||
if flags.hasConfirmShipment || flags.hasSendCard || flags.hasAdjustPrice {
|
||||
return errors.New("求评价规则只能发送文本")
|
||||
}
|
||||
if !hasSendText {
|
||||
return RuleInput{}, errors.New("求评价规则至少需要一个已启用的文本动作")
|
||||
if !flags.hasSendText {
|
||||
return errors.New("求评价规则至少需要一个已启用的文本动作")
|
||||
}
|
||||
}
|
||||
return RuleInput{UserID: userID, CookieID: draft.CookieID, ItemID: draft.ItemID, Name: draft.Name,
|
||||
TriggerType: draft.TriggerType, Enabled: draft.Enabled, Priority: draft.Priority,
|
||||
ConfigJSON: draft.ConfigJSON, Actions: actions}, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create 创建已校验的自动化规则。
|
||||
@@ -412,6 +474,56 @@ func (s *RuleService) Delete(ctx context.Context, userID, ruleID int64) error {
|
||||
return s.repository.Delete(ctx, userID, ruleID)
|
||||
}
|
||||
|
||||
// validateAdjustPriceConfig 校验改价动作配置中的目标价格。
|
||||
// 金额使用十进制字符串校验:0.01 到 1000000 元、至多两位小数,禁止浮点解析。
|
||||
func validateAdjustPriceConfig(configJSON string) error {
|
||||
// cfg 保存改价动作的目标价格配置;target_price 以元为单位的字符串。
|
||||
var cfg struct {
|
||||
TargetPrice string `json:"target_price"`
|
||||
}
|
||||
if json.Unmarshal([]byte(configJSON), &cfg) != nil {
|
||||
return errors.New("改价动作配置必须是 JSON 对象")
|
||||
}
|
||||
// raw 是去空白后的目标价格文本。
|
||||
raw := strings.TrimSpace(cfg.TargetPrice)
|
||||
if raw == "" {
|
||||
return errors.New("改价动作必须填写目标价格")
|
||||
}
|
||||
// wholeText、fracText 分别是金额的整数部分与小数部分文本。
|
||||
wholeText, fracText := raw, ""
|
||||
if // dot 是小数点在金额文本中的位置。
|
||||
dot := strings.IndexByte(raw, '.'); dot >= 0 {
|
||||
wholeText, fracText = raw[:dot], raw[dot+1:]
|
||||
}
|
||||
if wholeText == "" || len(fracText) > 2 {
|
||||
return errors.New("目标价格必须是最多两位小数的金额")
|
||||
}
|
||||
// whole、wholeErr 分别是整数元部分的数值和解析错误。
|
||||
whole, wholeErr := strconv.ParseInt(wholeText, 10, 64)
|
||||
if wholeErr != nil || whole < 0 {
|
||||
return errors.New("目标价格必须是最多两位小数的金额")
|
||||
}
|
||||
// frac 是小数部分折算出的分值。
|
||||
frac := int64(0)
|
||||
if fracText != "" {
|
||||
// fracValue、fracErr 分别是小数部分的数值和解析错误。
|
||||
fracValue, fracErr := strconv.ParseInt(fracText, 10, 64)
|
||||
if fracErr != nil || fracValue < 0 {
|
||||
return errors.New("目标价格必须是最多两位小数的金额")
|
||||
}
|
||||
frac = fracValue
|
||||
if len(fracText) == 1 {
|
||||
frac *= 10
|
||||
}
|
||||
}
|
||||
// cents 是目标价格的整数分结果。
|
||||
cents := whole*100 + frac
|
||||
if cents <= 0 || cents > 100000000 {
|
||||
return errors.New("目标价格必须在 0.01 到 1000000 元之间")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// isJSONObject 判断配置是否为 JSON 对象。
|
||||
func isJSONObject(raw string) bool {
|
||||
// value 是 JSON 对象解析结果,仅用于确认配置顶层类型,不保存业务状态。
|
||||
@@ -422,7 +534,7 @@ func isJSONObject(raw string) bool {
|
||||
// defaultRuleName 根据触发类型和商品标识生成默认规则名称。
|
||||
func defaultRuleName(triggerType, itemID string) string {
|
||||
// name 是按触发类型选择的默认显示名称,必要时再附加商品标识。
|
||||
name := map[string]string{TriggerOrderPaid: "付款后自动发货", TriggerBuyerReviewed: "评价后发送赠品", TriggerReviewMissingTimeout: "超时未评价求评价"}[triggerType]
|
||||
name := map[string]string{TriggerOrderCreated: "拍下未付款自动改价", TriggerOrderPaid: "付款后自动发货", TriggerBuyerReviewed: "评价后发送赠品", TriggerReviewMissingTimeout: "超时未评价求评价"}[triggerType]
|
||||
if name == "" {
|
||||
name = "自动化规则"
|
||||
}
|
||||
|
||||
@@ -163,6 +163,60 @@ func TestRuleServiceRejectsInvalidAction(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRuleServiceNormalizeOrderCreatedAdjustPrice 验证拍下未付款改价规则的合法输入和默认名称。
|
||||
func TestRuleServiceNormalizeOrderCreatedAdjustPrice(t *testing.T) {
|
||||
// service 是绑定测试端口的规则应用服务。
|
||||
service := NewRuleService(&ruleRepositoryFake{}, &ruleOwnershipFake{})
|
||||
// input、err 分别是规范化结果和校验错误。
|
||||
input, err := service.Normalize(context.Background(), 42, RuleDraft{
|
||||
CookieID: "account-1", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{
|
||||
{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"9.9"}`},
|
||||
{ActionType: ActionSendText, MessageTemplate: "已为您改价,请尽快支付"},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if input.TriggerType != TriggerOrderCreated || input.Name != "拍下未付款自动改价" || len(input.Actions) != 2 {
|
||||
t.Fatalf("拍下改价规则规范化错误: %+v", input)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRuleServiceRejectsInvalidOrderCreatedRules 验证拍下未付款规则的动作组合和目标价格校验。
|
||||
func TestRuleServiceRejectsInvalidOrderCreatedRules(t *testing.T) {
|
||||
// cases 保存非法拍下改价规则输入和预期错误。
|
||||
cases := []struct {
|
||||
// name 是测试分支名称。
|
||||
name string
|
||||
// draft 是待校验规则。
|
||||
draft RuleDraft
|
||||
// want 是预期错误片段。
|
||||
want string
|
||||
}{
|
||||
{name: "missing adjust price", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionSendText, MessageTemplate: "x"}}}, want: "至少需要一个已启用的改价动作"},
|
||||
{name: "send card forbidden", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionSendCard, CardID: 1}, {ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1"}`}}}, want: "只能包含改价和文本动作"},
|
||||
{name: "confirm shipment forbidden", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionConfirmShipment}, {ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1"}`}}}, want: "只能包含改价和文本动作"},
|
||||
{name: "missing price", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionAdjustPrice, ConfigJSON: `{}`}}}, want: "必须填写目标价格"},
|
||||
{name: "bad price format", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1.234"}`}}}, want: "最多两位小数"},
|
||||
{name: "zero price", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"0"}`}}}, want: "0.01 到 1000000"},
|
||||
{name: "too high price", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderCreated, Actions: []ActionDraft{{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1000000.01"}`}}}, want: "0.01 到 1000000"},
|
||||
{name: "adjust price on paid trigger", draft: RuleDraft{CookieID: "a", TriggerType: TriggerOrderPaid, Actions: []ActionDraft{{ActionType: ActionSendCard, CardID: 1}, {ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1"}`}}}, want: "只能用于拍下未付款规则"},
|
||||
{name: "adjust price on review trigger", draft: RuleDraft{CookieID: "a", TriggerType: TriggerReviewMissingTimeout, Actions: []ActionDraft{{ActionType: ActionSendText, MessageTemplate: "x"}, {ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"1"}`}}}, want: "求评价规则只能发送文本"},
|
||||
}
|
||||
// testCase 是当前非法拍下改价规则分支及其预期错误的测试样例。
|
||||
for _, testCase := range cases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
// service 是当前分支使用的规则应用服务。
|
||||
service := NewRuleService(&ruleRepositoryFake{}, &ruleOwnershipFake{})
|
||||
// _, err 保存规则校验错误。
|
||||
_, err := service.Normalize(context.Background(), 42, testCase.draft)
|
||||
if err == nil || !containsRuleError(err, testCase.want) {
|
||||
t.Fatalf("错误=%v,期望包含=%q", err, testCase.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestRuleServiceNormalizesPageLimit 验证分页大小和偏移量被应用层归一化。
|
||||
func TestRuleServiceNormalizesPageLimit(t *testing.T) {
|
||||
// repository 保存分页调用条件。
|
||||
|
||||
@@ -37,7 +37,7 @@ type automationActionExecutor struct {
|
||||
cardLocks sync.Map
|
||||
}
|
||||
|
||||
// shipmentConsignSession 保存一次确认发货请求开始前固定的凭证视图和响应 Cookie 会话;Cookie 明文只在本次 MTOP 调用及条件写回期间存在,禁止记录到日志或任务快照。
|
||||
// shipmentConsignSession 保存一次交易类 MTOP 请求(确认发货、订单改价共用)开始前固定的凭证视图和响应 Cookie 会话;Cookie 明文只在本次 MTOP 调用及条件写回期间存在,禁止记录到日志或任务快照。
|
||||
type shipmentConsignSession struct {
|
||||
// requestContext 是携带完整 Cookie Jar 或扁平 Cookie 的 MTOP 请求上下文。
|
||||
requestContext context.Context
|
||||
@@ -49,7 +49,7 @@ type shipmentConsignSession struct {
|
||||
credentialFingerprint string
|
||||
}
|
||||
|
||||
// shipmentConsignResult 保存 Consign 的业务结果、响应 Cookie 和传输错误,供后续会话状态与订单事实分别收口。
|
||||
// shipmentConsignResult 保存交易类 MTOP 调用(Consign、订单改价共用)的业务结果、响应 Cookie 和传输错误,供后续会话状态与订单事实分别收口。
|
||||
type shipmentConsignResult struct {
|
||||
// succeeded 表示平台明确确认订单已发货。
|
||||
succeeded bool
|
||||
@@ -76,6 +76,8 @@ func (e *automationActionExecutor) executeAction(ctx context.Context, task Task,
|
||||
switch action.ActionType {
|
||||
case ActionConfirmShipment:
|
||||
return 0, e.confirmShipment(ctx, task)
|
||||
case ActionAdjustPrice:
|
||||
return e.adjustOrderPrice(ctx, task, action)
|
||||
case ActionSendCard:
|
||||
return e.sendCard(ctx, task, action)
|
||||
case ActionSendText:
|
||||
@@ -171,6 +173,135 @@ func (e *automationActionExecutor) confirmShipmentAttempt(ctx context.Context, t
|
||||
return nil
|
||||
}
|
||||
|
||||
// adjustOrderPrice 把买家已拍下未付款订单的价格修改为动作配置的目标价格。
|
||||
// 成功返回 1 作为外部结果数量,供运行统计与结果通知使用。
|
||||
func (e *automationActionExecutor) adjustOrderPrice(ctx context.Context, task Task, action db.AutomationAction) (int, error) {
|
||||
if task.OrderID == "" {
|
||||
return 0, fmt.Errorf("%w: 订单改价缺少订单ID", errActionNotPerformed)
|
||||
}
|
||||
// priceCents 是目标价格的整数分表示;parseErr 表示动作配置缺失或金额格式非法。
|
||||
priceCents, parseErr := adjustPriceCentsFromConfig(action.ConfigJSON)
|
||||
if parseErr != nil {
|
||||
return 0, fmt.Errorf("%w: %v", errActionNotPerformed, parseErr)
|
||||
}
|
||||
// attemptErr 表示改价请求或恢复流程的最终失败原因。
|
||||
if attemptErr := e.adjustOrderPriceAttempt(ctx, task, priceCents, true); attemptErr != nil {
|
||||
return 0, attemptErr
|
||||
}
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
// adjustOrderPriceAttempt 使用凭证快照调用订单改价,并以指纹条件写回响应 Cookie;Session 失效时最多执行一次凭证恢复后重试。
|
||||
func (e *automationActionExecutor) adjustOrderPriceAttempt(ctx context.Context, task Task, priceCents int64, allowCredentialRecovery bool) error {
|
||||
// session 固定本次 MTOP 请求的最小凭证视图,外部调用期间不持有账号凭证锁。
|
||||
session, err := e.openShipmentConsignSession(ctx, task.AccountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// succeeded、returns、updatedCookie、callErr 分别是改价的业务成功标记、业务返回、扁平 Cookie 更新和调用错误。
|
||||
succeeded, returns, updatedCookie, callErr := e.mtop().AdjustOrderPriceContext(session.requestContext, session.cookieStr, task.OrderID, priceCents)
|
||||
// result 归并 MTOP 远端结果,Cookie 写回随后独立处理。
|
||||
result := shipmentConsignResult{succeeded: succeeded, returns: returns, updatedCookie: updatedCookie, callErr: callErr}
|
||||
// cookiePersistence 收集响应 Cookie 的条件写回结果,并在锁外同步在线运行时。
|
||||
cookiePersistence := e.persistShipmentConsignCookies(ctx, task.AccountID, session, result)
|
||||
// persistenceErrs 收集本地 Cookie 写回失败;改价结果本身不依赖本地事实写入。
|
||||
persistenceErrs := cookiePersistence.errors
|
||||
// sessionErr 将请求层错误和远端业务失败统一为凭证状态判断输入。
|
||||
sessionErr := result.callErr
|
||||
if sessionErr == nil && !result.succeeded {
|
||||
sessionErr = errors.New(strings.Join(result.returns, "; "))
|
||||
}
|
||||
if mtop.IsSessionExpiredErr(sessionErr) {
|
||||
if len(persistenceErrs) > 0 {
|
||||
return errors.Join(fmt.Errorf("订单改价 Session 已失效: %w", sessionErr), errors.Join(persistenceErrs...))
|
||||
}
|
||||
// recoverer 是当前生效的凭证恢复器快照,避免一次判断期间被替换两次。
|
||||
recoverer := e.recoverer()
|
||||
if allowCredentialRecovery && recoverer != nil && recoverer.RecoverExpiredCredential(ctx, task.AccountID) {
|
||||
e.logger.Info("订单改价凭证恢复成功,重新执行改价", "account", task.AccountID, "order_id", task.OrderID)
|
||||
return e.adjustOrderPriceAttempt(ctx, task, priceCents, false)
|
||||
}
|
||||
if !allowCredentialRecovery {
|
||||
return fmt.Errorf("%w: 订单改价在凭证恢复后仍返回 Session 失效: %v", errActionNotPerformed, sessionErr)
|
||||
}
|
||||
return fmt.Errorf("%w: 订单改价 Session 已失效且凭证恢复失败: %v", errActionNotPerformed, sessionErr)
|
||||
}
|
||||
if result.callErr != nil {
|
||||
if len(persistenceErrs) > 0 {
|
||||
result.callErr = errors.Join(result.callErr, errors.Join(persistenceErrs...))
|
||||
}
|
||||
return uncertainAction(result.callErr)
|
||||
}
|
||||
if !result.succeeded {
|
||||
// failure 是远端拒绝改价的业务错误,例如订单已付款或已关闭。
|
||||
failure := fmt.Errorf("订单改价失败: %s", strings.Join(result.returns, "; "))
|
||||
if len(persistenceErrs) > 0 {
|
||||
return errors.Join(failure, errors.Join(persistenceErrs...))
|
||||
}
|
||||
return failure
|
||||
}
|
||||
if len(persistenceErrs) > 0 {
|
||||
return uncertainAction(fmt.Errorf("闲鱼已完成订单改价,但响应凭证保存失败: %w", errors.Join(persistenceErrs...)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// adjustPriceCentsFromConfig 从动作配置解析目标价格并转换为整数分。
|
||||
// 金额使用十进制字符串解析,最多两位小数,禁止浮点运算引入误差。
|
||||
func adjustPriceCentsFromConfig(configJSON string) (int64, error) {
|
||||
// cfg 保存改价动作的目标价格配置;target_price 以元为单位的字符串。
|
||||
var cfg struct {
|
||||
TargetPrice string `json:"target_price"`
|
||||
}
|
||||
if // err 是动作配置 JSON 的解析错误。
|
||||
err := json.Unmarshal([]byte(configJSON), &cfg); err != nil {
|
||||
return 0, fmt.Errorf("解析改价动作配置: %w", err)
|
||||
}
|
||||
return parseYuanToCents(cfg.TargetPrice)
|
||||
}
|
||||
|
||||
// parseYuanToCents 把以元为单位的十进制金额文本转换为整数分。
|
||||
// 允许 0.01 到 1000000 元、至多两位小数;非法格式返回错误。
|
||||
func parseYuanToCents(raw string) (int64, error) {
|
||||
raw = strings.TrimSpace(raw)
|
||||
if raw == "" {
|
||||
return 0, errors.New("改价动作缺少目标价格")
|
||||
}
|
||||
// wholeText、fracText 分别是金额的整数部分与小数部分文本。
|
||||
wholeText, fracText := raw, ""
|
||||
if // dot 是小数点在金额文本中的位置。
|
||||
dot := strings.IndexByte(raw, '.'); dot >= 0 {
|
||||
wholeText, fracText = raw[:dot], raw[dot+1:]
|
||||
}
|
||||
if wholeText == "" || len(fracText) > 2 {
|
||||
return 0, fmt.Errorf("目标价格格式非法: %q", raw)
|
||||
}
|
||||
// whole、wholeErr 分别是整数元部分的数值和解析错误。
|
||||
whole, wholeErr := strconv.ParseInt(wholeText, 10, 64)
|
||||
if wholeErr != nil || whole < 0 {
|
||||
return 0, fmt.Errorf("目标价格格式非法: %q", raw)
|
||||
}
|
||||
// frac 是小数部分折算出的分值。
|
||||
frac := int64(0)
|
||||
if fracText != "" {
|
||||
// fracValue、fracErr 分别是小数部分的数值和解析错误。
|
||||
fracValue, fracErr := strconv.ParseInt(fracText, 10, 64)
|
||||
if fracErr != nil || fracValue < 0 {
|
||||
return 0, fmt.Errorf("目标价格格式非法: %q", raw)
|
||||
}
|
||||
frac = fracValue
|
||||
if len(fracText) == 1 {
|
||||
frac *= 10
|
||||
}
|
||||
}
|
||||
// cents 是目标价格的整数分结果。
|
||||
cents := whole*100 + frac
|
||||
if cents <= 0 || cents > 100000000 {
|
||||
return 0, fmt.Errorf("目标价格必须在 0.01 到 1000000 元之间: %q", raw)
|
||||
}
|
||||
return cents, nil
|
||||
}
|
||||
|
||||
// openShipmentConsignSession 在账号凭证锁内读取最小运行时视图,再在锁外构造 MTOP 会话;返回的 Cookie 只供当前确认发货请求使用。
|
||||
func (e *automationActionExecutor) openShipmentConsignSession(ctx context.Context, accountID string) (shipmentConsignSession, error) {
|
||||
// unlock 释放账号凭证锁;锁仅保护运行时 Cookie 和 metadata 的读取。
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package automation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"xianyu-go/internal/db"
|
||||
)
|
||||
|
||||
// TestAdjustOrderPriceActionSuccess 验证改价动作成功时返回一个外部结果并传递整数分价格。
|
||||
func TestAdjustOrderPriceActionSuccess(t *testing.T) {
|
||||
// store、cleanup 保存测试数据库及其清理函数。
|
||||
store, cleanup := newAutomationTestStore(t)
|
||||
defer cleanup()
|
||||
// fake 保存返回业务成功的 MTOP 客户端。
|
||||
fake := &fakeMTop{adjustOk: true, adjustRet: []string{"SUCCESS::调用成功"}}
|
||||
// center 保存注入测试 MTOP 客户端的自动化中心。
|
||||
center := NewWithDependencies(store, nil, nil, CenterDependencies{MTop: fake})
|
||||
// sent、err 分别是动作报告的外部结果数量和执行错误。
|
||||
sent, err := center.executeAction(context.Background(), Task{AccountID: "cid", OrderID: "order-1"},
|
||||
db.AutomationAction{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"9.9"}`})
|
||||
if err != nil || sent != 1 {
|
||||
t.Fatalf("sent=%d err=%v", sent, err)
|
||||
}
|
||||
if fake.adjustCalls != 1 || fake.adjustOrderIn != "order-1" || fake.adjustCentsIn != 990 {
|
||||
t.Fatalf("改价入参错误: calls=%d order=%q cents=%d", fake.adjustCalls, fake.adjustOrderIn, fake.adjustCentsIn)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceActionMissingOrderID 验证缺少订单号时动作标记为明确未执行。
|
||||
func TestAdjustOrderPriceActionMissingOrderID(t *testing.T) {
|
||||
// store、cleanup 保存测试数据库及其清理函数。
|
||||
store, cleanup := newAutomationTestStore(t)
|
||||
defer cleanup()
|
||||
// fake 保存不应被调用的 MTOP 客户端。
|
||||
fake := &fakeMTop{adjustOk: true}
|
||||
// center 保存注入测试 MTOP 客户端的自动化中心。
|
||||
center := NewWithDependencies(store, nil, nil, CenterDependencies{MTop: fake})
|
||||
// sent、err 分别是动作报告的外部结果数量和执行错误。
|
||||
sent, err := center.executeAction(context.Background(), Task{AccountID: "cid"},
|
||||
db.AutomationAction{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"9.9"}`})
|
||||
if sent != 0 || !errors.Is(err, errActionNotPerformed) {
|
||||
t.Fatalf("sent=%d err=%v", sent, err)
|
||||
}
|
||||
if fake.adjustCalls != 0 {
|
||||
t.Fatalf("缺少订单号不应触达外部改价: calls=%d", fake.adjustCalls)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceActionInvalidConfig 验证目标价格非法时动作标记为明确未执行且不触网。
|
||||
func TestAdjustOrderPriceActionInvalidConfig(t *testing.T) {
|
||||
// store、cleanup 保存测试数据库及其清理函数。
|
||||
store, cleanup := newAutomationTestStore(t)
|
||||
defer cleanup()
|
||||
// fake 保存不应被调用的 MTOP 客户端。
|
||||
fake := &fakeMTop{adjustOk: true}
|
||||
// center 保存注入测试 MTOP 客户端的自动化中心。
|
||||
center := NewWithDependencies(store, nil, nil, CenterDependencies{MTop: fake})
|
||||
// configs 是应当被拒绝的非法目标价格配置样本。
|
||||
configs := []string{`{}`, `{"target_price":""}`, `{"target_price":"abc"}`, `{"target_price":"1.234"}`, `{"target_price":"0"}`, `{"target_price":"-1"}`}
|
||||
// config 是当前被验证的非法配置。
|
||||
for _, config := range configs {
|
||||
// sent、err 分别是动作报告的外部结果数量和执行错误。
|
||||
sent, err := center.executeAction(context.Background(), Task{AccountID: "cid", OrderID: "order-1"},
|
||||
db.AutomationAction{ActionType: ActionAdjustPrice, ConfigJSON: config})
|
||||
if sent != 0 || !errors.Is(err, errActionNotPerformed) {
|
||||
t.Fatalf("config=%s sent=%d err=%v", config, sent, err)
|
||||
}
|
||||
}
|
||||
if fake.adjustCalls != 0 {
|
||||
t.Fatalf("非法配置不应触达外部改价: calls=%d", fake.adjustCalls)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceActionBizFailure 验证平台业务拒绝时返回带业务返回文本的失败。
|
||||
func TestAdjustOrderPriceActionBizFailure(t *testing.T) {
|
||||
// store、cleanup 保存测试数据库及其清理函数。
|
||||
store, cleanup := newAutomationTestStore(t)
|
||||
defer cleanup()
|
||||
// fake 保存返回业务失败的 MTOP 客户端。
|
||||
fake := &fakeMTop{adjustOk: false, adjustRet: []string{"FAIL_BIZ_ORDER_NOT_ALLOW_MODIFY::当前订单不允许修改价格"}}
|
||||
// center 保存注入测试 MTOP 客户端的自动化中心。
|
||||
center := NewWithDependencies(store, nil, nil, CenterDependencies{MTop: fake})
|
||||
// sent、err 分别是动作报告的外部结果数量和执行错误。
|
||||
sent, err := center.executeAction(context.Background(), Task{AccountID: "cid", OrderID: "order-1"},
|
||||
db.AutomationAction{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"9.9"}`})
|
||||
if sent != 0 || err == nil || !strings.Contains(err.Error(), "FAIL_BIZ_ORDER_NOT_ALLOW_MODIFY") {
|
||||
t.Fatalf("sent=%d err=%v", sent, err)
|
||||
}
|
||||
// uncertain 用于确认业务拒绝不会被误判为结果未知。
|
||||
var uncertain *uncertainActionError
|
||||
if errors.As(err, &uncertain) {
|
||||
t.Fatalf("业务拒绝不应标记为结果未知: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceActionTransportErrorIsUncertain 验证传输错误标记为结果未知,禁止自动重放。
|
||||
func TestAdjustOrderPriceActionTransportErrorIsUncertain(t *testing.T) {
|
||||
// store、cleanup 保存测试数据库及其清理函数。
|
||||
store, cleanup := newAutomationTestStore(t)
|
||||
defer cleanup()
|
||||
// fake 保存返回传输错误的 MTOP 客户端。
|
||||
fake := &fakeMTop{adjustErr: errors.New("网络中断")}
|
||||
// center 保存注入测试 MTOP 客户端的自动化中心。
|
||||
center := NewWithDependencies(store, nil, nil, CenterDependencies{MTop: fake})
|
||||
// sent、err 分别是动作报告的外部结果数量和执行错误。
|
||||
sent, err := center.executeAction(context.Background(), Task{AccountID: "cid", OrderID: "order-1"},
|
||||
db.AutomationAction{ActionType: ActionAdjustPrice, ConfigJSON: `{"target_price":"9.9"}`})
|
||||
if sent != 0 || err == nil {
|
||||
t.Fatalf("sent=%d err=%v", sent, err)
|
||||
}
|
||||
// uncertain 用于确认传输错误被标记为结果未知。
|
||||
var uncertain *uncertainActionError
|
||||
if !errors.As(err, &uncertain) {
|
||||
t.Fatalf("传输错误应标记为结果未知: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestParseYuanToCents 验证十进制金额文本到整数分的转换边界。
|
||||
func TestParseYuanToCents(t *testing.T) {
|
||||
// cases 是金额文本与期望整数分(-1 表示期望解析失败)的样本。
|
||||
cases := []struct {
|
||||
// raw 是输入的金额文本。
|
||||
raw string
|
||||
// cents 是期望的整数分结果;-1 表示期望返回错误。
|
||||
cents int64
|
||||
}{
|
||||
{"9.9", 990}, {"0.01", 1}, {"12.34", 1234}, {"12", 1200}, {" 5.20 ", 520},
|
||||
{"1000000", 100000000},
|
||||
{"", -1}, {"abc", -1}, {"1.234", -1}, {"0", -1}, {"-1", -1}, {".5", -1}, {"1000000.01", -1},
|
||||
}
|
||||
// c 是当前被验证的样本。
|
||||
for _, c := range cases {
|
||||
// got、err 分别是解析出的整数分和解析错误。
|
||||
got, err := parseYuanToCents(c.raw)
|
||||
if c.cents == -1 {
|
||||
if err == nil {
|
||||
t.Fatalf("raw=%q 应解析失败, got=%d", c.raw, got)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err != nil || got != c.cents {
|
||||
t.Fatalf("raw=%q got=%d err=%v want %d", c.raw, got, err, c.cents)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,18 @@ type fakeMTop struct {
|
||||
consignStarted chan struct{}
|
||||
// consignRelease 控制测试外部 Consign 调用何时返回。
|
||||
consignRelease chan struct{}
|
||||
// adjustErr 是订单改价调用的预置传输错误。
|
||||
adjustErr error
|
||||
// adjustOk 是订单改价调用的预置业务成功标志。
|
||||
adjustOk bool
|
||||
// adjustRet 是订单改价调用的预置业务返回。
|
||||
adjustRet []string
|
||||
// adjustCalls 统计订单改价被调用的次数。
|
||||
adjustCalls int
|
||||
// adjustOrderIn 记录最后一次订单改价的订单号入参。
|
||||
adjustOrderIn string
|
||||
// adjustCentsIn 记录最后一次订单改价的整数分价格入参。
|
||||
adjustCentsIn int64
|
||||
}
|
||||
|
||||
// fakeConsignResult 用于本次流程后续判断的fakeConsign结果
|
||||
@@ -43,6 +55,14 @@ func (f *fakeMTop) FetchUserProfile(context.Context, string) (*mtop.UserProfileR
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 返回测试预置的订单改价结果并记录入参。
|
||||
func (f *fakeMTop) AdjustOrderPriceContext(_ context.Context, _ string, orderID string, priceCents int64) (bool, []string, string, error) {
|
||||
f.adjustCalls++
|
||||
f.adjustOrderIn = orderID
|
||||
f.adjustCentsIn = priceCents
|
||||
return f.adjustOk, f.adjustRet, "", f.adjustErr
|
||||
}
|
||||
|
||||
// ConsignContext 封装Consign上下文业务协调。
|
||||
func (f *fakeMTop) ConsignContext(_ context.Context, cookiesStr, orderID string) (bool, []string, string, error) {
|
||||
if f.consignStarted != nil {
|
||||
|
||||
@@ -23,6 +23,7 @@ func (n deliveryNotifier) notifyResult(ctx context.Context, task Task, runID int
|
||||
}
|
||||
// triggerName 是面向用户展示的自动化触发类型名称。
|
||||
triggerName := map[string]string{
|
||||
TriggerOrderCreated: "拍下改价",
|
||||
TriggerOrderPaid: "付款发货",
|
||||
TriggerBuyerReviewed: "评价赠品",
|
||||
TriggerReviewMissingTimeout: "求评价",
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
// TriggerOrderPaid 用于本次流程后续判断的Trigger订单Paid
|
||||
const (
|
||||
TriggerOrderCreated = "order_created"
|
||||
TriggerOrderPaid = "order_paid"
|
||||
TriggerBuyerReviewed = "buyer_reviewed"
|
||||
TriggerReviewMissingTimeout = "review_missing_timeout"
|
||||
@@ -24,6 +25,8 @@ const (
|
||||
ActionConfirmShipment = "confirm_shipment"
|
||||
ActionSendCard = "send_card"
|
||||
ActionSendText = "send_text"
|
||||
// ActionAdjustPrice 表示把待付款订单价格修改为动作配置中的目标价格。
|
||||
ActionAdjustPrice = "adjust_price"
|
||||
)
|
||||
|
||||
// Task 是自动化中心的统一输入。它可以来自 WS 系统事件、计划任务或手动触发。
|
||||
@@ -90,6 +93,8 @@ func ExtractTaskFromWS(accountID, cookieStr string, raw map[string]any) *Task {
|
||||
switch {
|
||||
case isOrderPaidEvent(f):
|
||||
task.TriggerType = TriggerOrderPaid
|
||||
case isOrderCreatedEvent(f):
|
||||
task.TriggerType = TriggerOrderCreated
|
||||
case isBuyerReviewedEvent(f):
|
||||
task.TriggerType = TriggerBuyerReviewed
|
||||
default:
|
||||
@@ -212,6 +217,18 @@ func isOrderPaidEvent(f rawFields) bool {
|
||||
strings.Contains(f.redReminder, "等待卖家发货")
|
||||
}
|
||||
|
||||
// isOrderCreatedEvent 判定买家已拍下但尚未付款的交易卡片。
|
||||
// 闲鱼拍下样本:reminderContent=[我已拍下,待付款],或红色提醒“等待买家付款”。
|
||||
// 买家角色的同类卡片属于当前账号自己下单,不进入卖家自动化。
|
||||
func isOrderCreatedEvent(f rawFields) bool {
|
||||
if f.orderRole == "buyer" {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(f.text, "我已拍下") ||
|
||||
strings.Contains(f.text, "已拍下,待付款") ||
|
||||
strings.Contains(f.redReminder, "等待买家付款")
|
||||
}
|
||||
|
||||
// isBuyerReviewedEvent 封装is买家ReviewedEvent业务协调。
|
||||
func isBuyerReviewedEvent(f rawFields) bool {
|
||||
// 闲鱼评价样本:
|
||||
|
||||
@@ -129,6 +129,50 @@ func TestExtractTaskFromWS_BuyerOrderPaidTaskNameIgnored(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractTaskFromWS_OrderCreated 校验买家拍下未付款卡片解析为 order_created 事件。
|
||||
func TestExtractTaskFromWS_OrderCreated(t *testing.T) {
|
||||
// raw 是卖家收到的买家拍下待付款交易卡片样本。
|
||||
raw := mustMap(t, `{
|
||||
"1": {
|
||||
"2": "63107041124@goofish",
|
||||
"10": {
|
||||
"redReminder": "等待买家付款",
|
||||
"reminderContent": "[我已拍下,待付款]",
|
||||
"senderUserId": "2222315258815",
|
||||
"reminderUrl": "fleamarket://message_chat?itemId=1063177864132&peerUserId=2222315258815&sid=63107041124",
|
||||
"extJson": "{\"updateKey\":\"63107041124:3310145690545023994:10:BUYER_CREATE_ORDER:26\",\"contentType\":\"26\"}"
|
||||
},
|
||||
"6": {"3": {"5": "{\"dxCard\":{\"item\":{\"main\":{\"targetUrl\":\"fleamarket://order_detail?id=3310145690545023994&role=seller\"}}}}"}}
|
||||
}
|
||||
}`)
|
||||
// task 是解析出的自动化任务。
|
||||
task := ExtractTaskFromWS("acc1", "cookie", raw)
|
||||
if task == nil || task.TriggerType != TriggerOrderCreated || task.OrderID != "3310145690545023994" ||
|
||||
task.ChatID != "63107041124" || task.ItemID != "1063177864132" || task.BuyerID != "2222315258815" {
|
||||
t.Fatalf("task=%+v", task)
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractTaskFromWS_BuyerOrderCreatedIgnored 校验买家角色的拍下卡片不进入卖家自动化。
|
||||
func TestExtractTaskFromWS_BuyerOrderCreatedIgnored(t *testing.T) {
|
||||
// raw 是当前账号自己下单产生的买家角色拍下卡片样本。
|
||||
raw := mustMap(t, `{
|
||||
"1": {
|
||||
"2": "63107041124@goofish",
|
||||
"10": {
|
||||
"redReminder": "等待买家付款",
|
||||
"reminderContent": "[我已拍下,待付款]",
|
||||
"senderUserId": "2222315258815"
|
||||
},
|
||||
"6": {"3": {"5": "{\"dxCard\":{\"item\":{\"main\":{\"targetUrl\":\"fleamarket://order_detail?id=3310145690545023994&role=buyer\"}}}}"}}
|
||||
}
|
||||
}`)
|
||||
if // task 是不应产生的自动化任务。
|
||||
task := ExtractTaskFromWS("acc1", "cookie", raw); task != nil {
|
||||
t.Fatalf("买家拍下订单不应进入卖家自动化: %+v", task)
|
||||
}
|
||||
}
|
||||
|
||||
// mustMap 封装mustMap业务协调。
|
||||
func mustMap(t *testing.T, s string) map[string]any {
|
||||
t.Helper()
|
||||
|
||||
@@ -76,6 +76,11 @@ func (m *responseCookieRiskMTop) FetchUserProfile(context.Context, string) (*mto
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 满足 MTOP 客户端接口,风控恢复测试不关心订单改价。
|
||||
func (m *responseCookieRiskMTop) AdjustOrderPriceContext(context.Context, string, string, int64) (bool, []string, string, error) {
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// ConsignContext 封装Consign上下文业务协调。
|
||||
func (m *responseCookieRiskMTop) ConsignContext(context.Context, string, string) (bool, []string, string, error) {
|
||||
return true, nil, "", nil
|
||||
|
||||
@@ -43,6 +43,11 @@ func (f *fakeRunMtop) ConsignContext(context.Context, string, string) (bool, []s
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 满足 MTOP 客户端接口,引擎测试不关心订单改价。
|
||||
func (f *fakeRunMtop) AdjustOrderPriceContext(context.Context, string, string, int64) (bool, []string, string, error) {
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// FetchItemsPage 封装Fetch商品列表页码业务协调。
|
||||
func (f *fakeRunMtop) FetchItemsPage(context.Context, string, int, int) (*mtop.ItemListResult, error) {
|
||||
return nil, nil
|
||||
@@ -76,6 +81,11 @@ func (f *fakeFailTokenMtop) ConsignContext(context.Context, string, string) (boo
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// AdjustOrderPriceContext 满足 MTOP 客户端接口,token 失败测试不关心订单改价。
|
||||
func (f *fakeFailTokenMtop) AdjustOrderPriceContext(context.Context, string, string, int64) (bool, []string, string, error) {
|
||||
return true, nil, "", nil
|
||||
}
|
||||
|
||||
// FetchItemsPage 封装Fetch商品列表页码业务协调。
|
||||
func (f *fakeFailTokenMtop) FetchItemsPage(context.Context, string, int, int) (*mtop.ItemListResult, error) {
|
||||
return nil, nil
|
||||
|
||||
@@ -81,7 +81,7 @@ func (s *Server) listAutomationRules(w http.ResponseWriter, r *http.Request) {
|
||||
triggerType := strings.TrimSpace(query.Get("trigger_type"))
|
||||
if triggerType != "" {
|
||||
switch triggerType {
|
||||
case automationapp.TriggerOrderPaid, automationapp.TriggerBuyerReviewed, automationapp.TriggerReviewMissingTimeout:
|
||||
case automationapp.TriggerOrderCreated, automationapp.TriggerOrderPaid, automationapp.TriggerBuyerReviewed, automationapp.TriggerReviewMissingTimeout:
|
||||
default:
|
||||
writeErr(w, http.StatusBadRequest, "不支持的触发类型")
|
||||
return
|
||||
@@ -269,7 +269,7 @@ func automationRuleDraft(req automationRuleRequest) automationapp.RuleDraft {
|
||||
// defaultAutomationRuleName 保留旧测试和兼容调用所需的默认名称函数。
|
||||
func defaultAutomationRuleName(triggerType, itemID string) string {
|
||||
// name 保存按触发类型选择的默认规则名称,必要时附加商品标识。
|
||||
name := map[string]string{automationapp.TriggerOrderPaid: "付款后自动发货", automationapp.TriggerBuyerReviewed: "评价后发送赠品", automationapp.TriggerReviewMissingTimeout: "超时未评价求评价"}[triggerType]
|
||||
name := map[string]string{automationapp.TriggerOrderCreated: "拍下未付款自动改价", automationapp.TriggerOrderPaid: "付款后自动发货", automationapp.TriggerBuyerReviewed: "评价后发送赠品", automationapp.TriggerReviewMissingTimeout: "超时未评价求评价"}[triggerType]
|
||||
if name == "" {
|
||||
name = "自动化规则"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import{b as ie,j as e,r as n,c as Oe}from"./react-vendor-C_od1ZSF.js";import{g as X,c as Pe,o as ke,p as ae,a as ce,d as Le}from"./index-zEvleK2K.js";import{n as ue,X as de,f as ze,L as K,o as Ie,p as Ge,q as We,r as Te,s as $e,U as De,t as te,u as Ve,k as _e,Q as ve,v as Ee,R as Ke,w as He,x as Je,y as Ne,K as Xe,z as Ye,F as Ze,e as Fe,H as es}from"./icons-vendor-DwxdQTKt.js";const ss=(s,t)=>{const r=s.avatar_url||"";if(!r)return"";try{const a=new URL(r,window.location.origin);return a.hostname.endsWith("alicdn.com")&&a.searchParams.set("_v",t),a.toString()}catch{return r}},ts=async s=>{const t=await X("/api/v1/accounts/details",void 0,s),r=Pe(t,["data","accounts","details"]),a=Date.now().toString();return r.map(o=>({id:o.id,cookie_configured:o.has_cookie===!0,enabled:o.enabled,auto_confirm:o.auto_confirm,remark:o.remark,pause_duration:o.pause_duration,paused_until:Number(o.paused_until||0),paused:o.paused===!0,username:o.username||"",login_password_configured:void 0,show_browser:o.show_browser===!0||o.show_browser===1||o.show_browser==="1"||o.show_browser==="true",nickname:o.nickname||o.remark||`账号 ${o.id.substring(0,6)}`,avatar_url:ss(o,a),profile_error:o.profile_error||"",ai_enabled:!1,auto_rate_enabled:o.auto_rate_enabled,rate_content:o.rate_content||"不错的买家,交易愉快",auto_polish_enabled:o.auto_polish_enabled,polish_time:o.polish_time||"03:00",last_rate_scan_at:Number(o.last_rate_scan_at||0),last_polish_date:o.last_polish_date||"",last_polish_at:Number(o.last_polish_at||0)}))},as=async s=>{const t=await X("/api/v1/accounts/runtime-status",void 0,s);return ke(t,["statuses","data","result"])||{}},rs=async s=>ce("/api/v1/qr-login/generate",void 0,{...s,timeoutMs:(s==null?void 0:s.timeoutMs)??13e4}),ns=async(s,t)=>X(`/api/v1/qr-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),ls=async(s,t)=>ce(`/api/v1/qr-login/complete-verification/${s}`,{target_account_id:t||""}),os=async(s,t)=>ae(`/api/v1/accounts/${s}/status`,{enabled:t}),is=async s=>Le(`/api/v1/accounts/${s}`),cs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/pause-duration`,{pause_duration:t},r),ds=async(s,t,r)=>ae(`/api/v1/accounts/${s}/settings`,t,r),us=async(s,t)=>X(`/api/v1/accounts/${s}/long-login`,void 0,t),xs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/long-login`,{enabled:t},r),ms=async(s,t)=>ce("/api/v1/password-login",s,t),bs=async(s,t)=>X(`/api/v1/password-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),hs=async(s,t)=>Le(`/api/v1/password-login/cancel/${s}`,void 0,t),gs=async s=>ce(`/api/v1/accounts/${s}/refresh-profile`,{}),ps=async s=>{const t=await X("/api/v1/settings/ai-reply",void 0,s);return ke(t,["settings","data","result"])||{}},fs=async(s,t)=>X(`/api/v1/settings/ai-reply/${s}`,void 0,t),ys=async(s,t,r)=>{const a={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return ae(`/api/v1/settings/ai-reply/${s}`,a,r)},js=s=>{if(Array.isArray(s))return s.filter(Boolean);if(typeof s!="string"||!s.trim())return[];try{const t=JSON.parse(s);if(Array.isArray(t))return t.filter(Boolean)}catch{}return s.split(/[,\s;]+/).map(t=>t.trim()).filter(Boolean)},ws=async s=>{const t=await X("/api/v1/notifications/channels",void 0,s);return{success:!0,data:Pe(t,["data","channels","items"]).map(a=>{const o={},c=a.type==="ding_talk"?"dingtalk":a.type==="lark"?"feishu":a.type;return{id:String(a.id),name:a.name,type:c,config:o,event_types:js(a.event_types),enabled:a.enabled}})}},_s=async(s,t)=>{const r=await X(`/api/v1/notifications/accounts/${s}/bindings`,void 0,t),a=ke(r,["data","result"])||{};return Array.isArray(a.channel_ids)?a.channel_ids:[]},vs=({account:s,settings:t,saving:r,onChange:a,onClose:o,onSave:c})=>{const i=u=>a({...t,...u}),d=()=>i({ai_enabled:!t.ai_enabled}),b=u=>i({max_discount_percent:parseInt(u.target.value,10)||0}),m=u=>i({max_discount_amount:parseInt(u.target.value,10)||0}),f=u=>i({max_bargain_rounds:parseInt(u.target.value,10)||1}),h=u=>i({custom_prompts:u.target.value});return ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-2xl font-extrabold text-gray-900 flex items-center gap-2",children:[e.jsx(ue,{className:"w-6 h-6 text-purple-500"}),"AI助手设置"]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:s.nickname||s.remark||s.id})]}),e.jsx("button",{onClick:o,className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0","aria-label":"关闭 AI 设置",children:e.jsx(de,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"modal-body space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-purple-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-gray-900 flex iteLine truncated
|
||||
import{b as ie,j as e,r as n,c as Oe}from"./react-vendor-C_od1ZSF.js";import{g as X,c as Pe,o as ke,p as ae,a as ce,d as Le}from"./index-DJhzW1ER.js";import{n as ue,X as de,f as ze,L as K,o as Ie,p as Ge,q as We,r as Te,s as $e,U as De,t as te,u as Ve,k as _e,Q as ve,v as Ee,R as Ke,w as He,x as Je,y as Ne,K as Xe,z as Ye,F as Ze,e as Fe,H as es}from"./icons-vendor-BP_RGPqo.js";const ss=(s,t)=>{const r=s.avatar_url||"";if(!r)return"";try{const a=new URL(r,window.location.origin);return a.hostname.endsWith("alicdn.com")&&a.searchParams.set("_v",t),a.toString()}catch{return r}},ts=async s=>{const t=await X("/api/v1/accounts/details",void 0,s),r=Pe(t,["data","accounts","details"]),a=Date.now().toString();return r.map(o=>({id:o.id,cookie_configured:o.has_cookie===!0,enabled:o.enabled,auto_confirm:o.auto_confirm,remark:o.remark,pause_duration:o.pause_duration,paused_until:Number(o.paused_until||0),paused:o.paused===!0,username:o.username||"",login_password_configured:void 0,show_browser:o.show_browser===!0||o.show_browser===1||o.show_browser==="1"||o.show_browser==="true",nickname:o.nickname||o.remark||`账号 ${o.id.substring(0,6)}`,avatar_url:ss(o,a),profile_error:o.profile_error||"",ai_enabled:!1,auto_rate_enabled:o.auto_rate_enabled,rate_content:o.rate_content||"不错的买家,交易愉快",auto_polish_enabled:o.auto_polish_enabled,polish_time:o.polish_time||"03:00",last_rate_scan_at:Number(o.last_rate_scan_at||0),last_polish_date:o.last_polish_date||"",last_polish_at:Number(o.last_polish_at||0)}))},as=async s=>{const t=await X("/api/v1/accounts/runtime-status",void 0,s);return ke(t,["statuses","data","result"])||{}},rs=async s=>ce("/api/v1/qr-login/generate",void 0,{...s,timeoutMs:(s==null?void 0:s.timeoutMs)??13e4}),ns=async(s,t)=>X(`/api/v1/qr-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),ls=async(s,t)=>ce(`/api/v1/qr-login/complete-verification/${s}`,{target_account_id:t||""}),os=async(s,t)=>ae(`/api/v1/accounts/${s}/status`,{enabled:t}),is=async s=>Le(`/api/v1/accounts/${s}`),cs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/pause-duration`,{pause_duration:t},r),ds=async(s,t,r)=>ae(`/api/v1/accounts/${s}/settings`,t,r),us=async(s,t)=>X(`/api/v1/accounts/${s}/long-login`,void 0,t),xs=async(s,t,r)=>ae(`/api/v1/accounts/${s}/long-login`,{enabled:t},r),ms=async(s,t)=>ce("/api/v1/password-login",s,t),bs=async(s,t)=>X(`/api/v1/password-login/check/${s}`,void 0,{signal:t,timeoutMs:1e4}),hs=async(s,t)=>Le(`/api/v1/password-login/cancel/${s}`,void 0,t),gs=async s=>ce(`/api/v1/accounts/${s}/refresh-profile`,{}),ps=async s=>{const t=await X("/api/v1/settings/ai-reply",void 0,s);return ke(t,["settings","data","result"])||{}},fs=async(s,t)=>X(`/api/v1/settings/ai-reply/${s}`,void 0,t),ys=async(s,t,r)=>{const a={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return ae(`/api/v1/settings/ai-reply/${s}`,a,r)},js=s=>{if(Array.isArray(s))return s.filter(Boolean);if(typeof s!="string"||!s.trim())return[];try{const t=JSON.parse(s);if(Array.isArray(t))return t.filter(Boolean)}catch{}return s.split(/[,\s;]+/).map(t=>t.trim()).filter(Boolean)},ws=async s=>{const t=await X("/api/v1/notifications/channels",void 0,s);return{success:!0,data:Pe(t,["data","channels","items"]).map(a=>{const o={},c=a.type==="ding_talk"?"dingtalk":a.type==="lark"?"feishu":a.type;return{id:String(a.id),name:a.name,type:c,config:o,event_types:js(a.event_types),enabled:a.enabled}})}},_s=async(s,t)=>{const r=await X(`/api/v1/notifications/accounts/${s}/bindings`,void 0,t),a=ke(r,["data","result"])||{};return Array.isArray(a.channel_ids)?a.channel_ids:[]},vs=({account:s,settings:t,saving:r,onChange:a,onClose:o,onSave:c})=>{const i=u=>a({...t,...u}),d=()=>i({ai_enabled:!t.ai_enabled}),b=u=>i({max_discount_percent:parseInt(u.target.value,10)||0}),m=u=>i({max_discount_amount:parseInt(u.target.value,10)||0}),f=u=>i({max_bargain_rounds:parseInt(u.target.value,10)||1}),h=u=>i({custom_prompts:u.target.value});return ie.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-2xl font-extrabold text-gray-900 flex items-center gap-2",children:[e.jsx(ue,{className:"w-6 h-6 text-purple-500"}),"AI助手设置"]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:s.nickname||s.remark||s.id})]}),e.jsx("button",{onClick:o,className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0","aria-label":"关闭 AI 设置",children:e.jsx(de,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"modal-body space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-purple-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-bold text-gray-900 flex iteLine truncated
|
||||
|
||||
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(ze,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:o,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:r,children:"取消"}),e.jsxs("button",{onClick:(()=>void c()),className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:r,children:[r?e.jsx(K,{className:"w-4 h-4 animate-spin"}):e.jsx(Ie,{className:"w-4 h-4"}),r?"保存中...":"保存"]})]})})]})}),document.body)},Ce=async(s,t)=>X(`/api/v1/account-tasks/${s}`,void 0,t),Se=async(s,t,r)=>ae(`/api/v1/account-tasks/${s}`,t,r),Ns=async(s,t,r)=>ce(`/api/v1/account-tasks/${s}/run`,{task_type:t},{timeoutMs:12e4,...r}),Re=s=>({account_id:s.id,auto_rate_enabled:s.auto_rate_enabled===!0,rate_content:s.rate_content||"不错的买家,交易愉快",auto_polish_enabled:s.auto_polish_enabled===!0,polish_time:s.polish_time||"03:00",last_rate_scan_at:s.last_rate_scan_at,last_polish_date:s.last_polish_date,last_polish_at:s.last_polish_at}),Y=(s,t,r)=>s===t&&!r.aborted,je=(s,t)=>s instanceof Error?s.message:t,we=s=>s instanceof Error&&s.message==="请求已取消",Ae=(s,t)=>!s&&t==="",ks=({account:s,onSaved:t})=>{const[r,a]=n.useState(()=>Re(s)),[o,c]=n.useState(!0),[i,d]=n.useState(!1),[b,m]=n.useState(""),[f,h]=n.useState(""),[u,A]=n.useState(null),[k,g]=n.useState(null),p=n.useRef(0),L=n.useRef(null);n.useEffect(()=>{var v;const S=++p.current;(v=L.current)==null||v.abort();const j=new AbortController;return L.current=j,a(Re(s)),A(null),h(""),d(!1),m(""),g(null),c(!0),Ce(s.id,{signal:j.signal}).then(R=>{Y(p.current,S,j.signal)&&a(R)}).catch(R=>{Y(p.current,S,j.signal)&&!we(R)&&h(je(R,"加载任务设置失败"))}).finally(()=>{Y(p.current,S,j.signal)&&c(!1)}),(()=>j.abort())},[s.id]),n.useEffect(()=>(()=>{var S;return(S=L.current)==null?void 0:S.abort()}),[]);const U=n.useCallback(async()=>{var v;if(!Ae(i,b))return;const S=++p.current;(v=L.current)==null||v.abort();const j=new AbortController;L.current=j,d(!0),h(""),g(null);try{const R=await Se(s.id,r,{signal:j.signal});if(!Y(p.current,S,j.signal))return;a(R),t(R)}catch(R){Y(p.current,S,j.signal)&&!we(R)&&(h(je(R,"保存失败")),g(()=>U))}finally{Y(p.current,S,j.signal)&&d(!1)}},[s.id,r,t,b,i]),M=n.useCallback(async S=>{var R;if(!Ae(i,b)||!s.enabled)return;const j=++p.current;(R=L.current)==null||R.abort();const v=new AbortController;L.current=v,m(S),h(""),A(null),g(null);try{await Se(s.id,r,{signal:v.signal});const w=await Ns(s.id,S,{signal:v.signal}),q=await Ce(s.id,{signal:v.signal});if(!Y(p.current,j,v.signal))return;A(w.summary),a(q),t(q)}catch(w){Y(p.current,j,v.signal)&&!we(w)&&(h(je(w,"任务执行失败")),g(()=>(()=>M(S))))}finally{Y(p.current,j,v.signal)&&m("")}},[s.enabled,s.id,r,t,b,i]),T=n.useCallback(async()=>{k&&await k()},[k]);return{form:r,loading:o,saving:i,running:b,summary:u,error:f,retryAvailable:k!==null,setForm:a,save:U,run:M,retry:T}},qe=({checked:s,onChange:t,label:r})=>e.jsx("button",{type:"button","aria-label":r,"aria-pressed":s,onClick:t,className:`relative h-8 w-14 shrink-0 rounded-full transition-colors ${s?"bg-sky-500":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-sm transition-transform ${s?"translate-x-6":""}`})}),Cs=({account:s,onClose:t,onSaved:r})=>{const{form:a,loading:o,saving:c,running:i,error:d,summary:b,retryAvailable:m,setForm:f,save:h,run:u,retry:A}=ks({account:s,onSaved:r});return e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"640px"},role:"dialog","aria-modal":"true","aria-labelledby":"account-task-title",children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"account-task-title",className:"text-2xl font-extrabold text-slate-950",children:"账号自动任务"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:s.nickname||s.remark||s.id})]}),e.jsx("button",{type:"button",onClick:t,className:"rounded-xl p-2 text-slate-400 hover:bg-slate-100 hover:text-slate-700","aria-label":"关闭",children:e.jsx(de,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"modal-body space-y-5",children:[o&
Line truncated
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{r as i,b as z,j as e}from"./react-vendor-C_od1ZSF.js";import{g as Z,c as ee,p as te,d as ae,a as H,b as se}from"./index-zEvleK2K.js";import{X as G,W as le,J as O,Y as ne,L as V,N as U,C as W,_ as re,$ as X,a0 as Y,a1 as oe,I as ie,a2 as ce,V as de,y as xe,P as pe,o as me}from"./icons-vendor-DwxdQTKt.js";const he=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},K=l=>({...l,api_config:l.api_config?JSON.stringify(l.api_config):""}),ue=async l=>{const n=await Z("/api/v1/cards",void 0,l);return ee(n,["cards","data","items"]).map(he)},be=async l=>H("/api/v1/cards",K(l)),J=async(l,n)=>te(`/api/v1/cards/${l}`,K(n)),ge=async l=>ae(`/api/v1/cards/${l}`),ye=async(l,n)=>{const a=new FormData;return a.append("file",l),se("/api/v1/cards/batch",a,n)},fe=async(l,n,a)=>H(`/api/v1/cards/${l}/append-data`,{content:n},a),je=(l,n,a)=>{const u=a.trim().toLocaleLowerCase();return l.filter(m=>(!n||m.type===n)&&(!u||m.name.toLocaleLowerCase().includes(u)))},Q=l=>l.split(`
|
||||
import{r as i,b as z,j as e}from"./react-vendor-C_od1ZSF.js";import{g as Z,c as ee,p as te,d as ae,a as H,b as se}from"./index-DJhzW1ER.js";import{X as G,W as le,J as O,Y as ne,L as V,N as U,C as W,_ as re,$ as X,a0 as Y,a1 as oe,I as ie,a2 as ce,V as de,y as xe,P as pe,o as me}from"./icons-vendor-BP_RGPqo.js";const he=l=>{let n=l.api_config;if(typeof n=="string"&&n.trim())try{n=JSON.parse(n)}catch{n=void 0}return{...l,api_config:n||void 0}},K=l=>({...l,api_config:l.api_config?JSON.stringify(l.api_config):""}),ue=async l=>{const n=await Z("/api/v1/cards",void 0,l);return ee(n,["cards","data","items"]).map(he)},be=async l=>H("/api/v1/cards",K(l)),J=async(l,n)=>te(`/api/v1/cards/${l}`,K(n)),ge=async l=>ae(`/api/v1/cards/${l}`),ye=async(l,n)=>{const a=new FormData;return a.append("file",l),se("/api/v1/cards/batch",a,n)},fe=async(l,n,a)=>H(`/api/v1/cards/${l}/append-data`,{content:n},a),je=(l,n,a)=>{const u=a.trim().toLocaleLowerCase();return l.filter(m=>(!n||m.type===n)&&(!u||m.name.toLocaleLowerCase().includes(u)))},Q=l=>l.split(`
|
||||
`).map(n=>n.trim()).filter(Boolean),Ne=(l,n,a)=>!!(l&&Q(n).length>0&&!a),F=(l,n,a,u)=>l===n&&a===u,q=()=>({name:"",type:"data",content:"",description:"",enabled:!0,delay_seconds:0,api_method:"GET",api_timeout:10,api_headers:"",api_params:""}),D=(l,n)=>l instanceof Error?l.message:n,ve=({cards:l,loadCards:n})=>{const[a,u]=i.useState(!1),[m,_]=i.useState(!1),[f,j]=i.useState(null),[d,A]=i.useState({}),[c,y]=i.useState(q),[N,b]=i.useState(""),[r,x]=i.useState(""),s=i.useMemo(()=>l.filter(o=>o.type==="data"),[l]),h=i.useMemo(()=>je(l,N,r),[l,r,N]),E=i.useCallback(o=>{var t,g,k,S,C;j(o),A({id:o.id,name:o.name||"",type:o.type||"text",api_url:((t=o.api_config)==null?void 0:t.url)||"",api_method:((g=o.api_config)==null?void 0:g.method)||"GET",api_timeout:((k=o.api_config)==null?void 0:k.timeout)||10,api_headers:((S=o.api_config)==null?void 0:S.headers)||"",api_params:((C=o.api_config)==null?void 0:C.params)||"",text_content:o.text_content||"",data_content:o.data_content||"",image_url:o.image_url||"",delay_seconds:o.delay_seconds||0,description:o.description||"",enabled:o.enabled}),u(!0)},[]),M=i.useCallback(async()=>{var o,t,g,k,S,C,p,B;if(f){if(!((o=d.name)!=null&&o.trim())){alert("请输入卡密名称");return}if(!d.type){alert("请选择卡密类型");return}try{const w={name:d.name.trim(),type:d.type,description:(t=d.description)==null?void 0:t.trim(),delay_seconds:d.delay_seconds||0,enabled:d.enabled??!0};d.type==="api"?w.api_config={url:((g=d.api_url)==null?void 0:g.trim())||"",method:d.api_method||"GET",timeout:d.api_timeout||10,headers:((k=d.api_headers)==null?void 0:k.trim())||void 0,params:((S=d.api_params)==null?void 0:S.trim())||void 0}:d.type==="text"?w.text_content=((C=d.text_content)==null?void 0:C.trim())||"":d.type==="data"?w.data_content=((p=d.data_content)==null?void 0:p.trim())||"":d.type==="image"&&(w.image_url=((B=d.image_url)==null?void 0:B.trim())||""),await J(f.id,w),u(!1),await n()}catch(w){console.error("更新卡密失败:",w),alert(D(w,"更新失败,请重试"))}}},[d,n,f]),R=i.useCallback(async o=>{if(confirm("确认删除该卡密吗?"))try{await ge(o),await n()}catch(t){console.error("删除卡密失败:",t),alert(D(t,"删除失败,请重试"))}},[n]),v=i.useCallback(async()=>{if(!c.name.trim()){alert("请输入卡密名称");return}if(!c.content.trim()){alert(c.type==="api"?"请输入 API 地址":"请输入卡密内容");return}try{const o={name:c.name.trim(),type:c.type,description:c.description.trim(),enabled:c.enabled,delay_seconds:c.delay_seconds};c.type==="text"&&(o.text_content=c.content.trim()),c.type==="data"&&(o.data_content=c.content.trim()),c.type==="image"&&(o.image_url=c.content.trim()),c.type==="api"&&(o.api_config={url:c.content.trim(),method:c.api_method,timeout:c.api_timeout,headers:c.api_headers.trim()||void 0,params:c.api_params.trim()||void 0}),await be(o),_(!1),y(q()),await n()}catch(o){console.error("添加卡密失败:",o),alert(D(o,"添加失败,请重试"))}},[c,n]),T=i.useCallback(async o=>{try{await J(o.id,{...o,enabled:!o.enabled}),await n()}catch(t){console.error("切换状态失败:",t)}},[n]),P=i.useCallback(async o=>{try{await navigator.clipboard.writeText(String(o)),alert(`已复制卡密组ID:${o}`)}catch{prompt("复制卡密组ID",String(o))}},[]),$=i.useCallback(()=>{const g=[["名称","类型","内容","描述","启用","延迟秒","多规格","规格名","规格值"],...[["VIP月卡","data",`VIP-MONTH-001
|
||||
VIP-MONTH-002
|
||||
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(p=>p.map(B=>`"${String(B).replace(/"/g,'""')}"`).join(",")).join(`
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{j as e,c as x0,r as i}from"./react-vendor-C_od1ZSF.js";import{L as re}from"./vendor-Es4K8PXl.js";import{e as M0,f as le,h as F0,m as P0,s as ce,i as oe,j as pe,k as me,l as z0}from"./index-zEvleK2K.js";import{L as X,ak as ge,al as de,M as B0,I as xe,R as ue,ad as U0,k as he,am as _e,t as J0,an as be,ao as fe,ah as Q0,X as je}from"./icons-vendor-DwxdQTKt.js";const Z0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899-2-tps-64-64.png_110x10000.jpg_.webp"],["city不city啊","https://img.alicdn.com/imgextra/i2/O1CN01zRjPTR29lWHqabmDA_!!6000000008108-2-tps-64-64.png_110x10000.jpg_.webp"],["激推","https://img.alicdn.com/imgextra/i3/O1CN01ADTJ6u1khypfxbfnQ_!!6000000004716-2-tps-64-64.png_110x10000.jpg_.webp"],["微笑","https://img.alicdn.com/imgextra/i1/O1CN017b61R51wRk2lVV7vx_!!6000000006305-2-tps-980-980.png_110x10000.jpg_.webp"],["龇牙","https://img.alicdn.com/imgextra/i2/O1CN01nmOh4S22Yxz8IdEVf_!!6000000007133-2-tps-980-980.png_110x10000.jpg_.webp"],["流泪","https://img.alicdn.com/imgextra/i2/O1CN01Ec1EaL1zqQETcM2dX_!!6000000006765-2-tps-980-980.png_110x10000.jpg_.webp"],["尴尬","https://img.alicdn.com/imgextra/i2/O1CN01UrWH7a1ZVBrgRYXlc_!!6000000003199-2-tps-980-980.png_110x10000.jpg_.webp"],["撇嘴","https://img.alicdn.com/imgextra/i2/O1CN01Sr7o2b1lUWg5KfOD8_!!6000000004822-2-tps-980-980.png_110x10000.jpg_.webp"],["破涕为笑","https://img.alicdn.com/imgextra/i4/O1CN01pPetah1gkwndfn7Fs_!!6000000004181-2-tps-980-980.png_110x10000.jpg_.webp"],["捂脸哭","https://img.alicdn.com/imgextra/i2/O1CN0170KgpE1dE1TuQgd66_!!6000000003703-2-tps-980-980.png_110x10000.jpg_.webp"],["害羞","https://img.alicdn.com/imgextra/i3/O1CN01ZoB0Lb1ps7XpqP8PQ_!!6000000005415-2-tps-980-980.png_110x10000.jpg_.webp"],["感动","https://img.alicdn.com/imgextra/i2/O1CN01wqD4ly29yndR3Qp3A_!!6000000008137-2-tps-980-980.png_110x10000.jpg_.webp"],["滴泪","https://img.alicdn.com/imgextra/i1/O1CN01MpkJ3L1oUTTqfryOn_!!6000000005228-2-tps-980-980.png_110x10000.jpg_.webp"],["暗中观察","https://img.alicdn.com/imgextra/i1/O1CN010LO9yj272W07GlLls_!!6000000007739-2-tps-980-980.png_110x10000.jpg_.webp"],["偷笑","https://img.alicdn.com/imgextra/i4/O1CN01vJtO031g818IuYO7x_!!6000000004096-2-tps-980-980.png_110x10000.jpg_.webp"],["ok","https://img.alicdn.com/imgextra/i3/O1CN01QRkqDF25tz0WcANje_!!6000000007585-2-tps-980-980.png_110x10000.jpg_.webp"],["送花","https://img.alicdn.com/imgextra/i2/O1CN01PpzBNX1JNpeJBWnvr_!!6000000001017-2-tps-980-980.png_110x10000.jpg_.webp"],["大哭","https://img.alicdn.com/imgextra/i4/O1CN014TiaNb1ViEgNvRrTB_!!6000000002686-2-tps-980-980.png_110x10000.jpg_.webp"],["色","https://img.alicdn.com/imgextra/i2/O1CN01840t1B1JaCLGvHnBK_!!6000000001044-2-tps-980-980.png_110x10000.jpg_.webp"],["惊慌","https://img.alicdn.com/imgextra/i1/O1CN01mnqO7G1LAfUnfAN2U_!!6000000001259-2-tps-980-980.png_110x10000.jpg_.webp"],["惊讶","https://img.alicdn.com/imgextra/i3/O1CN0127IeyS1Kw0p0P4jzI_!!6000000001227-2-tps-980-980.png_110x10000.jpg_.webp"],["得意","https://img.alicdn.com/imgextra/i4/O1CN018QUnFv1WpOUES9POZ_!!6000000002837-2-tps-980-980.png_110x10000.jpg_.webp"],["睡","https://img.alicdn.com/imgextra/i2/O1CN01RprGZl1lqVgnEJLCx_!!6000000004870-2-tps-980-980.png_110x10000.jpg_.webp"],["不好意思","https://img.alicdn.com/imgextra/i3/O1CN01rMJJgn1SUXzuVpUhO_!!6000000002250-2-tps-980-980.png_110x10000.jpg_.webp"],["托腮","https://img.alicdn.com/imgextra/i1/O1CN01w3reBU1d3wlgOBtyZ_!!6000000003681-2-tps-980-980.png_110x10000.jpg_.webp"],["发怒","https://img.alicdn.com/imgextra/i2/O1CN013Wzy8d2A8PxGJZPpT_!!6000000008158-2-tps-980-980.png_110x10000.jpg_.webp"],["难过","https://img.alicdn.com/imgextra/i2/O1CN01zcwaSh1G9gZCFuFal_!!6000000000580-2-tps-980-980.png_110x10000.jpg_.webp"],["调皮","https://img.alicdn.com/imgextra/i3/O1CN01Zd1YHi1TI0lwpBe8c_!!6000000002358-2-tps-980-980.png_110x10000.jpg_.webp"],["愉快","https://img.alicdn.com/imgextra/i2/O1CN0145wDk21SWpyjTvsvA_!!6000000002255-2-tps-980-980.png_110x10000.jpg_.webp"],["白眼","https://img.alicdn.com/imgextra/i4/O1CN01nexGth1hwEAT1SHO2_!!6000000004341-2-tps-980-980.png_110x10000.jpg_.webp"],["拒绝","https://img.alicdn.com/imgextra/i2/O1CN01nqusqS1uHXzoUcpXr_!!6000000006012-2-tps-980-980.png_110x10000.jpg_.webp"],["期待","https://img.alicdn.com/imgextra/i3/O1CN01M44QY11Oh8Q5PdMIx_!!6000000001736-2-tps-980-980.png_110x10000.jpg_.webp"],["困","https://img.alicdn.com/imgextra/i4/O1CN01J4hFFz1Y9pmNdBq76_
Line truncated
|
||||
import{j as e,c as x0,r as i}from"./react-vendor-C_od1ZSF.js";import{L as re}from"./vendor-Es4K8PXl.js";import{e as M0,f as le,h as F0,m as P0,s as ce,i as oe,j as pe,k as me,l as z0}from"./index-DJhzW1ER.js";import{L as X,al as ge,am as de,M as B0,I as xe,R as ue,ad as U0,k as he,an as _e,t as J0,ao as be,ap as fe,ai as Q0,X as je}from"./icons-vendor-BP_RGPqo.js";const Z0=[["尊嘟假嘟","https://img.alicdn.com/imgextra/i2/O1CN01hWzOgD1KcmFEIaGwE_!!6000000001185-2-tps-64-64.png_110x10000.jpg_.webp"],["鸡哔你","https://img.alicdn.com/imgextra/i1/O1CN01P9TVJl1JCqCZcQIdW_!!6000000000993-2-tps-64-64.png_110x10000.jpg_.webp"],["谁懂啊","https://img.alicdn.com/imgextra/i1/O1CN01r9qUnx1g3tcrtSmcs_!!6000000004087-2-tps-64-64.png_110x10000.jpg_.webp"],["吗喽","https://img.alicdn.com/imgextra/i4/O1CN01dTynZh1LnbIYTHI1D_!!6000000001344-2-tps-64-64.png_110x10000.jpg_.webp"],["功德+1","https://img.alicdn.com/imgextra/i1/O1CN01l1G5pS1IVn37pfQJi_!!6000000000899-2-tps-64-64.png_110x10000.jpg_.webp"],["city不city啊","https://img.alicdn.com/imgextra/i2/O1CN01zRjPTR29lWHqabmDA_!!6000000008108-2-tps-64-64.png_110x10000.jpg_.webp"],["激推","https://img.alicdn.com/imgextra/i3/O1CN01ADTJ6u1khypfxbfnQ_!!6000000004716-2-tps-64-64.png_110x10000.jpg_.webp"],["微笑","https://img.alicdn.com/imgextra/i1/O1CN017b61R51wRk2lVV7vx_!!6000000006305-2-tps-980-980.png_110x10000.jpg_.webp"],["龇牙","https://img.alicdn.com/imgextra/i2/O1CN01nmOh4S22Yxz8IdEVf_!!6000000007133-2-tps-980-980.png_110x10000.jpg_.webp"],["流泪","https://img.alicdn.com/imgextra/i2/O1CN01Ec1EaL1zqQETcM2dX_!!6000000006765-2-tps-980-980.png_110x10000.jpg_.webp"],["尴尬","https://img.alicdn.com/imgextra/i2/O1CN01UrWH7a1ZVBrgRYXlc_!!6000000003199-2-tps-980-980.png_110x10000.jpg_.webp"],["撇嘴","https://img.alicdn.com/imgextra/i2/O1CN01Sr7o2b1lUWg5KfOD8_!!6000000004822-2-tps-980-980.png_110x10000.jpg_.webp"],["破涕为笑","https://img.alicdn.com/imgextra/i4/O1CN01pPetah1gkwndfn7Fs_!!6000000004181-2-tps-980-980.png_110x10000.jpg_.webp"],["捂脸哭","https://img.alicdn.com/imgextra/i2/O1CN0170KgpE1dE1TuQgd66_!!6000000003703-2-tps-980-980.png_110x10000.jpg_.webp"],["害羞","https://img.alicdn.com/imgextra/i3/O1CN01ZoB0Lb1ps7XpqP8PQ_!!6000000005415-2-tps-980-980.png_110x10000.jpg_.webp"],["感动","https://img.alicdn.com/imgextra/i2/O1CN01wqD4ly29yndR3Qp3A_!!6000000008137-2-tps-980-980.png_110x10000.jpg_.webp"],["滴泪","https://img.alicdn.com/imgextra/i1/O1CN01MpkJ3L1oUTTqfryOn_!!6000000005228-2-tps-980-980.png_110x10000.jpg_.webp"],["暗中观察","https://img.alicdn.com/imgextra/i1/O1CN010LO9yj272W07GlLls_!!6000000007739-2-tps-980-980.png_110x10000.jpg_.webp"],["偷笑","https://img.alicdn.com/imgextra/i4/O1CN01vJtO031g818IuYO7x_!!6000000004096-2-tps-980-980.png_110x10000.jpg_.webp"],["ok","https://img.alicdn.com/imgextra/i3/O1CN01QRkqDF25tz0WcANje_!!6000000007585-2-tps-980-980.png_110x10000.jpg_.webp"],["送花","https://img.alicdn.com/imgextra/i2/O1CN01PpzBNX1JNpeJBWnvr_!!6000000001017-2-tps-980-980.png_110x10000.jpg_.webp"],["大哭","https://img.alicdn.com/imgextra/i4/O1CN014TiaNb1ViEgNvRrTB_!!6000000002686-2-tps-980-980.png_110x10000.jpg_.webp"],["色","https://img.alicdn.com/imgextra/i2/O1CN01840t1B1JaCLGvHnBK_!!6000000001044-2-tps-980-980.png_110x10000.jpg_.webp"],["惊慌","https://img.alicdn.com/imgextra/i1/O1CN01mnqO7G1LAfUnfAN2U_!!6000000001259-2-tps-980-980.png_110x10000.jpg_.webp"],["惊讶","https://img.alicdn.com/imgextra/i3/O1CN0127IeyS1Kw0p0P4jzI_!!6000000001227-2-tps-980-980.png_110x10000.jpg_.webp"],["得意","https://img.alicdn.com/imgextra/i4/O1CN018QUnFv1WpOUES9POZ_!!6000000002837-2-tps-980-980.png_110x10000.jpg_.webp"],["睡","https://img.alicdn.com/imgextra/i2/O1CN01RprGZl1lqVgnEJLCx_!!6000000004870-2-tps-980-980.png_110x10000.jpg_.webp"],["不好意思","https://img.alicdn.com/imgextra/i3/O1CN01rMJJgn1SUXzuVpUhO_!!6000000002250-2-tps-980-980.png_110x10000.jpg_.webp"],["托腮","https://img.alicdn.com/imgextra/i1/O1CN01w3reBU1d3wlgOBtyZ_!!6000000003681-2-tps-980-980.png_110x10000.jpg_.webp"],["发怒","https://img.alicdn.com/imgextra/i2/O1CN013Wzy8d2A8PxGJZPpT_!!6000000008158-2-tps-980-980.png_110x10000.jpg_.webp"],["难过","https://img.alicdn.com/imgextra/i2/O1CN01zcwaSh1G9gZCFuFal_!!6000000000580-2-tps-980-980.png_110x10000.jpg_.webp"],["调皮","https://img.alicdn.com/imgextra/i3/O1CN01Zd1YHi1TI0lwpBe8c_!!6000000002358-2-tps-980-980.png_110x10000.jpg_.webp"],["愉快","https://img.alicdn.com/imgextra/i2/O1CN0145wDk21SWpyjTvsvA_!!6000000002255-2-tps-980-980.png_110x10000.jpg_.webp"],["白眼","https://img.alicdn.com/imgextra/i4/O1CN01nexGth1hwEAT1SHO2_!!6000000004341-2-tps-980-980.png_110x10000.jpg_.webp"],["拒绝","https://img.alicdn.com/imgextra/i2/O1CN01nqusqS1uHXzoUcpXr_!!6000000006012-2-tps-980-980.png_110x10000.jpg_.webp"],["期待","https://img.alicdn.com/imgextra/i3/O1CN01M44QY11Oh8Q5PdMIx_!!6000000001736-2-tps-980-980.png_110x10000.jpg_.webp"],["困","https://img.alicdn.com/imgextra/i4/O1CN01J4hFFz1Y9pmNdBq76_
Line truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{j as e,r as c}from"./react-vendor-C_od1ZSF.js";import{f as me}from"./dateTime-DDi7rqpW.js";import{j as de,k as ge,l as te,D as he,c as pe,P as be,m as se,E as fe,T as ye}from"./icons-vendor-DwxdQTKt.js";import{R as E,B as je,X as ae,Y as re,T as F,a as ve,C as U,A as Ne,b as we,c as _e,P as ne,d as le,L as ke}from"./charts-vendor-deWqkrdG.js";import{g as q,c as xe,o as De}from"./index-zEvleK2K.js";import"./vendor-Es4K8PXl.js";const M=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},H=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},X=(t,a)=>({startDate:M(H(t,-(a-1))),endDate:M(t)}),ue=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?X(H(a,-1),1):X(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Se=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=H(a,-1);return X(n,l)},i=(t,a)=>a===void 0?`rgb(var(--color-${t}))`:`rgb(var(--color-${t}) / ${a})`,Ce=({chartData:t,selectedRangeLabel:a,totalAmount:s})=>e.jsxs("div",{className:"ios-card p-8 rounded-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"营收趋势分析"}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:[a,"的销售额走势"]})]}),e.jsx("div",{className:"dashboard-revenue-chart h-[350px] w-full",children:t.length===0||s===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(de,{className:"w-16 h-16 mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无营收数据"}),e.jsx("p",{className:"text-sm mt-2",children:"所选时间范围内暂无订单记录"})]}):t.length<=2?e.jsx(E,{width:"100%",height:"100%",children:e.jsxs(je,{data:t,margin:{top:30,right:20,left:0,bottom:30},barCategoryGap:"45%",children:[e.jsx(ae,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-700"),fontSize:14,fontWeight:600},dy:10}),e.jsx(re,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},tickFormatter:(l=>`¥${l}`)}),e.jsx(F,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{fill:i("brand",.08)},formatter:(l=>[`¥${Number(l).toFixed(2)}`,"营收"])}),e.jsx(ve,{dataKey:"amount",fill:i("brand"),maxBarSize:72,radius:[12,12,0,0],activeBar:!1,stroke:"none",strokeWidth:0,children:t.map((l,n)=>e.jsx(U,{fill:i("brand"),stroke:"none",strokeWidth:0},`cell-${n}`))})]})}):e.jsx(E,{width:"100%",height:"100%",children:e.jsxs(Ne,{data:t,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorAmount",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:i("brand"),stopOpacity:.5}),e.jsx("stop",{offset:"95%",stopColor:i("brand"),stopOpacity:0})]})}),e.jsx(ae,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},dy:15}),e.jsx(re,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500}}),e.jsx(we,{vertical:!1,stroke:i("neutral-100"),strokeDasharray:"3 3"}),e.jsx(F,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{stroke:i("brand"),strokeWidth:2,strokeDasharray:"4 4"}}),e.jsx(_e,{type:"monotone",dataKey:"amount",stroke:i("brand"),strokeWidth:4,fillOpacity:1,fill:"url(#colorAmount)",activeDot:{r:8,fill:i("white"),stroke:i("brand"),strokeWidth:2}})]})})})]}),oe=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},$e=async t=>q("/api/v1/analytics/dashboard",void 0,t),Re=async(t,a)=>{const s=await q("/api/v1/items",void 0,a);return xe(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ie=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:M(n),end_date:M(l)}}else s=t;return q("/api/v1/analytics/orders",{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()},a)},Le=async(t,a)=>{const s=await q("/api/v1/analytics/orders/valid",{...t,timezone_offset_minutes:-new Date().getTimezoneOffset()},a),l=De(s,["data","result"])||{},o=xe(s,["orders","data","items"]).map(b=>({...b,id:b.order_id,status:oe(b.statusLine truncated
|
||||
import{j as e,r as c}from"./react-vendor-C_od1ZSF.js";import{f as me}from"./dateTime-DDi7rqpW.js";import{j as de,k as ge,l as te,D as he,c as pe,P as be,m as se,E as fe,T as ye}from"./icons-vendor-BP_RGPqo.js";import{R as E,B as je,X as ae,Y as re,T as F,a as ve,C as U,A as Ne,b as we,c as _e,P as ne,d as le,L as ke}from"./charts-vendor-deWqkrdG.js";import{g as q,c as xe,o as De}from"./index-DJhzW1ER.js";import"./vendor-Es4K8PXl.js";const M=t=>{const a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${s}-${l}`},H=(t,a)=>{const s=new Date(t);return s.setHours(12,0,0,0),s.setDate(s.getDate()+a),s},X=(t,a)=>({startDate:M(H(t,-(a-1))),endDate:M(t)}),ue=(t,a=new Date,s="",l="")=>{if(t==="custom"&&s&&l){if(s>l)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:l}}return t==="yesterday"?X(H(a,-1),1):X(a,t==="3days"?3:t==="30days"?30:t==="today"?1:7)},Se=t=>{const a=new Date(`${t.startDate}T12:00:00`),s=new Date(`${t.endDate}T12:00:00`),l=Math.round((s.getTime()-a.getTime())/864e5)+1,n=H(a,-1);return X(n,l)},i=(t,a)=>a===void 0?`rgb(var(--color-${t}))`:`rgb(var(--color-${t}) / ${a})`,Ce=({chartData:t,selectedRangeLabel:a,totalAmount:s})=>e.jsxs("div",{className:"ios-card p-8 rounded-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"营收趋势分析"}),e.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:[a,"的销售额走势"]})]}),e.jsx("div",{className:"dashboard-revenue-chart h-[350px] w-full",children:t.length===0||s===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(de,{className:"w-16 h-16 mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无营收数据"}),e.jsx("p",{className:"text-sm mt-2",children:"所选时间范围内暂无订单记录"})]}):t.length<=2?e.jsx(E,{width:"100%",height:"100%",children:e.jsxs(je,{data:t,margin:{top:30,right:20,left:0,bottom:30},barCategoryGap:"45%",children:[e.jsx(ae,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-700"),fontSize:14,fontWeight:600},dy:10}),e.jsx(re,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},tickFormatter:(l=>`¥${l}`)}),e.jsx(F,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{fill:i("brand",.08)},formatter:(l=>[`¥${Number(l).toFixed(2)}`,"营收"])}),e.jsx(ve,{dataKey:"amount",fill:i("brand"),maxBarSize:72,radius:[12,12,0,0],activeBar:!1,stroke:"none",strokeWidth:0,children:t.map((l,n)=>e.jsx(U,{fill:i("brand"),stroke:"none",strokeWidth:0},`cell-${n}`))})]})}):e.jsx(E,{width:"100%",height:"100%",children:e.jsxs(Ne,{data:t,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"colorAmount",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:i("brand"),stopOpacity:.5}),e.jsx("stop",{offset:"95%",stopColor:i("brand"),stopOpacity:0})]})}),e.jsx(ae,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500},dy:15}),e.jsx(re,{axisLine:!1,tickLine:!1,tick:{fill:i("neutral-400"),fontSize:13,fontWeight:500}}),e.jsx(we,{vertical:!1,stroke:i("neutral-100"),strokeDasharray:"3 3"}),e.jsx(F,{contentStyle:{backgroundColor:i("white"),borderRadius:"8px",border:`1px solid ${i("neutral-200")}`,boxShadow:"var(--shadow-xl)",padding:"12px 16px"},labelStyle:{color:i("neutral-500"),fontWeight:500},itemStyle:{color:i("brand"),fontWeight:600},cursor:{stroke:i("brand"),strokeWidth:2,strokeDasharray:"4 4"}}),e.jsx(_e,{type:"monotone",dataKey:"amount",stroke:i("brand"),strokeWidth:4,fillOpacity:1,fill:"url(#colorAmount)",activeDot:{r:8,fill:i("white"),stroke:i("brand"),strokeWidth:2}})]})})})]}),oe=t=>{const a=String(t||"");return a==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(a)?a:"unknown"},$e=async t=>q("/api/v1/analytics/dashboard",void 0,t),Re=async(t,a)=>{const s=await q("/api/v1/items",void 0,a);return xe(s,["items","data","results"]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:n.is_multi_spec===!0||n.is_multi_spec===1,multi_quantity_delivery:n.multi_quantity_delivery===!0||n.multi_quantity_delivery===1}))},ie=async(t=7,a)=>{let s;if(typeof t=="number"){const l=new Date,n=new Date;n.setDate(n.getDate()-t),s={start_date:M(n),end_date:M(l)}}else s=t;return q("/api/v1/analytics/orders",{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()},a)},Le=async(t,a)=>{const s=await q("/api/v1/analytics/orders/valid",{...t,timezone_offset_minutes:-new Date().getTimezoneOffset()},a),l=De(s,["data","result"])||{},o=xe(s,["orders","data","items"]).map(b=>({...b,id:b.order_id,status:oe(b.statusLine truncated
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
import{j as e,r,b as we}from"./react-vendor-C_od1ZSF.js";import{g as je,c as Qe,a as ce,b as et,d as tt,A as yt,p as ft}from"./index-zEvleK2K.js";import{a3 as jt,U as De,R as Se,N as Te,a4 as Pe,a5 as _e,V as vt,y as Nt,B as wt,a6 as Ue,a7 as _t,a8 as kt,A as Ct,d as It,X as be,o as St,a9 as ze,I as Oe}from"./icons-vendor-DwxdQTKt.js";const Ke="ydisks-amap-js-api",Pt="c9b68d4ce9a2a97f22a4a439404488ca";let ye=null;const Bt=()=>Pt,qt=()=>window.AMap?Promise.resolve(window.AMap):ye||(ye=new Promise((s,l)=>{const i=document.getElementById(Ke),m=i||document.createElement("script"),u=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(R)},f=()=>{window.AMap?(u(),s(window.AMap)):(u(),l(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},R=window.setTimeout(()=>{u(),l(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=f,m.id=Ke,m.async=!0,m.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(Bt())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,m.onerror=()=>{u(),l(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},i||document.head.appendChild(m)}).catch(s=>{throw ye=null,s}),ye),ke=s=>Number.isFinite(s)&&s!==0,Lt=s=>{var u,f;const l=Number((u=s.location)==null?void 0:u.lng),i=Number((f=s.location)==null?void 0:f.lat),m={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:l,latitude:i,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!m.division_id||!m.province||!m.city||!m.poi_id||!m.poi_name||!ke(l)||!ke(i)||l<-180||l>180||i<-90||i>90?null:m},At=async(s,l,i={})=>{if(!ke(s)||!ke(l)||s<-180||s>180||l<-90||l>90)throw new Error("经纬度无效");const m=await qt();return new Promise((u,f)=>{var G,E;let R=!1;const k=Math.max(1,i.timeoutMs??1e4),A=M=>{var p;R||(R=!0,globalThis.clearTimeout(Z),(p=i.signal)==null||p.removeEventListener("abort",I),M())},I=()=>A(()=>f(new DOMException("aborted","AbortError"))),Z=globalThis.setTimeout(()=>A(()=>f(new Error("高德地图附近地址查询超时,请稍后重试"))),k);if((G=i.signal)!=null&&G.aborted){I();return}(E=i.signal)==null||E.addEventListener("abort",I,{once:!0}),new m.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,l],1e3,(M,p)=>{var d;if(R)return;if(M!=="complete"){if(M==="no_data"){A(()=>u([]));return}A(()=>f(new Error("高德地图附近地址查询失败,请稍后重试")));return}const B=(((d=p==null?void 0:p.poiList)==null?void 0:d.pois)||[]).map(Lt).filter(j=>j!==null);A(()=>u(B))})})},Et=async s=>je("/api/v1/accounts/details",void 0,s),Je=async s=>je("/api/v1/automation-rules",void 0,s),Mt=(s,l,i)=>At(s,l,i),Be=(s,l)=>{if(s instanceof yt)switch(s.code){case"stock_permission_missing":return"发布失败:该账号没有库存发布权限,无法按库存数量发布商品。请换账号或先在闲鱼确认库存能力。";case"conflict":case"item_conflict":return"商品状态已发生变化,请刷新后重试。";case"external_result_unknown":case"manual_review_required":return"平台结果暂时无法确认,请先人工核对闲鱼状态,再决定是否重试。";case"retryable":case"temporarily_unavailable":return"平台暂时不可用,请稍后重试。";default:return s.message||l}if(s instanceof Error)return s.message;const i=typeof s=="object"&&s!==null&&"message"in s?s.message:void 0;return typeof i=="string"?i:l},qe=s=>s===!0||s===1||s==="1",Ze=async(s,l)=>{const i=await je("/api/v1/items",void 0,l);return Qe(i,["items","data","results"]).map(u=>({...u,id:u.id||`${u.cookie_id}-${u.item_id}`,is_multi_spec:qe(u.is_multi_spec),is_multi_qty_ship:qe(u.is_multi_qty_ship??u.multi_quantity_delivery),multi_quantity_delivery:qe(u.multi_quantity_delivery??u.is_multi_qty_ship)}))},Rt=async s=>ce("/api/v1/items/get-all-from-account",{cookie_id:s}),Ft=async(s,l)=>tt(`/api/v1/items/${s}/${l}`),Gt=async(s,l)=>ce(`/api/v1/items/${s}`,l),$t=async s=>{const l=new FormData;l.set("cookie_id",s.cookie_id),l.set("title",s.title),l.set("description",s.description),l.set("price",s.price),l.set("original_price",s.original_price||""),l.set("quantity",String(s.quantity)),l.set("postage_mode",s.postage_mode),l.set("postage",s.postage||""),s.location&&l.set("location",JSON.stringify(s.location));for(const i of s.images)l.append("images",i);return et("/api/v1/items/publish",l)},Dt=async(s,l,i)=>ce("/api/v1/items/publish-categories/recommend",{cookie_id:s,keyword:l},i),Tt=async(s,l)=>{const i=new FormData;return i.set("file",s.file),s.imagesZip&&i.set("images_zip",s.imagesZip),s.defaultCookieId&&i.set("default_cookie_id",s.defaultCookieId),i.set("fallback_category_id",s.fallbackCategory.catId),i.set("fallback_category_name",s.fallbackCategory.catName),i.set("fallback_channel_category_id",s.fallbackCategory.channelCatId||""),i.set("fallback_tb_category_id",s.fallbackCategory.tbCatLine truncated
|
||||
import{j as e,r,b as we}from"./react-vendor-C_od1ZSF.js";import{g as je,c as Qe,a as ce,b as et,d as tt,A as yt,p as ft}from"./index-DJhzW1ER.js";import{a3 as jt,U as De,R as Se,N as Te,a4 as Pe,a5 as _e,V as vt,y as Nt,B as wt,a6 as Ue,a7 as _t,a8 as kt,A as Ct,d as It,X as be,o as St,a9 as ze,I as Oe}from"./icons-vendor-BP_RGPqo.js";const Ke="ydisks-amap-js-api",Pt="c9b68d4ce9a2a97f22a4a439404488ca";let ye=null;const Bt=()=>Pt,qt=()=>window.AMap?Promise.resolve(window.AMap):ye||(ye=new Promise((s,l)=>{const i=document.getElementById(Ke),m=i||document.createElement("script"),u=()=>{window.__ydisksAmapLoaded=void 0,window.clearTimeout(R)},f=()=>{window.AMap?(u(),s(window.AMap)):(u(),l(new Error("高德地图 API 加载完成但未找到 AMap 对象")))},R=window.setTimeout(()=>{u(),l(new Error("高德地图 API 加载超时,请检查网络或 VITE_AMAP_JS_KEY 配置"))},15e3);window.__ydisksAmapLoaded=f,m.id=Ke,m.async=!0,m.src=`https://webapi.amap.com/maps?v=2.0&key=${encodeURIComponent(Bt())}&plugin=AMap.PlaceSearch&callback=__ydisksAmapLoaded`,m.onerror=()=>{u(),l(new Error("高德地图 API 加载失败,请检查网络或 VITE_AMAP_JS_KEY 配置"))},i||document.head.appendChild(m)}).catch(s=>{throw ye=null,s}),ye),ke=s=>Number.isFinite(s)&&s!==0,Lt=s=>{var u,f;const l=Number((u=s.location)==null?void 0:u.lng),i=Number((f=s.location)==null?void 0:f.lat),m={area:String(s.adname||"").trim(),city:String(s.cityname||"").trim(),division_id:String(s.adcode||"").trim(),longitude:l,latitude:i,poi_id:String(s.id||"").trim(),poi_name:String(s.name||"").trim(),province:String(s.pname||"").trim()};return!m.division_id||!m.province||!m.city||!m.poi_id||!m.poi_name||!ke(l)||!ke(i)||l<-180||l>180||i<-90||i>90?null:m},At=async(s,l,i={})=>{if(!ke(s)||!ke(l)||s<-180||s>180||l<-90||l>90)throw new Error("经纬度无效");const m=await qt();return new Promise((u,f)=>{var G,E;let R=!1;const k=Math.max(1,i.timeoutMs??1e4),A=M=>{var p;R||(R=!0,globalThis.clearTimeout(Z),(p=i.signal)==null||p.removeEventListener("abort",I),M())},I=()=>A(()=>f(new DOMException("aborted","AbortError"))),Z=globalThis.setTimeout(()=>A(()=>f(new Error("高德地图附近地址查询超时,请稍后重试"))),k);if((G=i.signal)!=null&&G.aborted){I();return}(E=i.signal)==null||E.addEventListener("abort",I,{once:!0}),new m.PlaceSearch({extensions:"all",pageSize:10}).searchNearBy("",[s,l],1e3,(M,p)=>{var d;if(R)return;if(M!=="complete"){if(M==="no_data"){A(()=>u([]));return}A(()=>f(new Error("高德地图附近地址查询失败,请稍后重试")));return}const B=(((d=p==null?void 0:p.poiList)==null?void 0:d.pois)||[]).map(Lt).filter(j=>j!==null);A(()=>u(B))})})},Et=async s=>je("/api/v1/accounts/details",void 0,s),Je=async s=>je("/api/v1/automation-rules",void 0,s),Mt=(s,l,i)=>At(s,l,i),Be=(s,l)=>{if(s instanceof yt)switch(s.code){case"stock_permission_missing":return"发布失败:该账号没有库存发布权限,无法按库存数量发布商品。请换账号或先在闲鱼确认库存能力。";case"conflict":case"item_conflict":return"商品状态已发生变化,请刷新后重试。";case"external_result_unknown":case"manual_review_required":return"平台结果暂时无法确认,请先人工核对闲鱼状态,再决定是否重试。";case"retryable":case"temporarily_unavailable":return"平台暂时不可用,请稍后重试。";default:return s.message||l}if(s instanceof Error)return s.message;const i=typeof s=="object"&&s!==null&&"message"in s?s.message:void 0;return typeof i=="string"?i:l},qe=s=>s===!0||s===1||s==="1",Ze=async(s,l)=>{const i=await je("/api/v1/items",void 0,l);return Qe(i,["items","data","results"]).map(u=>({...u,id:u.id||`${u.cookie_id}-${u.item_id}`,is_multi_spec:qe(u.is_multi_spec),is_multi_qty_ship:qe(u.is_multi_qty_ship??u.multi_quantity_delivery),multi_quantity_delivery:qe(u.multi_quantity_delivery??u.is_multi_qty_ship)}))},Rt=async s=>ce("/api/v1/items/get-all-from-account",{cookie_id:s}),Ft=async(s,l)=>tt(`/api/v1/items/${s}/${l}`),Gt=async(s,l)=>ce(`/api/v1/items/${s}`,l),$t=async s=>{const l=new FormData;l.set("cookie_id",s.cookie_id),l.set("title",s.title),l.set("description",s.description),l.set("price",s.price),l.set("original_price",s.original_price||""),l.set("quantity",String(s.quantity)),l.set("postage_mode",s.postage_mode),l.set("postage",s.postage||""),s.location&&l.set("location",JSON.stringify(s.location));for(const i of s.images)l.append("images",i);return et("/api/v1/items/publish",l)},Dt=async(s,l,i)=>ce("/api/v1/items/publish-categories/recommend",{cookie_id:s,keyword:l},i),Tt=async(s,l)=>{const i=new FormData;return i.set("file",s.file),s.imagesZip&&i.set("images_zip",s.imagesZip),s.defaultCookieId&&i.set("default_cookie_id",s.defaultCookieId),i.set("fallback_category_id",s.fallbackCategory.catId),i.set("fallback_category_name",s.fallbackCategory.catName),i.set("fallback_channel_category_id",s.fallbackCategory.channelCatId||""),i.set("fallback_tb_category_id",s.fallbackCategory.tbCatLine truncated
|
||||
`),X=new Blob(["\uFEFF"+L],{type:"text/csv;charset=utf-8"}),F=URL.createObjectURL(X),P=document.createElement("a");P.href=F,P.download="批量铺货模板.csv",document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(F)},[]),n=r.useCallback(()=>{y(o=>({...o,cookie_id:s||o.cookie_id})),p(!0)},[s]),h=r.useCallback(()=>{v(o=>({...o,cookie_id:s||o.cookie_id})),d(!0)},[s]),q=r.useCallback(async o=>{if(!(o?s:b.cookie_id))return alert("请先选择发布账号");if(!navigator.geolocation)return alert("当前浏览器不支持定位");D();const L=new AbortController;H.current=L;const X=++z.current;S(!0);try{const F=await new Promise((ue,me)=>{const Ce=Q=>ue(Q),re=Q=>me(Q);navigator.geolocation.getCurrentPosition(Ce,re,{enableHighAccuracy:!0,timeout:15e3,maximumAge:6e4})});if(L.signal.aborted||X!==z.current)return;const P=await Mt(F.coords.longitude,F.coords.latitude,{signal:L.signal});if(L.signal.aborted||X!==z.current)return;if(!P.length)throw new Error("当前位置附近没有可用的高德发货地,请稍后重试");o?(R(P),k(P[0])):(W(P),U(P[0]))}catch(F){if(L.signal.aborted||X!==z.current)return;if(typeof F=="object"&&F!==null&&"code"in F){const P=F;alert(P.code===P.PERMISSION_DENIED?"定位权限被拒绝,请在浏览器设置中允许定位":"无法获取当前位置,请稍后重试")}else alert(Be(F,"获取发货地失败"))}finally{X===z.current&&(H.current=null,S(!1))}},[D,b.cookie_id,s,k,R]);return{selectedAccount:s,setSelectedAccount:l,loading:A,publishing:Z,showEditModal:G,setShowEditModal:E,showAddModal:M,setShowAddModal:p,showPublishModal:B,setShowPublishModal:d,locationLoading:j,publishLocations:V,setPublishLocations:W,publishLocation:Y,setPublishLocation:U,selectedItem:$,editForm:C,setEditForm:se,addForm:g,setAddForm:y,publishForm:b,setPublishForm:v,publishImagePreviews:x,handleSync:te,handleEdit:oe,handleSaveEdit:le,handleDelete:de,handleAddItem:xe,handlePublishItem:ve,downloadPublishTemplate:a,openAddModal:n,openPublishModal:h,locateForPublish:q}},Qt=s=>{const l=String(s||"").trim();return l?/^[¥¥]/.test(l)?l:`¥${l}`:"-"},as=({onConfigureDelivery:s})=>{const[l,i]=r.useState([]),[m,u]=r.useState([]),[f,R]=r.useState([]),[k,A]=r.useState(""),[I,Z]=r.useState(""),T=r.useRef(0),G=r.useRef(0),E=r.useCallback(async()=>{const t=++T.current,c=await Ze();t===T.current&&i(c)},[]),M=r.useCallback(async()=>{const t=++G.current,c=await Je();t===G.current&&u(c)},[]),p=Ht({selectedAccount:k,loadItems:E,loadShippingRules:M}),{showBatchModal:B,batchLoading:d,batchPhase:j,batchFile:S,setBatchFile:V,batchImagesZip:W,setBatchImagesZip:Y,batchCategoryKeyword:U,setBatchCategoryKeyword:$,batchCategoryLoading:K,batchFallbackCategory:C,setBatchFallbackCategory:se,batchPreview:g,batchDetail:y,recentBatch:b,setRecentBatch:v,batchLocations:x,batchLocation:ae,batchPublishIntervalSeconds:H,setBatchPublishIntervalSeconds:z,setBatchLocations:D,setBatchLocation:te,openBatchModal:oe,handleRecommendBatchCategory:le,openRecentBatchResult:de,handlePreviewBatch:xe,handleStartBatch:ve,handleCancelBatch:a,abandonBatchPreview:n,closeBatchModal:h,handleRetryBatchFailed:q}=p,o=Xt({selectedAccount:k,setSelectedAccount:A,setItems:i,loadItems:E,loadShippingRules:M,onConfigureDelivery:s,setBatchLocations:D,setBatchLocation:te}),{loading:N,publishing:L,showEditModal:X,setShowEditModal:F,showAddModal:P,setShowAddModal:ue,showPublishModal:me,setShowPublishModal:Ce,locationLoading:re,publishLocations:Q,setPublishLocations:at,publishLocation:lt,setPublishLocation:Le,selectedItem:Ae,editForm:ee,setEditForm:Ne,addForm:O,setAddForm:he,publishForm:w,setPublishForm:J,publishImagePreviews:Ee,handleSync:rt,handleEdit:nt,handleSaveEdit:it,handleDelete:ct,handleAddItem:ot,handlePublishItem:dt,downloadPublishTemplate:xt,openAddModal:ut,openPublishModal:mt,locateForPublish:Me}=o;r.useEffect(()=>{const t=new AbortController,c=++T.current,_=++G.current;let ge=!0;return Promise.all([Et({signal:t.signal}),Ze(void 0,{signal:t.signal}),Je({signal:t.signal}),st(20,{signal:t.signal})]).then(([ne,pt,gt,$e])=>{if(!ge||t.signal.aborted||c!==T.current||_!==G.current)return;R(ne),i(pt),u(gt);const bt=$e.find(Ie=>["running","canceling"].includes(Ie.status))||$e.find(Ie=>Ie.status!=="preview");v(bt||null)}).catch(ne=>{t.signal.aborted||console.error("加载商品配置失败:",ne)}),(()=>{ge=!1,t.abort()})},[]);const ht=t=>m.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id).length>0?m.filter(c=>c.cookie_id===t.cookie_id&&c.item_id===t.item_id):m.filter(c=>c.cookie_id===t.cookie_id&&!c.item_id),Re=r.useMemo(()=>new Map(f.map(t=>[t.id,t])),[f]),Fe=r.useMemo(()=>I?l.filter(t=>t.cookie_id===I):l,[I,l]),pe=t=>{const c=Re.get(t),_=(c==null?void 0:c.remark)||(c==null?void 0:c.nickname);return _?`${_} · ${t.slice(0,6)}`:`账号 ${t.slice(0,8)}`},Ge=t=>{const c=Re.get(t);return(c==null?void 0:c.remark)||(c==null?void 0:c.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"fl
Line truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{j as e,b as _e,r as d}from"./react-vendor-C_od1ZSF.js";import{ai as ee,ah as se,aj as Ne,u as K,e as W,L as I,w as ve,y as ke,t as Q,X as te,z as ae,F as ne,o as we,R as Se,N as Ce}from"./icons-vendor-DwxdQTKt.js";import{g as le,p as re,a as oe,d as Te}from"./index-zEvleK2K.js";const H=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],G=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},ie=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=H.some(n=>String(s[n]??"").trim()!=="");return{...s,use_custom_smtp:t?G(s.use_custom_smtp,!1):a}},ce=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const n of H)String(a[n]??"").trim()===""&&t[n]!==void 0&&(a[n]=t[n]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=G(a.smtp_use_tls,!0),a.smtp_use_ssl=G(a.smtp_use_ssl,!1),a},de=s=>{const t=ie(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const n of H)a[n]=t[n];return a},B={bark:{label:"Bark",icon:W,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:Ne,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:se,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的用户 ID",Line truncated
|
||||
import{j as e,b as _e,r as d}from"./react-vendor-C_od1ZSF.js";import{aj as ee,ai as se,ak as Ne,u as K,e as W,L as I,w as ve,y as ke,t as Q,X as te,z as ae,F as ne,o as we,R as Se,N as Ce}from"./icons-vendor-BP_RGPqo.js";import{g as le,p as re,a as oe,d as Te}from"./index-DJhzW1ER.js";const H=["smtp_server","smtp_port","smtp_user","smtp_password","smtp_from_name","smtp_from_address","smtp_use_tls","smtp_use_ssl"],G=(s,t)=>{if(typeof s=="boolean")return s;if(typeof s=="string"){if(["true","1","yes","on"].includes(s.toLowerCase()))return!0;if(["false","0","no","off"].includes(s.toLowerCase()))return!1}return t},ie=s=>{const t=Object.prototype.hasOwnProperty.call(s,"use_custom_smtp"),a=H.some(n=>String(s[n]??"").trim()!=="");return{...s,use_custom_smtp:t?G(s.use_custom_smtp,!1):a}},ce=(s,t)=>{const a={...s,use_custom_smtp:!0};for(const n of H)String(a[n]??"").trim()===""&&t[n]!==void 0&&(a[n]=t[n]);return a.smtp_port||(a.smtp_port=587),a.smtp_from_address||(a.smtp_from_address=a.smtp_user||""),a.smtp_use_tls=G(a.smtp_use_tls,!0),a.smtp_use_ssl=G(a.smtp_use_ssl,!1),a},de=s=>{const t=ie(s),a={to_email:String(t.to_email??"").trim(),use_custom_smtp:t.use_custom_smtp===!0};if(a.use_custom_smtp)for(const n of H)a[n]=t[n];return a},B={bark:{label:"Bark",icon:W,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"Ydisks闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app/<key>/这是测试推送内容","URL 路径里 <key> 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:K,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:Ne,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:se,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的用户 ID",Line truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{j as e,b as X,r as a}from"./react-vendor-C_od1ZSF.js";import{f as Z}from"./dateTime-DDi7rqpW.js";import{U as re,I as ie,X as H,J as ce,R as K,N as oe,O as ee,m as se,E as de,F as xe,V as me,y as ue,h as he,g as ge,o as pe}from"./icons-vendor-DwxdQTKt.js";import{g as U,o as be,c as ye,b as le,a as Y,p as fe,d as ne}from"./index-zEvleK2K.js";const ve=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],je=s=>{const t=typeof s=="object"&&s!==null?s:{},i=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:i.map(Ne)}},Ne=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},we=s=>(s==null?void 0:s.results.filter(_e))||[],_e=s=>!s.success,ke=(s,t)=>s!==null&&!t,Ce=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},T=(s,t)=>s===t,Se=(s,t)=>s instanceof Error&&s.message?s.message:t,Ee=({filter:s,onFilterChange:t,accountFilter:i,onAccountFilterChange:u,accounts:b,accountName:m,searchText:h,onSearchChange:N})=>{const g=l=>t(l.currentTarget.dataset.status||"all"),f=l=>u(l.target.value),y=l=>N(l.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:ve.map(l=>e.jsx("button",{"data-status":l.key,onClick:g,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===l.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:l.label},l.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:i,onChange:f,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),b.map(l=>e.jsx("option",{value:l.id,children:m(l.id)},l.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(ie,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:h,onChange:y,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Oe=s=>{const t=m=>{var h;s.setImportFile(((h=m.target.files)==null?void 0:h[0])||null)},i=()=>s.closeImportModal(),u=()=>void s.handleImportOrders(),b=()=>void s.handleRetryImport();return s.showImportModal?X.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:i,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(H,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:b,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:成功 ",s.importResult.success_count," 条,失败 ",s.iLine truncated
|
||||
import{j as e,b as X,r as a}from"./react-vendor-C_od1ZSF.js";import{f as Z}from"./dateTime-DDi7rqpW.js";import{U as re,I as ie,X as H,J as ce,R as K,N as oe,O as ee,m as se,E as de,F as xe,V as me,y as ue,h as he,g as ge,o as pe}from"./icons-vendor-BP_RGPqo.js";import{g as U,o as be,c as ye,b as le,a as Y,p as fe,d as ne}from"./index-DJhzW1ER.js";const ve=[{key:"all",label:"全部"},{key:"processing",label:"处理中"},{key:"shipped",label:"已发货"},{key:"pending_ship",label:"待发货"},{key:"completed",label:"已完成"},{key:"cancelled",label:"已取消"},{key:"refunding",label:"退款中"}],je=s=>{const t=typeof s=="object"&&s!==null?s:{},i=Array.isArray(t.results)?t.results:[];return{total:Number(t.total||0),success_count:Number(t.success_count||0),failed_count:Number(t.failed_count||0),results:i.map(Ne)}},Ne=s=>{const t=typeof s=="object"&&s!==null?s:{};return{order_id:String(t.order_id||"unknown"),success:t.success===!0,message:String(t.message||"")}},we=s=>(s==null?void 0:s.results.filter(_e))||[],_e=s=>!s.success,ke=(s,t)=>s!==null&&!t,Ce=s=>{if(!s)return"请选择订单文件";const t=s.name.toLowerCase().split(".").pop()||"";return["xlsx","csv","tsv","json"].includes(t)?"":"仅支持 .xlsx、.csv、.tsv、.json 格式"},T=(s,t)=>s===t,Se=(s,t)=>s instanceof Error&&s.message?s.message:t,Ee=({filter:s,onFilterChange:t,accountFilter:i,onAccountFilterChange:u,accounts:b,accountName:m,searchText:h,onSearchChange:N})=>{const g=l=>t(l.currentTarget.dataset.status||"all"),f=l=>u(l.target.value),y=l=>N(l.target.value);return e.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted",children:[e.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:ve.map(l=>e.jsx("button",{"data-status":l.key,onClick:g,className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${s===l.key?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:l.label},l.key))}),e.jsxs("div",{className:"flex w-full md:w-auto flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{"aria-label":"按账号筛选订单",value:i,onChange:f,className:"ios-input pl-10 pr-9 py-2.5 rounded-xl w-full sm:w-56 bg-white border-none shadow-sm",children:[e.jsx("option",{value:"",children:"全部账号"}),b.map(l=>e.jsx("option",{value:l.id,children:m(l.id)},l.id))]})]}),e.jsxs("div",{className:"relative group",children:[e.jsx(ie,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors"}),e.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:h,onChange:y,className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]})]})},Oe=s=>{const t=m=>{var h;s.setImportFile(((h=m.target.files)==null?void 0:h[0])||null)},i=()=>s.closeImportModal(),u=()=>void s.handleImportOrders(),b=()=>void s.handleRetryImport();return s.showImportModal?X.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),e.jsx("button",{onClick:i,className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(H,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),e.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:t,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),s.importFile&&e.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-900",children:s.importFile.name})]})}),s.importError&&e.jsxs("div",{className:"rounded-xl bg-red-50 border border-red-100 p-3 text-sm text-red-700 flex items-center justify-between gap-3",children:[e.jsx("span",{children:s.importError}),e.jsx("button",{type:"button",onClick:b,disabled:s.importing||!s.importFile,className:"font-bold whitespace-nowrap",children:"重试"})]}),s.importResult&&s.importResult.failed_count>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-100 p-3 text-sm font-bold text-amber-800",children:["导入完成:成功 ",s.importResult.success_count," 条,失败 ",s.iLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as e,r as d,b as Oe}from"./react-vendor-C_od1ZSF.js";import{k as We,ae as gt,af as At,m as $t,ag as bt,R as Ve,N as nt,Z as it,u as Mt,n as ot,I as Pt,a1 as It,X as Ae,V as qe,y as $e,h as Lt,g as Tt,a6 as Dt,ah as Ft,o as dt,ai as zt}from"./icons-vendor-BP_RGPqo.js";import{g as Z,o as Ie,c as Ze,p as Xe,a as ve,d as Qe}from"./index-DJhzW1ER.js";const Be=(t,a)=>t.allowed_resolutions.includes(a),Et=(t,a)=>({runs:t.runs.filter(i=>!a||i.cookie_id===a),pending_tasks:t.pending_tasks.filter(i=>!a||i.cookie_id===a)}),Ot=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",Vt=({runs:t,pendingTasks:a,onResolveRun:i,onResolveDeferredTask:g})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(We,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Ot(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Be(r,"continue")&&e.jsx("button",{onClick:(()=>i(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Be(r,"retry")&&e.jsx("button",{onClick:(()=>i(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Be(r,"cancel")&&e.jsx("button",{onClick:(()=>i(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),a.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>g(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>g(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),qt=async t=>Z("/api/v1/accounts/details",void 0,t),ht=async t=>Z("/api/v1/cards",void 0,t),yt=async(t,a)=>Z("/api/v1/items",void 0,a),_t=t=>t.map(a=>{var i,g;return{id:String(a.id),name:a.name||"",trigger_type:a.trigger_type||"order_paid",item_keyword:a.item_title||a.item_id||"",cookie_id:a.cookie_id||"",item_id:a.item_id||"",item_title:a.item_title||"",card_group_id:Number(((i=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:i.card_id)||0),card_group_name:((g=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:g.card_name)||"",priority:a.priority||100,enabled:a.enabled||!1,config_json:a.config_json||"{}",actions:(a.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(a.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let h={};try{h=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:h.spec_name||"",spec_value:h.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:h.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Bt=async()=>{const t=await Z("/api/v1/automation-rules"),a=Ze(t,["data","rules","items"]);return _t(a)},Jt=async({cookieId:t,triggerType:a,enabled:i,search:g,page:r=1,pageSize:h=10}={})=>{const $=await
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e,r as o,b as Fe}from"./react-vendor-C_od1ZSF.js";import{k as Je,ae as it,af as vt,m as Nt,R as Te,N as Ye,Z as He,u as wt,n as et,I as kt,a1 as Ct,X as ke,V as ze,y as Ce,h as St,g as Rt,a6 as At,ag as $t,o as tt,ah as Mt}from"./icons-vendor-DwxdQTKt.js";import{g as Z,o as Ae,c as Ge,p as Ke,a as fe,d as Ue}from"./index-zEvleK2K.js";const Ee=(t,a)=>t.allowed_resolutions.includes(a),Pt=(t,a)=>({runs:t.runs.filter(i=>!a||i.cookie_id===a),pending_tasks:t.pending_tasks.filter(i=>!a||i.cookie_id===a)}),Lt=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",It=({runs:t,pendingTasks:a,onResolveRun:i,onResolveDeferredTask:u})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Je,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Lt(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[Ee(r,"continue")&&e.jsx("button",{onClick:(()=>i(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),Ee(r,"retry")&&e.jsx("button",{onClick:(()=>i(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),Ee(r,"cancel")&&e.jsx("button",{onClick:(()=>i(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),a.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>u(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>u(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Dt=async t=>Z("/api/v1/accounts/details",void 0,t),ot=async t=>Z("/api/v1/cards",void 0,t),dt=async(t,a)=>Z("/api/v1/items",void 0,a),ct=t=>t.map(a=>{var i,u;return{id:String(a.id),name:a.name||"",trigger_type:a.trigger_type||"order_paid",item_keyword:a.item_title||a.item_id||"",cookie_id:a.cookie_id||"",item_id:a.item_id||"",item_title:a.item_title||"",card_group_id:Number(((i=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:i.card_id)||0),card_group_name:((u=(a.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:u.card_name)||"",priority:a.priority||100,enabled:a.enabled||!1,config_json:a.config_json||"{}",actions:(a.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(a.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let y={};try{y=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:y.spec_name||"",spec_value:y.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:y.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),Ft=async()=>{const t=await Z("/api/v1/automation-rules"),a=Ge(t,["data","rules","items"]);return ct(a)},Tt=async({cookieId:t,triggerType:a,enabled:i,search:u,page:r=1,pageSize:y=10}={})=>{const A=await Z("/api/vLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{r,j as e}from"./react-vendor-C_od1ZSF.js";import{a as xe,g as re,p as le}from"./index-zEvleK2K.js";import{f as ue,R as se,aa as pe,r as me,z as R,F as O,ab as he,t as ge,S as te,ac as ae,ad as ye,o as fe}from"./icons-vendor-DwxdQTKt.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",be=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],we=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),je=s=>{if("values"in s||"secrets"in s)return s;const a={},o={};for(const[d,h]of Object.entries(s))if(h!=null){if(oe.has(d)){o[d]=h===""?{action:"clear"}:{action:"replace",value:String(h)};continue}a[d]=h}return Object.keys(o).length>0?{values:a,secrets:o}:a},ve=s=>{const a={...s};for(const o of oe){const d=`${o}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const o=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(o)?o:10}return a},_e=async(s,a)=>le("/api/v1/session/credentials",s,a),Ne=async s=>{const a=await re("/api/v1/settings/system",void 0,s),o=a.data||a.settings||a;return ve(o)},Se=async(s,a)=>le("/api/v1/settings/system",je(s),a),ke=async(s,a="",o)=>{const d=await xe("/api/v1/settings/ai-models",{base_url:s,api_key:a},o);return Array.isArray(d.models)?d.models:[]},Ce=async s=>re("/api/v1/session",void 0,s),Ee=s=>Object.fromEntries(Object.entries(s).filter(([a,o])=>!we.has(a)&&o!==void 0&&o!==null)),Ae=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,o)=>s===a&&!o.aborted,D=s=>s instanceof Error&&s.message==="请求已取消",K=(s,a)=>s instanceof Error?s.message:a,Ie=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),T=(s,a)=>({type:s,text:a}),Me=()=>{const[s,a]=r.useState(null),[o,d]=r.useState(!1),[h,p]=r.useState(""),[S,A]=r.useState(!1),[P,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[M,x]=r.useState(""),[$,v]=r.useState(!1),[z,q]=r.useState(!1),[U,u]=r.useState(!1),[b,F]=r.useState(!1),[G,V]=r.useState(!1),[Y,_]=r.useState(!1),[L,y]=r.useState(null),[t,X]=r.useState(()=>Ie()),[ce,J]=r.useState("idle"),Z=r.useRef(null),ee=r.useRef(null),m=r.useRef(0),W=r.useRef(null);ee.current=s;const E=r.useCallback(()=>{var c;(c=W.current)==null||c.abort();const n=new AbortController;return W.current=n,m.current+=1,{controller:n,sequence:m.current}},[]),B=r.useCallback(async(n,c=!1,l)=>{const i=n||ee.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),x("");try{const N=await ke(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Q=>Q&&{...Q,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||D(N))return;w([]),v(!1),x(K(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),H=r.useCallback(()=>{const{controller:n,sequence:c}=E();d(!0),J("loading"),p(""),Promise.all([Ne({signal:n.signal}),Ce({signal:n.signal})]).then(([l,i])=>{f(m.current,c,n.signal)&&(a(l),i.username&&X(g=>({...g,new_username:i.username||""})),B(l,!1,n.signal),J("success"))}).catch(l=>{!f(m.current,c,n.signal)||D(l)||(a(null),p(K(l,"加载配置失败")),J("error"))}).finally(()=>{f(m.current,c,n.signal)&&d(!1)})},[E,B]);r.useEffect(()=>(H(),(()=>{var n;return(n=W.current)==null?void 0:n.abort()})),[H]),r.useEffect(()=>{const n=c=>{var l;(l=Z.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",n),(()=>document.removeEventListener("mousedown",n))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:n,sequence:c}=E();A(!0),k("");try{if(await Se(Ee(s),{signal:n.signal}),!f(m.current,c,n.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(m.current,c,n.signal)||D(l))return;k(K(l,"保存配置失败"))}finally{f(m.current,c,n.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async n=>{n.preventDefault(),y(null);const c=Ae(t);if(c){y(T("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await _e({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(m.current,i,l.signal))return;if(!g.success){y(T("error",g.message||"登录凭据更新失败"));return}y(T("success",g.message||"登录凭据已更新")),window.setTimeout(()=>windLine truncated
|
||||
import{r,j as e}from"./react-vendor-C_od1ZSF.js";import{a as xe,g as re,p as le}from"./index-DJhzW1ER.js";import{f as ue,R as se,aa as pe,r as me,z as R,F as O,ab as he,t as ge,S as te,ac as ae,ad as ye,o as fe}from"./icons-vendor-BP_RGPqo.js";const ne="https://dashscope.aliyuncs.com/compatible-mode/v1",be=[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],we=new Set(["ai_api_key_configured","smtp_password_configured","qq_reply_secret_key_configured","captcha.remote_secret_key_configured","smtp_server","smtp_port","smtp_user","smtp_password","smtp_from","smtp_from_name","smtp_from_address","registration_enabled","show_default_login_info","login_captcha_enabled","item_sync_enabled","item_sync_interval","item_sync_max_pages","default_reply"]),oe=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),je=s=>{if("values"in s||"secrets"in s)return s;const a={},o={};for(const[d,h]of Object.entries(s))if(h!=null){if(oe.has(d)){o[d]=h===""?{action:"clear"}:{action:"replace",value:String(h)};continue}a[d]=h}return Object.keys(o).length>0?{values:a,secrets:o}:a},ve=s=>{const a={...s};for(const o of oe){const d=`${o}_configured`;d in a&&(a[d]=a[d]===!0||a[d]==="true")}if("renewal_log_retention_days"in a){const o=Number(a.renewal_log_retention_days);a.renewal_log_retention_days=Number.isFinite(o)?o:10}return a},_e=async(s,a)=>le("/api/v1/session/credentials",s,a),Ne=async s=>{const a=await re("/api/v1/settings/system",void 0,s),o=a.data||a.settings||a;return ve(o)},Se=async(s,a)=>le("/api/v1/settings/system",je(s),a),ke=async(s,a="",o)=>{const d=await xe("/api/v1/settings/ai-models",{base_url:s,api_key:a},o);return Array.isArray(d.models)?d.models:[]},Ce=async s=>re("/api/v1/session",void 0,s),Ee=s=>Object.fromEntries(Object.entries(s).filter(([a,o])=>!we.has(a)&&o!==void 0&&o!==null)),Ae=s=>s.new_username.trim().length<3?"用户名至少需要 3 个字符":s.current_password?s.new_password&&s.new_password.length<8?"新密码至少需要 8 个字符":s.new_password!==s.confirm_password?"两次输入的新密码不一致":"":"请输入当前密码确认身份",f=(s,a,o)=>s===a&&!o.aborted,D=s=>s instanceof Error&&s.message==="请求已取消",K=(s,a)=>s instanceof Error?s.message:a,Ie=(s="")=>({new_username:s,current_password:"",new_password:"",confirm_password:""}),T=(s,a)=>({type:s,text:a}),Me=()=>{const[s,a]=r.useState(null),[o,d]=r.useState(!1),[h,p]=r.useState(""),[S,A]=r.useState(!1),[P,k]=r.useState(""),[C,w]=r.useState([]),[j,I]=r.useState(!1),[M,x]=r.useState(""),[$,v]=r.useState(!1),[z,q]=r.useState(!1),[U,u]=r.useState(!1),[b,F]=r.useState(!1),[G,V]=r.useState(!1),[Y,_]=r.useState(!1),[L,y]=r.useState(null),[t,X]=r.useState(()=>Ie()),[ce,J]=r.useState("idle"),Z=r.useRef(null),ee=r.useRef(null),m=r.useRef(0),W=r.useRef(null);ee.current=s;const E=r.useCallback(()=>{var c;(c=W.current)==null||c.abort();const n=new AbortController;return W.current=n,m.current+=1,{controller:n,sequence:m.current}},[]),B=r.useCallback(async(n,c=!1,l)=>{const i=n||ee.current,g=(i==null?void 0:i.ai_api_url)||(i==null?void 0:i.ai_base_url)||ne;I(!0),x("");try{const N=await ke(g,(i==null?void 0:i.ai_api_key)||"",{signal:l});if(l!=null&&l.aborted)return;w(N),v(c&&N.length>0),!(i!=null&&i.ai_model)&&N.length>0&&a(Q=>Q&&{...Q,ai_model:N[0]})}catch(N){if(l!=null&&l.aborted||D(N))return;w([]),v(!1),x(K(N,"读取模型失败"))}finally{l!=null&&l.aborted||I(!1)}},[]),H=r.useCallback(()=>{const{controller:n,sequence:c}=E();d(!0),J("loading"),p(""),Promise.all([Ne({signal:n.signal}),Ce({signal:n.signal})]).then(([l,i])=>{f(m.current,c,n.signal)&&(a(l),i.username&&X(g=>({...g,new_username:i.username||""})),B(l,!1,n.signal),J("success"))}).catch(l=>{!f(m.current,c,n.signal)||D(l)||(a(null),p(K(l,"加载配置失败")),J("error"))}).finally(()=>{f(m.current,c,n.signal)&&d(!1)})},[E,B]);r.useEffect(()=>(H(),(()=>{var n;return(n=W.current)==null?void 0:n.abort()})),[H]),r.useEffect(()=>{const n=c=>{var l;(l=Z.current)!=null&&l.contains(c.target)||v(!1)};return document.addEventListener("mousedown",n),(()=>document.removeEventListener("mousedown",n))},[]);const ie=r.useCallback(async()=>{if(!s||S)return;const{controller:n,sequence:c}=E();A(!0),k("");try{if(await Se(Ee(s),{signal:n.signal}),!f(m.current,c,n.signal))return;window.alert("系统配置已保存")}catch(l){if(!f(m.current,c,n.signal)||D(l))return;k(K(l,"保存配置失败"))}finally{f(m.current,c,n.signal)&&A(!1)}},[E,S,s]),de=r.useCallback(async n=>{n.preventDefault(),y(null);const c=Ae(t);if(c){y(T("error",c));return}const{controller:l,sequence:i}=E();_(!0);try{const g=await _e({current_password:t.current_password,new_username:t.new_username.trim(),new_password:t.new_password||void 0},{signal:l.signal});if(!f(m.current,i,l.signal))return;if(!g.success){y(T("error",g.message||"登录凭据更新失败"));return}y(T("success",g.message||"登录凭据已更新")),window.setTimeout(()=>windLine truncated
|
||||
+84
-79
@@ -23,394 +23,399 @@ import{r as h}from"./react-vendor-C_od1ZSF.js";/**
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],O1=e("activity",g);/**
|
||||
*/const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Z1=e("activity",g);/**
|
||||
* @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 u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Z1=e("arrow-right",u);/**
|
||||
*/const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],K1=e("arrow-right",u);/**
|
||||
* @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 $=[["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"}]],K1=e("bell",$);/**
|
||||
*/const $=[["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"}]],G1=e("bell",$);/**
|
||||
* @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 N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],G1=e("bot",N);/**
|
||||
*/const N=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Q1=e("bot",N);/**
|
||||
* @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 f=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Q1=e("box",f);/**
|
||||
*/const f=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],J1=e("box",f);/**
|
||||
* @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 w=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],J1=e("calendar-clock",w);/**
|
||||
*/const w=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],X1=e("calendar-clock",w);/**
|
||||
* @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 z=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],X1=e("check-check",z);/**
|
||||
*/const z=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],Y1=e("check-check",z);/**
|
||||
* @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 b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Y1=e("check",b);/**
|
||||
*/const b=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],e2=e("check",b);/**
|
||||
* @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 q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e2=e("chevron-down",q);/**
|
||||
*/const q=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],a2=e("chevron-down",q);/**
|
||||
* @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 C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],a2=e("chevron-left",C);/**
|
||||
*/const C=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],t2=e("chevron-left",C);/**
|
||||
* @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 j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],t2=e("chevron-right",j);/**
|
||||
*/const j=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c2=e("chevron-right",j);/**
|
||||
* @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 A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],c2=e("circle-alert",A);/**
|
||||
*/const A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],o2=e("circle-alert",A);/**
|
||||
* @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 H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],o2=e("circle-check",H);/**
|
||||
*/const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],y2=e("circle-check",H);/**
|
||||
* @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 V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],y2=e("circle-dashed",V);/**
|
||||
*/const V=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],h2=e("circle-dashed",V);/**
|
||||
* @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 L=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],h2=e("clock-3",L);/**
|
||||
*/const L=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],s2=e("circle-dollar-sign",L);/**
|
||||
* @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 P=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],s2=e("clock",P);/**
|
||||
*/const S=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],d2=e("clock-3",S);/**
|
||||
* @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 S=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],d2=e("cloud-upload",S);/**
|
||||
*/const P=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n2=e("clock",P);/**
|
||||
* @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 U=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],n2=e("code",U);/**
|
||||
*/const U=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],k2=e("cloud-upload",U);/**
|
||||
* @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 E=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],k2=e("copy",E);/**
|
||||
*/const D=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],i2=e("code",D);/**
|
||||
* @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 B=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],i2=e("credit-card",B);/**
|
||||
*/const E=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],p2=e("copy",E);/**
|
||||
* @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 D=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],p2=e("database",D);/**
|
||||
*/const B=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],r2=e("credit-card",B);/**
|
||||
* @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 R=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],r2=e("dollar-sign",R);/**
|
||||
*/const R=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],l2=e("database",R);/**
|
||||
* @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 T=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],l2=e("external-link",T);/**
|
||||
*/const T=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],M2=e("dollar-sign",T);/**
|
||||
* @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 W=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],M2=e("eye-off",W);/**
|
||||
*/const W=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_2=e("external-link",W);/**
|
||||
* @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 F=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_2=e("eye",F);/**
|
||||
*/const F=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],x2=e("eye-off",F);/**
|
||||
* @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 I=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],x2=e("file-down",I);/**
|
||||
*/const I=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],v2=e("eye",I);/**
|
||||
* @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 O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],v2=e("file-text",O);/**
|
||||
*/const O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],m2=e("file-down",O);/**
|
||||
* @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 Z=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],m2=e("funnel",Z);/**
|
||||
*/const Z=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],g2=e("file-text",Z);/**
|
||||
* @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 K=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],g2=e("gift",K);/**
|
||||
*/const K=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],u2=e("funnel",K);/**
|
||||
* @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 G=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],u2=e("git-commit-horizontal",G);/**
|
||||
*/const G=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],$2=e("gift",G);/**
|
||||
* @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 Q=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],$2=e("image-plus",Q);/**
|
||||
*/const Q=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],N2=e("git-commit-horizontal",Q);/**
|
||||
* @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 J=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],N2=e("image",J);/**
|
||||
*/const J=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],f2=e("image-plus",J);/**
|
||||
* @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 X=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],f2=e("key",X);/**
|
||||
*/const X=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],w2=e("image",X);/**
|
||||
* @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 Y=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],w2=e("layers",Y);/**
|
||||
*/const Y=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],z2=e("key",Y);/**
|
||||
* @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 e1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],z2=e("layout-dashboard",e1);/**
|
||||
*/const e1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],b2=e("layers",e1);/**
|
||||
* @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 a1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],b2=e("link-2",a1);/**
|
||||
*/const a1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],q2=e("layout-dashboard",a1);/**
|
||||
* @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 t1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],q2=e("list-plus",t1);/**
|
||||
*/const t1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],C2=e("link-2",t1);/**
|
||||
* @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 c1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],C2=e("loader-circle",c1);/**
|
||||
*/const c1=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],j2=e("list-plus",c1);/**
|
||||
* @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 o1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],j2=e("locate-fixed",o1);/**
|
||||
*/const o1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],A2=e("loader-circle",o1);/**
|
||||
* @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 y1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],A2=e("lock-keyhole",y1);/**
|
||||
*/const y1=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],H2=e("locate-fixed",y1);/**
|
||||
* @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 h1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],H2=e("lock",h1);/**
|
||||
*/const h1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],V2=e("lock-keyhole",h1);/**
|
||||
* @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 s1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],V2=e("log-out",s1);/**
|
||||
*/const s1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],L2=e("lock",s1);/**
|
||||
* @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 d1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],L2=e("mail",d1);/**
|
||||
*/const d1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],S2=e("log-out",d1);/**
|
||||
* @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 n1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],P2=e("message-circle-more",n1);/**
|
||||
*/const n1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],P2=e("mail",n1);/**
|
||||
* @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 k1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],S2=e("message-circle",k1);/**
|
||||
*/const k1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]],U2=e("message-circle-more",k1);/**
|
||||
* @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 i1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],U2=e("message-square-quote",i1);/**
|
||||
*/const i1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],D2=e("message-circle",i1);/**
|
||||
* @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 p1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],E2=e("package-check",p1);/**
|
||||
*/const p1=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],E2=e("message-square-quote",p1);/**
|
||||
* @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 r1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],B2=e("package-plus",r1);/**
|
||||
*/const r1=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],B2=e("package-check",r1);/**
|
||||
* @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 l1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],D2=e("package",l1);/**
|
||||
*/const l1=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],R2=e("package-plus",l1);/**
|
||||
* @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 M1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],R2=e("pen",M1);/**
|
||||
*/const M1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],T2=e("package",M1);/**
|
||||
* @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 _1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],T2=e("play",_1);/**
|
||||
*/const _1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],W2=e("pen",_1);/**
|
||||
* @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 x1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],W2=e("plus",x1);/**
|
||||
*/const x1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],F2=e("play",x1);/**
|
||||
* @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 v1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],F2=e("power",v1);/**
|
||||
*/const v1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],I2=e("plus",v1);/**
|
||||
* @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 m1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],I2=e("qr-code",m1);/**
|
||||
*/const m1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],O2=e("power",m1);/**
|
||||
* @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 g1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],O2=e("refresh-cw",g1);/**
|
||||
*/const g1=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Z2=e("qr-code",g1);/**
|
||||
* @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 u1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Z2=e("save",u1);/**
|
||||
*/const u1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],K2=e("refresh-cw",u1);/**
|
||||
* @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 $1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],K2=e("search",$1);/**
|
||||
*/const $1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],G2=e("save",$1);/**
|
||||
* @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 N1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],G2=e("send",N1);/**
|
||||
*/const N1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Q2=e("search",N1);/**
|
||||
* @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 f1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Q2=e("settings",f1);/**
|
||||
*/const f1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],J2=e("send",f1);/**
|
||||
* @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 w1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],J2=e("shield-check",w1);/**
|
||||
*/const w1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],X2=e("settings",w1);/**
|
||||
* @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 z1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],X2=e("shopping-bag",z1);/**
|
||||
*/const z1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Y2=e("shield-check",z1);/**
|
||||
* @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 b1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Y2=e("shopping-cart",b1);/**
|
||||
*/const b1=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],e0=e("shopping-bag",b1);/**
|
||||
* @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 q1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],e0=e("sliders-horizontal",q1);/**
|
||||
*/const q1=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],a0=e("shopping-cart",q1);/**
|
||||
* @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 C1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],a0=e("smile",C1);/**
|
||||
*/const C1=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],t0=e("sliders-horizontal",C1);/**
|
||||
* @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 j1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],t0=e("sparkles",j1);/**
|
||||
*/const j1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],c0=e("smile",j1);/**
|
||||
* @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 A1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],c0=e("square-pen",A1);/**
|
||||
*/const A1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],o0=e("sparkles",A1);/**
|
||||
* @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 H1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],o0=e("trash-2",H1);/**
|
||||
*/const H1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],y0=e("square-pen",H1);/**
|
||||
* @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 V1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],y0=e("trending-up",V1);/**
|
||||
*/const V1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],h0=e("trash-2",V1);/**
|
||||
* @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 L1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],h0=e("triangle-alert",L1);/**
|
||||
*/const L1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],s0=e("trending-up",L1);/**
|
||||
* @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 P1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],s0=e("truck",P1);/**
|
||||
*/const S1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],d0=e("triangle-alert",S1);/**
|
||||
* @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 S1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],d0=e("upload",S1);/**
|
||||
*/const P1=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],n0=e("truck",P1);/**
|
||||
* @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 U1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],n0=e("user-round",U1);/**
|
||||
*/const U1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],k0=e("upload",U1);/**
|
||||
* @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 E1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],k0=e("user",E1);/**
|
||||
*/const D1=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],i0=e("user-round",D1);/**
|
||||
* @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 B1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],i0=e("users",B1);/**
|
||||
*/const E1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],p0=e("user",E1);/**
|
||||
* @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 D1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],p0=e("webhook",D1);/**
|
||||
*/const B1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],r0=e("users",B1);/**
|
||||
* @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 R1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],r0=e("wifi-off",R1);/**
|
||||
*/const R1=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],l0=e("webhook",R1);/**
|
||||
* @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 T1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],l0=e("wifi",T1);/**
|
||||
*/const T1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],M0=e("wifi-off",T1);/**
|
||||
* @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 W1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],M0=e("x",W1);/**
|
||||
*/const W1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],_0=e("wifi",W1);/**
|
||||
* @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 F1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],_0=e("zap",F1);export{N2 as $,Z1 as A,Q1 as B,i2 as C,r2 as D,l2 as E,_2 as F,u2 as G,h0 as H,K2 as I,d0 as J,f2 as K,C2 as L,P2 as M,W2 as N,s0 as O,D2 as P,I2 as Q,O2 as R,J2 as S,y0 as T,k0 as U,c0 as V,q2 as W,M0 as X,x2 as Y,_0 as Z,n2 as _,H2 as a,v2 as a0,e0 as a1,k2 as a2,m2 as a3,B2 as a4,d2 as a5,o2 as a6,y2 as a7,b2 as a8,j2 as a9,p2 as aa,e2 as ab,A2 as ac,n0 as ad,h2 as ae,g2 as af,w2 as ag,G2 as ah,L2 as ai,p0 as aj,l0 as ak,r0 as al,X1 as am,a0 as an,$2 as ao,z2 as b,i0 as c,X2 as d,K1 as e,Q2 as f,t2 as g,a2 as h,V2 as i,Y2 as j,c2 as k,O1 as l,E2 as m,G1 as n,Z2 as o,U2 as p,T2 as q,t0 as r,J1 as s,Y1 as t,S2 as u,s2 as v,R2 as w,F2 as x,o0 as y,M2 as z};
|
||||
*/const F1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x0=e("x",F1);/**
|
||||
* @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 I1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],v0=e("zap",I1);export{w2 as $,K1 as A,J1 as B,r2 as C,M2 as D,_2 as E,v2 as F,N2 as G,d0 as H,Q2 as I,k0 as J,z2 as K,A2 as L,U2 as M,I2 as N,n0 as O,T2 as P,Z2 as Q,K2 as R,Y2 as S,s0 as T,p0 as U,y0 as V,j2 as W,x0 as X,m2 as Y,v0 as Z,i2 as _,L2 as a,g2 as a0,t0 as a1,p2 as a2,u2 as a3,R2 as a4,k2 as a5,y2 as a6,h2 as a7,C2 as a8,H2 as a9,l2 as aa,a2 as ab,V2 as ac,i0 as ad,d2 as ae,$2 as af,s2 as ag,b2 as ah,J2 as ai,P2 as aj,l0 as ak,_0 as al,M0 as am,Y1 as an,c0 as ao,f2 as ap,q2 as b,r0 as c,e0 as d,G1 as e,X2 as f,c2 as g,t2 as h,S2 as i,a0 as j,o2 as k,Z1 as l,B2 as m,Q1 as n,G2 as o,E2 as p,F2 as q,o0 as r,X1 as s,e2 as t,D2 as u,n2 as v,W2 as w,O2 as x,h0 as y,x2 as z};
|
||||
@@ -1 +0,0 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-C9RwPfK-.js","assets/react-vendor-C_od1ZSF.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-DwxdQTKt.js","assets/charts-vendor-deWqkrdG.js","assets/vendor-Es4K8PXl.js","assets/vendor-DUblxfbA.css","assets/AccountList-bbR-Z2_J.js","assets/OrderList-Dma_R9-T.js","assets/CardList-CvCo2zF6.js","assets/ItemList-CZPbhJDg.js","assets/Settings-BmdW4Gos.js","assets/Rules-CeggCy2B.js","assets/Notifications-DUiNU4WL.js","assets/Chat-CKN6Wl0-.js"])))=>i.map(i=>d[i]);
|
||||
import{c as R,j as t,r as l,d as te}from"./react-vendor-C_od1ZSF.js";import{L as U,a as O,S as se,U as ne,A as re,b as ae,c as oe,M as ie,C as ce,B as le,d as de,Z as ue,e as he,f as me,G as M,g as fe,h as pe,i as xe}from"./icons-vendor-DwxdQTKt.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();class ge extends R.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:n}=this.state,{children:s}=this.props;return n?t.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:t.jsxs("section",{className:"max-w-md text-center",children:[t.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),t.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):s}}const be=3e4,ye=10*6e4;let P=!1;class q extends Error{constructor(n,s){super(je(s,n)),this.name="ApiError",this.status=n,this.code=E(s)?s.code:`http_${n}`,this.requestId=E(s)?s.request_id:void 0,this.request_id=this.requestId,this.details=E(s)?s.details:void 0,this.payload=s}}const F=()=>{P||typeof window>"u"||(P=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{P=!1}))},ve=e=>{if(!e)return"";const n=new URLSearchParams;for(const[o,r]of Object.entries(e))r!=null&&n.set(o,String(r));const s=n.toString();return s?`?${s}`:""},A=async(e,n,s={})=>{var d;const o=ve(s.params),r=`${n}${o}`,i=B(s.signal,s.timeoutMs??be);let a;try{a=await fetch(r,{method:e,credentials:"include",signal:i.signal,headers:{...s.body===void 0?{}:{"Content-Type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(h){throw i.signal.aborted?new Error((d=s.signal)!=null&&d.aborted?"请求已取消":"请求超时,请稍后重试"):h}finally{i.cleanup()}const u=(a.headers.get("content-type")||"").includes("application/json");if(!a.ok){a.status===401&&!s.skipAuthLogout&&F();const h=await V(a,u);throw new q(a.status,h)}return u?await a.json():await a.text()},j=async(e,n,s)=>A("GET",e,{params:n,...s}),L=async(e,n,s)=>A("POST",e,{body:n,...s}),ot=async(e,n,s)=>A("PUT",e,{body:n,...s}),it=async(e,n,s)=>A("DELETE",e,{params:n,...s}),we=async(e,n,s={})=>{var u;const o=B(s.signal,s.timeoutMs??ye);let r;try{r=await fetch(e,{method:"POST",credentials:"include",signal:o.signal,body:n})}catch(d){throw o.signal.aborted?new Error((u=s.signal)!=null&&u.aborted?"请求已取消":"上传超时,请稍后重试"):d}finally{o.cleanup()}const a=(r.headers.get("content-type")||"").includes("application/json"),c=await V(r,a);if(!r.ok)throw r.status===401&&F(),new q(r.status,c);return c},B=(e,n)=>{const s=new AbortController,o=()=>s.abort(e==null?void 0:e.reason);e!=null&&e.aborted?o():e==null||e.addEventListener("abort",o,{once:!0});const r=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,n));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(r),e==null||e.removeEventListener("abort",o)}}},V=async(e,n)=>n?e.json().catch(()=>{}):e.text().catch(()=>{}),E=e=>{if(typeof e!="object"||e===null)return!1;const n=e;return typeof n.code=="string"&&typeof n.message=="string"},je=(e,n)=>typeof e=="string"?e:E(e)?e.message:`请求失败: ${n}`,Le=async e=>L("/api/v1/session/login",e,{skipAuthLogout:!0}),Ce=async e=>L("/api/v1/session/initialize",{password:e},{skipAuthLogout:!0}),Ne=async e=>j("/api/v1/session",void 0,e),Ee=async()=>L("/api/v1/session/logout",{}),G=l.createContext(void 0),Se=({children:e})=>{const[n,s]=l.useState(!1),[o,r]=l.useState(!1),[i,a]=l.useState(!0),[c,u]=l.useState(!1),d=()=>{s(!1),r(!1)};l.useEffect(()=>{const x=new AbortController;let p=!0;Ne({signal:x.signal}).then(b=>{if(p){if((b==null?void 0:b.initialized)===!1){u(!0),d();return}u(!1),b!=null&&b.authenticated?(s(!0),r(b.is_admin===!0)):d()}}).catch(b=>{!p||b instanceof DOMException&&b.name==="AbortError"||(u(!1),d())}).finally(()=>{p&&a(!1)});const m=()=>d();return window.addEventListener("auth:logout",m),(()=>{p=!1,x.abort(),window.removeEventListener("auth:logout",m)})},[]);const h=async x=>{const p=await Le(x);return p.success&&(u(!1),s(!0),r(p.is_admin===!0)),p},g=async x=>{const p=await Ce(x);return p.success&&(u(!1),s(!0Line truncated
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-NfnNIx-0.js","assets/react-vendor-C_od1ZSF.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-BP_RGPqo.js","assets/charts-vendor-deWqkrdG.js","assets/vendor-Es4K8PXl.js","assets/vendor-DUblxfbA.css","assets/AccountList-DNYhASF8.js","assets/OrderList-Cv77w4wV.js","assets/CardList-BNhM7Nsy.js","assets/ItemList-BQ1666J4.js","assets/Settings-nmmlNL7R.js","assets/Rules-BTuZkOWs.js","assets/Notifications-pFIU2IhO.js","assets/Chat-B7Pd0rqO.js"])))=>i.map(i=>d[i]);
|
||||
import{c as R,j as t,r as l,d as te}from"./react-vendor-C_od1ZSF.js";import{L as U,a as O,S as se,U as ne,A as re,b as ae,c as oe,M as ie,C as ce,B as le,d as de,Z as ue,e as he,f as me,G as M,g as fe,h as pe,i as xe}from"./icons-vendor-BP_RGPqo.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();class ge extends R.Component{constructor(){super(...arguments),this.state={hasError:!1},this.handleReload=()=>{window.location.reload()}}static getDerivedStateFromError(){return{hasError:!0}}render(){const{hasError:n}=this.state,{children:s}=this.props;return n?t.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas p-6 text-ink",children:t.jsxs("section",{className:"max-w-md text-center",children:[t.jsx("h1",{className:"text-xl font-semibold",children:"页面暂时无法显示"}),t.jsx("button",{className:"ios-btn-primary mt-6 px-4 py-2",type:"button",onClick:this.handleReload,children:"重新加载"})]})}):s}}const be=3e4,ye=10*6e4;let P=!1;class q extends Error{constructor(n,s){super(je(s,n)),this.name="ApiError",this.status=n,this.code=E(s)?s.code:`http_${n}`,this.requestId=E(s)?s.request_id:void 0,this.request_id=this.requestId,this.details=E(s)?s.details:void 0,this.payload=s}}const F=()=>{P||typeof window>"u"||(P=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{P=!1}))},ve=e=>{if(!e)return"";const n=new URLSearchParams;for(const[o,r]of Object.entries(e))r!=null&&n.set(o,String(r));const s=n.toString();return s?`?${s}`:""},A=async(e,n,s={})=>{var d;const o=ve(s.params),r=`${n}${o}`,i=B(s.signal,s.timeoutMs??be);let a;try{a=await fetch(r,{method:e,credentials:"include",signal:i.signal,headers:{...s.body===void 0?{}:{"Content-Type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(h){throw i.signal.aborted?new Error((d=s.signal)!=null&&d.aborted?"请求已取消":"请求超时,请稍后重试"):h}finally{i.cleanup()}const u=(a.headers.get("content-type")||"").includes("application/json");if(!a.ok){a.status===401&&!s.skipAuthLogout&&F();const h=await V(a,u);throw new q(a.status,h)}return u?await a.json():await a.text()},j=async(e,n,s)=>A("GET",e,{params:n,...s}),L=async(e,n,s)=>A("POST",e,{body:n,...s}),ot=async(e,n,s)=>A("PUT",e,{body:n,...s}),it=async(e,n,s)=>A("DELETE",e,{params:n,...s}),we=async(e,n,s={})=>{var u;const o=B(s.signal,s.timeoutMs??ye);let r;try{r=await fetch(e,{method:"POST",credentials:"include",signal:o.signal,body:n})}catch(d){throw o.signal.aborted?new Error((u=s.signal)!=null&&u.aborted?"请求已取消":"上传超时,请稍后重试"):d}finally{o.cleanup()}const a=(r.headers.get("content-type")||"").includes("application/json"),c=await V(r,a);if(!r.ok)throw r.status===401&&F(),new q(r.status,c);return c},B=(e,n)=>{const s=new AbortController,o=()=>s.abort(e==null?void 0:e.reason);e!=null&&e.aborted?o():e==null||e.addEventListener("abort",o,{once:!0});const r=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,n));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(r),e==null||e.removeEventListener("abort",o)}}},V=async(e,n)=>n?e.json().catch(()=>{}):e.text().catch(()=>{}),E=e=>{if(typeof e!="object"||e===null)return!1;const n=e;return typeof n.code=="string"&&typeof n.message=="string"},je=(e,n)=>typeof e=="string"?e:E(e)?e.message:`请求失败: ${n}`,Le=async e=>L("/api/v1/session/login",e,{skipAuthLogout:!0}),Ce=async e=>L("/api/v1/session/initialize",{password:e},{skipAuthLogout:!0}),Ne=async e=>j("/api/v1/session",void 0,e),Ee=async()=>L("/api/v1/session/logout",{}),G=l.createContext(void 0),Se=({children:e})=>{const[n,s]=l.useState(!1),[o,r]=l.useState(!1),[i,a]=l.useState(!0),[c,u]=l.useState(!1),d=()=>{s(!1),r(!1)};l.useEffect(()=>{const x=new AbortController;let p=!0;Ne({signal:x.signal}).then(b=>{if(p){if((b==null?void 0:b.initialized)===!1){u(!0),d();return}u(!1),b!=null&&b.authenticated?(s(!0),r(b.is_admin===!0)):d()}}).catch(b=>{!p||b instanceof DOMException&&b.name==="AbortError"||(u(!1),d())}).finally(()=>{p&&a(!1)});const m=()=>d();return window.addEventListener("auth:logout",m),(()=>{p=!1,x.abort(),window.removeEventListener("auth:logout",m)})},[]);const h=async x=>{const p=await Le(x);return p.success&&(u(!1),s(!0),r(p.is_admin===!0)),p},g=async x=>{const p=await Ce(x);return p.success&&(u(!1),s(!0Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
|
||||
@@ -6,10 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
|
||||
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
|
||||
<script type="module" crossorigin src="/static/assets/index-zEvleK2K.js"></script>
|
||||
<script type="module" crossorigin src="/static/assets/index-DJhzW1ER.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-DwxdQTKt.js">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-D5pYdG6n.css">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-BP_RGPqo.js">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-mo8bfmYY.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Package mtop: 订单改价域 — mtop.taobao.idle.trade.user.adjust.price 调用与重试。
|
||||
package mtop
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"xianyu-go/internal/xianyu/protocol"
|
||||
)
|
||||
|
||||
// AdjustPriceAPI 是卖家对待付款订单改价的 MTOP 端点。
|
||||
const AdjustPriceAPI = "https://h5api.m.goofish.com/h5/mtop.taobao.idle.trade.user.adjust.price/1.0/"
|
||||
|
||||
// AdjustOrderPriceContext 调用 mtop.taobao.idle.trade.user.adjust.price 修改待付款订单价格。
|
||||
// priceCents 是改价后的订单总价,单位为分;平台只接受买家尚未付款的订单。
|
||||
// 签名 token 过期时使用响应下发的新 Cookie 重签并重试,与确认发货保持同一恢复策略。
|
||||
func (c *ClientImpl) AdjustOrderPriceContext(ctx context.Context, cookiesStr, orderID string, priceCents int64) (ok bool, ret []string, updatedCookies string, err error) {
|
||||
// currentCookies 是本轮请求实际使用的扁平 Cookie,优先取上下文中的会话状态。
|
||||
currentCookies := cookiesStr
|
||||
if // session 是上下文携带的响应 Cookie 会话,存在时以其合并状态为准。
|
||||
session := cookieSessionFromContext(ctx); session != nil {
|
||||
currentCookies, _, _ = session.State()
|
||||
}
|
||||
// lastRet 保存最后一次业务返回,供重试耗尽后回传调用方。
|
||||
var lastRet []string
|
||||
for // attempt 是含首次在内的 token 重签尝试序号。
|
||||
attempt := 0; attempt < 4; attempt++ {
|
||||
// previousCookies 记录本次请求前的 Cookie,用于判断响应是否下发了新 token。
|
||||
previousCookies := currentCookies
|
||||
// ok、ret、updated、requestErr 分别是单次调用的业务成功标志、业务返回、Cookie 更新和传输错误。
|
||||
ok, ret, updated, requestErr := c.adjustOrderPriceOnce(ctx, currentCookies, orderID, priceCents)
|
||||
if requestErr != nil {
|
||||
return false, ret, currentCookies, requestErr
|
||||
}
|
||||
lastRet = ret
|
||||
if updated != "" {
|
||||
currentCookies = updated
|
||||
}
|
||||
if ok {
|
||||
return true, ret, currentCookies, nil
|
||||
}
|
||||
if isSessionExpiredRet(ret) {
|
||||
return false, ret, currentCookies, sessionExpiredError("订单改价接口", ret)
|
||||
}
|
||||
if !isTokenExpiredRet(ret) {
|
||||
return false, ret, currentCookies, nil
|
||||
}
|
||||
if attempt == 3 {
|
||||
break
|
||||
}
|
||||
|
||||
// MTop 通常会在 token 过期响应中通过 Set-Cookie 下发新签名 token;
|
||||
// 未下发时主动刷新一次 token 再重试。
|
||||
if currentCookies == previousCookies {
|
||||
// refreshed、refreshErr 分别是 token 主动刷新结果和刷新失败原因。
|
||||
refreshed, refreshErr := c.RefreshTokenContext(ctx, currentCookies)
|
||||
if refreshErr != nil {
|
||||
return false, ret, currentCookies, fmt.Errorf("订单改价 token 过期且刷新失败: %w", refreshErr)
|
||||
}
|
||||
if refreshed.UpdatedCookies != "" {
|
||||
currentCookies = refreshed.UpdatedCookies
|
||||
}
|
||||
}
|
||||
if // err 是重试间隔等待期间的上下文取消错误。
|
||||
err := sleepCtx(ctx, MTopRetryGap); err != nil {
|
||||
return false, ret, currentCookies, err
|
||||
}
|
||||
}
|
||||
return false, lastRet, currentCookies, nil
|
||||
}
|
||||
|
||||
// adjustOrderPriceOnce 执行一次订单改价请求;业务成功要求 ret 为 SUCCESS 且 data.success 为 true。
|
||||
func (c *ClientImpl) adjustOrderPriceOnce(ctx context.Context, cookiesStr, orderID string, priceCents int64) (ok bool, ret []string, updatedCookies string, err error) {
|
||||
// hc 是带统一日志的 HTTP 客户端。
|
||||
hc := c.httpClient()
|
||||
// adjustURL 是实际请求端点,测试可通过 AdjustPriceURL 覆盖。
|
||||
adjustURL := c.AdjustPriceURL
|
||||
if adjustURL == "" {
|
||||
adjustURL = AdjustPriceAPI
|
||||
}
|
||||
// signingCookies、requestCookies 分别是参与签名的 Cookie 和随请求发送的 Cookie。
|
||||
signingCookies, requestCookies := mtopRequestCookies(ctx, cookiesStr, "https://www.goofish.com/", adjustURL)
|
||||
// token 是从 Cookie 提取的 MTOP 签名 token。
|
||||
token := protocol.SignToken(signingCookies)
|
||||
// t 是签名使用的毫秒时间戳。
|
||||
t := strconv.FormatInt(time.Now().UnixMilli(), 10)
|
||||
// dataVal 是改价请求体:modifyFee 为整数分,运费固定为 0。
|
||||
dataVal := `{"modifyFee":` + strconv.FormatInt(priceCents, 10) + `,"newTransportFee":"0","orderId":"` + orderID + `"}`
|
||||
// sign 是本次请求的 MTOP 签名。
|
||||
sign := protocol.GenerateSign(t, token, dataVal)
|
||||
|
||||
// query 是改价请求的 URL 查询参数。
|
||||
query := buildAdjustPriceQuery(t, sign)
|
||||
// body 是 URL 编码后的请求体。
|
||||
body := "data=" + url.QueryEscape(dataVal)
|
||||
// req、err 分别是构造的 HTTP 请求和构造错误。
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost,
|
||||
adjustURL+"?"+query,
|
||||
strings.NewReader(body))
|
||||
if err != nil {
|
||||
return false, nil, cookiesStr, err
|
||||
}
|
||||
setCommonHeaders(req, requestCookies)
|
||||
// resp、err 分别是 HTTP 响应和传输错误。
|
||||
resp, err := hc.Do(req)
|
||||
if err != nil {
|
||||
return false, nil, cookiesStr, fmt.Errorf("订单改价请求失败: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
// updated 是合并响应 Set-Cookie 后的最新扁平 Cookie。
|
||||
updated := absorbMTopResponseCookies(ctx, cookiesStr, resp)
|
||||
// raw、err 分别是响应正文和读取错误。
|
||||
raw, err := readMTopBody(resp)
|
||||
if err != nil {
|
||||
return false, nil, updated, err
|
||||
}
|
||||
// res 是改价响应的最小解析结构;data.success 是平台的业务成功标志。
|
||||
var res struct {
|
||||
Ret []string `json:"ret"`
|
||||
Data struct {
|
||||
Success bool `json:"success"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if // err 是响应 JSON 解析错误。
|
||||
err := json.Unmarshal(raw, &res); err != nil {
|
||||
return false, nil, updated, fmt.Errorf("解析订单改价响应失败: %w (body=%s)", err, truncate(string(raw), 300))
|
||||
}
|
||||
if hasMTopSuccess(res.Ret) && res.Data.Success {
|
||||
return true, res.Ret, updated, nil
|
||||
}
|
||||
return false, res.Ret, updated, nil
|
||||
}
|
||||
|
||||
// buildAdjustPriceQuery 构造订单改价请求的固定查询参数。
|
||||
func buildAdjustPriceQuery(t, sign string) string {
|
||||
// parts 是按顺序拼接的查询键值对。
|
||||
parts := [][2]string{
|
||||
{"jsv", "2.7.2"},
|
||||
{"appKey", protocol.SignAppKey},
|
||||
{"t", t},
|
||||
{"sign", sign},
|
||||
{"v", "1.0"},
|
||||
{"type", "originaljson"},
|
||||
{"accountSite", "xianyu"},
|
||||
{"dataType", "json"},
|
||||
{"timeout", "20000"},
|
||||
{"api", "mtop.taobao.idle.trade.user.adjust.price"},
|
||||
{"sessionOption", "AutoLoginOnly"},
|
||||
}
|
||||
// b 是查询字符串构造器。
|
||||
var b strings.Builder
|
||||
// i、p 分别是当前键值对的下标和内容。
|
||||
for i, p := range parts {
|
||||
if i > 0 {
|
||||
b.WriteByte('&')
|
||||
}
|
||||
b.WriteString(p[0])
|
||||
b.WriteByte('=')
|
||||
b.WriteString(p[1])
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package mtop
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// adjustPriceCookies 是订单改价单测使用的最小签名 Cookie。
|
||||
const adjustPriceCookies = "unb=123; _m_h5_tk=token_1;"
|
||||
|
||||
// TestAdjustOrderPriceSuccess: ret SUCCESS 且 data.success=true 时业务成功,请求体携带整数分价格。
|
||||
func TestAdjustOrderPriceSuccess(t *testing.T) {
|
||||
// requests 统计服务端收到的请求次数。
|
||||
var requests atomic.Int32
|
||||
// gotBody 保存服务端收到的请求体,用于校验改价参数。
|
||||
var gotBody atomic.Value
|
||||
// server 是模拟 MTOP 改价端点的本地 HTTP 服务。
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
requests.Add(1)
|
||||
// body、_ 分别是读取到的请求体和忽略的读取错误。
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
gotBody.Store(string(body))
|
||||
fmt.Fprint(w, `{"api":"mtop.taobao.idle.trade.user.adjust.price","ret":["SUCCESS::调用成功"],"data":{"success":true,"serverTime":"1"},"v":"1.0"}`)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
// client 是指向本地服务的 MTOP 客户端。
|
||||
client := &ClientImpl{HTTPClient: server.Client(), AdjustPriceURL: server.URL + "/"}
|
||||
// ok、ret、updated、err 分别是改价结果、业务返回、Cookie 更新和调用错误。
|
||||
ok, ret, updated, err := client.AdjustOrderPriceContext(context.Background(), adjustPriceCookies, "order-1", 990)
|
||||
if err != nil {
|
||||
t.Fatalf("err=%v", err)
|
||||
}
|
||||
if !ok || len(ret) == 0 || !strings.Contains(ret[0], "SUCCESS") {
|
||||
t.Fatalf("ok=%v ret=%v", ok, ret)
|
||||
}
|
||||
if updated != adjustPriceCookies {
|
||||
t.Fatalf("无 Set-Cookie 时 updated 应保持原样: %q", updated)
|
||||
}
|
||||
if requests.Load() != 1 {
|
||||
t.Fatalf("requests=%d want 1", requests.Load())
|
||||
}
|
||||
// body 是服务端记录的实际请求体。
|
||||
body, _ := gotBody.Load().(string)
|
||||
if !strings.Contains(body, "%22modifyFee%22%3A990") || !strings.Contains(body, "order-1") {
|
||||
t.Fatalf("请求体缺少改价参数: %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceDataSuccessFalse: ret SUCCESS 但 data.success=false 时视为业务失败且不重试。
|
||||
func TestAdjustOrderPriceDataSuccessFalse(t *testing.T) {
|
||||
// requests 统计服务端收到的请求次数。
|
||||
var requests atomic.Int32
|
||||
// server 是返回 data.success=false 的本地改价端点。
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
requests.Add(1)
|
||||
fmt.Fprint(w, `{"ret":["SUCCESS::调用成功"],"data":{"success":false}}`)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
// client 是指向本地服务的 MTOP 客户端。
|
||||
client := &ClientImpl{HTTPClient: server.Client(), AdjustPriceURL: server.URL + "/"}
|
||||
// ok、ret、err 分别是改价结果、业务返回和调用错误。
|
||||
ok, ret, _, err := client.AdjustOrderPriceContext(context.Background(), adjustPriceCookies, "order-1", 990)
|
||||
if err != nil || ok || len(ret) == 0 {
|
||||
t.Fatalf("ok=%v ret=%v err=%v", ok, ret, err)
|
||||
}
|
||||
if requests.Load() != 1 {
|
||||
t.Fatalf("requests=%d want 1", requests.Load())
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceBizFailure: 非 token 过期的业务失败不重试,返回 ok=false 且无错误。
|
||||
func TestAdjustOrderPriceBizFailure(t *testing.T) {
|
||||
// requests 统计服务端收到的请求次数。
|
||||
var requests atomic.Int32
|
||||
// server 是返回订单状态错误的本地改价端点。
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
requests.Add(1)
|
||||
fmt.Fprint(w, `{"ret":["FAIL_BIZ_ORDER_NOT_ALLOW_MODIFY::当前订单不允许修改价格"],"data":{}}`)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
// client 是指向本地服务的 MTOP 客户端。
|
||||
client := &ClientImpl{HTTPClient: server.Client(), AdjustPriceURL: server.URL + "/"}
|
||||
// ok、ret、err 分别是改价结果、业务返回和调用错误。
|
||||
ok, ret, _, err := client.AdjustOrderPriceContext(context.Background(), adjustPriceCookies, "order-1", 990)
|
||||
if err != nil || ok || len(ret) == 0 || !strings.Contains(ret[0], "FAIL_BIZ_ORDER_NOT_ALLOW_MODIFY") {
|
||||
t.Fatalf("ok=%v ret=%v err=%v", ok, ret, err)
|
||||
}
|
||||
if requests.Load() != 1 {
|
||||
t.Fatalf("requests=%d want 1", requests.Load())
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceSessionExpired: Session 失效返回可识别的 SessionExpiredError。
|
||||
func TestAdjustOrderPriceSessionExpired(t *testing.T) {
|
||||
// server 是返回 Session 失效的本地改价端点。
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, `{"ret":["FAIL_SYS_SESSION_EXPIRED::Session过期"]}`)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
// client 是指向本地服务的 MTOP 客户端。
|
||||
client := &ClientImpl{HTTPClient: server.Client(), AdjustPriceURL: server.URL + "/"}
|
||||
// ok、err 分别是改价结果和调用错误。
|
||||
ok, _, _, err := client.AdjustOrderPriceContext(context.Background(), adjustPriceCookies, "order-1", 990)
|
||||
if ok || !IsSessionExpiredErr(err) {
|
||||
t.Fatalf("ok=%v err=%v", ok, err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdjustOrderPriceTokenRetry: token 过期时使用响应下发的新 Cookie 重签并重试成功。
|
||||
func TestAdjustOrderPriceTokenRetry(t *testing.T) {
|
||||
// requests 统计服务端收到的请求次数。
|
||||
var requests atomic.Int32
|
||||
// server 是首次返回 token 过期并下发新 token、第二次成功的本地改价端点。
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if requests.Add(1) == 1 {
|
||||
http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "token_2"})
|
||||
fmt.Fprint(w, `{"ret":["FAIL_SYS_TOKEN_EXOIRED::令牌过期"]}`)
|
||||
return
|
||||
}
|
||||
fmt.Fprint(w, `{"ret":["SUCCESS::调用成功"],"data":{"success":true}}`)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
// client 是指向本地服务的 MTOP 客户端。
|
||||
client := &ClientImpl{HTTPClient: server.Client(), AdjustPriceURL: server.URL + "/"}
|
||||
// ok、updated、err 分别是改价结果、Cookie 更新和调用错误。
|
||||
ok, _, updated, err := client.AdjustOrderPriceContext(context.Background(), adjustPriceCookies, "order-1", 990)
|
||||
if err != nil || !ok {
|
||||
t.Fatalf("ok=%v err=%v", ok, err)
|
||||
}
|
||||
if !strings.Contains(updated, "token_2") {
|
||||
t.Fatalf("updated 应包含新 token: %q", updated)
|
||||
}
|
||||
if requests.Load() != 2 {
|
||||
t.Fatalf("requests=%d want 2", requests.Load())
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ const (
|
||||
type Client interface {
|
||||
FetchUserProfile(ctx context.Context, cookiesStr string) (*UserProfileResult, error)
|
||||
ConsignContext(ctx context.Context, cookiesStr, orderID string) (ok bool, ret []string, updatedCookies string, err error)
|
||||
AdjustOrderPriceContext(ctx context.Context, cookiesStr, orderID string, priceCents int64) (ok bool, ret []string, updatedCookies string, err error)
|
||||
FetchItemsPage(ctx context.Context, cookiesStr string, pageNumber, pageSize int) (*ItemListResult, error)
|
||||
FetchAllItems(ctx context.Context, cookiesStr string, pageSize, maxPages int) (*ItemListResult, error)
|
||||
PublishItem(ctx context.Context, cookiesStr string, req PublishItemRequest) (*PublishItemResult, error)
|
||||
@@ -69,8 +70,10 @@ type ClientImpl struct {
|
||||
// Logger 记录 MTOP 请求的安全摘要(不会输出 Cookie、签名或响应正文)。
|
||||
// 未设置时使用 slog.Default,测试可传入丢弃日志的 logger。
|
||||
Logger *slog.Logger
|
||||
TokenURL string
|
||||
ConsignURL string
|
||||
TokenURL string
|
||||
ConsignURL string
|
||||
// AdjustPriceURL 覆盖订单改价端点,仅供测试注入本地 HTTP 服务。
|
||||
AdjustPriceURL string
|
||||
OrderDetailURL string
|
||||
SoldOrdersURL string
|
||||
ItemDetailURL string
|
||||
|
||||
Reference in new issue
Block a user