首页 后端开发 php教程 以上代码是调用24小时内的数据,请教如何改成调用一个月或一年的数据

以上代码是调用24小时内的数据,请教如何改成调用一个月或一年的数据

Jun 13, 2016 pm 01:08 PM
page sort time where

以下代码是调用24小时内的数据,请问怎么改成调用一个月或一年的数据

PHP code

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

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

<!--

 

Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/

 

-->    private function getList($where='',$no_query = false)

    {

        global $_FANWE;

 

        if(!$no_query)

        {

            if(defined('IS_CACHE_TPL'))

                $fields = '';

            else

                $fields = ',g.post_count';

 

            $page_args = array(

                'city_py' =&gt; CURRENT_CITY_PY,

                'site' =&gt; intval($_FANWE['request']['site']),

                'cat' =&gt; intval($_FANWE['request']['cat']),

                'sort' =&gt; trim($_FANWE['request']['sort']),

                'date' =&gt; trim($_FANWE['request']['date']),

                'keyword' =&gt; trim($_FANWE['request']['keyword']),

                'prices' =&gt; trim($_FANWE['request']['prices']),

            );

 

            $site_id = 0;

            if($page_args['site'] &gt; 0)

            {

                $site_id = $page_args['site'];

                $site_where = ' AND gk.site_id = '.$page_args['site'];

            }

            else

                unset($page_args['site']);

 

            $dates = S('Goods')-&gt;getExpiredGoodsDate();

 

            $min_time = getTodayTime();

            $max_time = TIME_UTC;

            $date = toDate($min_time,'Y-m-d');

 

            if(!empty($page_args['date']))

            {

                $time = str2Time($page_args['date']);

                if($time = $dates['min_time'])

                {

                    $date = toDate($time,'Y-m-d');

                    $min_time = str2Time(toDate($time,'Y-m-d'));

                    $max_time = $min_time + 863990000;

                    if($max_time &gt; TIME_UTC)

                        $max_time = TIME_UTC;

                }

            }

            else

            {

                $page_args['date'] = $date;

            }

 

            $dates['min_time'] = toDate($dates['min_time'],'r');

            $dates['max_time'] = toDate($dates['max_time'],'r');

 

              $where.=" AND gk.end_time &gt;= '$min_time' AND gk.end_time  0)

                $insert_sort = 'gk.ec_sort ASC';

 

            if(in_array($page_args['cat'],$_FANWE['cache']['goods']['root_cates']))

                $insert_sort = 'gk.dc_sort ASC';

 

 

            $city_name = $_FANWE['current_city']['name'];

 

            if(CURRENT_CITY_PY == CHINA_CITY_PY)

            {

                //全国不包含所有城市商品时

                if($_FANWE['setting']['all_city'] == 0)

                    $where.=  " AND gk.city = '$city_name'";

                else

                {

                    $insert_sort = 'gk.r_sort ASC';

 

                    if($page_args['cat'] &gt; 0)

                        $insert_sort = 'gk.e_sort ASC';

 

                    if(in_array($page_args['cat'],$_FANWE['cache']['goods']['root_cates']))

                        $insert_sort = 'gk.d_sort ASC';

                }

            }

            elseif(CURRENT_CITY_PY != '')

            {

                //城市显示全国商品时

                if($_FANWE['setting']['index_all'] == 1)

                {

                    $fields .= ",(gk.city = '$city_name') as is_now_city";

                    $insert_sort = 'is_now_city DESC,'.$insert_sort;

                    $quanguo_name = $_FANWE['cache']['city']['all'][CHINA_CITY_PY]['name'];

                    $where.=  " AND gk.city IN ('$city_name','$quanguo_name')";

                }

                else

                {

                    $where.=  " AND gk.city = '$city_name'";

                }

            }

 

            //价格条件

            $prices = '';

            if(!empty($page_args['prices']))

            {

                $prices = &amp;$page_args['prices'];

                $price_arr = explode(',',$prices);

                $price_min = intval($price_arr[0]);

                $price_max = intval($price_arr[1]);

 

                if($price_min &gt; 0)

                    $where.=" AND (g.shop_price &gt;= $price_min)";

 

                if($price_max &gt; 0)

                    $where.=" AND (g.shop_price getExpiredGoodsCats($site_where.$where);

 

            $cate_id = 0;

            if($page_args['cat'] &gt; 0)

            {

                $cate_id = &amp;$page_args['cat'];

                $cateobj = $_FANWE['cache']['goods']['cats'][$cate_id];

                $cate_ids = array();

                if(isset($cateobj['childs']))

                    $cate_ids = $cateobj['childs'];

 

                $cate_ids[] = $cate_id;

 

                if(count($cate_ids) &gt; 1)

                    $where.=' AND gk.cate_id IN ('.implode(',', $cate_ids).')';

                else

                    $where.=" AND gk.cate_id = '$cate_id'";

            }

            else

                unset($page_args['cat']);

 

            $goods_sites = S('Goods')-&gt;getExpiredGoodsSites($where);

 

            $where = $site_where.$where;

 

            $order = '';

            $sort = &amp;$page_args['sort'];

            $sort_array = array('spa'=&gt;'g.shop_price ASC','spd'=&gt;'g.shop_price DESC','eta'=&gt;'g.end_time ASC','etd'=&gt;'g.end_time DESC','cca'=&gt;'g.click_count ASC','ccd'=&gt;'g.click_count DESC','sa'=&gt;'g.score ASC','sd'=&gt;'g.score DESC','ba'=&gt;'g.bought ASC','bd'=&gt;'g.bought DESC','da'=&gt;'discount ASC','dd'=&gt;'discount DESC');

 

            if(array_key_exists($sort,$sort_array))

                $order = $sort_array[$sort];

            else

            {

                unset($page_args['sort']);

                $sort = '';

            }

 

            if(empty($order))

                $order .= 'g.is_best DESC,'.$insert_sort.',g.sort ASC,g.id ASC';

            else

                $order .= ','.$insert_sort.',g.sort ASC,g.id DESC';

 

            $goods_count = S('Goods')-&gt;getExpiredGoodsCount($where);

 

            $pager = buildPage('goods/'.ACTION_NAME,$page_args,$goods_count,$_FANWE['page'],15);

            $goods_result = S('Goods')-&gt;getExpiredGoodsList($where,$order,$fields,$pager['limit']);

            $goods_result['ids'] = implode(',',$goods_result['ids']);

        }

 

        include template('page/goods_index');

    }

 <div class="clear">

                  

               

               

         

            </div>

登录后复制
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章标签

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

uniapp中如何实现拖拽排序和拖拽操作 uniapp中如何实现拖拽排序和拖拽操作 Oct 19, 2023 am 09:39 AM

uniapp中如何实现拖拽排序和拖拽操作

探究C++sort函数的底层原理与算法选择 探究C++sort函数的底层原理与算法选择 Apr 02, 2024 pm 05:36 PM

探究C++sort函数的底层原理与算法选择

time包的单调时钟处理 time包的单调时钟处理 Aug 04, 2023 pm 05:45 PM

time包的单调时钟处理

使用C#中的Array.Sort函数对数组进行排序 使用C#中的Array.Sort函数对数组进行排序 Nov 18, 2023 am 10:37 AM

使用C#中的Array.Sort函数对数组进行排序

如何使用C#中的List.Sort函数对列表进行排序 如何使用C#中的List.Sort函数对列表进行排序 Nov 17, 2023 am 10:58 AM

如何使用C#中的List.Sort函数对列表进行排序

Laravel 集合中的 Where 方法实用指南 Laravel 集合中的 Where 方法实用指南 Mar 10, 2024 pm 04:36 PM

Laravel 集合中的 Where 方法实用指南

Laravel 集合中如何使用 Where 方法 Laravel 集合中如何使用 Where 方法 Mar 10, 2024 pm 10:21 PM

Laravel 集合中如何使用 Where 方法

为什么在Python中list.sort()不会返回已排序的列表? 为什么在Python中list.sort()不会返回已排序的列表? Sep 18, 2023 am 09:29 AM

为什么在Python中list.sort()不会返回已排序的列表?

See all articles