Exemple #1
0
 public function handle_request_internal()
 {
     $brokerId_ajk = $this->_params['brokerId'];
     if (empty($brokerId_ajk)) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk);
     $fixplans = Bll_HzFixPlan::get_broker_fixplans($brokerId_hz);
     $ret = array('status' => 'ok', 'data' => array());
     if ($fixplans) {
         $plan = array();
         $status_arr = array(1 => '有效', 2 => '计划上限', 3 => '手工结束', 4 => '暂停', 5 => '待推广', 6 => '删除', 7 => '余额上限', 9 => '手动停止');
         $city_id = $fixplans[0]['city_id'];
         if (empty($city_id)) {
             $user_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
             $city_id = $user_info['cityid'];
         }
         $cityTop = Bll_HzFixPlan::get_citytop($city_id);
         //播种城市
         foreach ($fixplans as $planInfo) {
             if (!empty($cityTop)) {
                 $fixPlanPropCeiling = round($cityTop['money'] / 100, 2);
                 $fixPlanPropCeiling = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0;
             } else {
                 $fixPlanPropCeiling = $planInfo['amount'] ? $planInfo['amount'] : 0;
             }
             $tmp = array('fixPlanId' => $planInfo['id'], 'fixPlanName' => $planInfo['plan_title'], 'fixPlanPropCeiling' => $fixPlanPropCeiling, 'fixPlanPropNum' => $planInfo['prop_count'] ? $planInfo['prop_count'] : 0, 'fixPlanState' => $planInfo['status'], 'fixPlanStateDesc' => $status_arr[$planInfo['status']]);
             $plan['planList'][] = $tmp;
         }
         $ret = array('status' => 'ok', 'data' => $plan);
     }
     return $ret;
 }
Exemple #2
0
 public function handle_request_internal()
 {
     $ajkBrokerId = $this->_params['brokerId'];
     //根据安居客经纪人ID获取好租经纪人ID
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId);
     //获取租房定价信息
     $fixPlansInfo = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId);
     //获取竞价计划状态
     $fixPlanStatus = $fixPlansInfo[0]['status'] == 1 ? V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_1 : V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_0;
     //获取计划ID
     $fixPlanId = $fixPlansInfo[0]['id'];
     $cityId = $fixPlansInfo[0]['city_id'];
     //获取租房点击和花费信息
     $promotion = Dao_Broker_HzPlan::get_plan_fee($hzBrokerId, $fixPlanId, date('Ymd'), 1);
     // 获取租房今日点击
     $fixPropIds = Model_Plan_HzPlanning::getFixPropIdsByPlanId($fixPlanId);
     $clicks = Model_Stats_PropClick::getPropBidClick($fixPropIds, $hzBrokerId, $cityId);
     $fixClickSums = Model_Stats_PropClick::calculateClickSumsGroupByPropId($clicks, 'fix');
     $todayClicks = 0;
     foreach ($fixClickSums as $clickSum) {
         $todayClicks += $clickSum;
     }
     //租房某计划的房源总量
     $totalProps = Model_Plan_HzPlanning::getFixPlanPropNum($fixPlanId);
     //查询经纪人新封顶模式信息
     //todo 等多档封顶合并了方法迁移到多档封顶
     $ppcLimitInfo = $this->getPpcBrokerLimitInfo($ajkBrokerId, V1_Zufang_Fix_SummaryController::PPC_BROKER_LIMIT_HZ_SITE);
     if (!$ppcLimitInfo) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => '封顶数据未能取到!');
     }
     $todayConsume = $promotion[$fixPlanId]['total_cost'] ? $promotion[$fixPlanId]['total_cost'] : 0;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('planId' => $fixPlanId, 'todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps, 'planStatus' => $fixPlanStatus, 'budget' => $ppcLimitInfo['amountLimit'] / 100, 'budgetUnit' => '元'));
 }
