0";
if ($v_commend=="ok") $whereStr.=" and d.v_commend>0";
if ($v_recycled=="ok") $whereStr.=" and d.v_recycled=1";
if (!empty($jqtype)) $whereStr.=" and d.v_jq like '%$jqtype%'";
if (!empty($area)) $whereStr.=" and d.v_publisharea = '$area'";
if (!empty($year)) $whereStr.=" and d.v_publishyear = '$year'";
if (!empty($yuyan)) $whereStr.=" and d.v_lang = '$yuyan'";
if (!empty($letter)) $whereStr.=" and d.v_letter = '$letter'";
if (!empty($commend)) $whereStr.=" and d.v_commend = '$commend'";
if (!empty($ver)) $whereStr.=" and d.v_ver = '$ver'";
if ($repeat=="ok") {
if($allrepeat=="ok")
{
$dsql->SetQuery("select v_name from duomi_data where v_recycled=0 group by v_name having count(*)>1");
$dsql->Execute('video_have');
$repeatsql="";
while($rowh=$dsql->GetObject('video_have'))
{
if(!empty($rowh->v_name))
{
$repeatsql.="'".$rowh->v_name."',";
}
}
if(empty($repeatsql))
{
showMsg('恭喜,无重复数据','admin_datarelate.php?action=repeat');
exit();
}else
{
$whereStr .= " and d.v_name in (".rtrim($repeatsql,',').")";
}
}else
{
$dsql->SetQuery("select substring(v_name,1,$rlen) as v_name from duomi_data where v_recycled=0 group by substring(v_name,1,$rlen) having count(*)>1");
$dsql->Execute('video_have');
$repeatsql="";
while($rowh=$dsql->GetObject('video_have'))
{
if(!empty($rowh->v_name))
{
$repeatsql.="or d.v_name like '$rowh->v_name%' ";
}
}
$whereStr.=rtrim(" and 1=2 or ".ltrim($repeatsql,"or"),"or ");
}
}
if ($empty=="ok") {
$whereStr.=" and p.body =''";
}
if (!empty($type)) $whereStr.=" and d.tid in (".getTypeId($type).")";
if (!empty($etype)) $whereStr.=" and d.tid in (".getTypeId($etype).")";
if (!empty($topic)) $whereStr.=" and d.v_topic =".$topic;
if (!empty($keyword)) $whereStr.=" and d.v_name like '%".$keyword."%' or d.v_actor like '%".$keyword."%' or d.v_nickname like '%".$keyword."%' or d.v_director like '%".$keyword."%' ";
if (!empty($playfrom)) $whereStr.=" and p.body like '%".$playfrom."$$%' ";
if (!empty($etype)) $whereStr.=" or FIND_IN_SET('".getTypeId($etype)."',d.v_extratype)<>0";
$whereorder = str_replace("where order","order",str_replace("where and","and",$whereStr.$orderStr));
//计算有多少条数据
$csqlStr="select count(*) as dd from `duomi_data` d left join `duomi_playdata` p on p.v_id=d.v_id where d.v_recycled=0 ".$whereorder;
if ($v_recycled=="ok")$csqlStr="select count(*) as dd from `duomi_data` d left join `duomi_playdata` p on p.v_id=d.v_id where d.v_recycled=1 ".$whereorder;
$row = $dsql->GetOne($csqlStr);
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
$sqlStr="select d.v_pic,d.v_isunion,d.v_id,d.v_name,d.v_hit,0,d.v_state,d.tid,d.v_topic,d.v_addtime,d.v_jq,d.v_enname,d.v_commend,p.body as v_playdata,p.body1 as v_playdata1,t.tname from duomi_data d left join `duomi_type` t on t.tid=d.tid left join `duomi_playdata` p on p.v_id=d.v_id where d.v_recycled=0 ".$whereorder." limit $limitstart,$numPerPage";
if ($v_recycled=="ok") $sqlStr="select d.v_pic,d.v_isunion,d.v_id,d.v_name,d.v_enname,d.v_hit,0,d.v_state,d.tid,d.v_topic,d.v_addtime,d.v_jq,d.v_commend,p.body as v_playdata,p.body1 as v_playdata1,t.tname from duomi_data d left join `duomi_type` t on t.tid=d.tid left join `duomi_playdata` p on p.v_id=d.v_id where 1=1 ".$whereorder." limit $limitstart,$numPerPage";
$jumpurl = "&v_recycled=$v_recycled&order=$order&type=$type&etype=$etype&keyword=$keyword&v_state=$v_state&v_commend=$v_commend&repeat=$repeat&allrepeat=$allrepeat&topic=$topic&playfrom=$playfrom&empty=$empty&rlen=$rlen&jqtype=$jqtype&area=$area&year=$year&yuyan=$yuyan&letter=$letter&commend=$commend&ver=$ver";
?>