Пример #1
0
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 public static function choicePromotion($params = array())
 {
     if (!self::checkJpParams($params)) {
         return self::buildReturn(0, self::$msg);
     }
     $spreadInfo = self::$spreadInfo;
     $brokerId = self::$brokerId;
     $spreadId = self::$spreadId;
     $houseInfo = self::$houseInfo;
     //新发和重推触发计费
     Bll_Log_JpClick::getInstance()->openActiviteBidPayLog($spreadInfo->memberId, $spreadInfo->id);
     //触发报表统计
     Bll_House_JpBwAnalysis::getInstance()->openSaveBluewhaleHouse($spreadInfo->houseId, date('Y-m-d'), $spreadInfo->id, Model_Plan_Jp::ENUM_TYPE_HP);
     //加入按时间停止计划队列
     Model_Plan_JpStop::addSpreadStopQueen($spreadInfo->id, $spreadInfo->endTime);
     //写给BI看的日志
     Bll_Log_JpHouse::getInstance()->writeHouseLog($spreadInfo->houseId, $spreadInfo->id, 1, $spreadInfo->memberId, Model_Log_JpHouseUpDown::ENUM_BID_MEMBER_NEW);
     ////log 4 张计划log表
     Bll_Log_JpPlan::getInstance()->writeSpreadBudgetLog(true, 1, 0, $spreadInfo->id, $spreadInfo->budget);
     Bll_Log_JpPlan::getInstance()->writeSpreadOfferLog($spreadInfo->id, $houseInfo['info']->spreadOffer, 1, 0);
     //新增和重推时
     Bll_Log_JpPlan::getInstance()->writeSpreadStatusLog(Model_Log_JpSpreadStatusUpdate::ENUM_STATUS_SPREAD_ONLINE, $spreadInfo->id);
     Bll_Log_JpPlan::getInstance()->writeSpreadHouseLog(true, $spreadInfo->houseId, $spreadInfo->id, Model_Log_JpSpreadHouseUpdate::ENUM_STATUS_HOUSE_IN);
     $reason = '计划:' . $spreadId;
     $res = self::updateBucketStatusAndHouseToSolr($spreadInfo, $brokerId, __FUNCTION__, $reason);
     return self::buildReturn(1, $res);
 }
Пример #3
0
 /**
  * 把房源从竞价推广中移除
  * @param $objHouse
  * @param int $p_intMemberId
  * @param $log_type:1,手动停止 2,房源过期
  * @param int $do_choice  是否处理精选计划,如果为false 说明插入竞价队列表,在竞价队列JOB中处理
  * @return mixed
  */
 public static function removeBidHouseFromSpread($objHouse, $memberId = 0, $log_type = 1, $do_choice = true)
 {
     if ($log_type == 1) {
         $arr_log_param = array('spread_status' => Model_Log_JpSpreadStatusUpdate::ENUM_STATUS_SPREAD_STOP, 'house_log' => Model_Log_JpHouseUpDown::ENUM_BID_MEMBER_HOUSE_STOP);
     } elseif ($log_type == 2) {
         $arr_log_param = array('spread_status' => Model_Log_JpSpreadStatusUpdate::ENUM_STATUS_SPREAD_HOUSE_EXPIRE, 'house_log' => Model_Log_JpHouseUpDown::ENUM_JOB_HOUSE_EXPIRE);
     }
     $p_intHouseId = $objHouse->id;
     //检查推广信息
     $arrResult = Bll_Plan_JpPlanManage::getInstance()->checkSpreadInfo($objHouse->bidSpreadId, $memberId, $objHouse->id);
     if (!$arrResult['success']) {
         return $arrResult;
     }
     $objSpread = $arrResult['data'];
     //从竞价中移除房源
     if ($objSpread->type == Model_Plan_Jp::ENUM_TYPE_HP) {
         if ($objSpread->bidVersion == Model_Plan_Jp::BIDVERSION_CHOICE) {
             if (false == $do_choice) {
                 return array('success' => true, 'data' => '操作成功');
             }
         }
         //记录停止日志
         Bll_Log_JpPlan::getInstance()->writeSpreadStatusLog($arr_log_param['spread_status'], $objHouse->bidSpreadId, '房源停止计划:触发结算前');
         //发送结算
         $params = array();
         $params['spread_id'] = $objHouse->bidSpreadId;
         $params['log_status'] = 7;
         Bll_Plan_Bid_JpSettlement::getInstance()->settlement($params, 'bid');
         //解除关系
         $objHouse->bidSpreadId = 0;
         $objHouse->save();
         //判断是否下架房源
         $intXiaJia = 1;
         if (!empty($objHouse->fixSpreadId)) {
             $objModel = Model_Plan_Jp::data_access();
             try {
                 $objFixSpread = $objModel->find_by_pk($objHouse->fixSpreadId, false);
             } catch (Exception $e) {
                 $objFixSpread = null;
             }
             if (!empty($objFixSpread) && $objFixSpread->status == 2) {
                 $intXiaJia = 0;
             }
         }
         //操作下架
         if ($intXiaJia) {
             //下架房源
             self::updateHouseIsList($objHouse->id, $objHouse->houseType, 0);
             //记录房源操作
             $intTitle = Const_CrmHouseLog::V_OPERATION_TITLE_OUT_SHELVES;
             $intComment = Const_CrmHouseLog::V_OPERATION_COMMENT_HOUSE_SPREAD_OFFLINE;
             Bll_Log_JpHouse::getInstance()->logHouseOperation($objHouse->id, $objHouse->memberId, $intTitle, $intComment);
         }
         //更新solr
         Bll_House_JpHouseInfo::updateHouseToSolr(1, $p_intHouseId, 1);
         //TO 初始化房源统计日志
         Bll_House_JpBwAnalysis::getInstance()->openSaveBluewhaleHouse($objHouse->id, date('Y-m-d'), $objHouse->bidSpreadId, $objSpread->type);
         //竞价房源下线日志
         Bll_Log_JpHouse::getInstance()->writeHouseLog($objHouse->id, $objHouse->bidSpreadId, 0, $objHouse->memberId, $arr_log_param['house_log']);
         $objSpread->isDelete = 1;
         $objSpread->save();
         return array('success' => true, 'data' => '操作成功');
     }
 }
