pull/5/head
wanghousheng 4 months ago
parent fc03e2e464
commit 6e8338fd91
  1. 21
      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\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;
/** /**
@ -154,20 +155,28 @@ class Order extends BaseModel
{ {
// 判断是否开启商品单独分销 // 判断是否开启商品单独分销
if (!$goods['is_ind_dealer']) { 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 [ return [
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000)), 'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 100)),
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000)), 'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 100)),
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000)) 'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 100))
]; ];
} }
// 商品单独分销 // 商品单独分销
if ($goods['dealer_money_type'] == 10) { if ($goods['dealer_money_type'] == 10) {
// 分销佣金类型:百分比 // 分销佣金类型:百分比
return [ return [
'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 1000), 'first_money' => $goodsPrice * helper::bcdiv($goods['first_money'], 100),
'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 1000), 'second_money' => $goodsPrice * helper::bcdiv($goods['second_money'], 100),
'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 1000) 'third_money' => $goodsPrice * helper::bcdiv($goods['third_money'], 100)
]; ];
} else { } else {
// 分销佣金类型:固定金额 // 分销佣金类型:固定金额

Loading…
Cancel
Save