Merge branch 'feature/more_payment' of 8.136.139.249:wmtx/platform into feature/statement_warning_change

master
chenzhi 3 years ago
commit a26cb8ccca

@ -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 = [];

@ -15,68 +15,27 @@ class OldCountController extends \Think\Controller
public function moreDepartment()
{
//1.新增组
$manager = M('auth_group','sys_')->where("title = '高级市场专员'")->find();
$dbres = M('auth_group','sys_')->where("title LIKE '%市场%' AND id != 18")->select();
$dbres = M('auth_group','sys_')->where("department_id = 2 and department_level != 5")->select();
// $ids = '32,33,34,35';
$ids = '';
foreach ($dbres as &$v) {
if($v['id'] == 25){
$v['rules'] = $manager['rules'];
$v['data_empower_type'] =3;
$v['show_data'] =1;
$v['show_market_admin'] =1;
$v['show_promote'] =1;
}
if(mb_strpos($v['title'],"初级")){
$v['department_level'] = 1;
}
if(mb_strpos($v['title'],"中级")){
$v['department_level'] = 2;
}
if(mb_strpos($v['title'],"高级")){
$v['department_level'] = 3;
}
if(mb_strpos($v['title'],"经理")){
$v['department_level'] = 4;
}
if(mb_strpos($v['title'],"总监")){
$v['department_level'] = 5;
}
$v['title'] = "一部".$v['title'];
$v['department_id'] = 1;
$v['department_name'] = "市场一部";
M('auth_group','sys_')->save($v);
unset($v['id']);
$v['title'] = str_replace("一部","二部",$v['title']);
$v['department_id'] = 2;
$v['department_name'] = '市场二部';
M('auth_group','sys_')->add($v);
$v['title'] = str_replace("二部","长沙",$v['title']);
$v['department_id'] = 3;
$v['department_name'] = '长沙分部';
$ids .= ( M('auth_group','sys_')->add($v) . ",");
}
$ids = rtrim($ids,',');
//3.增加部门表数据
M("department")->add([
'id'=>1,
'name'=>'市场一部',
'group_ids'=>'11,12,14,21,25',
'id'=>3,
'name'=>'长沙分部',
'group_ids'=>$ids,
'leader_group'=>'14',
'create_time'=>time(),
'update_time'=>time()
]);
M("department")->add([
'id'=>2,
'name'=>'市场二部',
'group_ids'=>'26,27,28,29,30',
'leader_group'=>'28',
'create_time'=>time(),
'update_time'=>time()
]);
//4.修改旧等级
M("market_altogether","tab_")->where("level = 21")->save(['level'=>1]);
M("market_altogether","tab_")->where("level = 11")->save(['level'=>2]);
M("market_altogether","tab_")->where("level = 12")->save(['level'=>3]);
M("market_altogether","tab_")->where("level = 25")->save(['level'=>4]);
}
public function setDataPresidentInit()

@ -5,7 +5,7 @@ use Think\Controller;
class MarketEvent extends Controller
{
private $MarketDepartmentId = "1,2";
private $MarketDepartmentId = "1,2,3";
private $ManagerLevel = "4";
private $DirectorLevel = "5";
private $LevelConfig = [
@ -14,7 +14,22 @@ class MarketEvent extends Controller
'3'=>'高级',
'4'=>'经理'
];
private $uid;
private $gid;
private $isMarket = false;
private $isInit = false;
public function defaultInit()
{
if($isInit) return $this;
$this->uid = $_SESSION['onethink_admin']['user_auth']['uid'];
$this->gid = session('user_group_id');
$info = $this->isMarketAdminGroup($this->gid);
if($info){
$this->isMarket = true;
}
return $this;
}
/**
* 获取所有市场部组id
*/
@ -78,7 +93,7 @@ class MarketEvent extends Controller
*/
public function getConfig($key)
{
return $this->$key;
return $this->defaultInit()->$key;
}
/**
* 获取等级名称
@ -87,6 +102,11 @@ class MarketEvent extends Controller
{
return $this->LevelConfig[$level];
}
/**
* 是否是市场专员
* @param [int] $gid 管理组id
* @return boolean
*/
public function isMarketAdminGroup($gid)
{
$where = [
@ -96,18 +116,6 @@ class MarketEvent extends Controller
return M('auth_group','sys_')->field("id,department_id,department_level")->where($where)->find();
}
public function isDepartmentLeder($department_id,$uid)
{
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id');
return M('department','sys_')->where("id = '{$department_id}' and leader_group = '$gid'")->field("id")->find();
}
public function isMarketLeder($uid)
{
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id');
return M("auth_group")->where("id = '{$gid}' and department_level = '{$this->DirectorLevel}'")->field("id")->find();
}
/**
* 添加部门总监的会长权限
* $uid,$promote_id
@ -240,4 +248,27 @@ class MarketEvent extends Controller
return $companyIds;
}
/**
* 获取部门领导管辖的所有用户,非领导返回自己
*
* @param int $value uid/null时候为自己
* @param string $type uid/group_id
* @return array
*/
public function getAdminidByLeaderid($uid=null)
{
$this->defaultInit();
if($uid){
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id');
}else{
$uid = $this->uid;
$gid = $this->gid;
}
$group_ids = M('department','sys_')->where("leader_group = '{$gid}'")->getField("group_concat(group_ids) as group_ids");
if(!$group_ids) return $uid;
$adminIds = M("auth_group_access")->where("group_id in ({$group_ids})")->getField('uid',true);
return $adminIds ?? $uid;
}
}

@ -95,7 +95,7 @@
<div class="data_list box_mt" style="margin-top: 10px;0">
<div class="">
<form id="form" action="{:U('coefficientSave')}" method="post" class="form-horizontal">
<form id="form" method="post" class="form-horizontal">
<table id="exporttable">
<!-- 表头 -->
<thead>
@ -115,7 +115,7 @@
</tbody>
</table>
<div class="jssearch fr cf search_list" style="width: 100%;">
<a class="sch-btn" id="jssearch" url="{:U('coefficientSave')}" style="width: 120px;margin-top: 20px;margin-right: 20px;float: right;">提交保存</a>
<a class="sch-btn" id="confimBtn" url="{:U('coefficientSave')}" style="width: 120px;margin-top: 20px;margin-right: 20px;float: right;">提交保存</a>
</div>
</form>
</div>
@ -125,8 +125,7 @@
<script type="text/javascript">
$("#jssearch").click(function(){
$("#confimBtn").click(function(){
var url = $(this).attr('url');
var query = $('table').find('input').serialize();
query += "&" + $('table').find('select').serialize();
@ -141,7 +140,7 @@
url += '&is_get=1';
layer.confirm('【提示】是否确认财务部编辑保存', {
layer.confirm('【提示】是否绩效确认', {
btn: ['确认','取消'],
title:false
}, function(index){

Loading…
Cancel
Save