@ -68,36 +68,13 @@ class MarketPercentageController extends ThinkController
$_REQUEST['promote_id'] ? ($map['promote_id'] = $_REQUEST['promote_id']) : '';
$_REQUEST['relation_game_id'] ? ($map['relation_game_id'] = $_REQUEST['relation_game_id']) : '';
// $_REQUEST['sdk_version']?($map['sdk_version'] = $_REQUEST['sdk_version']):'';
$_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
$_REQUEST['admin_id'] ? ($map['_string'] .= " AND admin_id = { $_REQUEST['admin_id']}" ) : '';
($_REQUEST['company_id'] || $_REQUEST['company_id'] == '0') ? ($map['company_id'] = $_REQUEST['company_id']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$gid = session('user_group_id');
$markerGroup = $this->MarketEvent->isMarketAdminGroup($gid);
if($markerGroup){
$map['department_id'] =["in",[0,$markerGroup['department_id']]];
if( !$this->MarketEvent->isDepartmentLeder($markerGroup['department_id'],$admin_id)){
$map['admin_id'] = $admin_id ;
}
if($this->MarketEvent->getConfig('isMarket')){
$map['admin_id'] = ['in',$this->MarketEvent->getAdminidByLeaderid()] ;
}
// dd($map);
// $map['admin_id'] = $admin_id;
// if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
// unset($map['admin_id']);
// $admin_data = M("member")
// ->field("access.uid admin_id")
// ->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
// ->join("left join sys_auth_group auth on access.group_id=auth.id")
// ->where(['group_id' => ['in', '11,12,21,25']])
// ->select();
// if ($admin_data) {
// $map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
// }
// $_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
// }
$search_date = [];
if (isset($_REQUEST['time_start']) & & isset($_REQUEST['time_end'])) {
@ -281,30 +258,20 @@ class MarketPercentageController extends ThinkController
public function indexuncaculate($row = 10, $p = 1)
{
$map = [];
$map = [
"_string"=>'1=1',
"is_settlement"=>0
];
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
$_REQUEST['promote_id'] ? ($map['promote_id'] = $_REQUEST['promote_id']) : '';
$_REQUEST['relation_game_id'] ? ($map['relation_game_id'] = $_REQUEST['relation_game_id']) : '';
$_REQUEST['sdk_version'] ? ($map['sdk_version'] = $_REQUEST['sdk_version']) : '';
$_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
$_REQUEST['admin_id'] ? ($map['_string'] .= " AND admin_id = { $_REQUEST['admin_id']}" ) : '';
($_REQUEST['company_id'] || $_REQUEST['company_id'] == '0') ? ($map['company_id'] = $_REQUEST['company_id']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
$map['is_settlement'] = 0;
if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->where(['group_id' => ['in', '11,12,21']])
->select();
if ($admin_data) {
$map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
$_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
if($this->MarketEvent->getConfig('isMarket')){
$map['admin_id'] = ['in',$this->MarketEvent->getAdminidByLeaderid()] ;
}
$search_date = [];
@ -479,7 +446,7 @@ class MarketPercentageController extends ThinkController
}
$data = M("auth_group")
->where(['title' => ['like', '%市场专员%' ]])
->where(['department_id' => ['in', $this->MarketEvent->getConfig('MarketDepartmentId') ]])
->select(false);
$member = M("auth_group_access")
@ -616,18 +583,17 @@ class MarketPercentageController extends ThinkController
} else {
$map['id'] =['in',A("Market","Event")->getNoLeaderMarketGroupId()];
$data = M("auth_group")
->where($map)
->select(false);
$map['sys_auth_group_access.uid'] =['in',$this->MarketEvent->getAdminidByLeaderid()];
$map['auth.id'] =['in',$this->MarketEvent->getNoLeaderMarketGroupId()];
$data = M("auth_group_access")
->field("sys_member.nickname,sys_member.real_name,sys_member.uid,sys_auth_group_access.group_id,IF(coefficient is not NULL, coefficient, 100) coefficient,sys_ucenter_member.leave_time")
->join("left join ({$data}) auth on auth.id = sys_auth_group_access.group_id")
->join("left join sys_auth_group auth on auth.id = sys_auth_group_access.group_id")
->join("left join sys_member on sys_member.uid = sys_auth_group_access.uid")
->join("left join sys_ucenter_member on sys_member.uid = sys_ucenter_member.id")
->join("left join tab_coefficient on tab_coefficient.admin_id = sys_member.uid and pay_time='{$pay_time}'")
->where("auth.title is not null")
->where($map)
->select();
$hideTime = strtotime(date('Y-m-01') . " - 1 month")-1;
foreach ($data as & $v) {
@ -652,23 +618,12 @@ class MarketPercentageController extends ThinkController
//获取权限
$marketPercentage = M("auth_group")->where($map)->getField("id,market_percentage");
$_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
$_REQUEST['level'] ? ($map['level'] = $_REQUEST['level']) : '';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$gid = session('user_group_id');
$markerGroup = $this->MarketEvent->isMarketAdminGroup($gid);
if($markerGroup){
if( $this->MarketEvent->isDepartmentLeder($markerGroup['department_id'],$admin_id)){
$map['admin_id'] = ['in',$this->MarketEvent->getDepartmentUserId($markerGroup['department_id'])];
}else{
$map['admin_id'] = $admin_id ;
}
}
$_REQUEST['admin_id'] ? ($map['_string'] .= " AND admin_id = {$_REQUEST['admin_id']}") : '';
if($this->MarketEvent->getConfig('isMarket')){
$map['admin_id'] = ['in',$this->MarketEvent->getAdminidByLeaderid()] ;
}
$search_date = [];
if (isset($_REQUEST['time_start']) & & isset($_REQUEST['time_end'])) {
@ -1036,17 +991,10 @@ class MarketPercentageController extends ThinkController
}
}
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$gid = session('user_group_id');
$markerGroup = $this->MarketEvent->isMarketAdminGroup($gid);
if($markerGroup){
if( $this->MarketEvent->isDepartmentLeder($markerGroup['department_id'],$admin_id)){
$map['admin_id'] = ['in',$this->MarketEvent->getDepartmentUserId($markerGroup['department_id'])];
}else{
$map['admin_id'] = $admin_id ;
}
}
$_REQUEST['admin_id'] ? ($map['_string'] .= " AND admin_id = {$_REQUEST['admin_id']}") : '';
if($this->MarketEvent->getConfig('isMarket')){
$map['admin_id'] = ['in',$this->MarketEvent->getAdminidByLeaderid()] ;
}
$search_date = [];