线索增加团队过滤
This commit is contained in:
@@ -7,6 +7,50 @@ class Common extends BaseCommon
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
}
|
||||
|
||||
public function teamList()
|
||||
{
|
||||
$groupType = $_SESSION['groupType'];
|
||||
if ($groupType == Pingan_users_model::GROUP_TYPE_DEP) { //部经理
|
||||
$where = ['groupType' => Pingan_users_model::GROUP_TYPE_TEAM];
|
||||
$result = $this->pingan_users_model->select($where, 'id asc', '', '', 'id as value,username as label');
|
||||
} elseif ($groupType > Pingan_users_model::GROUP_TYPE_DEP || $_SESSION['id'] == 1) { //部经理以上
|
||||
$groupList = Pingan_users_model::GROUP_TYPE_TEAM . ',' . Pingan_users_model::GROUP_TYPE_DEP;
|
||||
$where = ["groupType in ($groupList)" => null];
|
||||
$rows = $this->pingan_users_model->select($where, 'id asc', '', '', 'id,username,groupType,teamId,depId');
|
||||
$result = $this->toTree($rows);
|
||||
} else {
|
||||
$result = [];
|
||||
}
|
||||
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
private function toTree($rows)
|
||||
{
|
||||
$result = [];
|
||||
$tempList = $rows;
|
||||
foreach ($rows as $item) {
|
||||
if ($item['groupType'] == Pingan_users_model::GROUP_TYPE_DEP) {
|
||||
$children = [];
|
||||
foreach ($tempList as $key1 => $item2) {
|
||||
if ($item2['depId'] == $item['id'] && $item2['groupType'] == Pingan_users_model::GROUP_TYPE_TEAM) {
|
||||
$children[] = [
|
||||
'value' => $item2['id'],
|
||||
'label' => $item2['username']
|
||||
];
|
||||
//删除已添加的
|
||||
unset($tempList[$key1]);
|
||||
}
|
||||
}
|
||||
$result[] = [
|
||||
'value' => $item['id'],
|
||||
'label' => $item['username'],
|
||||
'children' => $children
|
||||
];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,8 @@ class Clues extends BaseController
|
||||
}
|
||||
$belongList = $this->pingan_users_model->levelListTree($_SESSION['id'], $_SESSION['groupType']);
|
||||
$levelList = Receiver_clues_model::LEVEL_LIST;
|
||||
$data = ['statusList' => $statusList, 'belongList' => $belongList, 'levelList' => $levelList];
|
||||
$isShowTeamSearch = $_SESSION['groupType'] == Pingan_users_model::GROUP_TYPE_ATTEND ? 0 : 1;
|
||||
$data = ['statusList' => $statusList, 'belongList' => $belongList, 'levelList' => $levelList, 'isShowTeamSearch' => $isShowTeamSearch];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
@@ -201,6 +202,7 @@ class Clues extends BaseController
|
||||
$brands = $this->input_param('brands');
|
||||
$status = $this->input_param('status');
|
||||
$citys = $this->input_param('citys');
|
||||
$teamIds = $this->input_param('teamIds');
|
||||
// $belong = $this->input_param('belong');
|
||||
$where = [
|
||||
'app_id' => self::APP_ID,
|
||||
@@ -242,6 +244,16 @@ class Clues extends BaseController
|
||||
$seriesIdString = implode(',', $seriesIdArr);
|
||||
$seriesIdString && $where["series_id in ($seriesIdString)"] = null;
|
||||
}
|
||||
if ($teamIds) {
|
||||
$teamIdArr = [];
|
||||
foreach ($teamIds as $item) {
|
||||
$itemArray = json_decode($item, true);
|
||||
$teamIdArr[] = count($itemArray) == 1 ? $itemArray[0] : $itemArray[1];
|
||||
}
|
||||
$teamIdString = implode(',', $teamIdArr);
|
||||
!$teamIdString && $teamIdString = 0;
|
||||
$where["team_id in ($teamIdString)"] = null;
|
||||
}
|
||||
strlen($status) && $where['status'] = intval($status);
|
||||
$citys && $where['city_id'] = $citys[1];
|
||||
if ($params['dateRange'][0] && $params['dateRange'][1]) {
|
||||
|
||||
@@ -62,9 +62,9 @@ class ApiAuthHook
|
||||
}
|
||||
} else { //后台
|
||||
if (preg_match($this->route, $uri_string) || preg_match($this->pingan_route, $uri_string)) {
|
||||
if (!in_array($uri_string, $this->route_un) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un)) {
|
||||
$headers = $this->CI->input->request_headers();
|
||||
$headers = $this->CI->input->request_headers();
|
||||
if ((!in_array($uri_string, $this->route_un) && !in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un))
|
||||
|| $this->tokenIsExist($headers)) {
|
||||
if ($this->tokenIsExist($headers)) {
|
||||
if ($urlArray[0] == 'pingan') {
|
||||
$userId = $this->validateToken($headers['Authorization'], 'jwt_key_pingan');
|
||||
|
||||
Reference in New Issue
Block a user