Commit 6b56fa63 by yink

fix(佣金计算): 优化商户佣金计算逻辑并移除冗余条件

修改商户佣金计算方式,增加员工佣金扣除计算
移除评论控制器中不必要的条件判断
清理调试日志代码
parent 6b161ed6
......@@ -49,11 +49,9 @@ public function add(Request $request)
$count = OrderGoods::where('order_id', $oid)->where('is_comment', 0)->count();
Log::add('订单商品评论' . $og_id, ['num' => $count]);
if ($count == 0) {
if ($useObj->spuid || $useObj->merchant_id) {
$orderObj->is_commission = 1;
$orderObj->order_status = 4;
$orderObj->save();
}
$orderObj->is_commission = 1;
$orderObj->order_status = 4;
$orderObj->save();
// Log::add('调用分佣', $orderObj->toArray());
// $this->dispatch(new AutoCompleteOrder($orderObj, 10));
}
......
......@@ -267,8 +267,12 @@ public static function getCommissionAmount($type, $obj_id)
log.goods_number,
-- 计算总的商品价格
COALESCE(log.goods_number*log.goods_price, 0) AS total_price,
-- 计算总的商户佣金
COALESCE((log.goods_number*log.goods_price * lg.merchant_commission)/100, 0) AS total_merchant_commission,
-- 计算总的商户佣金()
COALESCE(
ROUND(((log.goods_price * lg.merchant_commission * 1.0) / 100) - ((log.goods_price * lg.merchant_commission * sau.employee_commission) / 10000), 2),
ROUND(((log.goods_price * lg.merchant_commission * 1.0) / 100) , 2)
) AS total_merchant_commission,
-- 计算总的商户员工佣金
COALESCE((log.goods_number * log.goods_price * lg.merchant_commission * sau.employee_commission) / 10000, 0) AS total_employee_commission
FROM
......@@ -318,7 +322,7 @@ public static function getCommissionAmount($type, $obj_id)
in (
select user_id from store_employee_user_rec where employee_id=?
); ', [$obj_id, $obj_id]);
Log::add('zhu3',$obj_id);
//Log::add('zhu3',$obj_id);
}
//遍历列表,计算实际佣金
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment