fix(hjf): 保单商品多份购买分润计算全链路修复
- 公排入队:按件数拆分为 N 条独立记录,每条单份金额,逐条触发退款检测 - 周期佣金:位次统计改为按报单商品总件数(cart_num 之和),而非订单数 - 分销等级任务:type 6/7 订单数统计改为按 cart_num 累计保单商品份数 - 推荐返佣与积分奖励:验证 cart_num 倍乘逻辑正确 Made-with: Cursor
This commit is contained in:
@@ -1028,13 +1028,25 @@ class StoreOrderCreateServices extends BaseServices
|
||||
return '0';
|
||||
}
|
||||
|
||||
// fsgx B6:统计推荐人已完成的报单订单数,作为起始位次基准
|
||||
$completedCount = (int)\think\facade\Db::name('store_order')
|
||||
// fsgx B6:统计推荐人已完成的报单商品总件数(非订单数),作为起始位次基准
|
||||
$completedOrderIds = \think\facade\Db::name('store_order')
|
||||
->where('spread_uid', $spread_uid)
|
||||
->where('is_queue_goods', 1)
|
||||
->where('paid', 1)
|
||||
->where('is_del', 0)
|
||||
->count();
|
||||
->column('id');
|
||||
$completedCount = 0;
|
||||
if ($completedOrderIds) {
|
||||
$completedCartRows = \think\facade\Db::name('store_order_cart_info')
|
||||
->whereIn('oid', $completedOrderIds)
|
||||
->column('cart_info');
|
||||
foreach ($completedCartRows as $ccRow) {
|
||||
$ccItem = is_string($ccRow) ? json_decode($ccRow, true) : $ccRow;
|
||||
if (!empty($ccItem['productInfo']['is_queue_goods'])) {
|
||||
$completedCount += (int)($ccItem['cart_num'] ?? 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fsgx B-2B:逐件轮巡,每件商品取下一个位次的佣金比例后累加
|
||||
$total = '0';
|
||||
|
||||
Reference in New Issue
Block a user