推广分佣功能开发
This commit is contained in:
@@ -145,6 +145,7 @@ class OrderService
|
||||
'goods_amount' => $total_amount,
|
||||
'discount_amount' => 0,
|
||||
'remark' => $storeInfo['remark'] ?? '',
|
||||
'promoter_id' => PromotionService::getPromoterId(intval($userId)),
|
||||
];
|
||||
$orderData['parent_order_no'] = $orderData['order_no'];
|
||||
$existed = OrderService::getOne(['order_no' => $orderData['order_no']]);
|
||||
@@ -199,6 +200,7 @@ class OrderService
|
||||
$orderInfo = self::where(['parent_order_no' => $demand->parent_order_no])->find();
|
||||
$ratio = 0.5; //分期比率50%
|
||||
if (!$orderInfo) {
|
||||
$promoterId = PromotionService::getPromoterId(intval($demand->user_id));
|
||||
$installments = 2;//分期数
|
||||
for ($i = 1; $i <= $installments; $i++) {
|
||||
$total_amount = $i == 1 ? $totalCost * $ratio : $totalCost * (1 - $ratio);
|
||||
@@ -229,6 +231,7 @@ class OrderService
|
||||
'goods_amount' => $total_amount,
|
||||
'discount_amount' => 0,
|
||||
'remark' => '',
|
||||
'promoter_id' => $promoterId,
|
||||
];
|
||||
$existed = OrderService::getOne(['order_no' => $orderData['order_no']]);
|
||||
if (!$existed) {
|
||||
@@ -415,6 +418,8 @@ class OrderService
|
||||
}
|
||||
}
|
||||
}
|
||||
//交易完成:结算推广佣金
|
||||
PromotionService::settleOrders($order->parent_order_no ? ['parent_order_no' => $order->parent_order_no] : ['id' => $order->id]);
|
||||
Db::commit();
|
||||
$info = OrderService::getOne(['id' => $orderId]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user