type = $type; switch ($type) { case 1: $limit = 3; // break; case 2: $limit = 5; break; case 3: $limit = 2; break; default: return false; break; } $arr = $pushModel->Homegetlist($limit); return $arr; } /* * 资讯首页- 资讯栏目 and 资讯栏目所属资讯 * */ public function ColumnInfo() { $model = new CategoryNews(); return $model->getList([],['news_name','id'],1); } /* * 热点直达 * */ public function hotArrive() { $ctype = new \common\models\PushCharacteristic(); return $ctype->Homegetlist(10); } /* * 点击量 -- 热文 * */ public function clickList($num) { $model = new News(); return $model->Clicks($num); } /* * 资讯详情 * */ public function NewsDetails($input) { $model = new News(); if(is_numeric($input['nid'])) { $info = $model->FindById($input['nid']); if(!empty($info)) { $ip = new IpServer(); $ipaddress = $ip->add(); if($ipaddress === true) { $info->true_click = ++$info->true_click; $info->clicks = ++$info->clicks; $info->save(false); } return $info; } } } /* * 相关资讯 * */ public function Relevant($category) { $model = new News(); $model->category = $category; return $model->Clicks(4); } /* * 根据区域,随机推荐楼盘 * */ public function NewsCityHouse($city) { $model = new House(); $model->city = $city; return $model->randList(4); } /* * 获取最新资讯 */ public function GetNews($limit) { $model = new News(); $query = $model::find(); $query->select(['pfg_news.id','pfg_news.subject','pfg_news.create_at','pfg_category_news.news_name']); $query->andWhere(['pfg_news.del'=>1,'pfg_news.state'=>1]); $query->leftJoin('pfg_category_news','pfg_news.category = pfg_category_news.id'); $query->limit = $limit; $query->orderBy(['pfg_news.create_at'=>SORT_DESC,'pfg_news.id'=>SORT_DESC]); return $query->asArray()->all(); } }