Merge pull request '2.10号功能提交' (#170) from feature/add_item into release
Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/170master
commit
3c760984ab
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
namespace base\Factory;
|
||||
|
||||
class MarketPercentageFactory {
|
||||
|
||||
protected $coefficients = [];
|
||||
//实例化离职服务类
|
||||
public function __construct()
|
||||
{
|
||||
$this->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:[];
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue