From bc19bec4b1a0ff3ed777c62156032b05fdf9a5a0 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 2 Aug 2021 11:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=91=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 3 ++- .../Factory/MarketPercentageFactory.class.php | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 980eea7b1..0fc66bcef 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -729,7 +729,7 @@ class MarketPercentageController extends ThinkController ->order("pay_time DESC,pay_amount DESC") ->select(); } - + $count = SM("market_altogether", "tab_") ->where($map) ->count(); @@ -873,6 +873,7 @@ class MarketPercentageController extends ThinkController } // $data[$key]['should_performance_commission'] = number_format($value["performance_commission"] * ($market_percentage["performance_monthly_ratio"]/100), 2, '.', '')+$this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['performance_commission']; + $data[$key]['extend_commission'] += $this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['performance_commission']+$this->returnMarketPercentageArray[$value['admin_id'].$value['pay_time']]['achievement_bonus']; $data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'], 2, '.', ''); diff --git a/Application/Base/Factory/MarketPercentageFactory.class.php b/Application/Base/Factory/MarketPercentageFactory.class.php index fc6623d0f..0f40b8f70 100644 --- a/Application/Base/Factory/MarketPercentageFactory.class.php +++ b/Application/Base/Factory/MarketPercentageFactory.class.php @@ -4,9 +4,11 @@ namespace base\Factory; class MarketPercentageFactory { protected $coefficients = []; + protected $groupid = []; //实例化离职服务类 public function __construct() { + $this->groupid = A("Admin/Market","Event")->getMarketGroupId(); $this->coefficients = []; $coefficient_data = M("coefficient", "tab_")->where("1=1")->select(); @@ -16,23 +18,27 @@ class MarketPercentageFactory { } } + public function adminId2GroupID($admin_id){ + return M("auth_group_access","sys_")->where("uid = '{$admin_id}'")->getField("group_id"); + } public function returnMarketPercentageArray() { - $map['group_id'] = ['in', '11,12,21']; + $map['group_id'] = ['in', $this->groupid]; $marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage"); - $all_data = SM("market_altogether", "tab_") + $all_data = SM("market_altogether", "tab_")->alias("m")->field("m.*,a.group_id")->join("sys_auth_group_access as a on m.admin_id = a.uid") ->select(); $returnArr = []; foreach ($all_data as $key => $value) { - $level = $value['level']; + $level = $value['group_id']; 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'])); @@ -95,16 +101,18 @@ class MarketPercentageFactory { //返回待发放 public function returnWaitMarketPercentageArray() { - $map['group_id'] = ['in', '11,12,21']; + $map['group_id'] = ['in', $this->groupid]; $marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage"); - $all_data = SM("market_altogether", "tab_") + // $all_data = SM("market_altogether", "tab_") + // ->select(); + $all_data = SM("market_altogether", "tab_")->alias("m")->field("m.*,a.group_id")->join("sys_auth_group_access as a on m.admin_id = a.uid") ->select(); $returnArr = []; foreach ($all_data as $key => $value) { - $level = $value['level']; + $level = $value['group_id']; if (isset($marketPercentage[$level])) { $value['market_percentage'] = $marketPercentage[$level]; }