Default.class.php
2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* 默认控制器
*/
class Controller_Default extends Controller_Abstract
{
/**
* 首页
*
*/
public function indexAction()
{
$total = Facade_News::getTotal(array(), array('手机视频'));
$page = new Lib_Helper_Pagination($total, 96);
$page->setOptions(array('afterAppend' => 'setLayout'));
list($offset, $limit) = $page->getLimit();
$this->_view['banners'] = Facade_Index::getIndex(1);
$rightBanners = array();
if(empty($offset))
{
$rightBanners = Facade_Index::getIndex(2);
}
$list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
$this->_view['partnerList'] = Facade_Partner::getPartner();
$this->_view['partnerTypes'] = Facade_Partner::$types;
$this->_view['pagination'] = $page->getPagination();
$this->_view['rightBanners'] = $rightBanners;
$data=array_slice($list,0,24);
$this->_view['news'] = $data;
}
/**
* 客户端首页模块
*
*/
public function indexMobileAction()
{
$this->_view['banners'] = Facade_Index::getIndex(1);
}
public function otherAction()
{
}
public function testAction()
{
$link = SITE_MAIN.url('default/test');
$this->_view['wechat'] = Lib_Wechat_JSSDK::getSignPackage();
}
public function contactusAction()
{
}
/**
* 壁纸
*/
public function wallpaperAction()
{
$this->_viewname = 'wallpapermobile';
}
/**
* 壁纸图片
*
*/
public function wallpaperimageAction()
{
$dir = SITE_IMG.'/yohood/wallpaper';
$screenWidth = $this->_request->query('width');
$screenHeight = $this->_request->query('height');
$val = $this->_request->query('val');
if($screenWidth >=1440 && $screenHeight>=1200)
{
$dir.='/1440x1200/';
}
else if($screenWidth >=640 && $screenHeight>=1136)
{
$dir.='/640x1136/';
}
else
{
$dir.='/640x960/';
}
$this->_view['image'] = $dir.$val.'.jpg';
$this->_viewname = 'wallpaperimagemobile';
}
/**
* 首页加载资讯ajax接口
*
*/
public function LoadNewsAction()
{
$total = Facade_News::getTotal(array(), array('手机视频'));
$page = new Lib_Helper_Pagination($total, 72);
$page->setOptions(array('afterAppend' => 'setLayout'));
list($offset, $limit) = $page->getLimit();
$list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
$type = $this->_request->query('type', null);
if($type==1){
$data=array_slice($list,0,24);
};
if($type==2){
$data=array_slice($list,24,24);
}
if($type==3){
$data=array_slice($list,48,24);
}
if($type==4){
$data=array_slice($list,72,24);
}
return json_encode($data);
}
}