/** * 警告 * @param $audit */ private function _warning($audit) { $message = $this->_punishMsg($audit); $msg = '您发布了假房源(' . $message . '),这么任性可不好。如果再任性,我只能残忍地将您关进小黑屋,' . Const_Fyk::DETENTION_TIME . '天内无法再使用房源库哦~~'; $brokerInfo = Bll_Broker_User::getBrokerInfoByUserId(intval($audit['userId'])); if ($brokerInfo) { $chatInfos = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV(array($brokerInfo['brokerId'])); if (!empty($chatInfos)) { $chatInfo = $chatInfos[0]; $i = 0; do { $i++; $isPush = Bll_Mobile_ChatInfoBll::sendFykPublicMsgTxt($chatInfo['chatId'], $msg); } while (!$isPush && $i < 4); } if (empty($isPush)) { $this->setLog(date('Y-m-d H:i:s') . ' - broker_id: ' . $brokerInfo['brokerId'] . ', API call failure '); } if (!empty($isPush) && $isPush['data']['status'] == 'ERROR') { //如果api调用成功,但是执行失败,则记录日志 $this->setLog(date('Y-m-d H:i:s') . ' - broker_id: ' . $brokerInfo['brokerId'] . ', warning failure:' . $isPush['data']['errorCode'] . '(' . $isPush['data']['errorMessage'] . ')'); } } $this->_insertDataByType($audit, Model_Fyk_UserPunish::WARNING); }
/** * 两公里经纪人 * @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; }
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 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; }