public function index() { $prefix = C(DB_PREFIX); if (input("request.sort", 'trim')) { $sort = input("request.sort", 'trim'); } else { $sort = $prefix . 'item_comment.id'; } if (input("request.order", 'trim')) { $order = input("request.order", 'trim'); } else { $order = 'DESC'; } $p = input('get.p', 'intval', 1); $this->assign('p', $p); $where = '1=1'; $keyword = input('request.keyword', 'trim', ''); $keyword && ($where .= " AND ((" . $prefix . "user.username LIKE '%" . $keyword . "%') OR (" . $prefix . "item.title LIKE '%" . $keyword . "%') OR (" . $prefix . "item_comment.info LIKE '%" . $keyword . "%') )"); $search = array(); $keyword && ($search['keyword'] = $keyword); $this->assign('search', $search); $count = $this->_mod->join($prefix . 'user ON ' . $prefix . 'user.id=' . $prefix . 'item_comment.uid')->join($prefix . 'item ON ' . $prefix . 'item.id=' . $prefix . 'item_comment.item_id')->where($where)->count($prefix . 'item_comment.id'); $pager = new \Common\ORG\Page($count, 20); $list = $this->_mod->field($prefix . 'item_comment.*,' . $prefix . 'user.username,' . $prefix . 'item.title as item_name,' . $prefix . 'item.img')->join($prefix . 'user ON ' . $prefix . 'user.id=' . $prefix . 'item_comment.uid')->join($prefix . 'item ON ' . $prefix . 'item.id=' . $prefix . 'item_comment.item_id')->where($where)->order($sort . ' ' . $order)->limit($pager->firstRow . ',' . $pager->listRows)->select(); $this->assign('list', $list); $this->assign('page', $pager->show()); $this->assign('list_table', true); $this->display(); }
public function log() { $useracc = M('user_acclog'); if ($keyword = input('request.keyword', 'trim')) { $map['_string'] = "username like '%" . $keyword . "%' "; } if ($fl = input('request.fl', 'trim')) { if (!empty($fl)) { $map['fl'] = $fl; } } $count = $useracc->where($map)->count(); // 查询满足要求的总记录数 $map表示查询条件 $Page = new \Common\ORG\Page($count); // 实例化分页类 传入总记录数 $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 $list = $useracc->where($map)->order('logid desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('list', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 $this->display(); }
/** * 专辑审核 */ public function check() { $res = $this->_cate_mod->field('id,name')->select(); $album_cate = array(); foreach ($res as $val) { $album_cate[$val['id']] = $val['name']; } $this->assign('album_cate', $album_cate); $cate_list = D('album_cate')->select(); $this->assign('cate_list', $cate_list); $map = $this->_search(); $map['status'] = 0; ($cate_id = input('request.cate_id', 'trim')) && ($map['cate_id'] = array('eq', $cate_id)); ($keyword = input('request.keyword', 'trim')) && ($map['title'] = array('like', '%' . $keyword . '%')); $this->assign('search', array('keyword' => $keyword, 'cate_id' => $cate_id)); //分页 import("ORG.Util.Page"); $count = $this->_mod->where($map)->count('id'); $pager = new \Common\ORG\Page($count, 20); $select = $this->_mod->field('id,cate_id,title,banner,cover_cache')->where($map)->order('id DESC'); $select->limit($pager->firstRow . ',' . $pager->listRows); $page = $pager->show(); $this->assign("page", $page); $list = $select->select(); //格式化专辑图片数据 foreach ($list as $key => $val) { $list[$key]['cover'] = unserialize($val['cover_cache']); } $this->assign('list', $list); $this->assign('list_table', true); $this->display(); }
public function logs() { $score_log_mod = M('score_log'); $map = array(); $keyword = input('request.keyword', 'trim'); $keyword && ($map = array('uname' => array('like', '%' . $keyword . '%'))); $count = $score_log_mod->where($map)->count(); $pager = new \Common\ORG\Page($count, 20); $list = $score_log_mod->order('id DESC')->limit($pager->firstRow . ',' . $pager->listRows)->select(); $this->assign('list', $list); $this->assign('page', $pager->show()); $this->assign('keyword', array('keyword' => $keyword)); $this->display(); }
/** * 列表处理 * * @param obj $model 实例化后的模型 * @param array $map 条件数据 * @param string $sort_by 排序字段 * @param string $order_by 排序方法 * @param string $field_list 显示字段 * @param intval $pagesize 每页数据行数 */ protected function _list($model, $map = array(), $sort_by = '', $order_by = '', $field_list = '*', $pagesize = 20) { //排序 $mod_pk = $model->getPk(); if (input("request.sort", 'trim')) { $sort = input("request.sort", 'trim'); } else { if (!empty($sort_by)) { $sort = $sort_by; } else { if ($this->sort) { $sort = $this->sort; } else { $sort = $mod_pk; } } } if (input("request.order", 'trim')) { $order = input("request.order", 'trim'); } else { if (!empty($order_by)) { $order = $order_by; } else { if ($this->order) { $order = $this->order; } else { $order = 'DESC'; } } } //如果需要分页 if ($pagesize) { $count = $model->where($map)->count($mod_pk); $pager = new \Common\ORG\Page($count, $pagesize); } $select = $model->field($field_list)->where($map)->order($sort . ' ' . $order); // echo M()->getLastSql(); $this->list_relation && $select->relation(true); if ($pagesize) { $select->limit($pager->firstRow . ',' . $pager->listRows); $page = $pager->show(); $this->assign("page", $page); } $list = $select->select(); foreach ($list as $key => $value) { $catename = M('user_category')->field('name')->where(array('id' => $value['uid']))->find(); $value['cname'] = $catename['name']; $list[$key] = $value; //重复值list } //dump($list); $this->assign('list', $list); $this->assign('list_table', true); }
/** * 分类标签列表 */ public function tag_list() { $cate_id = input('get.cate_id', 'intval'); $keyword = input('get.keyword', 'trim'); $cate_tag_mod = M('item_cate_tag'); $db_pre = C('DB_PREFIX'); $table = $db_pre . 'item_cate_tag'; $pagesize = 20; $map = array($table . '.cate_id' => $cate_id); $keyword && ($map['t.name'] = array('like', '%' . $keyword . '%')); $join = $db_pre . 'tag t ON t.id = ' . $table . '.tag_id'; $count = $cate_tag_mod->where($map)->join($join)->count(); $pager = new \Common\ORG\Page($count, $pagesize); $list = $cate_tag_mod->field('t.id,t.name,weight')->where($map)->join($join)->limit($pager->firstRow . ',' . $pager->listRows)->select(); $cate_name = $this->_mod->get_name($cate_id); //分类名称 $this->assign('list', $list); $this->assign('page', $pager->show()); $this->assign('cate_id', $cate_id); $this->assign('cate_name', $cate_name); $this->assign('list_table', true); $this->display(); }
/** * 前台分页统一 */ protected function _pager($count, $pagesize) { $pager = new \Common\ORG\Page($count, $pagesize); $pager->rollPage = 5; $pager->setConfig('prev', '<'); $pager->setConfig('theme', '%upPage% %first% %linkPage% %end% %downPage%'); return $pager; }
public function log() { $zp = M('zhuanpan_list'); $useracc = M('zhuanpan_log'); if ($keyword = input('request.keyword', 'trim')) { $map['_string'] = "username like '%" . $keyword . "%' "; } $map['listid'] = array('lt', 7); $count = $useracc->where($map)->count(); // 查询满足要求的总记录数 $map表示查询条件 $Page = new \Common\ORG\Page($count); // 实例化分页类 传入总记录数 $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 $list = $useracc->where($map)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); foreach ($list as $key => $val) { $listid = $val['listid']; $listinfo = $zp->where("id={$listid}")->find(); $list[$key]['jp_leibei'] = $listinfo['praisename']; $list[$key]['jp_name'] = $listinfo['praisecontent']; } $this->assign('list', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 $this->display(); }
/** * 列表处理 * * @param obj $model 实例化后的模型 * @param array $map 条件数据 * @param string $sort_by 排序字段 * @param string $order_by 排序方法 * @param string $field_list 显示字段 * @param intval $pagesize 每页数据行数 */ protected function _list($model, $map = array(), $sort_by = '', $order_by = '', $field_list = '*', $pagesize = 20) { //排序 $mod_pk = $model->getPk(); if (input('request.sort', 'trim')) { $sort = input('request.sort', 'trim'); } else { if (!empty($sort_by)) { $sort = $sort_by; } else { if ($this->sort) { $sort = $this->sort; } else { $sort = $mod_pk; } } } if (input('request.order', 'trim')) { $order = input('request.order', 'trim'); } else { if (!empty($order_by)) { $order = $order_by; } else { if ($this->order) { $order = $this->order; } else { $order = 'DESC'; } } } //如果需要分页 if ($pagesize) { $count = $model->where($map)->count($mod_pk); $pager = new \Common\ORG\Page($count, $pagesize); } $select = $model->field($field_list)->where($map)->order($sort . ' ' . $order); $this->list_relation && $select->relation(true); if ($pagesize) { $select->limit($pager->firstRow . ',' . $pager->listRows); $page = $pager->show(); $this->assign('page', $page); } $list = $select->select(); $this->assign('list', $list); $this->assign('list_table', true); }
/** * 商品审核 */ public function check() { //分类信息 $res = $this->_cate_mod->field('id,name')->select(); $cate_list = array(); foreach ($res as $val) { $cate_list[$val['id']] = $val['name']; } $this->assign('cate_list', $cate_list); //商品信息 //$map = $this->_search(); $map = array(); $map['status'] = 0; ($time_start = input('request.time_start', 'trim')) && ($map['add_time'][] = array('egt', strtotime($time_start))); ($time_end = input('request.time_end', 'trim')) && ($map['add_time'][] = array('elt', strtotime($time_end) + (24 * 60 * 60 - 1))); $cate_id = input('request.cate_id', 'intval'); if ($cate_id) { $id_arr = $this->_cate_mod->getChildIds($cate_id, true); $map['cate_id'] = array('IN', $id_arr); $spid = $this->_cate_mod->where(array('id' => $cate_id))->getField('spid'); if ($spid == 0) { $spid = $cate_id; } else { $spid .= $cate_id; } } ($keyword = input('request.keyword', 'trim')) && ($map['title'] = array('like', '%' . $keyword . '%')); $this->assign('search', array('time_start' => $time_start, 'time_end' => $time_end, 'selected_ids' => $spid, 'cate_id' => $cate_id, 'keyword' => $keyword)); //分页 $count = $this->_mod->where($map)->count('id'); $pager = new \Common\ORG\Page($count, 20); $select = $this->_mod->field('id,title,img,tag_cache,cate_id,uid,uname')->where($map)->order('id DESC'); $select->limit($pager->firstRow . ',' . $pager->listRows); $page = $pager->show(); $this->assign("page", $page); $list = $select->select(); foreach ($list as $key => $val) { $tag_list = unserialize($val['tag_cache']); $val['tags'] = implode(' ', $tag_list); $list[$key] = $val; } $this->assign('list', $list); $this->assign('list_table', true); $this->display(); }
public function search() { //搜索结果 $taobaoke_item_list = array(); if (input('get.search')) { $map['keyword'] = input('get.keyword', 'trim'); //关键词 $map['cid'] = input('get.cid', 'intval'); //分类ID $p = input('get.p', 'intval', 1); //淘宝只提供400数据 if ($p > 10) { $this->redirect('collect_alimama/search', array('keyword' => $map['keyword'], 'cid' => $map['cid'], 'search' => 1)); } if (!$map['keyword'] && !$map['cid']) { $this->error(L('select_cid_or_keyword')); } $map['start_price'] = input('get.start_price', 'trim'); //价格下限 $map['end_price'] = input('get.end_price', 'trim'); //价格上限 $map['start_commissionRate'] = input('get.start_commissionRate', 'trim'); //佣金比率下限 $map['end_commissionRate'] = input('get.end_commissionRate', 'trim'); //佣金比率上限 $map['start_commissionNum'] = input('get.start_commissionNum', 'intval'); //30天推广量下限 $map['end_commissionNum'] = input('get.end_commissionNum', 'intval'); //30天推广量上限 $map['start_totalnum'] = input('get.start_totalnum', 'intval'); //总销量下限 $map['end_totalnum'] = input('get.end_totalnum', 'intval'); //总销量上限 $map['start_credit'] = input('get.start_credit', 'trim'); //卖家信用下限 $map['end_credit'] = input('get.end_credit', 'trim'); //卖家信用上限 $map['mall_item'] = input('get.mall_item', 'intval'); //是否天猫商品 $map['guarantee'] = input('get.guarantee', 'intval'); //是否消保卖家 $map['sevendays_return'] = input('get.sevendays_return', 'intval'); //是否支持7天退换 $map['real_describe'] = input('get.real_describe', 'intval'); //是否先行赔付 $map['cash_coupon'] = input('get.cash_coupon', 'intval'); //是否支持抵价券 $map['sort'] = input('get.sort', 'trim'); //排序方法 $map['like_init'] = input('get.like_init', 'trim'); $result = $this->_get_list($map, $p); //分页 $pager = new \Common\ORG\Page($result['count'], 20); $page = $pager->show(); $this->assign("page", $page); //列表内容 $taobaoke_item_list = $result['item_list']; } $taobaoke_item_list && F('taobaoke_item_list', $taobaoke_item_list); $this->assign('list', $taobaoke_item_list); $this->assign('list_table', true); $this->display(); }