From 7c4a944b43ba9884dd3c712ccda88226985e57b7 Mon Sep 17 00:00:00 2001 From: lettimepassby <86416409@qq.com> Date: Thu, 20 Aug 2026 10:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E8=A7=84=E5=88=99=E6=94=AF=E6=8C=81=E6=8B=8D=E4=B8=8B?= =?UTF-8?q?=E6=9C=AA=E4=BB=98=E6=AC=BE=E8=87=AA=E5=8A=A8=E6=94=B9=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 order_created 触发器,识别买家拍下待付款交易卡片 - 新增 MTOP 订单改价接口 mtop.taobao.idle.trade.user.adjust.price(含 token 重签与凭证恢复) - 新增 adjust_price 自动化动作,目标价格按整数分校验与执行,错误按三态收口 - 应用层规则校验限定改价动作只用于拍下未付款规则,可附带买家提醒文案 - 前端规则页新增拍下改价类型、目标价格与可选提醒编辑器 --- frontend/app/features/rules/api.ts | 1 + frontend/app/features/rules/pages/Rules.tsx | 45 +++- .../app/features/rules/ruleActions.test.tsx | 38 ++++ frontend/app/features/rules/ruleActions.ts | 55 ++++- frontend/app/features/rules/types.ts | 2 +- frontend/app/features/rules/utils.test.ts | 25 ++- frontend/app/features/rules/utils.ts | 49 ++++- frontend/shared/api-contract/transport.ts | 4 +- internal/account/manager_extra_test.go | 5 + internal/adapter/order_runtime_test.go | 5 + internal/application/automation/rules.go | 196 ++++++++++++++---- internal/application/automation/rules_test.go | 54 +++++ internal/automation/action_executor.go | 135 +++++++++++- .../automation/adjust_price_action_test.go | 148 +++++++++++++ internal/automation/center_mock_mtop_test.go | 20 ++ internal/automation/delivery_notifier.go | 1 + internal/automation/events.go | 17 ++ internal/automation/events_test.go | 44 ++++ internal/engine/account_extra_test.go | 5 + internal/engine/run_test.go | 10 + internal/server/automation_rule_handlers.go | 4 +- ...st-bbR-Z2_J.js => AccountList-DNYhASF8.js} | 2 +- ...dList-CvCo2zF6.js => CardList-BNhM7Nsy.js} | 2 +- .../{Chat-CKN6Wl0-.js => Chat-B7Pd0rqO.js} | 2 +- ...oard-C9RwPfK-.js => Dashboard-NfnNIx-0.js} | 2 +- ...mList-CZPbhJDg.js => ItemList-BQ1666J4.js} | 2 +- ...-DUiNU4WL.js => Notifications-pFIU2IhO.js} | 2 +- ...List-Dma_R9-T.js => OrderList-Cv77w4wV.js} | 2 +- .../webui/static/assets/Rules-BTuZkOWs.js | 1 + .../webui/static/assets/Rules-CeggCy2B.js | 1 - ...tings-BmdW4Gos.js => Settings-nmmlNL7R.js} | 2 +- ...r-DwxdQTKt.js => icons-vendor-BP_RGPqo.js} | 163 ++++++++------- .../webui/static/assets/index-D5pYdG6n.css | 1 - .../{index-zEvleK2K.js => index-DJhzW1ER.js} | 4 +- .../webui/static/assets/index-mo8bfmYY.css | 1 + internal/webui/static/index.html | 6 +- internal/xianyu/mtop/adjust_price.go | 168 +++++++++++++++ internal/xianyu/mtop/adjust_price_test.go | 147 +++++++++++++ internal/xianyu/mtop/client.go | 7 +- 39 files changed, 1218 insertions(+), 160 deletions(-) create mode 100644 internal/automation/adjust_price_action_test.go rename internal/webui/static/assets/{AccountList-bbR-Z2_J.js => AccountList-DNYhASF8.js} (99%) rename internal/webui/static/assets/{CardList-CvCo2zF6.js => CardList-BNhM7Nsy.js} (99%) rename internal/webui/static/assets/{Chat-CKN6Wl0-.js => Chat-B7Pd0rqO.js} (99%) rename internal/webui/static/assets/{Dashboard-C9RwPfK-.js => Dashboard-NfnNIx-0.js} (99%) rename internal/webui/static/assets/{ItemList-CZPbhJDg.js => ItemList-BQ1666J4.js} (99%) rename internal/webui/static/assets/{Notifications-DUiNU4WL.js => Notifications-pFIU2IhO.js} (99%) rename internal/webui/static/assets/{OrderList-Dma_R9-T.js => OrderList-Cv77w4wV.js} (99%) create mode 100644 internal/webui/static/assets/Rules-BTuZkOWs.js delete mode 100644 internal/webui/static/assets/Rules-CeggCy2B.js rename internal/webui/static/assets/{Settings-BmdW4Gos.js => Settings-nmmlNL7R.js} (99%) rename internal/webui/static/assets/{icons-vendor-DwxdQTKt.js => icons-vendor-BP_RGPqo.js} (73%) delete mode 100644 internal/webui/static/assets/index-D5pYdG6n.css rename internal/webui/static/assets/{index-zEvleK2K.js => index-DJhzW1ER.js} (95%) create mode 100644 internal/webui/static/assets/index-mo8bfmYY.css create mode 100644 internal/xianyu/mtop/adjust_price.go create mode 100644 internal/xianyu/mtop/adjust_price_test.go diff --git a/frontend/app/features/rules/api.ts b/frontend/app/features/rules/api.ts index 5108cca..3cb298c 100644 --- a/frontend/app/features/rules/api.ts +++ b/frontend/app/features/rules/api.ts @@ -152,6 +152,7 @@ export const updateShippingRule = async (rule: Partial): Promise = { + order_created: '拍下未付款自动改价', order_paid: '付款后自动发货', buyer_reviewed: '评价后发送赠品', review_missing_timeout: '超时未评价求评价', diff --git a/frontend/app/features/rules/pages/Rules.tsx b/frontend/app/features/rules/pages/Rules.tsx index 39692dc..ca4e79c 100644 --- a/frontend/app/features/rules/pages/Rules.tsx +++ b/frontend/app/features/rules/pages/Rules.tsx @@ -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 = ({ initialDeliveryTarget, onDeliveryTargetHandled }) => { @@ -105,7 +106,7 @@ const Rules: React.FC = ({ 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 = ({ initialDeliveryTarget, onDeliveryTargetHa - {selectedRuleItem && currentTrigger !== 'review_missing_timeout' && ( + {selectedRuleItem && currentTrigger !== 'review_missing_timeout' && currentTrigger !== 'order_created' && (
{selectedRuleItem.item_title || selectedRuleItem.item_id} @@ -738,7 +739,43 @@ const Rules: React.FC = ({ initialDeliveryTarget, onDeliveryTargetHa )} - {currentTrigger !== 'review_missing_timeout' ? ( + {currentTrigger === 'order_created' ? ( +
+
+ +

改价设置

+
+
+
+ + updateAdjustPriceTarget(event.target.value)} + placeholder="例如:9.9" + className="w-full ios-input px-4 py-3 rounded-xl" + /> +

买家拍下未付款后,系统会把该笔订单价格修改为此金额(0.01 - 1000000 元,最多两位小数)。

+
+
+ +