예제 #1
0
 /**
  * call api 当前拥有的套餐列表
  * 当前拥有的套餐列表
  * @param int $brokerId 二手房经纪人ID
  * @param bool $useCache
  * @link http://gitlab.corp.anjuke.com/_broker-docs/java-api-doc/blob/master/API-Document/comboApi.md
  * @return array
  */
 public static function getBrokerComboList($brokerId, $useCache = false)
 {
     static $_cache = array();
     if ($useCache && isset($_cache[$brokerId])) {
         return $_cache[$brokerId];
     }
     $userId = Bll_Broker_MainBusiness::getDataByEsfId($brokerId)->memberId;
     if (empty($userId)) {
         return array();
     }
     $combos = array();
     for ($i = 0; $i < 3; $i++) {
         /**
          * @var $combos Bll_Service_Client_HttpResponse
          */
         $combos = Bll_Service_Combo::ComboList(array('userId' => $userId));
         if ($combos->isSucceeded()) {
             break;
         }
     }
     if (defined('APP_NAME') && APP_NAME == 'jobs') {
         $logFile = sprintf('/data1/logs/Bll_Combo_Broker_BrokerComboInfo-%d.log', date('Ymd'));
         $content = sprintf('[%s] brokerId:%d result:%s', date('Y-m-d H:i:s'), $brokerId, json_encode($combos));
         @file_put_contents($logFile, $content . PHP_EOL, FILE_APPEND);
     }
     if ($combos['status'] == 'ok') {
         if ($useCache) {
             $_cache[$brokerId] = $combos['orders'];
         }
         return $combos['orders'];
     }
     return array();
 }
예제 #2
0
 public static function deleteHouses($houseIds, $ajkBrokerId)
 {
     if (!is_array($houseIds)) {
         $houseIds = array($houseIds);
     }
     foreach ($houseIds as $houseId) {
         $response = Bll_Service_Combo::JpDeleteHouses(array('shopId' => $houseId, 'brokerId' => $ajkBrokerId));
         if ($response['status'] != 'ok') {
             //删除房源失败 记录日志
             file_put_contents('/data1/logs/jp_delete_house_fail_' . date('Ymd'), "\n" . var_export($response['info'], true), FILE_APPEND);
         }
     }
     return Util_GlobalFunc::buildReturn(1, 'success');
 }