Example #1
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $app = $this->_params['app'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     /** 获取经纪人被关注的人数 */
     $brokerChatId = Model_Mobile_BrokerChatInfo::getBrokerChatInfo($brokerId, array('chatId'));
     $followerNum = 0;
     if ($brokerChatId['chatId']) {
         $followerNumInfo = Bll_Mobile_ChatInfoBll::getBrokerFollowerNum($brokerChatId['chatId']);
         if ($followerNumInfo['data']['status'] == 'OK') {
             $followerNum = $followerNumInfo['data']['result']['focus_count'];
         }
     }
     $analysis = Bll_Broker_CallAnalysis::getBrokerAnalysis($brokerId);
     $balanceInfo = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => Bll_Broker_MainBusiness::getDataByEsfId($brokerId)->memberId));
     $managerInfo = Bll_Broker::getWorkerNumInfo($brokerId);
     // 微聊达人
     $isTalent = -1;
     // 默认,微聊活动未开始或已结束
     if (Bll_Broker_CallAnalysis::isTalentEventOngoing()) {
         $isTalent = 0;
         // 活动中,默认不是微聊达人
         if ($analysis) {
             $isTalent = $analysis['isTalent'];
         }
     }
     $talentIcon = Bll_Broker_CallAnalysis::getTalentIcon($isTalent, $app);
     // 明星经纪人
     $isStarBroker = 0;
     $starBrokerIcon = '';
     try {
         $bllStarBroker = new Bll_Broker_StarIntermediary($brokerInfo['cityId']);
         $starBrokerInfo = $bllStarBroker->getBrokerNewestInfo($brokerId);
         if ($starBrokerInfo && $starBrokerInfo['broker']['isMingxing']) {
             $isStarBroker = 1;
             $starBrokerIcon = PageHelper::pure_static_url('/img/mobile/app/star_broker.png');
         }
     } catch (Exception $e) {
         // do nothing
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('replyRate' => $analysis['reply5minRate'] * 100, 'responseTime' => $analysis['avgRespondTime'], 'customNum' => $analysis['accChatUser'], 'loginDays' => $analysis['accLoginDays'], 'isTalent' => $isTalent, 'talentIcon' => $talentIcon, 'isStarBroker' => $isStarBroker, 'starBrokerIcon' => $starBrokerIcon, 'ajkContact' => $managerInfo['userName'], 'balance' => empty($balanceInfo['data']['balance']) ? 0 : round($balanceInfo['data']['balance'] / 100, 2), 'tel' => $managerInfo['mobile'], 'followerNum' => $followerNum));
 }