示例#1
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propIds = $this->_params['propIds'];
     $planId = isset($this->_params['planId']) ? $this->_params['planId'] : null;
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $propIds = explode(',', $propIds);
     // 转换成数组
     // 判断定价推广房源数量
     $fixPlans = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId);
     if (empty($fixPlans)) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 定价房源总数不能超过50套
     $fixPropNum = 0;
     foreach ($fixPlans as $planInfo) {
         $fixPropNum = $fixPropNum + $planInfo['prop_count'];
     }
     if ($fixPropNum + count($propIds) > 50) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3014);
     }
     // 房源加入定价计划组
     if (is_null($planId)) {
         $planId = $fixPlans[0]['id'];
     }
     $ret = Bll_HzFixPlan::batchprop_into_fix($hzBrokerId, $propIds, $planId);
     if (!$ret['status']) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return array('status' => 'ok', 'data' => array());
 }
示例#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' => '元'));
 }
示例#3
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;
 }