123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace wechat\server;
- use Yii;
- use common\models\News;
- use common\models\CategoryNews;
- use common\models\PushmNews;
- use common\models\House;
- class NewsServer
- {
- /*
- * 新闻资讯首页-推送部分
- * */
- public function Pushinfo($type)
- {
- $pushModel = new PushmNews();
- $pushModel->type = $type;
- switch ($type)
- {
- case 1:
- $limit = 3; //
- break;
- case 2:
- $limit = 3;
- 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','img']);
- }
- // public func
- /*
- * 点击量 -- 热文
- * */
- 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($input['nid']);
- //if($ipaddress === true)
- //{
- $info->clicks = ++$info->clicks;
- $info->true_click = ++$info->true_click;
- $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;
- $model->is_push=2;
- return $model->ispush(3);
- }
- }
|