public static function getRequireDetailInfo($requireInfo) { $requireList = array(); foreach ($requireInfo['baseInfo'] as $key => $value) { $requireListTmp = array(); $requireDetail = $requireInfo['detailInfo'][$key]; $ChatInfo = Model_RecommendCus_ChatUserBasic::getUserInfoByUserId($value['chatId']); $requireListTmp['requireId'] = $key; $requireListTmp['app'] = $value['appName']; $requireListTmp['udid2'] = $value['udid2']; $requireListTmp['guid'] = $value['guid']; $requireListTmp['macId'] = $value['macId']; $requireListTmp['userId'] = $value['userId']; $requireListTmp['chatId'] = $value['chatId']; $requireListTmp['userPhoto'] = $ChatInfo['icon']; $requireListTmp['otherRequire'] = $requireDetail['otherRequire']; $requireListTmp['tags'] = implode(' ', json_decode($requireDetail['tags'], true)); $requireListTmp['area'] = self::getAreaOrBlockNameV2($requireDetail['areaId']); $requireListTmp['block'] = self::getAreaOrBlockNameV2($requireDetail['blockId']); $requireListTmp['Price'] = self::formatPrice($requireDetail['minPrice'], $requireDetail['maxPrice']); $requireListTmp['roomNum'] = self::getRoomNum($requireDetail['roomNum']); $broSum = Model_RecommendCus_ServedCustomer::getServedBrokerSumByRequireId($key); $requireListTmp['broSum'] = $broSum >= 5 ? 5 : $broSum; $requireListTmp['canServed'] = $requireListTmp['broSum'] >= 5 ? 'false' : 'true'; $requireListTmp['customerName'] = Bll_Mobile_UserList::getUserName(isset($ChatInfo['nickName']) ? $ChatInfo['nickName'] : '', isset($ChatInfo['phone']) ? $ChatInfo['phone'] : '', $value['userId']); $requireListTmp['updateTime'] = self::formatTime($value['createTime']); $requireList[] = $requireListTmp; } return $requireList; }
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))); }
/** * @param $customers * @return array */ protected function prepareOutPut($customers) { if (empty($customers)) { return array(); } $result = array(); foreach ($customers as $customer) { $newStatus = Bll_Mobile_UserList::getApiStatusFrom($customer); $sort = Bll_Mobile_UserList::getStatusSortMapping($newStatus); $result[$sort][] = array('device_id' => $customer['userDeviceId'], 'user_name' => Bll_Mobile_UserList::getUserName(isset($customer['nickName']) ? $customer['nickName'] : '', isset($customer['phone']) ? $customer['phone'] : '', $customer['userDeviceId']), 'user_photo' => $customer['userPhoto'], 'blcok_name' => $customer['bankuaiPreferenceDesc'], 'block_name' => $customer['bankuaiPreferenceDesc'], 'house_type_preference' => $customer['houseTypePreference'], 'price_preference' => $customer['pricePreference'], 'view_prop_num' => $customer['viewPropNum'], 'last_operate_time' => Bll_Mobile_UserList::formatCreateTime($customer['lastOperateTime']), 'last_operate_unixtime' => strtotime($customer['lastOperateTime']), 'status' => $newStatus, 'status_msg' => Bll_Mobile_UserList::getMsgFormStatus($newStatus)); } // 遍历分组排序 foreach ($result as $k => $group) { usort($group, function ($a, $b) { return $a['last_operate_unixtime'] > $b['last_operate_unixtime'] ? -1 : 1; }); $result[$k] = $group; } ksort($result); if ($this->debug) { printf('分组排序后的数据' . PHP_EOL); print_r($result); } //把组织好的数据扁平化 $temps = $result; $result = array(); foreach ($temps as $group) { foreach ($group as $item) { $result[] = $item; } } return $result; }
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))); }
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))); }
/** * 获取app用户详细信息 * * @param $deviceId * @param $brokerId */ public function getAppUserDetail($deviceId, $brokerId) { $data = array('device_id' => $deviceId); if (empty($deviceId) || empty($brokerId)) { $this->errorMsg = "参数错误"; $this->errorCode = self::PARAMS_ERROR; return false; } try { $relationRecord = $this->getUserBrokerTodayRelation($deviceId, $brokerId); if (empty($relationRecord)) { $this->errorMsg = "关系不存在"; $this->errorCode = self::NO_RELATION_ERROR; return false; } //如果关系时间超过2天,直接返回已抢完 if (time() - strtotime($relationRecord->uploadDt) > Const_RobUser::RELATION_VALID_TIME) { $this->errorMsg = "关系过期"; $this->errorCode = self::RELATION_EXPIRE; return false; } //获取用户名字 $chatAccountInfos = array(); if ($relationRecord->chatId < 2000000000) { // 有效微聊ID,从2000000000开始 $data['user_name'] = Bll_Mobile_UserList::getUserName('', '', $deviceId); } else { if (($chatAccountInfos = Bll_Mobile_UserList::getChatAccountInfo(array($relationRecord->chatId))) === false) { $this->errorMsg = "获取用户名失败"; $this->errorCode = self::WEILIAO_API_FAIL; return false; } $data['user_name'] = Bll_Mobile_UserList::getUserName(isset($chatAccountInfos[0]['nick_name']) ? $chatAccountInfos[0]['nick_name'] : '', isset($chatAccountInfos[0]['phone']) ? $chatAccountInfos[0]['phone'] : '', $deviceId); } //app_name $data['app'] = $relationRecord->appName; //guid $data['i'] = $relationRecord->guid; //macid $data['macid'] = $relationRecord->macId; //udid2 $data['udid2'] = $relationRecord->userDeviceId2; //返回结果拼接用户头像 $data['user_portrait'] = $chatAccountInfos[0]['icon'] ? $chatAccountInfos[0]['icon'] : $relationRecord->userPhoto; //获取偏爱小区名字 $data['comm_preference'] = $this->getCommName($relationRecord->commPreference); //返回结果拼接偏爱户型 $data['house_type_preference'] = $relationRecord->houseTypePreference; //返回结果拼接偏爱价格段 $data['price_preference'] = $relationRecord->pricePreference; //返回结果拼接浏览房源数 $data['view_prop_num'] = $relationRecord->viewPropNum; //返回结果拼接浏览房源具体信息 $data['view_prop_info'] = array(); // $this->getProductDetail($relationRecord->viewPropList); //返回结果拼接用户状态 $data['status'] = $this->getAppUserStatus($deviceId, $brokerId, $relationRecord, true); } catch (Exception $e) { $this->errorMsg = $e->getMessage(); $this->errorCode = self::UNKNOW_ERROR; return false; } return $data; }