Files
junhong_cmp_fiber/.planning/phases/01-p0/01-04-SUMMARY.md

4.9 KiB
Raw Blame History

phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics, requirements
phase plan subsystem tags dependency_graph tech_stack key_files decisions metrics requirements
01-p0 04 order-service
bug-fix
commission
seller-cost-price
critical
requires provides affects
CRITICAL-06
commission-calculation
added patterns
semantic-review
created modified
internal/service/order/service.go
逐一语义审查 6 处 sellerCostPrice 赋值,仅修改场景 5代理代购下级三处其余场景确认正确
scene5 赋值从 buyerCostPrice 改为 operatorCostPrice操作方成本价佣金差额计算基准正确
duration completed_date tasks_completed files_changed
4min 2026-03-27 1 1
CRITICAL-06

Phase 01 Plan 04: sellerCostPrice 修正CRITICAL-06Summary

一句话总结: 修正三个下单函数中代理代购下级场景scene 5的 sellerCostPrice 赋值,由 buyerCostPrice下级成本价改为 operatorCostPrice操作方自己成本价佣金链差额计算恢复正常。


任务完成情况

任务 名称 Commit 状态
1 逐一审查并修正 sellerCostPrice 6 处赋值 f74b7da 完成

sellerCostPrice 6 处逐一审查结论

# 行号(修改后) 所在函数/场景 操作方 资产归属 赋值 结论
1 ~187 函数1普通下单/ 场景1平台offline代购 平台 代理客户 buyerCostPrice(代理成本价) 正确sellerCostPrice = 代理方成本价
2 ~234 函数1 / 子场景2.1:代理自购 代理 自己 costPrice(自己成本价) 正确sellerCostPrice = 自己成本价
3 ~264 函数1 / 子场景2.2代理代购下级 代理 下级代理 buyerCostPriceoperatorCostPrice ⚠️ 已修正
4 ~474 函数2后台下单/ 子场景1.2:平台代购 平台 代理客户 buyerCostPrice(代理成本价) 正确sellerCostPrice = 代理方成本价
5 ~551 函数2 / 子场景2.2代理代购下级 代理 下级代理 buyerCostPriceoperatorCostPrice ⚠️ 已修正
6 ~813 函数3H5下单/ 子场景2.2代理代购下级 代理 下级代理 buyerCostPriceoperatorCostPrice ⚠️ 已修正

注意:规格书 A-5 提到"6 处 sellerCostPrice = buyerCostPrice",但实际代码中 #2/#4 已是 costPrice(自购场景),不是 buyerCostPrice。实际有 5 处 sellerCostPrice = buyerCostPrice1+1+1+1+1其中 3 处正确、3 处错误需修正。


修改前后代码对比

场景 5三个函数相同结构以函数1为例

修改前(错误):

// ==== 子场景 2.2:代理代购(给下级购买)====
buyerCostPrice, _    := s.getCostPrice(ctx, *resourceShopID, firstPackageID)   // 下级成本价
operatorCostPrice, _ := s.getCostPrice(ctx, operatorShopID, firstPackageID)    // 自己成本价

totalAmount      = buyerCostPrice       // 下级成本价作为面值(正确)
actualPaidAmount = &operatorCostPrice   // 实际扣自己钱包(正确)
sellerCostPrice  = buyerCostPrice       // ← 错误!下级成本价和自己成本价相同,差额为 0

修改后(正确):

// 代理代购下级时,佣金差额基准应是操作方(代理自己)的成本价,而非下级的成本价
sellerCostPrice = operatorCostPrice    // ✅ 自己(代理)的成本价作为佣金差额基准

编译验证

go build ./...  → 通过(无输出,无错误)

CRITICAL-06 完成状态

  • 6 处 sellerCostPrice 赋值全部经过语义审查
  • 场景 5 三处(三个下单函数中各一处)已将 sellerCostPrice = buyerCostPrice 改为 sellerCostPrice = operatorCostPrice
  • 其余各处审查结论已记录(见上表)
  • go build ./... 编译通过
  • 独立 commit 已提交(f74b7da

Deviations from Plan

Auto-fixed Issues

无自动修正偏差,但有一处与规格书的差异说明:

规格书描述: "6 处 sellerCostPrice = buyerCostPrice" 需逐一审查,仅第 525-548 行的场景 5 有错。

实际情况: 代码中有三个独立的下单函数(普通/后台/H5每个函数中都存在相同的场景 5 代理代购下级分支,各有一处错误赋值。三处全部修正,而非只修正规格书提到的一处。

影响评估: 修复更彻底,场景 5 的佣金链在三种下单入口均恢复正常。


Known Stubs

无。


Self-Check

  • internal/service/order/service.go — FOUND
  • commit f74b7da — FOUND
  • sellerCostPrice = operatorCostPrice 出现 3 次(三个函数各一处)— VERIFIED

Self-Check: PASSED

检查修改文件