From 6e8338fd91235f7359d2045ea965cd599346a777 Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Thu, 18 Jul 2024 23:20:22 +0800 Subject: [PATCH] 1 --- app/common/model/dealer/Order.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/common/model/dealer/Order.php b/app/common/model/dealer/Order.php index 95f8e0cd..1ec77593 100644 --- a/app/common/model/dealer/Order.php +++ b/app/common/model/dealer/Order.php @@ -18,6 +18,7 @@ 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; /** @@ -154,20 +155,28 @@ class Order extends BaseModel { // 判断是否开启商品单独分销 if (!$goods['is_ind_dealer']) { + Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($setting), 'created_at' => date('Y-m-d H:i:s')]); + $arr = [ + 'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 100)), + 'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 100)), + 'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 100)) + ]; + 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')]); // 全局分销比例 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'], 100)), + 'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 100)), + 'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 100)) ]; } // 商品单独分销 if ($goods['dealer_money_type'] == 10) { // 分销佣金类型:百分比 return [ - 'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 1000), - 'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 1000), - 'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 1000) + '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) ]; } else { // 分销佣金类型:固定金额