|
|
|
@ -18,7 +18,6 @@ use app\common\library\helper; |
|
|
|
|
use app\common\model\Order as OrderModel; |
|
|
|
|
use app\common\model\OrderGoods as OrderGoodsModel; |
|
|
|
|
use cores\BaseModel; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
use think\model\relation\BelongsTo; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -136,8 +135,6 @@ class Order extends BaseModel |
|
|
|
|
$goodsPrice = min($capital['orderPrice'], $goods['total_pay_price']); |
|
|
|
|
// 计算商品实际佣金 |
|
|
|
|
$goodsCapital = static::calculateGoodsCapital($setting, $goods, (string)$goodsPrice); |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => 'goodsCapital数据', 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($goodsCapital), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
// 累积分销佣金 |
|
|
|
|
$level >= 1 && $capital['first_money'] = helper::bcadd($capital['first_money'], $goodsCapital['first_money']); |
|
|
|
|
$level >= 2 && $capital['second_money'] = helper::bcadd($capital['second_money'], $goodsCapital['second_money']); |
|
|
|
@ -158,13 +155,6 @@ class Order extends BaseModel |
|
|
|
|
// 判断是否开启商品单独分销 |
|
|
|
|
if (!$goods['is_ind_dealer']) { |
|
|
|
|
// 全局分销比例 |
|
|
|
|
$arr = [ |
|
|
|
|
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000, 3)), |
|
|
|
|
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000, 3)), |
|
|
|
|
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000, 3)) |
|
|
|
|
]; |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '全局分销比例', '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')]); |
|
|
|
|
return [ |
|
|
|
|
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000, 3)), |
|
|
|
|
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000, 3)), |
|
|
|
|