public static function createEsfOrder($planId) { $planInfo = Model_Plan_EsfAjkPropSpread::getPlanInfoByIdEx($planId); if (empty($planInfo)) { throw new Exception(sprintf('二手房竞价计划[%d]不存在', $planId)); } $data = array('requestId' => static::getRequestId($planId), 'status' => 0, 'userId' => $planInfo['userId'], 'siteType' => 1, 'failNum' => 0, 'addTime' => time(), 'addDate' => date('Ymd'), 'updateTime' => date('Ymd H:i:s'), 'remark' => '二手房精选结算', 'proId' => $planInfo['propId'], 'serialNumber' => $planInfo['serialnumber'], 'planId' => $planId, 'amount' => ($planInfo['budget'] - $planInfo['balance']) / 100, 'appName' => Const_PaymentApp::AJK_CHOICE); $order = Model_Payment_ABidUnfreeze::create($data, date('Y')); $order->save(); return new Bll_Ppc_BidUnfreeze($order->id); }
/** * 精选计划停止推广 */ public function do_stop() { $planInfo = Model_Plan_EsfAjkPropSpread::getPlanInfoByIdEx($this->params['planId']); if (empty($planInfo)) { $this->outPut(0, '没有获取到计划信息'); } if ($this->params['brokerId'] != $planInfo['brokerId']) { $this->outPut(0, '没有获取到计划信息(code:-2)'); } if (Model_Plan_EsfAjkPropSpread::ONQUEUE == $planInfo['status']) { $result = Bll_Plan_Bid_EsfWebChoiceOperation::stop_queue($this->params['planId'], $planInfo['brokerId']); } elseif (Model_Plan_EsfAjkPropSpread::ONLINE == $planInfo['status']) { $result = Bll_Plan_Bid_EsfWebChoiceOperation::stop_plan($this->params['planId'], $planInfo['brokerId']); } else { $this->outPut(0, '无效的计划'); return; } if ($result['status'] == 'ok') { $this->outPut(1, '计划取消推广成功'); } $this->outPut(0, '计划取消推广失败'); }
/** * 二手房板块精选 * @param $record * @return bool|mixed */ private function noticeBlockChoiceSolrAjkAPI($record) { //41-板块精选推广,42-取消板块精选推广,43-取消板块精选排队 if ($record['type'] == 41) { $flag = 1; } elseif ($record['type'] == 42 || $record['type'] == 43) { $flag = 2; } else { $this->setLog('不需要做solr处理' . __METHOD__); return false; } //根据计划id查询计划信息 $PlanInfo = Model_Plan_EsfAjkPropSpread::getPlanInfoByIdEx($record['planId']); if ($PlanInfo) { $offer = $PlanInfo['offer']; $commsHpratioA = $PlanInfo['commsHpratioA']; $commsHpratio = $PlanInfo['commsHpratio']; $spreadstartdate = $PlanInfo['spreadstartdate']; $spreadenddate = $PlanInfo['spreadenddate']; $planid = $PlanInfo['id']; } else { $offer = 0; $commsHpratioA = 0; $commsHpratio = 0; $spreadstartdate = 0; $spreadenddate = 0; $planid = $record['planId']; } $res = Bll_Combo_NoticeSolrUpDown::noticeBlockChoiceSolrAjkAPI($record['cityId'], $record['brokerId'], $record['houseId'], $flag, $offer, $commsHpratioA, $commsHpratio, $spreadstartdate, $spreadenddate, $planid, Bll_Combo_NoticeSolrUpDown::HLSFromChoiceUpDown, strtotime($record['addDate']), date('Ymd', strtotime($record['addDate'])) . $record['id']); $this->setLog('通知solr res: ' . json_encode($res)); return $res; }
/** * 小区合并修改计划信息 * * @param $queue * @return bool */ public function communityMerge($queue) { if ($queue['planId'] == 0 || $queue['proId'] == 0) { $this->setMsg('房源Id、计划Id不能为空'); return false; } /** 判断计划状态 */ $planInfo = Model_Plan_EsfAjkPropSpread::getPlanInfoByIdEx($queue['planId']); if ($planInfo['tradetype'] != 1 || $planInfo['bidVersion'] != 2) { $this->setMsg(sprintf('计划[%d]信息错误[%d - %d]', $queue['planId'], $planInfo['tradetype'], $planInfo['bidVersion'])); return false; } if ($planInfo['status'] != Model_Plan_EsfAjkPropSpread::ONLINE && $planInfo['status'] != Model_Plan_EsfAjkPropSpread::ONQUEUE) { $this->setMsg(sprintf('计划[%d]不在推广、排队中[%d]', $queue['planId'], $planInfo['status'])); return true; } if ($planInfo['propId'] != $queue['proId']) { $this->setMsg(sprintf('房源Id[%d - %d]不一致', $queue['proId'], $planInfo['propId'])); return true; } $houseInfo = Bll_House_EsfHouse::getHouseBaseInfoEx($queue['proId'], $planInfo['cityId']); if (empty($houseInfo)) { $this->setMsg(sprintf('房源[%d]信息没有获取到', $queue['proId'])); return true; } $housePrice = intval($houseInfo['proPrice'] * 10000); $priceIntervalInfo = Model_House_EsfPrice::get_price($planInfo['cityId'], $housePrice); if (empty($priceIntervalInfo)) { $this->setMsg(sprintf('房源[%d]没有获取到价格段信息[%d]', $queue['proId'], $housePrice)); return true; } $priceId = $priceIntervalInfo['id']; $communityId = $houseInfo['commId']; $data = array('commId' => $communityId); if (!Model_Plan_EsfAjkPropSpread::updatePlan($queue['planId'], $data)) { $this->setMsg(sprintf('更新计划[%d]信息[%s]失败', $queue['planId'], json_encode($data))); return false; } $bucketInfo = Model_Choice_EsfBidBucket::get_bucket_info($communityId, $priceId); if (empty($bucketInfo)) { Model_Choice_EsfBidBucket::init_bucket_info($communityId, $priceId, $planInfo['cityId']); } Model_Choice_EsfBidBucket::increment_used_num_ex($communityId, $priceId); $this->setMsg(sprintf('更新计划[%d]信息[%s]成功', $queue['planId'], json_encode($data))); $planInfo['proPriceInt'] = $planInfo['propriceint']; //todo 添加房源日志 type 小区合并,区域板块变更 Model_Log_HouseLogNew::create(array('houseId' => $queue['propId'], 'planId' => $queue['planId'], 'brokerId' => $queue['brokerId'], 'cityId' => $planInfo['cityId'], 'type' => Const_ProLogType::LOG_COMMUNITY_MERGE_PROP_CHANGE, 'changeType' => Const_ProPlanChangeType::COMM_MERGE_PROP_CHANGE, 'remark' => '小区合并,精选房源信息变更', 'operatorId' => $this->qInfo['operationId'], 'siteType' => 1), date('Ymd'))->save(); return $this->choiceComputeRank(array_merge($planInfo, $data)); }