示例#1
0
 /**
  * 列表页
  */
 public function index()
 {
     $model = D('Member');
     $where = $this->_search();
     //获得查询条件
     if (isset($_GET['_order'])) {
         $order = $_GET['_order'];
     } else {
         $order = !empty($sortBy) ? $sortBy : $model->getPk();
     }
     //排序方式默认按照倒序排列
     //接受 sost参数 0 表示倒序 非0都 表示正序
     if (isset($_GET['_sort'])) {
         $sort = $_GET['_sort'] ? 'asc' : 'desc';
     } else {
         $sort = $asc ? 'asc' : 'desc';
     }
     $count = $model->where($where)->count();
     $this->assign('count', $count);
     if ($count > 0) {
         //创建分页对象
         $listRows = '50';
         if (!empty($_GET['listRows'])) {
             $listRows = $_GET['listRows'];
         }
         $p = new \My\Page($count, $listRows);
         //$list = $model->field('id,utype,username,realname,balance,create_time,status')->where($where)->order( "`" . $order . "` " . $sort)->limit($p->firstRow.','.$p->listRows)->select();
         $list = $model->alias('a')->join('`' . C('DB_PREFIX') . 'member_wallet` as b on a.id=b.member_id')->field('a.id,a.utype,a.username,a.realname,a.create_time,a.status,province,city,district,b.balance,b.frozen,lv_name,bus_lv_name')->where($where)->order("`" . $order . "` " . $sort)->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $model->getlastsql();
         //分页跳转的时候保证查询条件
         foreach ($map as $key => $val) {
             if (is_array($val)) {
                 foreach ($val as $t) {
                     $p->parameter .= $key . '[]=' . urlencode($t) . "&";
                 }
             } else {
                 $p->parameter .= "{$key}=" . urlencode($val) . "&";
             }
         }
         //分页显示
         $page = $p->Show();
     }
     //列表排序显示
     $sortImg = $sort;
     //排序图标
     $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列';
     //排序提示
     $sort = $sort == 'desc' ? 1 : 0;
     //排序方式
     //模板赋值显示
     //echo json_encode($list);exit;
     $this->assign('list', $list);
     $this->assign('sort', $sort);
     $this->assign('order', $order);
     $this->assign('sortImg', $sortImg);
     $this->assign('sortType', $sortAlt);
     $this->assign("page", $page);
     $this->display();
 }
 /**
  * 排序
  */
 public function sort()
 {
     $name = CONTROLLER_NAME;
     $model = D($name);
     $b_data['pid'] = 0;
     $blist = $model->where($b_data)->order('sort asc,id asc')->select();
     $this->assign('blist', $blist);
     if ($_GET['pid']) {
         $data['pid'] = $_GET['pid'];
         $count = $model->where($data)->count();
         //创建分页对象
         $listRows = '20';
         $pageno = $_GET['p'] ? $_GET['p'] : 1;
         $offset = ($pageno - 1) * $page_size;
         $p = new \My\Page($count, $listRows);
         $list = $model->where($data)->order('sort asc,id asc')->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $model->getlastsql();
         $page = $p->Show();
         $this->assign('page', $page);
         $this->assign('list', $list);
     }
     $this->display();
 }
示例#3
0
 /**
  * 列表页
  */
 public function index()
 {
     $model = D('Article');
     $where = $this->_search();
     //获得查询条件
     if (isset($_GET['_order'])) {
         $order = $_GET['_order'];
     } else {
         $order = !empty($sortBy) ? $sortBy : $model->getPk();
     }
     //排序方式默认按照倒序排列
     //接受 sost参数 0 表示倒序 非0都 表示正序
     if (isset($_GET['_sort'])) {
         $sort = $_GET['_sort'] ? 'asc' : 'desc';
     } else {
         $sort = $asc ? 'asc' : 'desc';
     }
     if (!empty($_GET['listRows'])) {
         $listRows = $_GET['listRows'];
     } else {
         $page_size = C('page_size');
         $listRows = $page_size ? $page_size : 20;
     }
     $count = $model->where($where)->count();
     $page_count = ceil($count / $listRows);
     $this->assign('count', $count);
     $this->assign('page_count', $page_count);
     if ($count > 0) {
         //创建分页对象
         $listRows = 1;
         $p = new \My\Page($count, $listRows);
         $list = $model->field('id,title,cname,create_time,update_time,status')->where($where)->order($order . ' ' . $sort)->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $model->getlastsql();
         //分页跳转的时候保证查询条件
         foreach ($map as $key => $val) {
             if (is_array($val)) {
                 foreach ($val as $t) {
                     $p->parameter .= $key . '[]=' . urlencode($t) . "&";
                 }
             } else {
                 $p->parameter .= "{$key}=" . urlencode($val) . "&";
             }
         }
         //分页显示
         $page = $p->Show();
     }
     //dump($page);exit;
     //列表排序显示
     $sortImg = $sort;
     //排序图标
     $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列';
     //排序提示
     $sort = $sort == 'desc' ? 1 : 0;
     //排序方式
     $this->Predecessor();
     //分类
     //模板赋值显示
     $this->assign('list', $list);
     $this->assign('sort', $sort);
     $this->assign('order', $order);
     $this->assign('sortImg', $sortImg);
     $this->assign('sortType', $sortAlt);
     $this->assign("page", $page);
     $this->display();
 }
示例#4
0
 /**
  * 排序页面
  */
 public function sort()
 {
     $name = CONTROLLER_NAME;
     $amodel = D('flag_list');
     $flags = $this->get_moudel_flags();
     $this->assign('flags', $flags);
     if ($_GET['fid']) {
         $this->assign('fid', $_GET['fid']);
         $data1['fid'] = $data2['fid'] = $_GET['fid'];
         $data1['source'] = $data2['a.source'] = $name;
         if ($_GET['toptid']) {
             $this->assign('toptid', $_GET['toptid']);
             $data1['toptid'] = $_GET['toptid'];
         }
         $count = $amodel->where($data1)->count();
         if ($count > 0) {
             //创建分页对象
             $listRows = '20';
             $p = new \My\Page($count, $listRows);
             $pageno = $_GET['p'] ? $_GET['p'] : 1;
             $offset = ($pageno - 1) * $page_size;
             $list = $amodel->table('`' . C('DB_PREFIX') . 'flag_list` as a')->join('`' . C('DB_PREFIX') . strtolower($name) . '` as b on a.sourceid=b.id')->field('b.id,b.name,sort,b.create_time')->where($data2)->order('sort asc,sourceid desc')->limit($p->firstRow . ',' . $p->listRows)->select();
             //echo $amodel->getlastsql();exit;
             $page = $p->Show();
             $this->assign('page', $page);
             $this->assign('list', $list);
         }
     }
     $this->display();
 }
 /**
  * 列表信息
  */
 public function index()
 {
     $model = D('memberCoupon as a');
     $where = $this->_search();
     //获得查询条件
     if (isset($_GET['_order'])) {
         $order = 'a.' . $_GET['_order'];
     } else {
         $order = !empty($sortBy) ? $sortBy : 'a.id';
     }
     //排序方式默认按照倒序排列
     //接受 sost参数 0 表示倒序 非0都 表示正序
     if (isset($_GET['_sort'])) {
         $sort = $_GET['_sort'] ? 'asc' : 'desc';
     } else {
         $sort = $asc ? 'asc' : 'desc';
     }
     if (!empty($_GET['listRows'])) {
         $listRows = $_GET['listRows'];
     } else {
         $page_size = C('page_size');
         $listRows = $page_size ? $page_size : 20;
     }
     $count = $model->where($where)->count();
     $page_count = ceil($count / $listRows);
     $this->assign('count', $count);
     $this->assign('page_count', $page_count);
     if ($count > 0) {
         //创建分页对象
         $p = new \My\Page($count, $listRows);
         $list = $model->table('`' . C('DB_PREFIX') . 'member_coupon` as a')->join('`' . C('DB_PREFIX') . 'coupon` as b on a.coupon_id=b.id')->field('a.id,a.create_time,a.use_time,a.status,a.member_name,b.title,b.btime,b.etime')->where($where)->order('a.id desc')->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $model->getlastsql();
         //分页跳转的时候保证查询条件
         foreach ($map as $key => $val) {
             if (is_array($val)) {
                 foreach ($val as $t) {
                     $p->parameter .= $key . '[]=' . urlencode($t) . "&";
                 }
             } else {
                 $p->parameter .= "{$key}=" . urlencode($val) . "&";
             }
         }
         //分页显示
         $page = $p->Show();
     }
     //列表排序显示
     $sortImg = $sort;
     //排序图标
     $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列';
     //排序提示
     $sort = $sort == 'desc' ? 1 : 0;
     //排序方式
     //模板赋值显示
     $this->assign('list', $list);
     $this->assign('sort', $sort);
     $this->assign('order', $order);
     $this->assign('sortImg', $sortImg);
     $this->assign('sortType', $sortAlt);
     $this->assign("page", $page);
     $this->display();
 }
示例#6
0
 /**
  * 分成产看
  */
 function look_cp()
 {
     $model = M('member');
     $data['utype'] = 3;
     if ($_GET['id']) {
         $data['id'] = $_GET['id'];
         $this->assign('id', $_GET['id']);
     }
     if ($_GET['username']) {
         $data['username'] = $_GET['username'];
         $this->assign('username', $_GET['username']);
     }
     //默认本月
     if (!$_GET['btime'] && !$_GET['etime']) {
         $_GET['btime'] = date('Y-m-1');
         $_GET['etime'] = date('Y-m-' . date('t'));
     }
     //dump($_GET);exit;
     if ($_GET['btime'] && $_GET['etime']) {
         $odata['pay_time'] = array(array('gt', strtotime($_GET['btime'])), array('lt', strtotime($_GET['etime']) + 86400));
         $this->assign('btime', $_GET['btime']);
         $this->assign('etime', $_GET['etime']);
     } elseif ($_GET['btime']) {
         $odata['pay_time'] = array('gt', strtotime($_GET['btime']));
         $this->assign('btime', $_GET['btime']);
     } elseif ($_GET['etime']) {
         $odata['pay_time'] = array('lt', strtotime($_GET['etime']) + 86400);
         $this->assign('etime', $_GET['etime']);
     }
     $count = $model->where($data)->count();
     //echo $model->getlastsql();
     $this->assign('count', $count);
     if ($count > 0) {
         //创建分页对象
         $listRows = '20';
         if (!empty($_GET['listRows'])) {
             $listRows = $_GET['listRows'];
         }
         $p = new \My\Page($count, $listRows);
         //$list = $model->field('id,utype,username,realname,create_time,status')->where($data)->order('id desc')->limit($p->firstRow.','.$p->listRows)->select();
         $list = $model->table('`' . C('DB_PREFIX') . 'member` as a')->join('`' . C('DB_PREFIX') . 'member_wallet` as b on a.id=b.member_id')->field('a.id,a.utype,a.username,a.realname,a.create_time,a.status,b.balance,b.frozen')->where($data)->order('id desc')->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $model->getlastsql();
         //分页跳转的时候保证查询条件
         foreach ($map as $key => $val) {
             if (is_array($val)) {
                 foreach ($val as $t) {
                     $p->parameter .= $key . '[]=' . urlencode($t) . "&";
                 }
             } else {
                 $p->parameter .= "{$key}=" . urlencode($val) . "&";
             }
         }
         //分页显示
         $page = $p->Show();
     }
     //dump($list);exit;
     if ($list) {
         $model = M('order');
         foreach ($list as $key => $val) {
             $odata['agent_id'] = $val['id'];
             $odata['status'] = 2;
             $total = $model->field('sum(total_price) as much')->where($odata)->find();
             $list[$key]['much'] = $total['much'] ? $total['much'] : 0;
         }
     }
     //dump($list);
     //列表排序显示
     $sortImg = $sort;
     //排序图标
     $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列';
     //排序提示
     $sort = $sort == 'desc' ? 1 : 0;
     //排序方式
     //模板赋值显示
     $this->assign('list', $list);
     $this->assign('sort', $sort);
     $this->assign('order', $order);
     $this->assign('sortImg', $sortImg);
     $this->assign('sortType', $sortAlt);
     $this->assign("page", $page);
     $this->display();
 }
 /**
  * 产品列表
  */
 public function product_list()
 {
     $data['prom_type'] = 'order';
     $data['prom_id'] = $_GET['pid'];
     $subQuery = $this->ppldb->field('product_id')->where($data)->select(false);
     $where = 'id not in ' . $subQuery . ' AND status=1';
     if ($_GET['keyword']) {
         $where .= " AND name like '%" . $_GET['keyword'] . "%'";
         $this->assign('keyword', $_GET['keyword']);
     }
     $count = $this->pdb->where($where)->count();
     //echo $this->pdb->getlastsql();exit;
     $page_count = ceil($count / $listRows);
     $this->assign('count', $count);
     $this->assign('page_count', $page_count);
     if ($count > 0) {
         //创建分页对象
         $listRows = 10;
         $p = new \My\Page($count, $listRows);
         $list = $this->pdb->field('id,name,subtitle,lit_pic,price,stock')->where($where)->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $this->pdb->getlastsql();exit;
         $page = $p->Show();
         //dump($page);exit;
         $this->assign('page', $page);
     }
     $this->assign('list', $list);
     $this->display();
 }
示例#8
0
 /**
  * 内容列表
  */
 public function substance()
 {
     if (!$_GET['id']) {
         $this->error('推荐位没有');
     }
     $data['id'] = $_GET['id'];
     $parent = $this->db->where($data)->find();
     $this->assign('parent', $parent);
     $where = $this->_search2();
     //获得查询条件
     if (!empty($_GET['listRows'])) {
         $listRows = $_GET['listRows'];
     } else {
         $page_size = C('page_size');
         $listRows = $page_size ? $page_size : 20;
     }
     $count = $this->ddb->where($where)->count();
     $page_count = ceil($count / $listRows);
     $this->assign('count', $count);
     $this->assign('page_count', $page_count);
     if ($count > 0) {
         //创建分页对象
         //$listRows = 1;
         $p = new \My\Page($count, $listRows);
         $list = $this->ddb->field('id,title,data_type,lit_pic,create_time,sort,status')->where($where)->order('sort asc,id desc')->limit($p->firstRow . ',' . $p->listRows)->select();
         //echo $this->ddb->getlastsql();
         //分页跳转的时候保证查询条件
         foreach ($map as $key => $val) {
             if (is_array($val)) {
                 foreach ($val as $t) {
                     $p->parameter .= $key . '[]=' . urlencode($t) . "&";
                 }
             } else {
                 $p->parameter .= "{$key}=" . urlencode($val) . "&";
             }
         }
         //分页显示
         $page = $p->Show();
     }
     //列表排序显示
     $sortImg = $sort;
     //排序图标
     $sortAlt = $sort == 'desc' ? '升序排列' : '倒序排列';
     //排序提示
     $sort = $sort == 'desc' ? 1 : 0;
     //排序方式
     //模板赋值显示
     $this->assign('list', $list);
     $this->assign('sort', $sort);
     $this->assign('order', $order);
     $this->assign('sortImg', $sortImg);
     $this->assign('sortType', $sortAlt);
     $this->assign("page", $page);
     $this->display();
 }