diff --git a/app/common/model/dealer/Order.php b/app/common/model/dealer/Order.php index 76e88001..93b4f1aa 100644 --- a/app/common/model/dealer/Order.php +++ b/app/common/model/dealer/Order.php @@ -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; /** @@ -153,29 +152,22 @@ class Order extends BaseModel */ 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']) { // 全局分销比例 return [ - '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)) + '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)) ]; } // 商品单独分销 if ($goods['dealer_money_type'] == 10) { // 分销佣金类型:百分比 return [ - 'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 100), - 'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 100), - 'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 100) + 'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 1000, 3), + 'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 100, 3), + 'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 100, 3) ]; } else { // 分销佣金类型:固定金额