public static function getBase($url, $params) { if (!$params) { $arrCallback['status'] = 'error'; $arrCallback['info'] = 'miss params'; return $arrCallback; } $bizType = isset($params['bizType']) ? $params['bizType'] : Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ESF_SITE; $javaAPI = BLL_Service_JavaApi::getInstance($bizType); $result = $javaAPI->useapi($url, $params, BLL_Service_JavaApi::GETTYPE); return $result; }
public function run() { $this->setShCommonSleepTime(1); $year = date('Y'); $bll = new Bll_Plan_BidFreezeOrderNum($year); //获取一条未处理的记录 $result = $bll->getNotFixedOrder(); //没有未处理的数据,则设置sh为闲置状态 if (empty($result)) { $this->setShCommonSleepTime(5); exit; } //如果没有处理的记录超过指定时间,取消订单 if (time() - $result['addTime'] > Bll_Plan_BidFreezeOrderNum::ORDER_VALID_TIME) { $this->addLogger("需要处理数据:" . json_encode($result)); //请求取消冻结url $requestId = $bll->getRequestId($result['siteType'], $result['userId'], date('Y', strtotime($result['addDate'])), $result['id']); $javaApi = BLL_Service_JavaApi::getInstance($result['siteType']); $url = "service-exes/rest/exes/cancelFrozen"; $propSpread = APF::get_instance()->get_config("propSpread2", "app"); $fields = array('appId' => $propSpread['paycenter_id'], 'appKey' => $propSpread['paycenter_key'], 'reqId' => $requestId, 'userId' => $result['userId'], 'note' => '取消冻结'); $apiResult = $javaApi->useapi($url, $fields, BLL_Service_JavaApi::GETTYPE); if (isset($apiResult['code']) && $apiResult['code'] == 200) { $this->addLogger("Java API请求取消冻结成功:" . json_encode(array('url' => $url, 'param' => http_build_query($fields), 'result' => $apiResult))); //更新队列状态为取消冻结成功 if ($bll->cancleOrderSuccess($result['id'], $result['addTime'], $requestId)) { $this->addLogger("更新队列状态为取消成功"); //$this->updateCursor($result['id']); } else { $this->addLogger("更新队列状态为取消成功"); } } else { $this->addLogger("Java API请求取消冻结失败:" . json_encode(array('url' => $url, 'param' => http_build_query($fields), 'result' => $apiResult))); //更新队列状态为取消冻结失败 if ($bll->cancleOrderFail($result['id'], $result['addTime'])) { $this->addLogger("更新队列cancleFailNum成功"); } else { $this->addLogger("更新队列cancleFailNum失败"); } } } else { $this->noLogQuit('最近一条数据需要处理的时间不在有效处理时间之内'); } }
/** * 获取房源发布的最大数据 * @param int $city_id * @param $biz_type ajk-二手房,hz-租房,jp-商铺 * @return mixed * * 返回结果: { "status": true, “data”:{ "publishLimit": 90 } */ public static function getPropLimit($city_id = 0, $biz_type) { //初始化返回值 $result['status'] = false; $result['data'] = array(); //网站类型判断 if ($biz_type == 'ajk') { //二手房 $biz_type = Const_Site::ANJUKE; } elseif ($biz_type == 'hz') { //租房 $biz_type = Const_Site::HAOZU; } elseif ($biz_type == 'jp') { //金铺 $biz_type = Const_Site::JINPU; } else { $result['errMsg'] = '网站类型错误'; return $result; } //判断城市 if (empty($city_id)) { //正常的web请求能获取到经纪人的城市id。job无法获取到。 $city_id = APF::get_instance()->get_request()->getBrokerCityId(); } if (empty($city_id)) { $result['errMsg'] = "无法获取到cityId"; return $result; } //组装api请求参数 $flies = array('cityId' => $city_id, 'bizType' => $biz_type); $javaAPI = BLL_Service_JavaApi::getInstance($biz_type); $apiInfo = $javaAPI->useapi(Const_JavaAPI::PROPLIMIT, $flies); //初始化返回值 $result['status'] = true; $result['data'] = array('publishLimit' => 80); //默认80套 if (!empty($apiInfo) && $result['status'] == 'ok') { $result['data']['publishLimit'] = $apiInfo['data']['publishLimit'] ? $apiInfo['data']['publishLimit'] : 80; } return $result; }
/** * 获取二手房房源图片地址 * * @param $ProId * @param $CommId * @return string */ public function getThumbImageUrl($ProId, $CommId) { $api = BLL_Service_JavaApi::getInstance(BLL_Service_JavaApi::ESFSITE); $url = 'service-internal/rest/image/getDef/' . $ProId; $mixResult = $api->useapi($url, array()); $image_url = PageHelper::pure_static_url('/img/global/nopic_150x113.gif'); if ($mixResult['status'] == 'ok') { $image_url = $mixResult['photo']['fileName']; if (preg_match("/,/", $image_url)) { $img = array(); $arr = explode(",", $image_url); if ($arr[0] > 0) { $img['host_id'] = $arr[0]; $img['FileName'] = $arr[1]; } $image_url = $this->convert_property_image_to_icon_url($img['FileName'], $img['host_id']); if (isset($image_url['photourl'])) { $image_url = $image_url['photourl']; } } } return $image_url; }
public function __construct($userId) { $this->userId = $userId; $this->javaAPI = BLL_Service_JavaApi::getInstance(BLL_Service_JavaApi::ESFSITE); }
public function getCode($mobile, $appid = 'mobile.uppwd.authCode') { $javaAPI = BLL_Service_JavaApi::getInstance(BLL_Service_JavaApi::ESFSITE); $url = 'service-internal/rest/sysmsg/getAuthCode'; $fields = array('appid' => $appid, 'mobile' => $mobile, 'json' => 1); $result = $javaAPI->useapi($url, $fields, BLL_Service_JavaApi::GETTYPE); return $result; }
public static function housePublishApi($type, $params, $connectTime = 3, $executeTime = 3) { $url = ''; if ($type == 'o_p') { //office_publish $url = 'service-combo/rest/office/properties/v2/add'; } elseif ($type == 'o_e') { //office_edit $url = 'service-combo/rest/office/properties/v2/update'; } elseif ($type == 's_p') { //shop_publish $url = 'service-combo/rest/shop/properties/v2/add'; } elseif ($type == 's_e') { //shop_edit $url = 'service-combo/rest/shop/properties/v2/update'; } $apiInfo = BLL_Service_JavaApi::getInstance(BLL_Service_JavaApi::JPSITE)->useapi($url, $params, BLL_Service_JavaApi::POSTTYPE, $connectTime, $executeTime); //记录日志 file_put_contents('/data1/logs/apiPublish_' . $type . '_' . date('Ymd') . '.log', "\n" . date("Y-m-d H:i:s") . "\n" . $params['brokerId'] . "\n" . $params['price'] . $url . "\n" . var_export($apiInfo, true), FILE_APPEND); return $apiInfo; }
/** * 获取每日限额 */ public static function getLimitInfo($brokerId, $bizType = 3) { $javaAPI = BLL_Service_JavaApi::getInstance($bizType); $url = 'service-internal/rest/broker/showBrokerLimitConfig'; $fields = array('brokerId' => $brokerId, 'bizType' => $bizType); $apiInfo = $javaAPI->useapi($url, $fields, BLL_Service_JavaApi::GETTYPE); if (!empty($apiInfo) && $apiInfo['status'] == 'ok') { $result['publishLimit'] = $apiInfo['data']['publishLimit']; $result['promotionLimit'] = $apiInfo['data']['promotionLimit']; $result['amountLimit'] = $apiInfo['data']['amountLimit']; $result['tempId'] = $apiInfo['data']['tempId']; $result['tempName'] = $apiInfo['data']['tempName']; } else { $result = false; } return $result; }
/** * API 请求竞价冻结 * * @param $appid * @param $appkey * @param $requestid * @param $userId * @param $amount * @param int $sn * @param string $note * @return mixed */ public function freezeAccountApi($appid, $appkey, $requestid, $userId, $amount, $sn = 0, $note = "") { $url = APF::get_instance()->get_config('esfFreezeAccount', 'esf_javaapi_suffix_url'); $url .= "freeze?json&appId=" . $appid . "&appKey=" . $appkey . "&amount=" . $amount * 100 . "&userId=" . $userId . "&reqId=" . $requestid; if ($sn) { $url .= "&frozenSN=" . $sn; } if ($note) { $url .= "¬e=" . urlencode($note); } $javaApi = BLL_Service_JavaApi::getInstance(BLL_Service_JavaApi::ESFSITE); $result = $javaApi->useapi($url, array(), BLL_Service_JavaApi::GETTYPE); return json_decode($result); }