Exemple #3
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     $budget = $this->_params['budget'];
     $offer = $this->_params['offer'];
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $plan_id = Bll_HzBidPlan::get_planid_by_propid($propId);
     //@todo 不明白为什么一定要用propid而不用计划id
     $ret_offer = Bll_HzBidPlan::change_bid_offer($plan_id, $offer);
     //修改出价
     $ret_budget = Bll_HzBidPlan::change_bid_budget($plan_id, $budget);
     //修改预算 ----$new_amount 为需要增加的预算
     $r = array();
     if ($ret_offer['status'] && $ret_budget['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         if (!$ret_offer['status']) {
             $r = array('status' => 'error', 'errcode' => $ret_offer['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_offer['msg']));
         }
         if (!$ret_budget['status']) {
             $r = array('status' => 'error', 'errcode' => $ret_budget['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_budget['msg']));
         }
     }
     return $r;
 }
Exemple #4
0
 /**
  * 删除竞价
  */
 public function do_delete()
 {
     // 更新计划的flag为删除状态
     if (!Dao_Broker_HzPlan::update_history_bids($this->params['planId'])) {
         $this->outPut(0, '删除计划失败');
     }
     $this->outPut(1, 'success');
 }
 public function handle_request()
 {
     $currentTableSplitSuffix = date('m');
     $failedActionQueue = Model_Choice_ActionQueue::getFailedAbandonFee($this->queueId, Model_Choice_ActionQueue::ENUM_HAOZU, $this->tableSplitSuffix);
     if (empty($failedActionQueue)) {
         /** 如果不是同一个月的话,那么前一个月没有需要修复的数据就开始修复本月的数据 */
         if (strcmp($currentTableSplitSuffix, $this->tableSplitSuffix) != 0) {
             $this->saveCursor($currentTableSplitSuffix, 0);
         }
         return;
     }
     $this->log("开始修复: ID={$failedActionQueue['id']}\tBrokerId={$failedActionQueue['brokerId']}\tPlanId={$failedActionQueue['planId']}\tupdateRemark={$failedActionQueue['updateRemark']}");
     $ajkBrokerExtend = Model_Broker_AjkBrokerExtend::getDataByBrokerId($failedActionQueue['brokerId']);
     /** TODO 添加获取二手房经纪人信息为空日志 */
     if (empty($ajkBrokerExtend)) {
         $this->log(sprintf('    获取经纪人(%d)的UserId失败(%d)。', $failedActionQueue['brokerId'], $failedActionQueue['id']));
         $this->saveCursor($this->tableSplitSuffix, $failedActionQueue['id']);
         return;
     }
     $planExtend = Dao_Broker_HzPlan::get_bid_sn($failedActionQueue['planId']);
     /** TODO 添加获取SN 失败日志 */
     if (empty($planExtend)) {
         $this->log(sprintf('    获取计划(%d)的SN失败(%d)。', $failedActionQueue['planId'], $failedActionQueue['id']));
         $this->saveCursor($this->tableSplitSuffix, $failedActionQueue['id']);
         return;
     }
     // $planInfo = Dao_Broker_HzPlan::get_plan($failedActionQueue['planId']);
     $planInfo = Model_Plan_HzPlanBasic::get_plan_by_id($failedActionQueue['planId']);
     /** TODO 添加获取计划信息失败日志*/
     if (empty($planInfo)) {
         $this->log(sprintf('    获取计划(%d)的信息失败(%d)。', $failedActionQueue['planId'], $failedActionQueue['id']));
         $this->saveCursor($this->tableSplitSuffix, $failedActionQueue['id']);
         return;
     }
     //精选结算
     $amount = $planInfo['total_consume'];
     $note = '%E8%A7%A3%E5%86%BB';
     $this->log("    传递的参数:UserId={$ajkBrokerExtend['userId']}\tamount={$amount}\tplanId={$failedActionQueue['planId']}\tSN={$planExtend['sn']}");
     $unlockSuccess = Bll_PayAccount::cancel_frozen($ajkBrokerExtend['userId'], $amount, $failedActionQueue['planId'], Const_PaymentApp::HZ_CHOICE, $planExtend['sn'], $note, true);
     if ($unlockSuccess === true) {
         $this->log('    解冻成功。');
         $this->saveCursor($this->tableSplitSuffix, $failedActionQueue['id']);
         $repairRemark = $failedActionQueue['updateRemark'] . ', 解冻修复成功';
         /** 更新队列状态为处理成功 */
         Model_Choice_ActionQueue::setBidQueenStatusById($this->tableSplitSuffix, $failedActionQueue['id'], Model_Choice_ActionQueue::ENUM_SUCCESS, $repairRemark);
         return;
     }
     $this->log('    解冻失败。');
 }
 /**
  * 修复竞价计划没有解冻
  */
 public function repairPlanDeduct()
 {
     $planIds = array(823960, 829941, 832069, 832072, 832092, 832094, 836322, 836323, 839239, 839247);
     $note = urlencode('解冻');
     foreach ($planIds as $planId) {
         $this->log(sprintf('开始修复计划%d.....', $planId));
         $planInfo = Model_Plan_HzPlanBasic::get_plan_by_id($planId);
         $hzBrokerId = $planInfo['user_id'];
         $userId = Bll_HzBroker::get_userid_by_hzbrokerid($hzBrokerId);
         $planExtend = Dao_Broker_HzPlan::get_bid_sn($planId);
         $amount = $planInfo['total_consume'];
         $this->log("传递的参数:UserId={$userId}\tamount={$amount}\tplanId={$planId}\tSN={$planExtend['sn']}");
         $charge_sn = Bll_PayAccount::cancel_frozen($userId, $amount, $planId, Const_PaymentApp::HZ_BID, $planExtend['sn'], $note, true);
         if ($charge_sn['data']['status'] === 'ok') {
             $this->log('修复成功。');
         } else {
             $this->log('修复失败。');
         }
     }
 }
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $ret = Bll_HzBidPlan::prop_out_bid($brokerId_hz, $this->_params['propId']);
     $r = array();
     if ($ret['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $r;
 }
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $propId = $this->_params['propId'];
     $planId = $this->_params['planId'];
     $ret = Bll_HzBidPlan::delete_bid($brokerId_hz, $planId, $propId);
     //竞价解冻开发中
     if ($ret['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         $r = array('status' => 'error', 'errcode' => $ret['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret['msg']));
     }
     return $r;
 }
Exemple #9
0
 /**
  * 某套房源是否正在定价推广
  * @param $proid
  * @param $is_valid
  * @return bool
  */
 public static function is_prop_planning($proid, $is_valid = '1')
 {
     $data = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::SPREAD_TYPE, $is_valid);
     return empty($data) ? false : true;
 }
 /**
  * 208 计划手动开启
  * 查询计划信息
  * 如果计划status!=1 return
  *   记录计划推广日志
  *   判断计划是否是推广状态, 如非 return
  * 查询房源计划关系
  *   如果不存在 return
  *   记录房源推广日志
  *   更新关系状态 = 1
  */
 private function handle_plan_start()
 {
     $planInfo = $this->checkPlanIsEmpty();
     if ($planInfo['status'] != Const_HzPlan::SPREAD) {
         return;
     }
     $this->allReturn[] = "定价计划" . $planInfo['id'] . ",status=" . $planInfo['status'];
     /** Jackin Fix bug34418 */
     $broker_money = self::get_broker_balance_by_broker_id($this->params['ajk_broker_id']);
     // 余额不足
     if ($broker_money <= 0) {
         throw new Exception_BllErrorException('余额不足ajk_broker_id' . $this->params['ajk_broker_id']);
     }
     $plan_cost = Bll_HzFixPlan::get_plan_clickinfo($this->params['broker_id'], $this->params['plan_id']);
     if ($planInfo['amount'] <= $plan_cost[$this->params['plan_id']]['total_cost']) {
         throw new Exception_BllErrorException('限额不足');
     }
     $this->writePlanLog(4, '手动开始计划');
     $plannings = Dao_Broker_HzPlan::get_planning($this->params['plan_id']);
     if (empty($plannings)) {
         return;
     }
     foreach ($plannings as $planning) {
         // 更新状态为1
         if (!Dao_Broker_HzPlan::update_planning($planning['id'], Const_HzPlan::SPREAD)) {
             throw new Exception_BllErrorException("更新关系为手动开启推广失败,关系id={$planning['id']}");
         }
         $this->params['pro_id'] = $planning['proid'];
         // 维护房子状态
         Bll_HzPropBll::bulidHzProStatu($planning['proid']);
         //写入上线日志
         $this->writePropLog(5, '推广');
     }
 }
Exemple #11
0
 /**
  * 记录房源updown 日志
  */
 public static function add_updown_log($proid, $plan_id, $action, $option)
 {
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     $sql = "insert into prop_updown_log(`proid`,`brokerid`,`action`,`plan_id`,`offline_reason`,`plan_type`) value (?,?,?,?,?,?);";
     $reason = $action == 1 ? 0 : $option;
     $stmt = APF_DB_Factory::get_instance()->get_pdo('rent_logs_master')->prepare($sql);
     return $stmt->execute(array($proid, $plan_info['user_id'], $action, $plan_id, $reason, $plan_info['plan_type']));
 }
Exemple #12
0
 /**
  * 经纪人手动停止精选推广
  * 只将计划的状态状态设置为 Const_HzPlan::MENUOVER
  *
  * @param $ajkBrokerId
  * @param $planId
  * @param $ip
  * @return array
  */
 public static function stopChoicePlan($ajkBrokerId, $planId, $ip)
 {
     $result = array('status' => 'ok');
     $planInfo = Model_Plan_HzPlanBasic::get_plan_by_id($planId);
     if (empty($planInfo)) {
         return array('status' => 'error', 'msg' => '计划不存在。');
     }
     if ($planInfo['status'] != Const_HzPlan::SPREAD) {
         return array('status' => 'error', 'msg' => '计划不在推广中。');
     }
     $hzBrockId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
     if ($planInfo['user_id'] != $hzBrockId) {
         return array('status' => 'error', 'msg' => '计划不属于当前经纪人。');
     }
     $blockId = $planInfo['blockId'];
     $priceId = $planInfo['priceId'];
     // 根据plan_id查pro_id
     $planning = Dao_Broker_HzPlan::get_planning($planId, 2);
     $proId = $planning ? $planning[0]['proid'] : 0;
     $bidQueueData = array('siteType' => Model_Choice_ActionQueue::ENUM_HAOZU, 'brokerId' => $ajkBrokerId, 'planId' => $planId, 'proId' => $proId, 'actionId' => Model_Choice_ActionQueue::ENUM_STOP_BY_HAND, 'createTime' => time(), 'createRemark' => '经纪人手动停止推广', 'operationId' => $ajkBrokerId, 'ip' => $ip);
     Model_Choice_ActionQueue::addBidQueen($bidQueueData);
     /** 更新计划状态为手工结束状态 */
     //Bll_HzBidPlan::updatePlanStatus($planId, Const_HzPlan::MENUOVER);
     $updatePlanResult = Model_Plan_HzPlanBasic::updatePlan($planId, array('status' => Const_HzPlan::MENUOVER, 'stop_date' => time()));
     $updatePlanningResult = Model_Plan_HzPlanning::updatePropPlanStatusByPlanId($planId, Const_HzPlan::MENUOVER);
     // 计划和关系更新成功后坑才-1
     if ($updatePlanResult && $updatePlanningResult) {
         Model_Choice_HzBidBucket::decrement_used_num($blockId, $priceId);
     } else {
         return array('status' => 'error', 'msg' => '更新计划或者关系失败。');
     }
     return $result;
 }
 public function getPpcPropsInOneComm($brokerId, $cityId, $commId = '')
 {
     //获取该经纪人下所有的房源列表(竞价、定价、待推广房源)
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $plannings = Dao_Broker_HzPlan::get_broker_planning($hzBrokerId);
     $base_domain = APF::get_instance()->get_config('base_domain');
     $commProps = array();
     if (!empty($plannings)) {
         $planIds = array();
         foreach ($plannings as $arr) {
             $planIds[] = $arr['plan_id'];
         }
         //参与推广房源
         $plansProps = Bll_HzFixPlan::get_plan_props($planIds, $cityId);
         $propCommPair = array();
         foreach ($plansProps as $planProps) {
             foreach ($planProps['props'] as $propId => $prop) {
                 $contentBasic = $prop['content_basic'];
                 $row = array();
                 $row['id'] = $propId;
                 $row['title'] = $contentBasic['title'];
                 $row['commId'] = $contentBasic['commid'];
                 $row['commName'] = $contentBasic['commname'];
                 $row['roomNum'] = $contentBasic['roomnum'];
                 $row['hallNum'] = $contentBasic['hallnum'];
                 $row['toiletNum'] = $contentBasic['toilnetnum'];
                 $row['area'] = round($contentBasic['areanum']);
                 $row['price'] = round($contentBasic['pricenum']);
                 $row['priceUnit'] = '元/月';
                 $row['imgUrl'] = 'http://pages.haozu.ajkcdn.com/20120824/img/global/nopic2_100-75.gif';
                 $row['isMoreImg'] = $contentBasic['quality'] ? 1 : 0;
                 $row['renttype'] = $contentBasic['renttype'];
                 $row['propUrl'] = 'http://' . $base_domain . '/web/rent/x/' . $contentBasic['cityid'] . '/' . $propId . '-3';
                 $row['isBid'] = 0;
                 $row['isChoice'] = 0;
                 $row['isVisible'] = intval($contentBasic['status'] != 6);
                 $row['isPhonePub'] = intval(isset($contentBasic['from']) && $contentBasic['from'] == 'mobile-ajk-broker');
                 $row['publishDays'] = floor((time() - $contentBasic['created']) / 86400);
                 $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布';
                 $row['createTime'] = date('Y-m-d H:i:s', $contentBasic['created']);
                 $row['updateTime'] = date('Y-m-d H:i:s', $contentBasic['updated']);
                 $commProps[$contentBasic['commid']][$propId] = $row;
                 // 房源小区映射关系,用于添加房源的默认图片
                 $propCommPair[$propId] = $contentBasic['commid'];
             }
         }
         if ($propCommPair) {
             $propIds = array_keys($propCommPair);
             // 添加房源默认图
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
             foreach ($defaultImages as $defaultImage) {
                 $propId = $defaultImage['proid'];
                 $commProps[$propCommPair[$propId]][$propId]['imgUrl'] = $defaultImage->imageUrl();
             }
             $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
             // 批量获取房源竞价计划
             $planIds = array();
             $planPropMap = array();
             foreach ($relations as $relation) {
                 $planIds[] = $relation['plan_id'];
                 $planPropMap[$relation['plan_id']] = $relation['proid'];
             }
             if ($planIds) {
                 $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds);
                 foreach ($plans as $plan) {
                     if ($plan->flag == 0) {
                         continue;
                     }
                     if ($plan->bid_version == 2) {
                         $propId = $planPropMap[$plan['id']];
                         $commProps[$propCommPair[$propId]][$propId]['isChoice'] = 1;
                     } else {
                         $propId = $planPropMap[$plan['id']];
                         $commProps[$propCommPair[$propId]][$propId]['isBid'] = 1;
                     }
                 }
             }
         }
     }
     $return = $commProps;
     // 如果是获取某单个小区房源列表
     if ($commId) {
         $ret['status'] = 'ok';
         $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array();
     } else {
         $ret = $return;
     }
     return $ret;
 }
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     $brokerId = $this->_params['brokerId'];
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             return array('status' => 'ok', 'data' => array('propertyList' => array()));
         }
     }
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         //获取套餐推广房源列表
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         if (!empty($comboList)) {
             foreach ($comboList as $combo) {
                 $comboIds[$combo['houseId']] = 1;
             }
             //获取竞价房源 去除竞价房源
             $validBidPlans = Model_Plan_HzPlanBasic::getBidPlansByBrokerId($brokerId_hz);
             $planIds = array();
             if (!empty($validBidPlans)) {
                 foreach ($validBidPlans as $plan) {
                     if ($plan['flag'] == 1 && $plan['status'] != Const_HzPlan::DELETE) {
                         $planIds[] = $plan['id'];
                     }
                 }
                 if (!empty($planIds)) {
                     $bidPlannings = Model_Plan_HzPlanning::getPlanningByPlanIds($planIds);
                 }
                 if (!empty($bidPlannings)) {
                     foreach ($bidPlannings as $bid) {
                         unset($comboIds[$bid['proid']]);
                     }
                 }
             }
             //$propertyList = Model_House_HzProp::getPropsByPropIds(array_keys($comboIds));
             $propertyList = Dao_Broker_HzProp::get_prop(array_keys($comboIds));
             if (!empty($propertyList)) {
                 foreach ($propertyList as $key => $list) {
                     if ($list['content_basic']['quality'] != 1) {
                         unset($propertyList[$key]);
                     }
                 }
             }
             $result = $propertyList;
         } else {
             $result = array();
         }
         //去除竞价房源和非多图房源
     } else {
         $result = Bll_HzBidPlan::get_canbid_props($brokerId_hz);
     }
     $return = array();
     $return["status"] = "ok";
     $return["data"]['propertyList'] = array();
     if (!empty($result)) {
         $proprow = array();
         foreach ($result as $propertyList) {
             $proprow["id"] = $propertyList['proid'];
             $proprow["title"] = $propertyList['content_basic']['title'];
             $proprow["commId"] = $propertyList['content_basic']['commid'];
             $proprow["commName"] = $propertyList['content_basic']['commname'];
             $proprow["roomNum"] = $propertyList['content_basic']['roomnum'];
             $proprow["hallNum"] = $propertyList['content_basic']['hallnum'];
             $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum'];
             $proprow["area"] = round($propertyList['content_basic']['areanum']);
             $proprow["price"] = round($propertyList['content_basic']['pricenum']);
             $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0;
             $proprow["priceUnit"] = "元";
             $return["data"]['propertyList'][] = $proprow;
             unset($proprow);
         }
         unset($result);
     }
     return $return;
 }
