添加:经销商升级条件 - 团队业绩满多少升级支持去除业绩最多的一条线
This commit is contained in:
parent
2a992b56c7
commit
31684afd8b
|
|
@ -393,9 +393,9 @@ class TeamAgencyController extends BaseController
|
||||||
public function test(){
|
public function test(){
|
||||||
|
|
||||||
//因为model偶尔会出现status异常的问题,所以重新查询一遍
|
//因为model偶尔会出现status异常的问题,所以重新查询一遍
|
||||||
// $model = Order::with('hasManyOrderGoods')->find(84);
|
$model = Order::with('hasManyOrderGoods')->find(84);
|
||||||
// $set = \Setting::get('plugin.team_dividend');
|
$set = \Setting::get('plugin.team_dividend');
|
||||||
// (new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
|
(new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
|
||||||
|
|
||||||
// $order = Order::find(87);
|
// $order = Order::find(87);
|
||||||
// $TeamReturnService = ReturnConfig::getClass();
|
// $TeamReturnService = ReturnConfig::getClass();
|
||||||
|
|
|
||||||
|
|
@ -443,13 +443,11 @@ class UpgrateConditionService{
|
||||||
if(Setting::get('plugin.team_dividend.level_up_choose') == 1){
|
if(Setting::get('plugin.team_dividend.level_up_choose') == 1){
|
||||||
$column = 'yz_order.goods_price';
|
$column = 'yz_order.goods_price';
|
||||||
$amount_name = '订单商品现价';
|
$amount_name = '订单商品现价';
|
||||||
}
|
}else{
|
||||||
else{
|
|
||||||
$column = 'yz_order.price';
|
$column = 'yz_order.price';
|
||||||
$amount_name = '订单实付金额';
|
$amount_name = '订单实付金额';
|
||||||
}
|
}
|
||||||
if(!$type){
|
if(!$type){
|
||||||
//$this->addErrorChild($type);
|
|
||||||
$this->uplogService->pushCondition([
|
$this->uplogService->pushCondition([
|
||||||
'type' => $this->typeName,
|
'type' => $this->typeName,
|
||||||
'type_name' => '团队业绩'.$amount_name.'满',
|
'type_name' => '团队业绩'.$amount_name.'满',
|
||||||
|
|
@ -461,11 +459,23 @@ class UpgrateConditionService{
|
||||||
]);
|
]);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
$teamOrderPrice = MemberChild::select(['yz_member_children.child_id','yz_member_children.member_id'])
|
// 获取直推下级列表
|
||||||
->join('yz_order','yz_member_children.child_id','=','yz_order.uid')
|
$subIds = MemberChild::uniacid()
|
||||||
->where('yz_order.status','>=',$this->order_status)
|
->where('level',1)
|
||||||
->where('yz_member_children.member_id',$this->uid)
|
->where('member_id',$this->uid)
|
||||||
->sum($column);
|
->pluck('child_id')
|
||||||
|
->toArray();
|
||||||
|
$subPerformance = [];// 每条线的业绩
|
||||||
|
foreach($subIds as $subUid){
|
||||||
|
$lineAllUid = MemberChild::uniacid()->where('member_id',$subUid)->pluck('child_id')->toArray();
|
||||||
|
$lineAllUid[] = $subUid;
|
||||||
|
$subPerformance[$subUid] = Order::whereIn('uid',$lineAllUid)->where('status','>=',$this->order_status)->sum($column);
|
||||||
|
}
|
||||||
|
// 计算团队总业绩 判断:是否去除最大业绩
|
||||||
|
$maxAmount = 0;
|
||||||
|
if((int)$this->upgradeParase['team_order_amount_close_max'] == 1) $maxAmount = max($subPerformance);
|
||||||
|
$teamOrderPrice = (float)sprintf("%.2f",array_sum($subPerformance) - $maxAmount);
|
||||||
|
// 判断:是否开启自购
|
||||||
$logremark = '不计算自购订单';
|
$logremark = '不计算自购订单';
|
||||||
if($this->set['including_self'] == 1){
|
if($this->set['including_self'] == 1){
|
||||||
$logremark = '计算自购订单';
|
$logremark = '计算自购订单';
|
||||||
|
|
@ -473,12 +483,8 @@ class UpgrateConditionService{
|
||||||
->where('status','>=',$this->order_status)
|
->where('status','>=',$this->order_status)
|
||||||
->sum($column);
|
->sum($column);
|
||||||
}
|
}
|
||||||
|
// 判断:是否符合条件
|
||||||
$condition = $teamOrderPrice >= $this->upgradeParase[$this->typeName];
|
$condition = $teamOrderPrice >= $this->upgradeParase[$this->typeName];
|
||||||
/*dump($this->typeName);
|
|
||||||
dump($this->upgradeParase[$this->typeName]);
|
|
||||||
dump($teamOrderPrice);
|
|
||||||
return true;*/ // 记录详情
|
|
||||||
//$this->addLogChild($teamOrderPrice);
|
|
||||||
$this->uplogService->pushCondition([
|
$this->uplogService->pushCondition([
|
||||||
'type' => $this->typeName,
|
'type' => $this->typeName,
|
||||||
'type_name' => '团队业绩'.$amount_name.'满['.$logremark.']',
|
'type_name' => '团队业绩'.$amount_name.'满['.$logremark.']',
|
||||||
|
|
@ -488,9 +494,7 @@ class UpgrateConditionService{
|
||||||
'result' => $condition,
|
'result' => $condition,
|
||||||
'remark' => $condition ? '满足条件' : '不满足条件'
|
'remark' => $condition ? '满足条件' : '不满足条件'
|
||||||
]);
|
]);
|
||||||
if($condition){
|
if($condition) return TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -281,16 +281,13 @@
|
||||||
|
|
||||||
<div class="input-group row">
|
<div class="input-group row">
|
||||||
<label class="radio-inline col-xs-12 col-sm-6">
|
<label class="radio-inline col-xs-12 col-sm-6">
|
||||||
<input type="checkbox" name="upgrade_type[team_order_amount]" value="1"
|
<input type="checkbox" name="upgrade_type[team_order_amount]" value="1" @if ($upgrade_type['team_order_amount']) checked @endif>
|
||||||
@if ($upgrade_type['team_order_amount'])
|
|
||||||
checked
|
|
||||||
@endif
|
|
||||||
>
|
|
||||||
(编号:<a href='JavaScript:'>1007</a>)<br>
|
(编号:<a href='JavaScript:'>1007</a>)<br>
|
||||||
团队业绩金额满
|
团队业绩金额满
|
||||||
<input type="text" name="upgrade_value[team_order_amount]"
|
<input type="text" name="upgrade_value[team_order_amount]" value="{{$upgrade_value['team_order_amount']}}">
|
||||||
value="{{$upgrade_value['team_order_amount']}}">
|
|
||||||
<span>元</span>
|
<span>元</span>
|
||||||
|
去除业绩最大的那条线
|
||||||
|
<input type="checkbox" name="upgrade_value[team_order_amount_close_max]" value="1" @if ($upgrade_value['team_order_amount_close_max']) checked @endif>
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-inline col-xs-12 col-sm-6">
|
<label class="radio-inline col-xs-12 col-sm-6">
|
||||||
<input type="checkbox" name="upgrade_type[team_shop_order_amount]" value="1"
|
<input type="checkbox" name="upgrade_type[team_shop_order_amount]" value="1"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue