123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- /**
- * 小梦科技资源nanodreamtech.com
- *
- * ==========================================================================
- * @link https://www.nanodreamtech.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license https://www.nanodreamtech.com/license.html License
- * ==========================================================================
- *
- * @author fish
- *
- */
- namespace Home\Controller;
- class SuperSpikeController extends CommonController {
-
- //进行中
- public function index(){
-
-
- $per_page = 10;
- $page = I('post.page',1);
-
- $offset = ($page - 1) * $per_page;
-
- $super_spike = M('super_spike')->where('begin_time<'.time().' and end_time > '.time())->order('begin_time desc')->find();
-
- if($super_spike){
- $sql = 'select sg.state,g.goods_id,g.name,g.quantity,g.pinprice,g.price,g.image,g.store_id,g.seller_count from '.C('DB_PREFIX')."super_spike_goods as sg , ".C('DB_PREFIX')."goods as g
- where super_spike_id = ".$super_spike['id']." and sg.state =1 and sg.goods_id = g.goods_id and g.status =1 and g.quantity >0 order by sg.id asc limit {$offset},{$per_page}";
-
- $list = M()->query($sql);
-
- $this->list = $list;
- } else {
- $this->list = array();
- }
-
-
- if($page > 1) {
- $result = array('code' => 0);
- if(!empty($list)) {
- $result['code'] = 1;
- $result['html'] = $this->fetch('SuperSpike:superspike_ajax_fetch');
- }
- echo json_encode($result);
- die();
- }
- $this->display('SuperSpike:index');
- }
-
- //未开始
- public function wait()
- {
- $per_page = 10;
- $page = I('post.page',1);
-
- $offset = ($page - 1) * $per_page;
-
- $sql = 'select sg.state,sg.begin_time,sg.end_time,g.goods_id,g.name,g.quantity,g.pinprice,g.price,g.image from '.C('DB_PREFIX')."spike_goods as sg , ".C('DB_PREFIX')."goods as g
- where sg.state =1 and sg.goods_id = g.goods_id and g.status =1 and g.quantity >0 and sg.begin_time > ".time()." order by sg.begin_time asc limit {$offset},{$per_page}";
-
- $list = M()->query($sql);
-
- foreach ($list as $k => $v) {
- $list[$k]['image']=resize($v['image'], C('spike_thumb_width'), C('spike_thumb_height'));
- }
-
-
- $this->list = $list;
-
-
- $result = array('code' => 0);
- if(!empty($list)) {
- $result['code'] = 1;
- $result['html'] = $this->fetch('Widget:spike_ajax_wait_fetch');
- }
- echo json_encode($result);
- die();
-
- }
- public function over()
- {
- $per_page = 10;
- $page = I('post.page',1);
-
- $offset = ($page - 1) * $per_page;
-
- $sql = 'select sg.state,sg.begin_time,sg.end_time,g.goods_id,g.name,g.quantity,g.pinprice,g.price,g.image from '.C('DB_PREFIX')."spike_goods as sg , ".C('DB_PREFIX')."goods as g
- where sg.state =1 and sg.goods_id = g.goods_id and g.quantity =0 order by sg.begin_time asc limit {$offset},{$per_page}";
-
- $list = M()->query($sql);
-
- foreach ($list as $k => $v) {
- $list[$k]['image']=resize($v['image'], C('spike_thumb_width'), C('spike_thumb_height'));
- }
-
-
- $this->list = $list;
-
-
- $result = array('code' => 0);
- if(!empty($list)) {
- $result['code'] = 1;
- $result['html'] = $this->fetch('Widget:spike_ajax_over_fetch');
- }
- echo json_encode($result);
- die();
- }
-
-
-
- }
|