修改:经销商佣金和平级奖在商品开启消费返利情况下仅上级获得奖励、上上级获得平级奖

This commit is contained in:
wuhui_zzw 2024-03-18 16:58:15 +08:00
parent c01365ce02
commit 97d36eca89
2 changed files with 17 additions and 1 deletions

View File

@ -137,7 +137,7 @@ class ApplyController extends ApiController
if ($explain = $this->withdrawalExplain()) { if ($explain = $this->withdrawalExplain()) {
return str_replace('[奖励余额]', $this->awardBalance(), $explain); return str_replace('[奖励余额]', $this->awardBalance(), $explain);
} }
return $this->withdrawalName() . '申请成功预计到账时间T+2'; return $this->withdrawalName() . '申请成功预计到账时间T+1';
} }
private function validateWithdrawDeductionLove() private function validateWithdrawDeductionLove()

View File

@ -61,6 +61,8 @@ class TeamReturnService
private $team_levels; private $team_levels;
private $parentId;
private $parentUpId;
// public function __construct($order, $set, $buyMember, $order_goods, $agents) // public function __construct($order, $set, $buyMember, $order_goods, $agents)
// { // {
// $this->order = $order; // $this->order = $order;
@ -80,6 +82,7 @@ class TeamReturnService
$this->buyMember = $buyMember; $this->buyMember = $buyMember;
$this->order_goods = $order_goods; $this->order_goods = $order_goods;
$this->agents = $agents; $this->agents = $agents;
$this->team_goods = GoodsTeamDividend::getGoodsByGoodsId($this->order_goods->goods_id)->first(); $this->team_goods = GoodsTeamDividend::getGoodsByGoodsId($this->order_goods->goods_id)->first();
$this->levels = TeamDividendLevelModel::uniacid()->orderBy('level_weight','asc')->get()->toArray(); $this->levels = TeamDividendLevelModel::uniacid()->orderBy('level_weight','asc')->get()->toArray();
$this->flat_prize_limit = 0; $this->flat_prize_limit = 0;
@ -88,6 +91,13 @@ class TeamReturnService
->get() ->get()
->toArray(); ->toArray();
// 购买者上级 uid
$this->parentId = MemberShopInfo::where('member_id',$this->buyMember->uid)->value('parent_id');
// 购买者上级的上级 uid
$this->parentUpId = MemberShopInfo::where('member_id', $this->parentId)->value('parent_id');
\Log::debug('经销商创建-team_goods:' . $this->order_goods->goods_id, $this->team_goods ? $this->team_goods->toArray() : []); \Log::debug('经销商创建-team_goods:' . $this->order_goods->goods_id, $this->team_goods ? $this->team_goods->toArray() : []);
$this->init(); $this->init();
@ -211,6 +221,9 @@ class TeamReturnService
$ratio = $this->amount_service->getRatio(); $ratio = $this->amount_service->getRatio();
// 分红金额 判断:是否开启分期 // 分红金额 判断:是否开启分期
if($this->team_goods->is_stages == 1){ if($this->team_goods->is_stages == 1){
// 判断:仅直推上级获取
if($agent['uid'] != $this->parentId ) return;
// 佣金处理
$levelName = 'level_'.$agent['level']; $levelName = 'level_'.$agent['level'];
$stages_num = unserialize($this->team_goods->stages_num);//分期数量 $stages_num = unserialize($this->team_goods->stages_num);//分期数量
$stages_type = unserialize($this->team_goods->stages_type);//分期类型 $stages_type = unserialize($this->team_goods->stages_type);//分期类型
@ -333,6 +346,9 @@ class TeamReturnService
// 分红金额 判断:是否开启分期 // 分红金额 判断:是否开启分期
if($this->team_goods->is_stages == 1){ if($this->team_goods->is_stages == 1){
// 仅购买者上级的上级可得
if($agent['uid'] != $this->parentUpId) return;
// 佣金处理
$amountList = TeamDividendModel::where('order_sn',$this->order->order_sn) $amountList = TeamDividendModel::where('order_sn',$this->order->order_sn)
->select(['amount','status','expect_thaw_time','reality_thaw_time','month']) ->select(['amount','status','expect_thaw_time','reality_thaw_time','month'])
->whereIn('type',[7,8]) ->whereIn('type',[7,8])