Exemplo n.º 1
0
 /**
  * 增加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']}上线日志写入";
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * 公共房源日志写入
  * @param $type
  * @param $desc
  * @throws Exception_BllErrorException
  */
 private function writePropLog($type, $desc)
 {
     $data = Bll_HzPropBll::build_prop_log($this->params, $type, "房源{$this->params['pro_id']}{$desc}", $this->params['ajk_broker_id']);
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         throw new Exception_BllErrorException("房源{$this->params['pro_id']}{$desc}日志写入失败");
     } else {
         $this->allReturn[] = "房源{$this->params['pro_id']}{$desc}日志写入";
     }
 }
Exemplo n.º 3
0
 public static function checkList($list)
 {
     if (empty($list['planId'])) {
         return Bll_HzPropBll::build_return(0, array("planId 为空"));
     }
     if (empty($list['brokerId'])) {
         return Bll_HzPropBll::build_return(0, array("brokerId 为空"));
     }
     if (empty(Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($list['brokerId'])->id)) {
         return Bll_HzPropBll::build_return(0, array("获取金铺经纪人失败"));
     }
     return Bll_HzPropBll::build_return(1, array("success"));
 }
Exemplo n.º 4
0
 /**
  * 写房源日志
  *
  * @param array $params
  * @param int $type
  * @param string $remark
  * @return array
  */
 private static function notifySolr($params, $type, $remark)
 {
     $params['ajkBrokerId'] = $params['brokerId'];
     $data = self::build_prop_log($params, $type, $remark);
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         return Bll_HzPropBll::build_return(1, sprintf('精选房源[%d]变更为[%s]失败', $params['proId'], $remark));
     } else {
         return Bll_HzPropBll::build_return(1, sprintf('精选房源[%d]变更为[%s]成功', $params['proId'], $remark));
     }
 }
Exemplo n.º 5
0
 /**
  * 112 房源取消套餐推广
  * 查询房源套餐关系
  *   如果不存在 返回结束
  *   验证关系是否为删除状态(?)
  *   记录房源取消推广日志  type=6
  *   记录房源移除套餐日志 type=21
  *   如有竞价 下竞价  更新房子
  */
 private function pro_remove_from_combo()
 {
     // 查询套餐关系
     if (!($comboRelations = Bll_Combo_HouseRelation::getRelationByHouseId($this->params['pro_id'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, true))) {
         return $this->allReturn[] = "房源{$this->params['pro_id']}套餐关系为空";
     }
     // 维护房子状态
     Bll_HzPropBll::bulidHzProStatu($this->params['pro_id']);
     if (!Bll_Combo_HouseRelation::isRelationOnline($comboRelations['state'])) {
         $this->writePropLog(Const_ProLogType::LOG_REMOVE_FROM_COMBO, '取消套餐推广');
     }
     $this->tempDoBid();
 }
Exemplo n.º 6
0
 /**
  * 精选该上没上,该下没下
  *
  * @param array $queue
  * @return array
  */
 public static function notifySolrUpDown($queue)
 {
     $params = array();
     $params['houseId'] = $queue['proId'];
     $params['plan_id'] = 0;
     $params['ajk_broker_id'] = $queue['brokerId'];
     $params['city_id'] = 0;
     $params['changeType'] = 412;
     $houseChoicePlan = Model_Plan_Jp::getChoicePlanByHouseIdEx($queue['proId']);
     if (empty($houseChoicePlan)) {
         $remark = sprintf('房源[%d]没有获取到精选计划信息', $queue['proId']);
         $params['city_id'] = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($queue['brokerId']);
         $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN;
         $data = self::buildPropLog($params, $remark, 0);
         Model_Log_HouseLogNew::create($data, date('Ymd'))->save();
         return Bll_HzPropBll::build_return(1, $remark);
     }
     $params['city_id'] = $houseChoicePlan['cityId'];
     $params['plan_id'] = $houseChoicePlan['id'];
     if ($houseChoicePlan['status'] == Model_Plan_Jp::ENUM_STATUS_ONLINE) {
         $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_UP;
         $remark = sprintf('房源[%d]精选计划[%d]在推广中', $queue['proId'], $houseChoicePlan['id']);
         $data = self::buildPropLog($params, $remark, 0);
         Model_Log_HouseLogNew::create($data, date('Ymd'))->save();
         return Bll_HzPropBll::build_return(1, $remark);
     }
     $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN;
     $remark = sprintf('房源[%d]精选计划[%d - %d]不在推广中', $queue['proId'], $houseChoicePlan['id'], $houseChoicePlan['status']);
     $data = self::buildPropLog($params, $remark, 0);
     Model_Log_HouseLogNew::create($data, date('Ymd'))->save();
     return Bll_HzPropBll::build_return(1, $remark);
 }