34 lines
933 B
PHP
34 lines
933 B
PHP
<?php
|
|
namespace app\common\logic;
|
|
|
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
|
|
|
/**
|
|
* 产品佣金计算
|
|
*
|
|
*/
|
|
class CommissionProductLogic extends BaseLogic
|
|
{
|
|
|
|
/**
|
|
* 根据毛利率计算
|
|
*/
|
|
function calculate_product_flow($oid,$store_id,$product_id,$village_uid=0, $brigade_uid=0){
|
|
|
|
$find=StoreOrderCartInfo::where($oid,$product_id)->field('price,cart_num,rose')->find();
|
|
if($find && $find['rose']>0){
|
|
$product= StoreBranchProduct::where('store_id',$store_id)->where('product_id',$product_id)->find();
|
|
$price=bcmul($find['price'], $find['cart_num'], 2);
|
|
// $rose= bcdiv($find['rose'], 100, 2);
|
|
// $price=bcsub($price, $price
|
|
|
|
// )
|
|
// bcsub($price, $find['rose'], 2);
|
|
// return $price;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
} |