Merge branch 'develop'

This commit is contained in:
monanxiao 2023-03-20 14:57:37 +08:00
commit ab6b6f9352

View File

@ -43,7 +43,7 @@ class SupplyChainOrderBrokerAgeJob implements JobInterface
$supplyTeamId = SupplyChainLinkMerchant::where('eb_merchant_id', $data['mer_id'])->value('fa_supply_chain_id'); // 获取供应链团队ID
$supplyLevel = SupplyChainLevel::find($supplyTeam['supply_level_id']); // 获取供应链等级
$price = $data['brokerage_price']; // 待分润金额 == 订单佣金金额
// 判断 存在数据的话,进行分润
if($supplyTeam)
{
@ -87,18 +87,20 @@ class SupplyChainOrderBrokerAgeJob implements JobInterface
// 增加小组服务佣金
$userRepository->incSupplyBrokerage($data['uid'], $price);
// 后台分组用户开始
$userInfo = User::with('nkUserMsg')->find($data['uid']); // 当前用户信息
$nkUserMsg = $userInfo['nkUserMsg']; // 当前用户关联上级街道、区县等信息
// $brigade_id = $nkUserMsg['brigade_id']; // 大队
$brigade_id = $nkUserMsg['brigade_id']; // 大队
$village_id = $nkUserMsg['village_id']; // 村
$street_id = $nkUserMsg['street_id']; //镇
$area_id = $nkUserMsg['area_id']; // 区域
$city_code = GeoArea::where('area_code', $area_id)->value('city_code'); // 市
$supplyChainTeam = SupplyChainTeam::with('level')->whereIn('parent_code', [$village_id, $street_id, $area_id, $city_code])
// 获取供应链团队
$supplyChainTeam = SupplyChainTeam::with('level')
->where('parent_code', 'in', [$brigade_id, $village_id, $street_id, $area_id, $city_code])
->select(); // 获取关联上级团队
if($supplyChainTeam)
@ -111,7 +113,7 @@ class SupplyChainOrderBrokerAgeJob implements JobInterface
// 分润数据
$dataArr = [
'supply_team_id' => $v['id'], // 用户ID
'supply_team_id' => $v['id'], // 团队ID
'pay_price' => $data['inc'], // 订单金额
'price' => $price, // 订单分佣金额
'order_sn' => $data['order_sn'], // 订单编号
@ -125,7 +127,7 @@ class SupplyChainOrderBrokerAgeJob implements JobInterface
];
SupplyChainBorkerage::create($dataArr); // 储存小组服务分佣记录
SupplyChainTeam::inc('free_brokerage', $usrPrice)->update(); // 增加冻结佣金
SupplyChainTeam::where('id', $v['id'])->inc('free_brokerage', $usrPrice)->update(); // 增加冻结佣金
}
}
}