/** * 影片重名检测 * @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() { $request['wd'] = urldecode(trim($_REQUEST['wd'])); $request['status'] = intval($_GET['status']); if (!empty($request['wd'])) { $where[C('db_prefix') . 'comment.ip'] = array('like', '%' . $request["wd"] . '%'); $where[C('db_prefix') . 'comment.content'] = array('like', '%' . $request["wd"] . '%'); $where[C('db_prefix') . 'user.username'] = array('like', '%' . $request["wd"] . '%'); $where[C('db_prefix') . 'video.title'] = array('like', '%' . $request["wd"] . '%'); $where['_logic'] = 'or'; } if ($request['status']) { $where[C('db_prefix') . 'comment.status'] = 0; } $join = C('db_prefix') . 'user on ' . C('db_prefix') . 'comment.uid = ' . C('db_prefix') . 'user.id'; //查询影片名称 $join_video = C('db_prefix') . 'video on ' . C('db_prefix') . 'comment.did = ' . C('db_prefix') . 'video.id'; $field = C('db_prefix') . 'comment.*,' . C('db_prefix') . 'user.id as userid,' . C('db_prefix') . 'user.username,' . C('db_prefix') . 'video.title'; $order = C('db_prefix') . 'comment.id desc'; $cm_count = $this->CommDB->field($field)->where($where)->join($join)->join($join_video)->count(); $cm_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $cm_page = get_cms_page_max($cm_count, C('web_admin_pagenum'), $cm_page); $cm_url = U('Admin-Comment/Show', array('status' => $request['status'], 'wd' => urlencode($request['wd']), 'p' => ''), false, false); $listpages = get_cms_page($cm_count, C('web_admin_pagenum'), $cm_page, $cm_url, '条评论'); $list_comment = $this->CommDB->field($field)->where($where)->join($join)->join($join_video)->order($order)->limit(C('web_admin_pagenum'))->page($cm_page)->select(); // $_SESSION['comment_reurl'] = $cm_url . $cm_page; $this->assign($listpages); $this->assign('wd', $request['wd']); $this->assign('list_comment', $list_comment); $this->display('./views/admin/comment_show.html'); }
public function mana() { $status = $_REQUEST['status']; if ($status) { $where['status'] = $status; } if (isset($_GET['cid'])) { $where['cid'] = $_GET['cid']; } $special['type'] = !empty($_GET['type']) ? $_GET['type'] : C('web_admin_ordertype'); $special['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $order = $special['type'] . ' ' . $special['order']; //分页开始 $special_count = $this->SelfDB->where($where)->count('id'); $special_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $special_page = get_cms_page_max($special_count, C('web_admin_pagenum'), $special_page); $special_url = U('Admin-Self/Mana', array('status' => $status, 'type' => $video['type'], 'order' => $video['order'], 'p' => ''), false, false); $listpages = get_cms_page($special_count, C('web_admin_pagenum'), $special_page, $special_url, '篇专辑'); $list = $this->SelfDB->where($where)->order('id DESC')->limit(C('web_admin_pagenum'))->page($special_page)->select(); //var_dump(C('web_admin_pagenum')); $_SESSION['special_reurl'] = $special_url . $special_page; foreach ($list as $key => $val) { $list[$key]['countvideo'] = !empty($val['mids']) ? count(explode(',', $val['mids'])) : 0; $list[$key]['countinfo'] = !empty($val['aids']) ? count(explode(',', $val['aids'])) : 0; $list[$key]['specialurl'] = get_read_url('special', $list[$key]['id']); $list[$key]['cname'] = $this->getType($list[$key]['cid']); } $this->assign($listpages); $this->assign('order', $order); $this->assign('list_special', $list); $this->assign('list_type', $this->getType(NULL)); //var_dump($this->getType(NULL)); $this->display('views/admin/self_show.html'); }
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 lists() { $id = intval($_GET['id']); $page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $limit = intval(C('user_page_gb')); $order = C('db_prefix') . 'gbook.addtime desc'; $join = C('db_prefix') . 'user on ' . C('db_prefix') . 'gbook.uid = ' . C('db_prefix') . 'user.id'; $field = C('db_prefix') . 'gbook.*,' . C('db_prefix') . 'user.id as userid,' . C('db_prefix') . 'user.username,' . C('db_prefix') . 'user.face'; if (C('user_check')) { $where[C('db_prefix') . 'gbook.status'] = array('eq', 1); } $rs = M('gbook'); $count = $rs->field($field)->where($where)->count('id'); $page = get_cms_page_max($count, $limit, $page); $list = $rs->field($field)->where($where)->join($join)->order($order)->limit($limit)->page($page)->select(); //dump($rs->getLastSql()); foreach ($list as $key => $val) { $list[$key]['floor'] = $count - (($page - 1) * $limit + $key); } //强制栏目为动态模式 C('url_html_channel', 0); //分页展示信息 $totalpages = ceil($count / $limit); $pages = '共' . $count . '篇留言 当前:' . $page . '/' . $totalpages . '页 '; $pages .= get_cms_page_css($page, $totalpages, C('web_home_pagenum'), get_show_url('guestbook', '', 2), false); if ($id) { $rs = M("Video"); $arr = $rs->field('id,title')->where('status=1 and id=' . $id)->find(); if ($arr) { $this->assign('content', '影片<' . $arr['title'] . '>不能观看,请修复!'); } } $this->assign('webtitle', '留言本' . '-' . C('web_name')); $this->assign('navtitle', '<a href="' . C('web_path') . '">首页</a> > <span>留言本</span>'); $this->assign('list_guestbook', $list); $this->assign('pages', $pages); $this->assign('count', $count); $this->assign('id', $id); $this->display('guestbook'); }
public function show() { $request['eid'] = $_REQUEST['eid']; $request['wd'] = urldecode(trim($_REQUEST['wd'])); $request['status'] = intval($_GET['status']); if ($request['eid']) { $where[C('db_prefix') . 'gbook.errid'] = array('gt', 0); $request['showname'] = '报错'; } else { $where[C('db_prefix') . 'gbook.errid'] = array('eq', 0); $request['showname'] = '留言'; } if ($request['status']) { $where[C('db_prefix') . 'gbook.status'] = array('eq', 0); } if (!empty($request['wd'])) { $search[C('db_prefix') . 'gbook.ip'] = array('like', '%' . $request['wd'] . '%'); $search[C('db_prefix') . 'gbook.content'] = array('like', '%' . $request['wd'] . '%'); $search[C('db_prefix') . 'user.username'] = array('like', '%' . $request['wd'] . '%'); $search['_logic'] = 'or'; $where['_complex'] = $search; } $join = C('db_prefix') . 'user on ' . C('db_prefix') . 'gbook.uid = ' . C('db_prefix') . 'user.id'; $field = C('db_prefix') . 'gbook.*,' . C('db_prefix') . 'user.id as userid,' . C('db_prefix') . 'user.username'; $order = C('db_prefix') . 'gbook.id desc'; $gb_count = $this->GbookDB->field($field)->where($where)->join($join)->count(); $gb_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $gb_page = get_cms_page_max($gb_count, C('web_admin_pagenum'), $gb_page); $gb_url = U('Admin-Guestbook/Show', array('status' => $request['status'], 'eid' => $request['eid'], 'wd' => urlencode($request['wd']), 'p' => ''), false, false); $listpages = get_cms_page($gb_count, C('web_admin_pagenum'), $gb_page, $gb_url, '条留言'); $list_gbook = $this->GbookDB->field($field)->where($where)->join($join)->order($order)->limit(C('web_admin_pagenum'))->page($gb_page)->select(); // $_SESSION['guestbook_reurl'] = $gb_url . $gb_page; $this->assign($listpages); $this->assign($request); $this->assign('list_gbook', $list_gbook); $this->display('./views/admin/guestbook_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'); }
public function views() { $arr = $this->checklogin(); $uid = $arr['id']; $where[C('db_prefix') . 'userview.uid'] = $uid; $join = C('db_prefix') . 'video on ' . C('db_prefix') . 'userview.did = ' . C('db_prefix') . 'video.id'; $field = C('db_prefix') . 'userview.*,' . C('db_prefix') . 'video.id as videoid,' . C('db_prefix') . 'video.title,' . C('db_prefix') . 'video.cid'; $order = C('db_prefix') . 'userview.viewtime desc'; // $rs = M('Userview'); $user_count = $rs->field($field)->where($where)->join($join)->count(); $user_page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $user_page = get_cms_page_max($user_count, 20, $user_page); $user_url = U('User/Views', array('p' => ''), false, false); $listpages = get_cms_page($user_count, C('web_admin_pagenum'), $user_page, $user_url, '条记录', false); // $list_view = $rs->field($field)->where($where)->join($join)->order($order)->limit(C('web_admin_pagenum'))->page($user_page)->select(); foreach ($list_view as $key => $val) { $list_view[$key]['floor'] = $user_count - (($user_page - 1) * C('web_admin_pagenum') + $key); } $this->assign('pages', $listpages['listpages']); $this->assign('list_view', $list_view); $this->assign('count_view', $user_count); $this->display('./views/user/views.html'); }
function ChannelList($where) { $count = $this->CDB->where($where)->count('id'); $page = !empty($_GET['p']) ? intval($_GET['p']) : 1; $page = get_cms_page_max($count, C('web_admin_pagenum'), $page); $url = U('Admin-CustomCollect/AutoChannel', array('cname' => $where['cname'], 'reid' => $where['reid'], 'nid' => $where['nid'], 'p' => ''), false, false); $pagelist = get_cms_page($count, C('web_admin_pagenum'), $page, $url, '条记录'); $_SESSION['reurl'] = $url . $page; $Arr = $this->CDB->where($where)->order('id desc')->limit(C('web_admin_pagenum'))->page($page)->select(); $CacheData = F('_gxcms/channel_999'); if (!empty($CacheData)) { foreach ($CacheData as $key => $val) { $Cache[] = explode('_', $val['cname']); } $Cache = array_unique($Cache); foreach ($Cache as $k => $v) { $Cache[$k][1] = collect::get_node_name($v[1]); } } $Result = array('arr' => $Arr, 'cache' => $Cache, 'pagelist' => $pagelist, 'search' => $where); return $Result; }
public function videoread() { $mrid = intval($_REQUEST["mrid"]); $go = intval($_GET['go']); $this->checkhtml(C('url_html'), '影视内容', '?s=Admin/Html/Videoshow/msid/0/go/' . $go); echo '<div class="htmllist" id="show" style="font-size:12px;">'; if ($mrid) { if (get_channel_son($mrid)) { $where['cid'] = $mrid; } else { $where['cid'] = get_channel_sqlin($mrid); } } $where['status'] = 1; $count = $this->VideoDB->where($where)->count('id'); $listRows = C('url_create_num'); //每页生成数 $totalpages = ceil($count / $listRows); //总生成页数 $nowpage = !empty($_GET['page']) ? intval($_GET['page']) : 1; $nowpage = get_cms_page_max($count, $listRows, $nowpage); //当前页数 echo '<li>总共需要生成<span>' . $count . '</span>部影片,每页生成<span>' . $listRows . '</span>部,共需要分<span>' . $totalpages . '</span>页生成,当前正在生成第<span>' . $nowpage . '</span>页。</li>'; $list = $this->VideoDB->where($where)->order('addtime desc')->limit($listRows)->page($nowpage)->select(); if (empty($list)) { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show'); $this->error('暂无数据不需要生成!'); } foreach ($list as $key => $value) { $this->createvideo($value); } echo '</div><script>document.getElementById("show").style.display="none";</script>'; $this->assign("waitSecond", C('url_create_time')); if ($nowpage < $totalpages) { //是否生成完成 $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Videoread/mrid/' . $mrid . '/page/' . ($nowpage + 1) . '/go/' . $go); $this->success('第(' . $nowpage . ')页已经完成,正在准备下一个,请稍等!'); } else { if ($go) { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Videoshow/msid/0/go/' . $go); $this->success('恭喜您!所有影视内容页已经生成完毕,正在准备生成影视栏目页,请稍等!'); } else { $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show'); $this->success('恭喜您!所有影视内容页已经生成完毕!'); } } }
function Collecting(&$config) { $page = !empty($config['page']) ? intval($config['page']) : 1; $all = !empty($config['total']) ? intval($config['total']) : 0; $where = array('nid' => $config['id'], 'status' => '0'); //$where=array('nid'=>$config['id']); $total = $this->ContDB->where($where)->count(); if (empty($all)) { $all = $total; } $total_page = ceil($all / $config['pagesize']); $maxpage = get_cms_page_max($total, $config['pagesize'], $page); $list = $this->ContDB->where($where)->order('id desc')->limit($config['pagesize'])->page($maxpage)->select(); if ($page <= 1) { $this->DB->where('id=' . $config['id'])->save(array('lastdate' => time())); } //$i = 0; if (!empty($list) && is_array($list)) { if ($total_page < $page) { //$this->DB->where('id='.$config['id'])->save(array('lastdate'=>time())); F('_gxcms/ColCache', NUll); $this->error = '采集完成!'; return true; } //print_r($list);exit; foreach ($list as $v) { $html = $this->GetCon($v, $config); $msg = '<strong>' . $html['title'] . '</strong> '; if (!empty($html['cname'])) { $cname = $this->CModel->GetCname($html['cname'], $v['nid']); if (!$cname) { $msg .= '分类<strong>' . $html['cname'] . '</strong>待绑定'; $html['cid'] = 999; //===========================================// //写入缓存 $cache = F('_gxcms/channel_999'); $cache[$v['id']] = array('id' => $v['id'], 'cname' => $html['cname'] . '_' . $v['nid']); F('_gxcms/channel_999', $cache); } else { if ($cname != $html['cname']) { $msg .= '<span>已自动将分类<strong>' . $html['cname'] . '</strong>'; $html['cname'] = $cname; $msg .= '转换为<strong>' . $html['cname'] . '</strong></span>'; } } } $stauts = 1; if ($config['direct'] && $html['cid'] != 999) { //直接入库video if (!$this->CModel->videoImport($v['url'], $html)) { $msg .= $this->CModel->getError(); //continue; } else { $msg .= '影片入库保存成功.'; $stauts = 2; } } $updata = array('status' => $stauts, 'data' => collect::array2string($html), 'addtime' => time()); if (!empty($html['title'])) { $updata['title'] = $html['title']; } $Update = $this->ContDB->where('id=' . $v['id'])->save($updata); if ($Update === 'false') { //失败则跳过 $msg .= ' 采集入库失败!'; continue; } else { $msg .= ' 采集成功.'; } //$i++; if ($config['stime'] > 0) { //间隔时间 sleep($config['stime']); $msg .= '暂停' . $config['stime'] . '秒继续采集...'; } $result = array('con' => $this->ConvShow($html), 'url' => $v['url'], 'msg' => $msg); } $StrUrl = '?s=Admin/CustomCollect/ColRun/action/real/type/content/nid/' . $config['id'] . '/page/' . ($page + 1) . '/total/' . $all . '/stime/' . $config['stime']; $result['StrUrl'] = $StrUrl; $result['total'] = $all; $result['already'] = $page * $config['pagesize']; $result['percent'] = $result['already'] / $result['total'] * 200; if ($total_page >= $page) { //添加缓存--续采 $CacheUrl = '?s=Admin/CustomCollect/ColRun/action/real/type/content/nid/' . $config['id'] . '/page/' . $page . '/total/' . $all . '/stime/' . $config['stime']; F('_gxcms/ColCache', $CacheUrl); } return $result; } else { if (F('_gxcms/ColCache')) { F('_gxcms/ColCache', NUll); } $this->error = '没有要采集的影片'; return false; } }