/** * 影片重名检测 * @param int $len * @return array */ function RepeatCheck($Get) { $len = $Get['len']; //先查询$len内不同影片的title $arr = $this->VideoDB->field('title')->Group("Left(title,{$len})")->Having('count(*)>1')->select(); foreach ($arr as $key => $val) { $arrTitle[] .= $val['title']; } //$where['status']=array('neq',-1); $where = $this->SearchCon($Get); $where["left(title, {$len})"] = array('in', $arrTitle); $video_count = $this->VideoDB->where($where)->count('id'); $video_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $video_page = get_cms_page_max($video_count, C('web_admin_pagenum'), $video_page); $video_url = U('Admin-Datacheck/VideoCheck', array('check_sub' => 'ok', 'len' => urlencode($len), 'p' => ''), false, false); $pagelist = get_cms_page($video_count, C('web_admin_pagenum'), $video_page, $video_url, '部影片'); $_SESSION['video_repurl'] = $video_url . $video_page; //order by $video['type'] = !empty($_GET['type']) ? $_GET['type'] : 'title'; $video['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $order = $video["type"] . ' ' . $video['order']; $VResult = $this->VideoDB->field('id,title,cid,serial,addtime,hits,stars,status,picurl')->where($where)->order($order)->limit(C('web_admin_pagenum'))->page($video_page)->select(); foreach ($VResult as $key => $val) { $VResult[$key]['cname'] = get_channel_name($VResult[$key]['cid']); $VResult[$key]['channelurl'] = U('Admin-Video/Show', array('cid' => $VResult[$key]['cid']), false, false); $VResult[$key]['videourl'] = get_read_url('video', $VResult[$key]['id'], $VResult[$key]['cid']); $VResult[$key]['stararr'] = get_star_arr($VResult[$key]['stars']); } return array('vresult' => $VResult, 'pagelist' => $pagelist, 'len' => $len, 'order' => $order, 'cid' => $Get['cid']); }
public function show() { $where = array(); $cid = $_REQUEST['cid']; $keyword = urldecode(trim($_REQUEST['keyword'])); if ($cid) { if (get_channel_son($cid)) { $where['cid'] = $cid; } else { $where['cid'] = get_channel_sqlin($cid); } } if ($keyword) { $search['title'] = array('like', '%' . $keyword . '%'); $map = $search; $map['_logic'] = 'or'; $where['_complex'] = $map; } $info['type'] = !empty($_GET['type']) ? $_GET['type'] : C('web_admin_ordertype'); $info['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $order = $info["type"] . ' ' . $info['order']; //分页开始 $news_count = $this->InfoDB->where($where)->count('id'); $news_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $news_page = get_cms_page_max($news_count, C('web_admin_pagenum'), $news_page); $news_url = U('Admin-Info/Show', array('cid' => $cid, 'type' => $info['type'], 'order' => $info['order'], 'keyword' => urlencode($keyword), 'p' => ''), false, false); $listpages = get_cms_page($news_count, C('web_admin_pagenum'), $news_page, $news_url, '条文章'); $_SESSION['info_reurl'] = $news_url . $news_page; //查询数据 $list = $this->InfoDB->where($where)->order($order)->limit(C('web_admin_pagenum'))->page($news_page)->select(); if (empty($list)) { if ($cid || $keyword) { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Info/Show'); $this->error('没有查询到您所筛选的文章资讯,请重新选择条件!'); } else { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Info/Add'); $this->error('还没有任何资讯,请先添加!'); } } foreach ($list as $key => $val) { $list[$key]['cname'] = get_channel_name($list[$key]['cid']); $list[$key]['channelurl'] = U('Admin-Info/Show', array('cid' => $list[$key]['cid']), false, false); $list[$key]['infourl'] = get_read_url('info', $list[$key]['id'], $list[$key]['cid'], $list[$key]['jumpurl']); $list[$key]['stararr'] = get_star_arr($list[$key]['stars']); } $this->assign($listpages); $this->assign('order', $order); $this->assign('cid', $cid); $this->assign('keyword', $keyword); $this->assign('list_channel_info', F('_gxcms/channelinfo')); $this->assign('list_info', $list); $this->display('views/admin/info_show.html'); }
public function show() { //get params $where = array(); $cid = $_REQUEST['cid']; $status = $_REQUEST['status']; $serial = $_REQUEST['serial']; $picurl = $_REQUEST['picurl']; $keyword = urldecode(trim($_REQUEST['keyword'])); //search condition if ($cid) { if (get_channel_son($cid)) { $where['cid'] = $cid; } else { $where['cid'] = get_channel_sqlin($cid); } } if ($status || $status === '0') { $where['status'] = array('eq', intval($status)); } if ($serial) { $where['serial'] = array('neq', 0); } if ($picurl) { $where['Left(picurl,7)'] = array('eq', 'fail://'); } if ($keyword) { $search['title'] = array('like', '%' . $keyword . '%'); $search['intro'] = array('like', '%' . $keyword . '%'); $search['actor'] = array('like', '%' . $keyword . '%'); $search['director'] = array('like', '%' . $keyword . '%'); $search['_logic'] = 'or'; $where['_complex'] = $search; } // $video['type'] = !empty($_GET['type']) ? $_GET['type'] : C('web_admin_ordertype'); $video['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $order = $video["type"] . ' ' . $video['order']; // $video_count = $this->VideoDB->where($where)->count('id'); $video_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $video_page = get_cms_page_max($video_count, C('web_admin_pagenum'), $video_page); $video_url = U('Admin-Video/Show', array('cid' => $cid, 'status' => $status, 'serial' => $serial, 'picurl' => $picurl, 'type' => $video['type'], 'order' => $video['order'], 'keyword' => urlencode($keyword), 'p' => ''), false, false); $listpages = get_cms_page($video_count, C('web_admin_pagenum'), $video_page, $video_url, '部影片'); $_SESSION['video_reurl'] = $video_url . $video_page; // $list = $this->VideoDB->where($where)->order($order)->limit(C('web_admin_pagenum'))->page($video_page)->select(); if (empty($list)) { if ($status || $serial || $cid || $keyword) { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Video/Show'); $this->error('没有查询到您所筛选的影片信息,请重新选择条件!'); } else { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Video/Add'); if (empty($picurl)) { $this->error('还没有任何影片,请先添加一部影片!'); } } } foreach ($list as $key => $val) { $list[$key]['cname'] = get_channel_name($list[$key]['cid']); $list[$key]['channelurl'] = U('Admin-Video/Show', array('cid' => $list[$key]['cid']), false, false); $list[$key]['videourl'] = get_read_url('video', $list[$key]['id'], $list[$key]['cid']); $list[$key]['stararr'] = get_star_arr($list[$key]['stars']); } //dump($this->VideoDB->getLastSql()); $this->assign($listpages); $this->assign('order', $order); $this->assign('cid', $cid); $this->assign('keyword', $keyword); $this->assign('list_channel_video', F('_gxcms/channelvideo')); $this->assign('list_video', $list); $this->display('views/admin/video_show.html'); }