public function handle_request_internal() { $objRequest = APF::get_instance()->get_request(); $userTypeNew = $objRequest->getUserTypeNew(); $userId = $objRequest->getUserId(); if (2 == $userTypeNew) { //经纪人展示 $brokerId = $objRequest->getBrokerId(); $Daily = Model_Wechat_BrokerDaily::getDailyByBrokerId($brokerId); } elseif (3 == $userTypeNew) { //门店账号展示 $agcyAccount = Model_Broker_AgcyAccount::getAgcyByUserId($userId); $agcyType = Bll_Broker_AgcyInfo::getAgcyType($userId); $Daily = Model_Wechat_GroupDaily::getDailyByAccountId($agcyAccount['AccountId']); $objRequest->set_attribute("agcyType", $agcyType); } else { exit('error'); } $dayStr = date('m月d日', time() - 24 * 3600); $objRequest->set_attribute("dayStr", $dayStr); $objRequest->set_attribute("Daily", $Daily); $objRequest->set_attribute("brokerId", intval($brokerId)); return 'Wechat_Mbroker_Data_Overview'; }
public function handle_request_internal() { $objRequest = APF::get_instance()->get_request(); $params = $objRequest->get_parameters(); $baseUrl = '/ajkbroker/mbroker/data/weiliaodata?action=GetBrokersData'; $userTypeNew = $objRequest->getUserTypeNew(); $userId = $objRequest->getUserId(); $userName = $objRequest->getUserName(); if (3 != $userTypeNew) { echo '<script>window.history.go(-1);</script>'; exit; } //获取门店账号类别,0为非门店账号,1为组账号,2真实门店账号,3区经账号,4总监账号,5总账号 $agcyAccount = Model_Broker_AgcyAccount::getAgcyByUserId($userId); $accountId = $agcyAccount['AccountId']; $agcyType = Bll_Broker_AgcyInfo::getAgcyType($userId); if (1 == $agcyType || $params['action'] == 'GetBrokersData') { if ($params['action'] == 'GetBrokersData') { $objRequest->set_attribute("action", $params['action']); $objRequest->set_attribute("baseUrl", $baseUrl); $objRequest->set_attribute("teamName", urldecode($params['teamName'])); $accountId = $params['teamAccount']; } $objRequest->set_attribute("typeName", '经纪人'); $classname = 'broker'; //获取前16位经纪人信息 $topBroker = Model_Wechat_BrokerDaily::getBrokerListByTeamAccount($accountId, 'DESC', 16); if (count($topBroker) > 15) { //展示前五和后五 $showType = 2; $startList = array_slice($topBroker, 0, 5); $endList = Model_Wechat_BrokerDaily::getBrokerListByTeamAccount($accountId, 'ASC', 5); $objRequest->set_attribute("startList", $startList); $objRequest->set_attribute("endList", $endList); } else { //展示所有记录 $showType = 1; $objRequest->set_attribute("allList", $topBroker); } } elseif ($agcyType > 1) { $objRequest->set_attribute("typeName", '门店'); $classname = 'mendian'; //获取前16位门店信息 $topAgcy = Model_Wechat_GroupDaily::getAgcyListByTeamAccount($accountId, $agcyType, 'DESC'); foreach ($topAgcy as $k => $v) { $topAgcy[$k]['avg'] = floatval($v['replyRate'] * 0.5) + floatval($v['avgResponseMin'] * 0.5); $avg[] = $topAgcy[$k]['avg']; } array_multisort($avg, SORT_DESC, $topAgcy); if (count($topAgcy) > 15) { //展示前五和后五 $showType = 2; $startList = array_slice($topAgcy, 0, 5); $endList = array_slice($topAgcy, -5); $objRequest->set_attribute("startList", $startList); $objRequest->set_attribute("endList", $endList); } else { //展示所有记录 $showType = 1; $objRequest->set_attribute("allList", $topAgcy); } } //获取门店信息汇总 $Daily = Model_Wechat_GroupDaily::getDailyByAccountId($accountId); $objRequest->set_attribute("agcyType", $agcyType); $objRequest->set_attribute("userName", $userName); $objRequest->set_attribute("Daily", $Daily); $objRequest->set_attribute("showType", $showType); $objRequest->set_attribute("classname", $classname); $objRequest->set_attribute("agcyType", $agcyType); $objRequest->set_attribute("baseUrl", $baseUrl); return 'Wechat_Mbroker_Data_WeiliaoData'; }