|
|
@ -18,7 +18,6 @@ use app\common\library\helper; |
|
|
|
use app\common\model\Order as OrderModel; |
|
|
|
use app\common\model\Order as OrderModel; |
|
|
|
use app\common\model\OrderGoods as OrderGoodsModel; |
|
|
|
use app\common\model\OrderGoods as OrderGoodsModel; |
|
|
|
use cores\BaseModel; |
|
|
|
use cores\BaseModel; |
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
use think\model\relation\BelongsTo; |
|
|
|
use think\model\relation\BelongsTo; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -153,29 +152,22 @@ class Order extends BaseModel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static function calculateGoodsCapital(array $setting, OrderGoodsModel $goods, string $goodsPrice): array |
|
|
|
private static function calculateGoodsCapital(array $setting, OrderGoodsModel $goods, string $goodsPrice): array |
|
|
|
{ |
|
|
|
{ |
|
|
|
$arr = [ |
|
|
|
|
|
|
|
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000)), |
|
|
|
|
|
|
|
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000)), |
|
|
|
|
|
|
|
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000)) |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => 'arr数据', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($arr), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
|
|
|
// 判断是否开启商品单独分销 |
|
|
|
// 判断是否开启商品单独分销 |
|
|
|
if (!$goods['is_ind_dealer']) { |
|
|
|
if (!$goods['is_ind_dealer']) { |
|
|
|
// 全局分销比例 |
|
|
|
// 全局分销比例 |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000)), |
|
|
|
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000, 3)), |
|
|
|
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000)), |
|
|
|
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000, 3)), |
|
|
|
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000)) |
|
|
|
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000, 3)) |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
// 商品单独分销 |
|
|
|
// 商品单独分销 |
|
|
|
if ($goods['dealer_money_type'] == 10) { |
|
|
|
if ($goods['dealer_money_type'] == 10) { |
|
|
|
// 分销佣金类型:百分比 |
|
|
|
// 分销佣金类型:百分比 |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 100), |
|
|
|
'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 1000, 3), |
|
|
|
'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 100), |
|
|
|
'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 100, 3), |
|
|
|
'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 100) |
|
|
|
'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 100, 3) |
|
|
|
]; |
|
|
|
]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 分销佣金类型:固定金额 |
|
|
|
// 分销佣金类型:固定金额 |
|
|
|