Exemple #15
0
 /**
  * 竞价计划删除操作
  */
 public static function delete_bid($broker_id, $plan_id, $proid)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     if (empty($broker_id) || empty($plan_id) || empty($proid)) {
         $flag_array['msg'] = Const_HzErrorInfo::PARAMS;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_check_planning($proid, $plan_id, Const_HzPlan::BID_TYPE);
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $broker_id || $plan_info['plan_type'] != Const_HzPlan::BID_TYPE) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     // 如果精选  由job读取上下架日志处理
     if ($plan_info['bidVersion'] == 2) {
         $flag_array['status'] = 1;
         return $flag_array;
     }
     if ($plan_info['status'] == 1) {
         //正在推广的竞价,先停止再删除
         $outBidResult = self::prop_out_bid($broker_id, $proid, true);
         if ($outBidResult['status'] == 1) {
             Dao_Broker_HzPlan::update_history_bids($plan_id);
             $flag_array = $outBidResult;
             return $flag_array;
         } else {
             $flag_array['msg'] = $outBidResult['msg'];
             return $flag_array;
         }
     } else {
         Dao_Broker_HzPlan::update_history_bids($plan_id);
         $flag_array['status'] = 1;
         return $flag_array;
     }
 }
Exemple #16
0
 /**
  * 拼接参数,供上下文使用
  * @param $params
  * @return array
  */
 private static function joinParams(&$params)
 {
     // 获取basic
     // bug42309 需取master
     if (!($basic = Dao_Broker_HzPlan::get_plan($params['planId'], true))) {
         return Bll_HzPropBll::build_return(0, array("获取好租计划失败"));
     }
     $params['userId'] = $basic['user_id'];
     $params['blockId'] = $basic['blockId'];
     $params['priceId'] = $basic['priceId'];
     $params['status'] = $basic['status'];
     $params['flag'] = $basic['flag'];
     $params['bidVersion'] = $basic['bidVersion'];
     //精选标记 1-竞价,2-精选
     $params['planId'] = $basic['id'];
     //计划id
     $params['totalConsume'] = $basic['total_consume'];
     //竞价、精选花费
     $params['is_valid'] = $params['isValid'] = $basic['status'];
     // 由于经纪人操作太快, 可能关系里的plan_id已经被更新成新的了
     // 所以队列表里加了proId
     // 此处兼容proId=0的情况
     if (!isset($params['proId']) || $params['proId'] == 0) {
         // 获取planning
         $planning = Dao_Broker_HzPlan::get_planning($params['planId'], 2, '', true);
         if (count($planning) < 1) {
             return Bll_HzPropBll::build_return(0, array("获取好租关系失败"));
         }
         $params['proId'] = $planning[0]['proid'];
     }
     // 获取城市id
     $userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($params['userId']);
     $params['cityId'] = isset($userInfo['cityId']) ? $userInfo['cityId'] : 0;
     return Bll_HzPropBll::build_return(1, array("success"));
 }
 /**
  * 增加money产生的公共动作
  * @param string $descript
  * @throws Exception_BllErrorException
  */
 private function addMoneyCommon($descript = '')
 {
     // 上线前判断余额 Jackin
     $userId = Bll_Broker_MainBusiness::getDataByEsfId($this->params['ajk_broker_id'])->memberId;
     try {
         $balanceInfo = Bll_Service_Payment::balance(Const_PaymentApp::HZ_DEFAULT, array('userId' => $userId));
     } catch (Exception $e) {
         throw new Exception_BllErrorException(sprintf('调用api失败: %s userId=%d broker_id=%d ajk_broker_id=%d', $e->getMessage(), $userId, $this->params['broker_id'], $this->params['ajk_broker_id']));
     }
     if ($balanceInfo['status'] == 'error') {
         throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 获取余额失败', $descript, $this->params['ajk_broker_id']));
     } elseif ($balanceInfo['data']['balance'] <= 0) {
         throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 余额(%d)不足', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance']));
     }
     $this->allReturn = array(sprintf('hz:%s ajkBrokerId(%d) 当前余额(%d) ', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance']));
     //获取刷爆$descript的计划
     $plans = Dao_Broker_HzPlan::get_broker_plan($this->params['broker_id'], 7);
     if (empty($plans)) {
         $this->allReturn[] = '没有获取到 status=7 的计划';
         return;
     }
     $plan_ids = array();
     foreach ($plans as $plan) {
         $plan_ids[] = $plan['id'];
     }
     // 获取所有房子并上线
     $plans_props = Bll_HzFixPlan::get_plan_props($plan_ids, $this->params['city_id']);
     if (empty($plans_props)) {
         $this->allReturn[] = sprintf('没有获取到计划(%s)的房源', implode(',', $plan_ids));
         return;
     }
     foreach ($plans_props as $plan_id => $props) {
         // 更新计划状态
         if (Bll_HzPropBll::switchUpOrDown()) {
             if (!Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::SPREAD)) {
                 $this->allReturn[] = "更新计划[{$plan_id}]数据失败";
             }
         } else {
             $this->allReturn[] = "开关关闭,计划[{$plan_id}]数据不再更新";
         }
         // 记录计划上线日志
         $data = Bll_HzFixPlanBll::build_plan_log($this->params, 8, "{$descript},计划上线", $this->params['broker_id']);
         if (!Model_House_UpDown_PlanLog::create($data, date('m'))->save()) {
             $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入失败";
         } else {
             $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入";
         }
         foreach ($props['props'] as $prop) {
             if (Bll_HzPropBll::switchUpOrDown()) {
                 if (Dao_Broker_HzProp::change_prop_status($prop['proid'], Const_HzStatus::ONLINE) && Model_Plan_HzPlanning::updatePlanningByPropId($prop['proid'], Const_HzPlan::SPREAD, Const_HzPlan::SPREAD_TYPE)) {
                     $this->allReturn[] = "房源{$prop['proid']}上线成功";
                 } else {
                     $this->allReturn[] = "房源{$prop['proid']}上线失败";
                 }
             } else {
                 $all_return[] = "开关关闭,房源[{$prop['proid']}]状态不改变";
             }
             $data = Bll_HzPropBll::build_prop_log($this->params, 5, "房源上线", $this->params['broker_id']);
             $data['planId'] = $plan_id;
             $data['houseId'] = $prop['proid'];
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 $this->allReturn[] = "房源{$prop['proid']}上线日志写入失败";
             } else {
                 $this->allReturn[] = "房源{$prop['proid']}上线日志写入";
             }
         }
     }
 }
