|
|
@ -4,9 +4,11 @@ namespace base\Factory;
|
|
|
|
class MarketPercentageFactory {
|
|
|
|
class MarketPercentageFactory {
|
|
|
|
|
|
|
|
|
|
|
|
protected $coefficients = [];
|
|
|
|
protected $coefficients = [];
|
|
|
|
|
|
|
|
protected $groupid = [];
|
|
|
|
//实例化离职服务类
|
|
|
|
//实例化离职服务类
|
|
|
|
public function __construct()
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->groupid = A("Admin/Market","Event")->getMarketGroupId();
|
|
|
|
$this->coefficients = [];
|
|
|
|
$this->coefficients = [];
|
|
|
|
$coefficient_data = M("coefficient", "tab_")->where("1=1")->select();
|
|
|
|
$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() {
|
|
|
|
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");
|
|
|
|
$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();
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
$returnArr = [];
|
|
|
|
$returnArr = [];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($all_data as $key => $value) {
|
|
|
|
foreach ($all_data as $key => $value) {
|
|
|
|
|
|
|
|
|
|
|
|
$level = $value['level'];
|
|
|
|
$level = $value['group_id'];
|
|
|
|
if (isset($marketPercentage[$level])) {
|
|
|
|
if (isset($marketPercentage[$level])) {
|
|
|
|
$value['market_percentage'] = $marketPercentage[$level];
|
|
|
|
$value['market_percentage'] = $marketPercentage[$level];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$market_percentage = json_decode($value['market_percentage'], true);
|
|
|
|
$market_percentage = json_decode($value['market_percentage'], true);
|
|
|
|
|
|
|
|
|
|
|
|
$month = date("m", strtotime($value['pay_time']));
|
|
|
|
$month = date("m", strtotime($value['pay_time']));
|
|
|
|
$yes = date("Y", strtotime($value['pay_time']));
|
|
|
|
$yes = date("Y", strtotime($value['pay_time']));
|
|
|
|
|
|
|
|
|
|
|
@ -95,16 +101,18 @@ class MarketPercentageFactory {
|
|
|
|
//返回待发放
|
|
|
|
//返回待发放
|
|
|
|
public function returnWaitMarketPercentageArray() {
|
|
|
|
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");
|
|
|
|
$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();
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
$returnArr = [];
|
|
|
|
$returnArr = [];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($all_data as $key => $value) {
|
|
|
|
foreach ($all_data as $key => $value) {
|
|
|
|
|
|
|
|
|
|
|
|
$level = $value['level'];
|
|
|
|
$level = $value['group_id'];
|
|
|
|
if (isset($marketPercentage[$level])) {
|
|
|
|
if (isset($marketPercentage[$level])) {
|
|
|
|
$value['market_percentage'] = $marketPercentage[$level];
|
|
|
|
$value['market_percentage'] = $marketPercentage[$level];
|
|
|
|
}
|
|
|
|
}
|
|
|
|