コード例 #1
0
ファイル: Choice.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 好租-精选房源管理页面
  * 返回值 为页面参数,所以必须是数组
  *
  * @param int $ajkBrokerId
  * @param int $cityId
  * @param array $extraData $request->get_parameters();
  * @return array
  */
 public static function hz_init_manage($ajkBrokerId, $cityId, $extraData = array())
 {
     $pageAttribute = array('broker_id' => $ajkBrokerId, 'city_id' => $cityId);
     $hz_broker_id = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
     if (0 == $hz_broker_id) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '您不是好租经纪人!');
     }
     /** 判断经纪人有效精选房源推广计划数 */
     $validPlanCount = Bll_HzBidPlan::countChoiceValidPlanEx($ajkBrokerId);
     if ($validPlanCount >= self::ALL_ZF_PLAN_NUM) {
         $pageAttribute['bidChoiceIsFull'] = true;
     } else {
         $pageAttribute['bidChoiceIsFull'] = false;
     }
     $pageAttribute['validPlanCount'] = $validPlanCount;
     /** 获取有效的精选房源计划 */
     $validPlanList = Bll_HzBidPlan::getChoiceValidPlanEx($ajkBrokerId);
     if (empty($validPlanList)) {
         $pageAttribute['bidChoiceIsFull'] = false;
         return $pageAttribute;
     }
     /** 对计划分组 */
     $planGroup = array();
     $propPlans = array();
     $propInfos = array();
     foreach ($validPlanList as $planBasic) {
         $propPlan = Model_Plan_HzPlanning::getPlanByPlanId($planBasic['id']);
         if (empty($propPlan)) {
             continue;
         }
         if ($planBasic['status'] == Const_HzPlan::WAITING) {
             $planBasic['rank'] = Bll_Plan_Bid_HzBid::getChoiceWaitPosition($planBasic['id'], $cityId, $planBasic['blockId'], $planBasic['priceId']);
         }
         /** todo 获取精选点击数量  */
         $planBasic['clicks'] = Bll_Plan_Bid_HzBid::getPropBidClick($propPlan['proid'], $cityId, $hz_broker_id);
         $propPlans[$planBasic['id']] = $propPlan;
         $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($propPlan['proid']);
         $propInfos[$planBasic['id']] = $propInfo;
         $planBasic['unit_price'] = $propPlan['unit_price'];
         $planGroup[$planBasic['status']][] = $planBasic;
     }
     $pageAttribute['planGroup'] = $planGroup;
     $pageAttribute['propPlans'] = $propPlans;
     $pageAttribute['propInfos'] = $propInfos;
     return $pageAttribute;
 }