123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace mobile\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;
- }
-
- public function ColumnInfo()
- {
- $model = new CategoryNews();
- return $model->getList([],['news_name','id','img'],1);
- }
-
- 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))
- {
-
-
-
-
- $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);
- }
- }
|