Пример #4
0
 /**
  * @param $intSpreadId
  * @param $intHouseId
  * @param null $memberId
  * @param bool $isSettlement
  * @return int
  * @throws Exception
  */
 public function stopBidSpread($intSpreadId, $intHouseId, $memberId = null, $isSettlement = true)
 {
     if (!$memberId) {
         $apf = APF::get_instance();
         $memberId = $apf->get_request()->get_member_id();
     }
     $spreadInfo = Model_Plan_Jp::data_access()->filter('id', $intSpreadId)->find_only();
     if (!$spreadInfo) {
         return false;
     }
     if ($isSettlement) {
         // add log: broker stop hp
         Bll_Log_JpPlan::getInstance()->writeSpreadStatusLog(Model_Log_JpSpreadStatusUpdate::ENUM_STATUS_SPREAD_STOP, $intSpreadId, '精选房源计划手动停止计划:触发结算前');
         $params = array();
         $params['spread_id'] = $spreadInfo->id;
         $params['log_status'] = 7;
         Bll_Plan_Bid_JpSettlement::getInstance()->settlement($params, 'choice');
     }
     //解除i_house.spread_bid_id
     $objHouse = Model_House_JpHouseIdx::getPropInfoByPk($intHouseId);
     if (!$objHouse) {
         return false;
     }
     $objHouse->bidSpreadId = 0;
     $objHouse->save();
     //记录日志
     Bll_Log_JpPlan::getInstance()->writeSpreadHouseLog(1, $intHouseId, $intSpreadId, 2);
     //判断是否下架房源
     $intHouseOp = 1;
     if (!empty($objHouse->fixSpreadId)) {
         $objFixSpread = Model_Plan_Jp::getPlanInfoByPk($objHouse->fixSpreadId);
         if (!empty($objFixSpread) && $objFixSpread->status == 2) {
             $intHouseOp = 0;
         }
     }
     //操作下架
     if ($intHouseOp) {
         // 房源下架
         Bll_House_JpHouseInfo::houseOutShelves(intval($intHouseId), $memberId);
         //记录房源操作
         $intTitle = Const_CrmHouseLog::V_OPERATION_TITLE_OUT_SHELVES;
         $intComment = Const_CrmHouseLog::V_OPERATION_COMMENT_HOUSE_SPREAD_OFFLINE;
         Bll_Log_JpHouse::getInstance()->logHouseOperation($intHouseId, $memberId, $intTitle, $intComment);
     }
     Bll_Log_JpHouse::getInstance()->writeHouseLog($intHouseId, $intSpreadId, 0, $memberId, Model_Log_JpHouseUpDown::ENUM_BID_MEMBER_STOP);
     return Bll_House_JpHouseInfo::updateHouseToSolr(1, intval($intHouseId), 1);
 }