---
phase: 01-p0
plan: 04
type: execute
wave: 1
depends_on: []
files_modified:
- internal/service/order/service.go
autonomous: true
requirements:
- CRITICAL-06
must_haves:
truths:
- "场景 5 分支(代理代购下级)的 sellerCostPrice 使用 operatorCostPrice,不再是 buyerCostPrice"
- "其他 5 处 sellerCostPrice 赋值经过语义审查,确认正确或按需修正"
- "佣金差额计算基准正确,场景 5 的上级代理能获得应有佣金"
artifacts:
- path: internal/service/order/service.go
provides: "场景 5 sellerCostPrice 修正"
contains: "operatorCostPrice"
key_links:
- from: internal/service/order/service.go
to: "佣金计算链路"
via: "sellerCostPrice 作为佣金差额基准传递"
pattern: "sellerCostPrice"
---
逐一审查并修正代购订单中 sellerCostPrice 的 6 处赋值(CRITICAL-06),确保场景 5(代理代购下级)使用正确的成本价基准。
Purpose: sellerCostPrice 是佣金差额计算的基准。场景 5 中错误使用 buyerCostPrice(下级成本价)导致整个佣金链差额为 0,所有上级代理无法获得应有佣金。修复后代购场景佣金链正常工作。
Output:
- order/service.go: 场景 5 的 sellerCostPrice 改为 operatorCostPrice,其余 5 处经语义审查确认或按需修正
@$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md
@$HOME/.config/opencode/get-shit-done/templates/summary.md
@.planning/phases/01-p0/01-CONTEXT.md
# 修复规格书(方案 A-5,第 579-618 行)
@.sisyphus/plans/修正业务-完整方案.md
Task 1: 逐一审查并修正 sellerCostPrice 6 处赋值(CRITICAL-06)
internal/service/order/service.go
**步骤 1:定位 6 处赋值**
```bash
rg -n "sellerCostPrice" internal/service/order/service.go
```
确认规格书所述的 6 处(第 187, 262, 472, 548, 734, 809 行)是否与实际一致(行号可能有偏移)。
**步骤 2:对照五种场景表逐一审查**
对每一处 `sellerCostPrice = buyerCostPrice`,阅读其所在分支的上下文,确认:
- 这里的"操作方"是谁?(平台/代理)
- 资产归属是谁?(自己客户/下级代理客户)
- 对照上方场景表,sellerCostPrice 应该是哪个变量?
**步骤 3:修正确认有问题的位置**
规格书明确指出场景 5(代理代购下级代理客户)约在第 525-548 行:
```go
// 当前错误(sellerCostPrice 用了下级成本价)
buyerCostPrice, _ := s.getCostPrice(ctx, *resourceShopID, firstPackageID) // 下级成本价
operatorCostPrice, _ := s.getCostPrice(ctx, operatorShopID, firstPackageID) // 自己成本价
totalAmount = buyerCostPrice // 下级成本价作为面值(正确)
actualPaidAmount = &operatorCostPrice // 实际扣自己钱包(正确)
sellerCostPrice = buyerCostPrice // ← 错误!应是 operatorCostPrice
// 修正后
sellerCostPrice = operatorCostPrice // ✅ 自己(代理)的成本价作为佣金差额基准
```
对其余 5 处,若语义审查确认正确(即该场景下 sellerCostPrice 本就应等于 buyerCostPrice),则**不修改**,并在 SUMMARY 中记录每处审查结论。
**步骤 4:执行 `go build ./...`,确认编译通过,提交独立 commit(per D-05)。**
注意:只改确认有问题的位置,禁止全量替换(per D-03)。
go build ./... && rg -n "sellerCostPrice" internal/service/order/service.go
- 6 处 sellerCostPrice 赋值全部经过语义审查
- 场景 5 分支已将 sellerCostPrice = buyerCostPrice 改为 sellerCostPrice = operatorCostPrice
- 其余各处审查结论已记录
- go build ./... 编译通过
- 独立 commit 已提交
整体验收:
```bash
# 1. 编译验证
go build ./...
# 2. 查看所有 sellerCostPrice 赋值(人工确认场景 5 已修正)
rg -n "sellerCostPrice" internal/service/order/service.go
# 3. 搜索场景 5 分支(代购下级)是否仍然存在 sellerCostPrice = buyerCostPrice
# 需人工确认第 525-548 行附近已修改
```
人工验收(参见修正业务-完整方案.md A-5 验收清单):
- DBHub 抽查"代理代购下级代理客户"的订单和佣金记录
- 预期:tb_order.total_amount = 下级成本价,佣金链不再全部为 0
1. `go build ./...` 编译通过
2. 场景 5(代理代购下级)sellerCostPrice = operatorCostPrice(不再是 buyerCostPrice)
3. 其余 5 处经语义审查,结论记录在 SUMMARY 中
4. 独立 commit 已提交