/**
  * @return Model_Fyk_PropLibrary|null
  * @throws Exception
  */
 public function prop()
 {
     return Model_Fyk_PropLibrary::data_access()->filter('id', $this->propId)->find_only();
 }
 public function handle_request_internal()
 {
     $propLists = array();
     $hasNextPage = 0;
     $userId = $this->_params['userId'];
     $sinceId = isset($this->_params['sinceId']) ? intval($this->_params['sinceId']) : 0;
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $propIds = Model_Broker_FykPushProps::data_access()->load_field('propId')->filter('userId', $userId)->sort('id', 'desc')->limit($per + 1)->offset($sinceId)->get_all();
     if (!empty($propIds)) {
         $hasNextPage = count($propIds) > $per ? 1 : 0;
         if ($hasNextPage) {
             array_pop($propIds);
             $sinceId = $sinceId + $per;
         } else {
             $sinceId = 0;
         }
         $propIds = self::getArrayColumn($propIds, 'propId');
         $props = Model_Fyk_PropLibrary::data_access()->filter('id', array_unique($propIds))->get_all();
         //获取小区、板块名称 start
         $commNames = $typeNames = array();
         $commIds = self::getArrayColumn($props, 'commId');
         /*$commInfos = Model_Community_AjkCommunity::data_access()
           ->filter('commId', $commIds)
           ->get_all();*/
         $commInfos = Bll_Community_APIComm::getInstance()->getInfoById($commIds);
         foreach ($commInfos as $info) {
             $commNames[$info['comm_id']] = $info['name'];
         }
         //————————————————————————————————————————————————
         $districtIds = self::getArrayColumn($props, 'areaId');
         $blockIds = self::getArrayColumn($props, 'blockId');
         $typeIds = array_merge($districtIds, $blockIds);
         $typeInfos = Model_City_TypeCode::data_access()->load_field('typeId')->load_field('typeName')->filter('typeId', $typeIds)->get_all();
         foreach ($typeInfos as $info) {
             $typeNames[$info['typeId']] = $info['typeName'];
         }
         //获取小区、板块名称 end
         foreach ($props as $prop) {
             //计算发布时间
             $publishDate = strtotime(date('Y-m-d', $prop['createTime']));
             $nowDate = strtotime(date('Y-m-d', time()));
             $publishDays = intval(($nowDate - $publishDate) / 86400);
             $propId = $prop['id'];
             $propList['fPropId'] = $propId;
             $propList['isOnly'] = $prop['isOnly'];
             $propList['isReal'] = $prop['isReal'];
             $propList['certificate'] = $prop['certificate'];
             $propList['commId'] = $prop['commId'];
             $propList['commName'] = $commNames[$prop['commId']];
             $propList['districtId'] = $prop['areaId'];
             $propList['districtName'] = $typeNames[$prop['areaId']];
             $propList['blockId'] = $prop['blockId'];
             $propList['blockName'] = $typeNames[$prop['blockId']];
             $propList['roomNum'] = $prop['cell'];
             $propList['hallNum'] = $prop['hall'];
             $propList['toiletNum'] = $prop['toilet'];
             $propList['area'] = $prop['acreage'];
             $propList['areaUnit'] = '平';
             $propList['price'] = intval($prop['totalPrices']);
             $propList['priceUnit'] = '万';
             $propList['publishDays'] = $publishDays;
             $propList['publishDaysMsg'] = $propList['publishDays'] > 0 ? "{$propList['publishDays']}天前发布" : '今天发布';
             $propLists[$propId] = $propList;
         }
     }
     $propListFormat = array();
     foreach ($propIds as $id) {
         $propListFormat[] = $propLists[$id];
     }
     unset($propLists);
     //更新为0
     Model_Fyk_PushPropsLatestCount::data_access()->set_field('count', 0)->filter('userId', $userId)->update();
     $data['props'] = $propListFormat;
     $data['sinceId'] = $sinceId;
     $data['hasNextPage'] = $hasNextPage;
     return API_Result::create()->ok()->data($data)->toArray();
 }