Exemple #18
0
 /**
  * @param $proId
  * @param $blockId
  * @param $areaId
  * @param $cityId
  * @return array
  */
 public static function changePropBlock($proId, $blockId, $areaId, $cityId)
 {
     $allReturn = array();
     if (Dao_Broker_HzProp::changePropBlock($proId, $blockId, $areaId)) {
         $allReturn[] = "租房房源ID: " . $proId . ",房源信息更新成功";
         // rebuild solr
         // 在定价
         if (Dao_Broker_HzPlan::get_prop_planning($proId, 1, 1)) {
             $allReturn[] = "租房房源ID: " . $proId . ",房源信息定价需要rebuild";
             if (Dao_Broker_HzProp::into_prop_lucene($proId, $cityId, 1)) {
                 $allReturn[] = "租房房源ID: " . $proId . ",房源信息定价rebuild成功";
             } else {
                 return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息定价rebuild失败");
             }
         }
         // 在竞价
         if (Dao_Broker_HzPlan::get_prop_planning($proId, 2, 1)) {
             $allReturn[] = "租房房源ID: " . $proId . ",房源信息竞价需要rebuild";
             if (Dao_Broker_HzProp::into_prop_lucene($proId, $cityId, 1)) {
                 $allReturn[] = "租房房源ID: " . $proId . ",房源信息竞价rebuild成功";
             } else {
                 return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息竞价rebuild失败");
             }
         }
     } else {
         return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息更新失败");
     }
     return self::buildReturn(1, $allReturn);
 }