You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace Admin\Event;
use Think\Controller;
class MarketEvent extends Controller
{
private $MarketDepartmentId = "1,2";
private $ManagerLevel = "4";
/**
* 获取所有市场部组id
*/
public function getMarketGroupId()
{
$res = M('department','sys_')->where("id in ({$this->MarketDepartmentId})")->getField("group_ids",true);
$sendData = '';
foreach ($res as $value) {
$sendData .= $value.",";
}
return rtrim($sendData,",");
}
/**
* 获取普通的市场专员初中高的gid
*/
public function getGeneralMarketGroup()
{
$where = [
"department_id"=>['in',$this->MarketDepartmentId],
"department_level"=>['LT',4]
];
$dbres = M('auth_group','sys_')->where($where)->getField("id",true);
return implode(",",$dbres);
}
/**
* 获取经理信息
*/
public function getManagerPerformanInfo()
{
$where = [
"department_id"=>['in',$this->MarketDepartmentId],
"department_level"=>['eq',$this->ManagerLevel]
];
$dbres = M('auth_group','sys_')->where($where)->getField("id",true);
$market = M("auth_group_access")
->alias("acc")
->where(["acc.group_id"=>['in',$dbres]])
->join("sys_member as mem on acc.uid = mem.uid")
->join("sys_auth_group as gro on acc.group_id = gro.id")
->getField("acc.uid,mem.nickname,mem.real_name,gro.department_id,gro.market_percentage",true);
return $market;
}
public function getConfig($key)
{
return $this->$key;
}
}