public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $userMobile = $this->_params['userMobile']; //检测电话号码格式是否正确 if (strlen($userMobile) != 11) { throw new Exception_Broker_BrokerMobileFormatError('电话号码格式错误', Const_APIStatus::E_BROKER_MOBILE_FORMAT_ERROR); } $brokerInfo = Model_Broker_AjkBrokerExtend::getBrokerInfoByMobile($userMobile); if (!$brokerInfo) { throw new Exception_Broker_BrokerNotVerified('经纪人不存在', Const_APIStatus::E_BROKER_MOBILE_SEARCH_ERROR); } if ($brokerInfo->checkState != 1) { throw new Exception_BrokerNotFoundException('经纪人审核未通过', Const_APIStatus::E_BROKER_MOBILE_SEARCH_NOT_VERIFIED); } //查询微聊信息 $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->onlyGetChatInfo($brokerInfo->brokerId); $re = array(); $re['brokerId'] = $brokerInfo->brokerId; $re['companyInfo'] = $brokerInfo->company; $re['trueName'] = $brokerInfo->trueName; $re['userMobile'] = $brokerInfo->userMobile; $re['userPhoto'] = Util_ImageUtils::get_broker_photo_url($brokerInfo->userPhoto, '200x200'); $re['chatId'] = $chatInfo['data']['chatId']; $re['twoCodeIcon'] = $chatInfo['data']['twoCodeIcon']; return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $re); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; //二手房 $ajk_ppc_info = Bll_BrokerInfoApp::get_broker_ppc_info($brokerId); //租房 $hz_ppc_info = Bll_BrokerInfoApp::get_broker_ppc_info_hz($brokerId, $cityId); //经纪人基础信息 $brokerBaseInfo = Bll_BrokerInfoApp::get_broker_baseinfo_simple($brokerId); try { $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($brokerId, 1); $chatId = $chatInfo['data']['chatId']; $twoCodeIcon = $chatInfo['data']['twoCodeIcon']; } catch (Exception $e) { $chatId = ''; $twoCodeIcon = ''; } //get bid flg for city $choiceCityFlag = Bll_City::isChoiceCity($cityId); // chat_token $info = array('phone' => $brokerBaseInfo['phone'], 'user_id' => $chatInfo['data']['chatId'], 'device' => array('app_name' => APF::get_instance()->get_config('java_api_from'), 'os' => $this->_params["o"], 'macid' => $this->_params["macid"], 'udid2' => $this->_params["udid2"])); $privateKey = APF::get_instance()->get_config('aes_private_key', 'mobile_api'); $iv = APF::get_instance()->get_config('aes_iv', 'mobile_api'); $token3rd = Util_CryptUtil::aes_encode($privateKey, $iv, $info); $ajk_dic_info = array('ajkClick' => $ajk_ppc_info['ajkClick'], 'ajkConsume' => $ajk_ppc_info['ajkConsume'], 'ajkFixHouse' => $ajk_ppc_info['ajkFixHouse'], 'ajkBidHouseNum' => $ajk_ppc_info['ajkBidHouseNum'], 'ajkNotFixHouseNum' => $ajk_ppc_info['ajkNotFixHouseNum'], 'haveAjk' => intval($ajk_ppc_info['ajkNotFixHouseNum']) + intval($ajk_ppc_info['ajkFixHouse'][0]['fixNum']) > 0 ? 1 : 0); $hz_dic_info = array('hzClick' => $hz_ppc_info['hzClick'], 'hzConsume' => $hz_ppc_info['hzConsume'], 'hzFixHouse' => $hz_ppc_info['hzFixHouse'], 'hzBidHouseNum' => $hz_ppc_info['hzBidHouseNum'], 'hzNotFixHouseNum' => $hz_ppc_info['hzNotFixHouseNum'], 'haveHz' => intval($hz_ppc_info['hzNotFixHouseNum']) + intval($hz_ppc_info['hzFixHouse'][0]['fixNum']) > 0 ? 1 : 0); if ($choiceCityFlag) { $ajk_dic_info['ajkBidHouseNum'] = 0; $hz_dic_info['hzBidHouseNum'] = 0; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('ajkDataDic' => $ajk_dic_info, 'hzDataDic' => $hz_dic_info, 'brokerName' => $brokerBaseInfo['brokerName'], 'phone' => $brokerBaseInfo['phone'], 'chatId' => $chatId, 'twoCodeIcon' => $twoCodeIcon, 'tokenChat' => $token3rd)); }
public function handle_request_internal() { $userId = $this->_params['userId']; $code = $this->_params['code']; //4.3之前版本的兼容性处理,此api之后将废弃 return array('status' => 'error', 'errcode' => Const_APIStatus::E_FYK_USER_ACTIVATION_CODE_CLOSE, 'message' => '此功能已关闭'); // TODO 校验用户是否存在 $brokerInfo = Model_Broker_AjkBrokerExtend::data_access()->filter('userId', $userId)->find_only(); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } // TODO 校验激活码是否有效 $codeInfo = Model_Fyk_InvitationCodes::data_access()->filter(Model_Fyk_InvitationCodes::CODE, $code)->filter(Model_Fyk_InvitationCodes::BIND_TO, $userId)->get_all(); if (empty($codeInfo)) { return API_Result::create()->error()->errorCode('9999')->message('邀请码错误')->toArray(); } $userInfo = Model_Fyk_Users::data_access()->filter(Model_Fyk_Users::USER_ID, $userId)->find_only(); if ($userInfo->status != Model_Fyk_Users::INIT) { return API_Result::create()->error()->errorCode('9999')->message('房源库功能已经激活')->toArray(); } $userInfo->status = Model_Fyk_Users::INVITATION; if ($userInfo->save()) { //TODO 关注房源库公共账号-待补充 $msg = '{"title": "房源库小喵 小贝欢迎大家到来","date": "' . date('m') . '月' . date('d') . '日","img":"http://pic1.ajkimg.com/m/fc68794e8da91a3d03f80487b888a193/540x270x95.jpg","desc": "成交从好的房源开始,好的房源来自移动房源库!","url": "http://api.anjuke.com/web/chat/content?id=101_290_0","jsonVersion": "1"}'; $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($brokerInfo->brokerId, 1); $chatId = $chatInfo['data']['chatId']; Bll_Mobile_ChatInfoBll::sendFykPublicMsg($chatId, $msg); return array('status' => 'ok', 'message' => '激活成功'); } }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $lng = $this->_params['lng']; $lat = $this->_params['lat']; $brokerId = $this->_params['brokerId']; $radius = isset($this->_params['radius']) ? $this->_params['radius'] : 3000; // 搜索半径,默认3000米 $total = isset($this->_params['total']) ? $this->_params['total'] : 100; // 最大总数,默认500 $days = isset($this->_params['days']) ? $this->_params['days'] : 3; // 查询天数,默认3天 //获取附近经纪人Id $brokerLocations = Bll_Broker_Location::getRoundBrokerLocationsInThePastFewDays($lng, $lat, $radius, $total, $days); $brokerIds = array_keys($brokerLocations); //根据经纪人Id数组查询多个经纪人信息 $brokerInfosTmp = Model_Broker_AjkBrokerExtend::findMultiBrokers($brokerIds); //提取经纪人ID $brokerIds = $brokerInfos = array(); foreach ($brokerInfosTmp as $value) { if ($value->brokerId != $brokerId) { $brokerIds[] = $value->brokerId; $brokerInfos[$value->brokerId] = $value; } } //批量查询微聊信息 $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->GetChatInfoByIds($brokerIds); //根据微聊信息筛选经纪人,去除微聊信息为空的经纪人 $brokers = array(); foreach ($chatInfos as $chatInfo) { $re = array(); $distance = Util_Map::distance($lng, $lat, $brokerLocations[$chatInfo['brokerId']]['lng'], $brokerLocations[$chatInfo['brokerId']]['lat']); $distance = round($distance / 1000, 2); if ($distance > 3 || $brokerInfos[$chatInfo['brokerId']]->checkState != 1) { continue; } $re['brokerId'] = $chatInfo['brokerId']; $re['companyInfo'] = $brokerInfos[$chatInfo['brokerId']]->company; $re['trueName'] = $brokerInfos[$chatInfo['brokerId']]->trueName; $re['userMobile'] = $brokerInfos[$chatInfo['brokerId']]->userMobile; $disarr[] = $distance; $re['distance'] = $distance; $re['userPhoto'] = Util_ImageUtils::get_broker_photo_url($brokerInfos[$chatInfo['brokerId']]->userPhoto, '200x200'); $re['chatId'] = $chatInfo['chatId']; $re['twoCodeIcon'] = $chatInfo['twoCodeIcon']; $brokers[] = $re; } //按距离排序 array_multisort($disarr, $brokers); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerList' => $brokers)); }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //根据区域代码查询经纪人 $brokerArea = $brokerInfo->areaCode; $brokerInfoTmp = Model_Broker_AjkBrokerExtend::getDataByAreaCodeAll($brokerArea); //提取经纪人ID $brokerIds = $brokerInfos = array(); foreach ($brokerInfoTmp as $value) { if ($value->brokerId != $brokerId) { $brokerIds[] = $value->brokerId; $brokerInfos[$value->brokerId] = $value; } } //批量查询微聊信息 $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->GetChatInfoByIds($brokerIds); //根据微聊信息筛选经纪人,去除微聊信息为空的经纪人 $brokers = array(); foreach ($chatInfos as $chatInfo) { if ($brokerInfos[$chatInfo['brokerId']]->checkState != 1) { continue; } $re = array(); $re['brokerId'] = $chatInfo['brokerId']; $re['trueName'] = $brokerInfos[$chatInfo['brokerId']]->trueName; $re['userMobile'] = $brokerInfos[$chatInfo['brokerId']]->userMobile; $re['companyInfo'] = $brokerInfos[$chatInfo['brokerId']]->company; $re['userPhoto'] = Util_ImageUtils::get_broker_photo_url($brokerInfos[$chatInfo['brokerId']]->userPhoto, '200x200'); $re['chatId'] = $chatInfo['chatId']; $re['twoCodeIcon'] = $chatInfo['twoCodeIcon']; $brokers[] = $re; } foreach ($brokers as $broker) { $brokerCompany[] = $broker['company']; } //按公司排序 array_multisort($brokerCompany, $brokers); $keyReturn = array(); foreach ($brokers as $broker) { $keyReturn[$broker['companyInfo']]['company'] = $broker['companyInfo']; $keyReturn[$broker['companyInfo']]['broker'][] = $broker; } $brokerList = array_values($keyReturn); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerList' => $brokerList)); }
/** * 发送微聊消息 * * @param $authToken * @param $chatBody * * @return bool * @throws Exception_CustomerRush_SendChatFailed * @throws Exception_CustomerRush_TooManyChat */ public static function sendAppMessage($authToken, $chatBody) { $response = Bll_Mobile_ChatInfoBll::getInstance()->apiSendAppMessage($authToken, $chatBody); if ($response && $response['http_code'] == 200 && $response['data']['status'] == 'OK' && $response['data']['result']) { $success = $response['data']['result']; } else { if ($response['data']['errorCode'] == 10043) { throw new Exception_CustomerRush_TooManyChat($response['data']['errorMessage']); } else { throw new Exception_CustomerRush_SendChatFailed('AuthToken: ' . $authToken . '; ChatBody: ' . $chatBody . '; Response: ' . json_encode($response)); } } return $success; }
/** * 客户是否允许被抢 * * @return bool */ public function isCustomerAllowRush() { $allow = true; $devicePair = array('app' => $this->appName); if ($this->appName == 'i-ajk') { $devicePair['udid2'] = $this->userDeviceId2; } else { // a-ajk $devicePair['i'] = $this->guid; $devicePair['macid'] = $this->macId; } $deviceSettings = Bll_Mobile_ChatInfoBll::getInstance()->getDeviceSettings(array($devicePair)); foreach ($deviceSettings as $deviceSetting) { if ($deviceSetting['recommend_switch'] != 0) { $allow = false; } } return $allow; }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //查询微聊信息 $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->onlyGetChatInfo($brokerInfo->brokerId); $re = array(); $re['brokerId'] = $brokerInfo->brokerId; $re['companyInfo'] = $brokerInfo->company; $re['trueName'] = $brokerInfo->trueName; $re['userMobile'] = $brokerInfo->userMobile; $re['userPhoto'] = Util_ImageUtils::get_broker_photo_url($brokerInfo->userPhoto, '200x200'); $re['chatId'] = $chatInfo['data']['chatId']; $re['twoCodeIcon'] = $chatInfo['data']['twoCodeIcon']; return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $re); }
public function handle_request_internal() { if (isset($this->_params['brokerId']) && isset($this->_params['cityId'])) { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; $chatFlag = $this->_params['chatFlag']; $brokerInfo = Bll_BrokerInfoApp::get_broker_info_app_v2($brokerId, $cityId); $brokerBaseInfo = Bll_BrokerInfoApp::get_broker_baseinfo_simple($brokerId); if (!empty($brokerInfo)) { $r = $this->get_result($brokerBaseInfo, $brokerInfo); //获取经纪人微聊信息 if ($chatFlag && 1 == $chatFlag) { try { $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($brokerId, 1); $r['data']['chatId'] = $chatInfo['data']['chatId']; $r['data']['twoCodeIcon'] = $chatInfo['data']['twoCodeIcon']; } catch (Exception $e) { $r = Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR); } } } else { $r = Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR); } } else { if (!isset($this->_params['brokerId'])) { $r = Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS); } elseif (!isset($this->_params['cityId'])) { $r = Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS); } else { $r = Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR); } } //生成第三方API所需token if ($chatFlag && 1 == $chatFlag) { $info = array('phone' => $brokerBaseInfo['phone'], 'user_id' => $chatInfo['data']['chatId'], 'device' => array('app_name' => APF::get_instance()->get_config('java_api_from'), 'os' => $this->_params["o"], 'macid' => $this->_params["macid"], 'udid2' => $this->_params["udid2"])); $token3rd = self::createToken3rd($info); $r['data']["tokenChat"] = $token3rd; } return $r; }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //根据公司ID查询经纪人,限制100个 $comId = $brokerInfo['cstBrokerCompanyId']; $brokerInfoTmp = Model_Broker_AjkBrokerExtend::getSameMendianBrokerInfo($comId); $brokerIds = array(); foreach ($brokerInfoTmp as $value) { if ($value->brokerId != $brokerId) { $brokerIds[] = $value->brokerId; $brokerInfos[$value->brokerId] = $value; } } $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->GetChatInfoByIds($brokerIds); foreach ($brokerInfoTmp as $brokerInfo) { $brokerInfos[$brokerInfo->brokerId] = $brokerInfo; } $brokerList = array(); foreach ($chatInfos as $chatInfo) { if ($brokerInfos[$chatInfo['brokerId']]->checkState != 1) { continue; } $re = array(); $re['brokerId'] = $chatInfo['brokerId']; $re['trueName'] = $brokerInfos[$chatInfo['brokerId']]->trueName; $re['userMobile'] = $brokerInfos[$chatInfo['brokerId']]->userMobile; $re['userPhoto'] = Util_ImageUtils::get_broker_photo_url($brokerInfos[$chatInfo['brokerId']]->userPhoto, '200x200'); $re['chatId'] = $chatInfo['chatId']; $re['twoCodeIcon'] = $chatInfo['twoCodeIcon']; $brokerList[] = $re; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerList' => $brokerList)); }
public function handle_request() { $limit = 1000; $offset = 0; while ($offset < $limit) { $brokerId = array(); $data = Bll_Mobile_RedisToDb::readCommSignStatistics(); if ($data) { //判断记录是否存在 $brokerId = Model_Broker_CommunitySignStatistics::data_access()->filter('brokerId', $data['brokerId'])->get_row(); if (empty($brokerId)) { $SignStatistics = Model_Broker_CommunitySignStatistics::create(array('brokerId' => $data['brokerId'], 'signCount' => $data['signCount'], 'maxSignCount' => $data['maxSignCount'], 'createTime' => date('Y-m-d H:i:s'))); $SignStatistics->save(); } else { $SignStatistics = Model_Broker_CommunitySignStatistics::data_access(); //$SignStatistics->set_field('id',$data['id']); $SignStatistics->set_field('signCount', $data['signCount']); $SignStatistics->set_field('maxSignCount', $data['maxSignCount']); $SignStatistics->set_field('updateTime', $data['updateTime']); $SignStatistics->filter('brokerId', $data['brokerId'])->update(); } //发送微聊信息 if ($data['sendFlag']) { //获取chat信息 $chatInfo = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($data['brokerId'], 1); if ($chatInfo['status'] == 'ok') { $chatId = $chatInfo['data']['chatId']; // 发送欢迎信息 Bll_Mobile_ChatInfoBll::getInstance()->sendPublicMsg($chatId, '您已连续签到' . $data['signCount'] . '天,最长连续签到' . $data['maxSignCount'] . '天。'); } } ++$offset; } else { break; } } }
/** * Job执行逻辑 */ public function handle_request() { $startTime = microtime(true); $this->log("Start sync broker info to chat."); // 获取经纪人信息 $brokers = $this->getBrokers(); foreach ($brokers as $broker) { // 默认模式下,更新游标 if ($this->action == self::ACTION_DEFAULT) { $this->cursor['id'] = $broker['id']; } // 获取经纪人微聊信息 $brokerChatInfo = Model_Mobile_BrokerChatInfo::getBrokerChatInfo($broker['brokerId']); if (empty($brokerChatInfo)) { $this->log("Skip, broker id: {$broker['brokerId']} has no chat info"); $this->setFlag($this->cursor); continue; } // 请求接口获取经纪人微聊信息 $i = 0; do { $response = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByChatId($brokerChatInfo['chatId']); // 最多尝试3次 if ($response !== false || ++$i > 3) { break; } } while (true); if (!$response || $response['data']['status'] == 'ERROR' || empty($response['data']['result'])) { $this->log("Failed to fetch broker chat info with chat id: {$brokerChatInfo['chatId']} and broker id: {$broker['brokerId']}"); $this->log(json_encode($response)); $this->setFlag($this->cursor); continue; } // 获取更新的字段 $apiChatInfo = $response['data']['result']; $updateData = $this->getUpdateData($broker, $apiChatInfo); if (empty($updateData)) { $this->log("Skip, broker chat info with chat id: {$brokerChatInfo['chatId']} and broker id: {$broker['brokerId']} has no changed data."); $this->setFlag($this->cursor); continue; } // 如果有资料更新,调用接口更新数据 $data = array('brokerId' => $broker['brokerId'], 'chatId' => $apiChatInfo['user_id'], 'updateData' => $updateData); $this->log('Sync broker info to chat: ' . json_encode($data)); try { $i = 0; do { $response = Bll_Mobile_ChatInfoBll::getInstance()->rsync($apiChatInfo['user_id'], $updateData); // 最多尝试3次 if ($response !== false || ++$i > 3) { break; } } while (true); if ($response === false) { $this->log('Failed to sync broker info to chat: ' . json_encode($data)); } } catch (Exception $e) { $this->log('Failed to sync broker info to chat with exception: ' . json_encode($data)); $this->log($e->getTraceAsString()); $this->setFlag($this->cursor); continue; } $this->setFlag($this->cursor); } $endTime = microtime(true); $used = $endTime - $startTime; $this->log("End sync broker info to chat use: {$used}s."); }
private function isShield($object) { $isShield = false; $devicePair['app'] = $object->appName; if ($object->appName == 'i-ajk') { $devicePair['udid2'] = $object->udid2; } else { // a-ajk $devicePair['i'] = $object->guid; $devicePair['macid'] = $object->macId; } $devicePairs[] = $devicePair; $deviceSettings = Bll_Mobile_ChatInfoBll::getInstance()->getDeviceSettings($devicePairs); if ($deviceSettings[0]['recommend_switch']) { //用户屏蔽 $isShield = true; } return $isShield; }
/** * 两公里经纪人 * @param $commId * @param $sosolat * @param $sosolng * @param $commIds //测试小区id * @param $pushOpen //兼容老的推送开关-测试使用 * @return array|bool|mixed|multitype|null */ private function getBroker2K($commId, $sosolat, $sosolng, $commIds, $pushOpen, $houseId) { $brokerIds = array(); if (!in_array($commId, $commIds)) { $km = 2000; //在小区详情表中获取小区所在的城市ID $commCityId = $this->getCityIdByCommId($commId); //查询该小区2KM内的所有经纪人 $rushCommunityLimit = APF::get_instance()->get_config('rush_community_limit'); $allBrokers = Model_Broker_BrokerActionCenter::getBrokerInfoByXY($sosolat, $sosolng, $km, $rushCommunityLimit); //剔除与该小区所在的cityid不同的经纪人id $aroundBrokerRaws = $this->getBrokerIdsByCityIdAndBrokerIds($allBrokers, $commCityId); $brokerIdsBefore = $aroundBrokers = array(); if (!empty($aroundBrokerRaws)) { $brokerIdsBefore = $aroundBrokerRaws; //读取微聊id $aroundBrokers = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV($brokerIdsBefore); $chargeMinCV = APF::get_instance()->get_config('charge_entrust_min_cv'); $freeMinCV = APF::get_instance()->get_config('free_entrust_min_cv'); $brokerIdsBefore = array(); foreach ($aroundBrokers as $chatinfosBroker) { //读取接口 if (!empty($chatinfosBroker['chatId'])) { $response = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByCV($chatinfosBroker['chatId']); } //3.7版本以上或免费城市3.4版本以上 if ($response['data']['result']['cv'] >= $chargeMinCV || !$pushOpen && $response['data']['result']['cv'] >= $freeMinCV) { $brokerIdsBefore[] = $chatinfosBroker['brokerId']; } else { $this->setLog(date('Y-m-d H:i:s') . '-houseId: ' . $houseId . ' - brokerId: ' . $chatinfosBroker['brokerId'] . '--该经纪人版本号不合要求'); } } //排序 foreach ($allBrokers as $broker) { if (in_array($broker['brokerId'], $brokerIdsBefore)) { $brokerIds[] = $broker['brokerId']; } } } else { $this->setLog(date('Y-m-d H:i:s') . '-houseId: ' . $houseId . ' - commId: ' . $commId . '--该小区2km内无经纪人'); } } else { //测试小区 if (!empty($_SERVER['PG_TEST'])) { //如果是PG $brokerIdsArr = APF::get_instance()->get_config('pg_test_broker_id', 'apiTestId'); $brokerIds = $brokerIdsArr[$commId]; } else { $brokerIdsArr = APF::get_instance()->get_config('test_broker_id', 'apiTestId'); $brokerIds = $brokerIdsArr[$commId]; } } return $brokerIds; }
private function isFriend($chatId, $brokerId) { $isFriend = FALSE; if ($chatId >= Const_Chat::MIN_CHAT_ID) { $friends = Bll_Mobile_ChatInfoBll::getInstance()->getChatFriendsWithBrokerId($brokerId); if (in_array($chatId, $friends)) { $isFriend = TRUE; } } return $isFriend; }
public function handle_request_internal() { $return = Bll_Mobile_ChatInfoBll::getInstance()->getChatInfo($this->_params['brokerId'], 2); return $return; }
public function handle_request_internal() { $userId = $this->_params['userId']; $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : 0; $per = isset($this->_params['per']) ? $this->_params['per'] : 20; $per += 1; $hasNextPage = 0; $fPropId = array(); $amountList = array(); $logInfo = Bll_Fyk_Payment_Log::getInstance()->getLogInfoByUserIdOrderByIdDesc($userId, $per, $sinceId); if (!empty($logInfo)) { //判断是否有下一页 if (isset($logInfo[$per - 1])) { $hasNextPage = 1; unset($logInfo[$per - 1]); } //房源数据获取 foreach ($logInfo as $log) { $fPropId[] = $log['propId']; } $fPropId = array_unique($fPropId); $fPropInfo = Bll_Fyk_Prop_Manage::getInstance()->getPropInfo($fPropId); //获取app版本号 $cv = 4.2; $chatInfos = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV(array($this->_params['brokerId'])); if (!empty($chatInfos)) { $chatInfo = $chatInfos[0]; $response = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByCV($chatInfo['chatId']); $cv = $response['data']['result']['cv']; } //组装数据 foreach ($logInfo as $log) { $list = array(); $createTime = date('Y-m-d', $log['createTime']); list($comment, $content, $symbol, $clickAble) = $this->_loadingLogConfig(intval($log['type'])); $amount = $this->_assemblyAmount($log['price'], $symbol); $type = $log['type']; $typeArr = array(Const_Fyk::THE_THIRD_PARTY_RECHARGE, Const_Fyk::THE_THIRD_PARTY_WITHDRAWAL, Const_Fyk::THE_THIRD_PARTY_WITHDRAWAL_FAILED); //4.3版本以下,做兼容处理 (支付宝提现,支付宝充值,支付宝提现失败,全部并入type=8) if ($cv < 4.3 && in_array($log['type'], $typeArr)) { $type = 8; } $list['id'] = $log['id']; $list['amountType'] = $type; $list['comment'] = $comment; $list['content'] = $content; $list['amount'] = $amount; $list['amountUnit'] = '元'; $list['fPropId'] = $log['propId']; $list['createTime'] = $createTime; $list['clickAble'] = $clickAble; $list['commName'] = ''; $list['roomNum'] = ''; $list['price'] = ''; $list['priceUnit'] = ''; $list['area'] = ''; //获取房源基本信息 if (empty($content)) { if (!empty($fPropInfo[$log['propId']])) { $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($fPropInfo[$log['propId']]['commId']); $list['commName'] = $commInfo['name']; $list['roomNum'] = $fPropInfo[$log['propId']]['cell']; $list['price'] = intval($fPropInfo[$log['propId']]['totalPrices']); $list['priceUnit'] = '万'; $list['area'] = $fPropInfo[$log['propId']]['acreage']; } } $amountList[] = $list; } //更新未读账户日志 Bll_Fyk_Payment_Amount::getInstance()->updateUnReadNewAmountNum($userId); } $result = array('status' => 'ok', 'data' => array('amountList' => $amountList, 'hasNextPage' => $hasNextPage)); return $result; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : 0; $per = isset($this->_params['per']) ? $this->_params['per'] : 20; // 判断经纪人是否存在 $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$broker) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 获取经纪人已抢客户列表 $locks = Model_Mobile_CustomerLock::getV2RushedCustomerLocks($brokerId, $sinceId, $per + 1); // 判断是否存在下一页数据 $hasNextPage = false; if (count($locks) > $per) { $hasNextPage = true; array_pop($locks); } if (empty($locks)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array(), 'hasNextPage' => intval($hasNextPage))); } // 获取关联的客户关系数据 $relationIds = array(); foreach ($locks as $lock) { /* @var Model_Mobile_CustomerLock $lock */ $month = date('Ym', strtotime($lock->uploadDt)); $relationIds[$month][] = $lock->relationId; } $relations = Model_Mobile_BrokerUserRelation::getV2CustomersWithIdsInMultiMonths($relationIds); if (empty($relations)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array(), 'hasNextPage' => intval($hasNextPage))); } $keyedRelations = array(); foreach ($relations as $relation) { /* @var Model_Mobile_BrokerUserRelation $relation */ $key = $relation->uploadDt . '_' . $relation->id; $keyedRelations[$key] = $relation; } $customers = array(); $chatIdCustomerIdMap = array(); $chatIdKeyMap = array(); foreach ($locks as $lock) { $key = $lock->uploadDt . '_' . $lock->relationId; if (!isset($keyedRelations[$key])) { continue; } /* @var Model_Mobile_BrokerUserRelation $relation */ $relation = $keyedRelations[$key]; $customerId = $relation->userDeviceId; $customer = array(); $customer['id'] = $lock->id; $customer['pushDate'] = $relation->uploadDt; $customer['customerId'] = $customerId; $customer['customerName'] = Bll_Mobile_UserList::getUserName('', '', $relation->userDeviceId); $customer['customerAvatarUrl'] = $relation->userPhoto; $customer['app'] = $relation->appName; $customer['udid2'] = $relation->userDeviceId2; $customer['guid'] = $relation->guid; $customer['macId'] = $relation->macId; $customer['recommendType'] = $relation->recommendType; $customer['recommendColor'] = Bll_CustomerRush_Basic::getRecommendColor($customer['recommendType']); $customer['recommendReason'] = $relation->recommendReason; $customer['preferPrice'] = $relation->pricePreference; $customer['preferHouseType'] = $relation->houseTypePreference; $customer['preferCommunities'] = explode(',', $relation->commPreferenceDesc); $customer['viewPropCount'] = $relation->viewPropNum; $customer['channelType'] = $relation->channelType; $customer['channelDesc'] = $relation->channelDesc; $customer['rentType'] = $relation->rentType; $customer['block'] = $relation->bankuaiPreferenceDesc; switch ($relation->rentType) { case 1: $rentDesc = '整租'; break; case 2: $rentDesc = '合租'; break; default: $rentDesc = ''; } $customer['rentDesc'] = $rentDesc; switch ($relation->channelType) { case 1: case 4: case 6: $channelType = '2'; //售 break; case 2: case 3: case 5: $channelType = '1'; //租 break; case 0: $channelType = ''; break; } $customer['isRentOrSale'] = $channelType; $customers[$key] = $customer; // 记录有效的微聊号 $chatId = $relation->chatId; if ($chatId >= Const_Chat::MIN_CHAT_ID) { $chatIdCustomerIdMap[$chatId] = $customerId; $chatIdKeyMap[$chatId] = $key; } } // 微聊信息 if ($chatIdKeyMap) { $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->getMultiChatInfoWithChatIds(array_keys($chatIdKeyMap)); foreach ($chatInfos as $chatInfo) { $chatId = $chatInfo['user_id']; $key = $chatIdKeyMap[$chatId]; $customerId = $chatIdCustomerIdMap[$chatId]; // customerName $customers[$key]['customerName'] = Bll_Mobile_UserList::getUserName(isset($chatInfo['nick_name']) ? $chatInfo['nick_name'] : '', isset($chatInfo['phone']) ? $chatInfo['phone'] : '', $customerId); // customerAvatarUrl if ($chatInfo['icon']) { $customers[$key]['customerAvatarUrl'] = $chatInfo['icon']; } } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array_values($customers), 'hasNextPage' => intval($hasNextPage))); }
public function getBrokersVersion($brokerIds) { //获取经纪人的微聊信息 $chatInfos = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV($brokerIds); $brokerVersion = array(); foreach ($chatInfos as $chatInfo) { $brokerVersionInfo = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByCV($chatInfo['chatId']); $brokerVersion[$chatInfo['brokerId']] = $brokerVersionInfo['data']['result']['cv']; } return $brokerVersion; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : 0; $per = isset($this->_params['per']) ? $this->_params['per'] : 20; // 判断经纪人是否存在 $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$broker) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 获取经纪人待抢客户列表 $relations = Model_Mobile_BrokerUserRelation::getPendingCustomers($brokerId, $sinceId, $per + 1); // 判断是否存在下一页数据 $hasNextPage = false; if (count($relations) > $per) { $hasNextPage = true; array_pop($relations); } $customers = array(); $customerIdChatIdMap = array(); $chatIdCustomerIdMap = array(); $devicePairs = array(); foreach ($relations as $relation) { /* @var Model_Mobile_BrokerUserRelation $relation */ $customerId = $relation->userDeviceId; $customer = array(); $customer['id'] = $relation->id; $customer['pushDate'] = $relation->uploadDt; $customer['customerId'] = $customerId; $customer['customerName'] = Bll_Mobile_UserList::getUserName('', '', $relation->userDeviceId); $customer['customerAvatarUrl'] = $relation->userPhoto; $customer['app'] = $relation->appName; $customer['udid2'] = $relation->userDeviceId2; $customer['guid'] = $relation->guid; $customer['macId'] = $relation->macId; $customer['recommendType'] = $relation->recommendType; $customer['recommendColor'] = Bll_CustomerRush_Basic::getRecommendColor($customer['recommendType']); $customer['recommendReason'] = $relation->recommendReason; $customer['preferPrice'] = $relation->pricePreference; $customer['preferHouseType'] = $relation->houseTypePreference; $customer['preferCommunities'] = explode(',', $relation->commPreferenceDesc); $customer['viewPropCount'] = $relation->viewPropNum; $customer['status'] = Const_CustomerRush::RUSHABLE_YES; $customer['statusMsg'] = Const_CustomerRush::RUSHABLE_YES_MSG; $customer['chatId'] = $relation->chatId; $customer['channelType'] = $relation->channelType; $customer['channelDesc'] = $relation->channelDesc; $customer['rentType'] = $relation->rentType; switch ($relation->rentType) { case 1: $rentDesc = '整租'; break; case 2: $rentDesc = '合租'; break; default: $rentDesc = ''; } $customer['rentDesc'] = $rentDesc; $customers[$customerId] = $customer; // 记录有效的微聊号 $chatId = $relation->chatId; if ($chatId >= Const_Chat::MIN_CHAT_ID) { $customerIdChatIdMap[$customerId] = $chatId; $chatIdCustomerIdMap[$chatId] = $customerId; } // 记录设备号和来源 App 类型 $devicePair = array('app' => $relation->appName); if ($relation->appName == 'i-ajk') { $devicePair['udid2'] = $relation->userDeviceId2; } else { // a-ajk $devicePair['i'] = $relation->guid; $devicePair['macid'] = $relation->macId; } $devicePairs[] = $devicePair; } // 微聊信息 if ($customerIdChatIdMap) { $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->getMultiChatInfoWithChatIds($customerIdChatIdMap); if ($this->isXRayMode()) { echo '<pre> CustomerId ChatId Map: '; print_r($customerIdChatIdMap); echo '</pre>'; echo '<pre> ChatId CustomerId Map: '; print_r($chatIdCustomerIdMap); echo '</pre>'; echo '<pre> API Return Chat Infos: '; print_r($chatInfos); echo '</pre>'; } foreach ($chatInfos as $chatInfo) { $chatId = $chatInfo['user_id']; $customerId = $chatIdCustomerIdMap[$chatId]; // customerName $customers[$customerId]['customerName'] = Bll_Mobile_UserList::getUserName(isset($chatInfo['nick_name']) ? $chatInfo['nick_name'] : '', isset($chatInfo['phone']) ? $chatInfo['phone'] : '', $customerId); // customerAvatarUrl if ($chatInfo['icon']) { $customers[$customerId]['customerAvatarUrl'] = $chatInfo['icon']; } } } // 通过用户开关判断可抢状态 $deviceSettings = Bll_Mobile_ChatInfoBll::getInstance()->getDeviceSettings($devicePairs); if ($this->isXRayMode()) { echo '<pre> API Return Device Settings: '; print_r($deviceSettings); echo '</pre>'; } foreach ($deviceSettings as $deviceSetting) { if ($deviceSetting['app'] == 'a-ajk') { $customerId = $deviceSetting['i'] . $deviceSetting['macid']; } else { // i-ajk $customerId = $deviceSetting['udid2']; } $switch = $deviceSetting['recommend_switch']; if ($switch != 0) { // TODO 移除 Magic Number $customers[$customerId]['status'] = Const_CustomerRush::RUSHABLE_NO; $customers[$customerId]['statusMsg'] = Const_CustomerRush::RUSHABLE_NO_MSG; $customers[$customerId]['statusMemo'] = '用户禁用'; } } // 通过微聊好友关系判断可抢状态 $friendChatIds = Bll_Mobile_ChatInfoBll::getInstance()->getChatFriendsWithBrokerId($brokerId); if ($this->isXRayMode()) { echo '<pre> API Return Friends: '; print_r($friendChatIds); echo '</pre>'; } foreach ($customers as &$customer) { if (in_array($customer['chatId'], $friendChatIds)) { $customer['status'] = Const_CustomerRush::RUSHABLE_NO; $customer['statusMsg'] = Const_CustomerRush::RUSHABLE_NO_MSG; $customer['statusMemo'] = '微聊好友'; } // 移除不必要的 ChatId unset($customer['chatId']); } // 通过用户锁定总数判断可抢状态 if (!empty($customers)) { $lockTimes = Model_Mobile_BrokerUserRelation::getMultiCustomerTodayLockTimes(array_keys($customers)); if ($this->isXRayMode()) { echo '<pre> Today Lock Times: '; print_r($lockTimes); echo '</pre>'; } foreach ($lockTimes as $customerId => $lockTime) { if ($lockTime >= Const_CustomerRush::CUSTOMER_MAX_RUSHED_COUNT) { $customers[$customerId]['status'] = Const_CustomerRush::RUSHABLE_NO; $customers[$customerId]['statusMsg'] = Const_CustomerRush::RUSHABLE_NO_MSG; $customers[$customerId]['statusMemo'] = '今日已被抢' . Const_CustomerRush::CUSTOMER_MAX_RUSHED_COUNT . '次'; } } } // 重置新推客户数 Bll_CustomerRush_Basic::resetBrokerLatestPushCount($brokerId); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array_values($customers), 'hasNextPage' => intval($hasNextPage))); }
public function handle_request_internal() { $limit = APF::get_instance()->get_config('customer_day_rushed_limit', 'customer'); $brokerId = $this->_params['brokerId']; // 判断经纪人是否存在 $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$broker) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 获取经纪人待抢客户列表 $relations = Model_Mobile_BrokerUserRelationSub::getPendingCustomers($brokerId); if (empty($relations)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array())); } $customers = array(); $customerIdChatIdMap = array(); $chatIdCustomerIdMap = array(); $customerStatus = array(); $devicePairs = array(); $customerIds = array(); foreach ($relations as $relation) { $customerId = $relation->userDeviceId; $customer = array(); $customer['id'] = $relation->id; $customer['pushDate'] = $relation->uploadDt; $customer['customerId'] = $customerId; $customer['customerName'] = Bll_Mobile_UserList::getUserName('', '', $relation->userDeviceId); $customer['customerAvatarUrl'] = $relation->userPhoto; $customer['app'] = $relation->appName; $customer['udid2'] = $relation->userDeviceId2; $customer['guid'] = $relation->guid; $customer['macId'] = $relation->macId; $customer['recommendType'] = $relation->recommendType; $customer['recommendColor'] = Bll_CustomerRush_Basic::getRecommendColor($customer['recommendType']); $customer['recommendReason'] = $relation->recommendReason; $customer['preferPrice'] = $relation->pricePreference; $customer['preferHouseType'] = $relation->houseTypePreference; $customer['preferCommunities'] = explode(',', $relation->commPreferenceDesc); $customer['viewPropCount'] = $relation->viewPropNum < 10 ? $relation->viewPropNum + 5 : $relation->viewPropNum; $customer['status'] = Const_CustomerRush::V2_RUSHABLE_YES; $customer['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_YES_MSG; $customer['canRushedTime'] = $limit; $customer['chatId'] = $relation->chatId; $customer['channelType'] = $relation->channelType; $customer['channelDesc'] = $relation->channelDesc; $customer['rentType'] = $relation->rentType; $customer['block'] = $relation->bankuaiPreferenceDesc; switch ($relation->rentType) { case 1: $rentDesc = '整租'; break; case 2: $rentDesc = '合租'; break; default: $rentDesc = ''; } $customer['rentDesc'] = $rentDesc; switch ($relation->channelType) { case 1: $channelType = '2'; //售 break; case 2: $channelType = '1'; //租 break; case 3: $channelType = '1'; break; case 4: $channelType = '2'; break; case 5: $channelType = '1'; break; case 6: $channelType = '2'; break; case 0: $channelType = ''; break; } $customer['isRentOrSale'] = $channelType; $customers[$customerId] = $customer; // 记录有效的微聊号 $chatId = $relation->chatId; if ($chatId >= Const_Chat::MIN_CHAT_ID) { $customerIdChatIdMap[$customerId] = $chatId; $chatIdCustomerIdMap[$chatId] = $customerId; } // 记录设备号和来源 App 类型 $devicePair = array('app' => $relation->appName); if ($relation->appName == 'i-ajk') { $devicePair['udid2'] = $relation->userDeviceId2; } else { // a-ajk $devicePair['i'] = $relation->guid; $devicePair['macid'] = $relation->macId; } $devicePairs[] = $devicePair; //记录status $customerStatus[$customerId] = $relation->status; //记录customerIds $customerIds[] = $customerId; } if ($this->isXRayMode()) { echo '<pre> CustomerIds: '; print_r($customerIds); echo '</pre>'; echo '<pre> Customer status: '; print_r($customerStatus); echo '</pre>'; } // 通过用户开关判断可抢状态 $deviceSettings = Bll_Mobile_ChatInfoBll::getInstance()->getDeviceSettings($devicePairs); if ($this->isXRayMode()) { echo '<pre> API Return Device Settings: '; print_r($deviceSettings); echo '</pre>'; } foreach ($deviceSettings as $deviceSetting) { if ($deviceSetting['app'] == 'a-ajk') { $customerId = $deviceSetting['i'] . $deviceSetting['macid']; } else { // i-ajk $customerId = $deviceSetting['udid2']; } $switch = $deviceSetting['recommend_switch']; if ($switch != 0 && !empty($customers[$customerId])) { // TODO 移除 Magic Number $customers[$customerId]['status'] = Const_CustomerRush::V2_RUSHABLE_NO; $customers[$customerId]['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_NO_MSG; $customers[$customerId]['statusMemo'] = '用户禁用'; //移除用户禁用 unset($customers[$customerId]); unset($customerIdChatIdMap[$customerId]); } } //通过一个经纪人当天内只能抢3次判断可抢状态 $date = date('Ymd'); $customerRushedCounts = Bll_CustomerRush_Customer::getInstance()->getCustomerRushedCount($customerIds, $date); if (!empty($customerRushedCounts)) { foreach ($customerRushedCounts as $key => $customerRushedCount) { if ($customerRushedCount['num'] >= $limit && !empty($customers[$customerRushedCount['customerId']])) { $customers[$customerRushedCount['customerId']]['status'] = Const_CustomerRush::V2_RUSHABLE_NO; $customers[$customerRushedCount['customerId']]['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_NO_MSG; $customers[$customerRushedCount['customerId']]['canRushedTime'] = 0; } elseif ($customerRushedCount['num'] < $limit && !empty($customers[$customerRushedCount['customerId']])) { $customers[$customerRushedCount['customerId']]['canRushedTime'] = $limit - $customerRushedCount['num']; } } } //如果该经纪人与该用户已经建立临时关系 foreach ($customerStatus as $key => $val) { if ($val == 1) { $customers[$key]['status'] = Const_CustomerRush::V2_RUSHABLE_YES; $customers[$key]['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_YES_MSG; } } //通过经纪人已抢列表判断可抢状态 $customerLocked = Model_Mobile_CustomerLock::getLockedByCustomerId($brokerId, $customerIds); if (!empty($customerLocked)) { foreach ($customerLocked as $locked) { $customerId = $locked['userDeviceId']; if ($locked['status'] == 2 && !empty($customers[$customerId])) { $customers[$customerId]['status'] = Const_CustomerRush::V2_RUSHABLE; $customers[$customerId]['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_MSG; } } } // 通过微聊好友关系判断可抢状态 $friendChatIds = Bll_Mobile_ChatInfoBll::getInstance()->getChatFriendsWithBrokerId($brokerId); if ($this->isXRayMode()) { echo '<pre> API Return Friends: '; print_r($friendChatIds); echo '</pre>'; } foreach ($customers as &$customer) { if (in_array($customer['chatId'], $friendChatIds)) { $customer['status'] = Const_CustomerRush::V2_RUSHABLE; $customer['statusMsg'] = Const_CustomerRush::V2_RUSHABLE_MSG; } // 移除不必要的 ChatId unset($customer['chatId']); } // 微聊信息 if ($customerIdChatIdMap) { $chatInfos = Bll_Mobile_ChatInfoBll::getInstance()->getMultiChatInfoWithChatIds($customerIdChatIdMap); if ($this->isXRayMode()) { echo '<pre> CustomerId ChatId Map: '; print_r($customerIdChatIdMap); echo '</pre>'; echo '<pre> ChatId CustomerId Map: '; print_r($chatIdCustomerIdMap); echo '</pre>'; echo '<pre> API Return Chat Infos: '; print_r($chatInfos); echo '</pre>'; } foreach ($chatInfos as $chatInfo) { $chatId = $chatInfo['user_id']; $customerId = $chatIdCustomerIdMap[$chatId]; // customerName $customers[$customerId]['customerName'] = Bll_Mobile_UserList::getUserName(isset($chatInfo['nick_name']) ? $chatInfo['nick_name'] : '', isset($chatInfo['phone']) ? $chatInfo['phone'] : '', $customerId); // customerAvatarUrl if ($chatInfo['icon']) { $customers[$customerId]['customerAvatarUrl'] = $chatInfo['icon']; } } } // 重置新推客户数 Bll_CustomerRush_Basic::resetBrokerLatestPushCount($brokerId); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('customers' => array_values($customers))); }