From 9b2f7b1a61407e88b4c4f30f3d40cc427629fb8f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 8 Feb 2021 09:46:48 +0800 Subject: [PATCH] =?UTF-8?q?2.10=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 110 ++----------- .../Base/Factory/BaseFactory.class.php | 1 + .../Factory/MarketPercentageFactory.class.php | 151 ++++++++++++++++++ 3 files changed, 166 insertions(+), 96 deletions(-) create mode 100644 Application/Base/Factory/MarketPercentageFactory.class.php diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 81188c4b0..54034f2f6 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -16,6 +16,10 @@ class MarketPercentageController extends ThinkController //实例化离职服务类 private $leavePercentage; private $unSettlementList; + private $marketPercentage; + + private $returnMarketPercentageArray = []; + private $returnWaitMarketPercentageArray = []; protected function _initialize() { @@ -30,6 +34,8 @@ class MarketPercentageController extends ThinkController $instance = BaseFactory::getInstance(); $this->leavePercentage = $instance->factoryClass("LeavePercentage"); + $this->marketPercentage = $instance->factoryClass("MarketPercentage"); + //不结算列表 $this->leavePercentage->unSettlementList(); $this->unSettlementList = $this->leavePercentage->returnUnSettlementList(); @@ -734,6 +740,9 @@ class MarketPercentageController extends ThinkController $sum['wait_commission'] = 0; $admin = $_SESSION['onethink_admin']['user_auth']['username']; + $this->returnMarketPercentageArray = $this->marketPercentage->returnMarketPercentageArray(); + $this->returnWaitMarketPercentageArray = $this->marketPercentage->returnWaitMarketPercentageArray(); + foreach ($data as $key => $value) { $level = $value['level']; if (isset($marketPercentage[$level])) { @@ -818,105 +827,13 @@ class MarketPercentageController extends ThinkController $data[$key]['company_profit'] = "0.00"; $value['company_profit'] = "0.00"; } - - if ($market_percentage['time'] == 1) { - - if ($month == '07') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'performance_commission']; - } elseif ($month == '10') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'performance_commission']; - } elseif ($month == '04') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'performance_commission'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'performance_commission']; - } elseif ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'performance_commission'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'performance_commission']; - } - } elseif ($market_percentage['time'] == 2) { - if ($month == '07') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission'] + - $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission']; - } elseif ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission']; - } - } elseif ($market_percentage['time'] == 3) { - if ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03' . 'performance_commission'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06' . 'performance_commission'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'performance_commission'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission']; - } - } else { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . date("Y-m", strtotime("last month", strtotime($value['pay_time']))) . 'performance_commission']; - } - - if ($market_percentage['remain_time'] == 1) { - if ($month == '07') { - - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'04'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'05'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'06'.'achievement_bonus']; - // dump($data[$key]['extend_commission']);die(); - } elseif ($month == '10') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'07'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'08'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'09'.'achievement_bonus']; - } elseif ($month == '04') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].$yes.'-'.'01'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'02'.'achievement_bonus'] + $wait_amount[$value['admin_id'].$yes.'-'.'03'.'achievement_bonus']; - } elseif ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus']; -// $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'].($yes-1).'-'.'10'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'11'.'achievement_bonus'] + $wait_amount[$value['admin_id'].($yes-1).'-'.'12'.'achievement_bonus']; - } - } elseif ($market_percentage['remain_time'] == 2) { - if ($month == '07') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus'] + - $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus']; - } elseif ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus']; - } - } elseif ($market_percentage['remain_time'] == 3) { - if ($month == '01') { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '03' . 'achievement_bonus'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '06' . 'achievement_bonus'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '09' . 'achievement_bonus'] + - $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus']; - } - } else { - $data[$key]['extend_commission'] += $wait_amount[$value['admin_id'] . date("Y-m", strtotime("last month", strtotime($value['pay_time']))) . 'achievement_bonus']; - } -// $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'], 2, '.', ''); // + $data[$key]['extend_commission'] += $this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['performance_commission']+$this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['achievement_bonus']; +// dump($this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['performance_commission']); +// dump($this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['achievement_bonus']); - if ($market_percentage['time'] == 1) { - - if ($month == '07') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'performance_commission']; - } elseif ($month == '10') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '07' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '08' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '09' . 'performance_commission']; - } elseif ($month == '04') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'performance_commission'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'performance_commission']; - } elseif ($month == '01') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'performance_commission'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'performance_commission']; - } - } - - if ($market_percentage['remain_time'] == 1) { - if ($month == '07') { - - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '04' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '05' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '06' . 'achievement_bonus']; - // dump($data[$key]['extend_commission']);die(); - } elseif ($month == '10') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '07' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '08' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '09' . 'achievement_bonus']; - } elseif ($month == '04') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . $yes . '-' . '01' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '02' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . $yes . '-' . '03' . 'achievement_bonus']; - } elseif ($month == '01') { - $data[$key]['wait_commission'] += $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '10' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '11' . 'achievement_bonus'] + $wait_amount[$value['admin_id'] . ($yes - 1) . '-' . '12' . 'achievement_bonus']; - } - } + $data[$key]['wait_commission'] += $this->returnWaitMarketPercentageArray[$value['admin_id'].$value['pay_time']]['performance_commission']+$this->returnWaitMarketPercentageArray[$value['admin_id'].$value['pay_time']]['achievement_bonus']; $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'], 2, '.', ''); $data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'], 2, '.', ''); @@ -933,6 +850,7 @@ class MarketPercentageController extends ThinkController } +// die(); $sum['wait_commission'] = '-------'; $sum['pay_time'] = '总计'; diff --git a/Application/Base/Factory/BaseFactory.class.php b/Application/Base/Factory/BaseFactory.class.php index 2aeec615c..6cfbf2b77 100644 --- a/Application/Base/Factory/BaseFactory.class.php +++ b/Application/Base/Factory/BaseFactory.class.php @@ -14,6 +14,7 @@ class BaseFactory { 'LeavePercentageFactory' => LeavePercentageFactory::class, 'SpecialCompoentFactory' => SpecialCompoentFactory::class, 'SpecialCompoentCaculateFactory' => SpecialCompoentCaculateFactory::class, + 'MarketPercentageFactory' => MarketPercentageFactory::class, ]; public function __construct() diff --git a/Application/Base/Factory/MarketPercentageFactory.class.php b/Application/Base/Factory/MarketPercentageFactory.class.php new file mode 100644 index 000000000..bd07c0a41 --- /dev/null +++ b/Application/Base/Factory/MarketPercentageFactory.class.php @@ -0,0 +1,151 @@ +coefficients = []; + $coefficient_data = M("coefficient", "tab_")->where("1=1")->select(); + + foreach ($coefficient_data as $key => $value) { + + $this->coefficients[$value['pay_time']][$value['admin_id']] = $value['coefficient'] / 100; + + } + } + + public function returnMarketPercentageArray() { + + $map['group_id'] = ['in', '11,12,21']; + $marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage"); + $all_data = SM("market_altogether", "tab_") + ->select(); + + $returnArr = []; + + foreach ($all_data as $key => $value) { + + $level = $value['level']; + if (isset($marketPercentage[$level])) { + $value['market_percentage'] = $marketPercentage[$level]; + } + $market_percentage = json_decode($value['market_percentage'], true); + $month = date("m", strtotime($value['pay_time'])); + $yes = date("Y", strtotime($value['pay_time'])); + + if ($market_percentage['time'] == 1) { + + if ($month=="01" || $month=="02" || $month=="03") { + $returnArr[$value['admin_id'].$yes."-07"]['performance_commission'] += $value['wait_performance_commission']; + } elseif ($month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-10"]['performance_commission'] += $value['wait_performance_commission']; + } elseif($month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-04"]['performance_commission'] += $value['wait_performance_commission']; + } elseif($month=="07" || $month=="08" || $month=="09") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['performance_commission'] += $value['wait_performance_commission']; + } + + } elseif($market_percentage['time'] == 2) { + if ($month=="01" || $month=="02" || $month=="03"||$month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-07"]['performance_commission'] += $value['wait_performance_commission']; + } elseif($month=="07" || $month=="08" || $month=="09"||$month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['performance_commission'] += $value['wait_performance_commission']; + } + } elseif($market_percentage['time'] == 3) { + $returnArr[$value['admin_id'].($yes+1)."-01"]['performance_commission'] += $value['wait_performance_commission']; + } else { + $returnArr[$value['admin_id'].date("Y-m", strtotime("next month", strtotime($value['pay_time'])))]['performance_commission'] += $value['wait_performance_commission']; + } + + if ($market_percentage['remain_time'] == 1) { + + if ($month=="01" || $month=="02" || $month=="03") { + $returnArr[$value['admin_id'].$yes."-07"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif ($month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-10"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif($month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-04"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif($month=="07" || $month=="08" || $month=="09") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['achievement_bonus'] += + $value['wait_achievement_commission'] * + ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } + + } elseif($market_percentage['remain_time'] == 2) { + if ($month=="01" || $month=="02" || $month=="03"||$month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-07"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif($month=="07" || $month=="08" || $month=="09"||$month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } + } elseif($market_percentage['remain_time'] == 3) { + $returnArr[$value['admin_id'].($yes+1)."-01"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } else { + $returnArr[$value['admin_id'].date("Y-m", strtotime("next month", strtotime($value['pay_time'])))]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } + + } + + return $returnArr?$returnArr:[]; + + } + + //返回待发放 + public function returnWaitMarketPercentageArray() { + + $map['group_id'] = ['in', '11,12,21']; + $marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage"); + $all_data = SM("market_altogether", "tab_") + ->select(); + + $returnArr = []; + + foreach ($all_data as $key => $value) { + + $level = $value['level']; + if (isset($marketPercentage[$level])) { + $value['market_percentage'] = $marketPercentage[$level]; + } + $market_percentage = json_decode($value['market_percentage'], true); + $month = date("m", strtotime($value['pay_time'])); + $yes = date("Y", strtotime($value['pay_time'])); + + if ($market_percentage['time'] == 1) { + + if ($month=="01" || $month=="02" || $month=="03") { + $returnArr[$value['admin_id'].$yes."-04"]['performance_commission'] += $value['wait_performance_commission']; + } elseif ($month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-07"]['performance_commission'] += $value['wait_performance_commission']; + } elseif($month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['performance_commission'] += $value['wait_performance_commission']; + } elseif($month=="07" || $month=="08" || $month=="09") { + $returnArr[$value['admin_id'].$yes."-10"]['performance_commission'] += $value['wait_performance_commission']; + } + + } + + if ($market_percentage['remain_time'] == 1) { + + if ($month=="01" || $month=="02" || $month=="03") { + $returnArr[$value['admin_id'].$yes."-04"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif ($month=="04" || $month=="05" || $month=="06") { + $returnArr[$value['admin_id'].$yes."-07"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif($month=="10" || $month=="11" || $month=="12") { + $returnArr[$value['admin_id'].($yes+1)."-01"]['achievement_bonus'] += $value['wait_achievement_commission'] * ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } elseif($month=="07" || $month=="08" || $month=="09") { + $returnArr[$value['admin_id'].($yes)."-10"]['achievement_bonus'] += + $value['wait_achievement_commission'] * + ($this->coefficients[$value['pay_time']][$value['admin_id']] ? $this->coefficients[$value['pay_time']][$value['admin_id']] : 1); + } + + } + + } + + return $returnArr?$returnArr:[]; + + } + +} \ No newline at end of file