<fh-function>
$keyword=t($_REQUEST["keyword"]);
$page=$_GET["page"];
$tag=t($_GET["tag"]);
$orderby=$_GET["orderby"];
$part=$_GET["part"];

switch($part){
  case "all":
  case " ":
    $pa="";
  break;
  case "free":
    $pa=" and P_price=0 ";
  break;
  case "pay":
    $pa=" and P_price>0 ";
  break;
  case "vip":
    $pa=" and P_vip=1 ";
  break;
}

switch($orderby){
  case "normal":
  case "":
    $order=" order by P_top desc,P_order asc,P_id desc";
  break;
  case "hot":
    $order=" order by P_view desc";
  break;
  case "time":
    $order=" order by P_id desc";
  break;
  case "rand":
    $order=" order by rand()";
  break;
}

$url=gethttp().$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
function url($url,$key,$value){
  $url=str_replace("&".$key."=".str_replace("%3A",":",urlencode($value)),"",$url);
  return $url;
}

if($tag==""){
  $taginfo="";
}else{
  $taginfo=" and CONCAT(\" \",P_tag,\" \") like '% ".$tag." %'";
}

$M_id=intval($_GET["M_id"]);
if($page==""){
  $page=1;
}
if($M_id!=0){
  $M_info=" and P_mid=$M_id ".$taginfo;
}else{
  $M_info=" and P_sh=1".$taginfo;
}

$sql="select * from sl_psort where S_id=".$id;
  $result = mysqli_query($conn, $sql);
  $row = mysqli_fetch_assoc($result);
  if (mysqli_num_rows($result) > 0) {
    $S_sub=$row["S_sub"];
  }


  if($id==0){
    $sql="select count(P_id) as P_count from sl_product where P_del=0 ".$pa.$M_pinfo."  ".shuxing("P_shuxing")." $M_info order by P_order,P_id desc";
  }else{
    if($S_sub==0){
      $sql="select count(P_id) as P_count from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_sub=".$id." order by P_order,P_id desc";
    }else{
      $sql="select count(P_id) as P_count from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_id=".$id." order by P_order,P_id desc";
    }
  }

$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$P_count=$row["P_count"];

$page_num=intval($P_count/10)+1;
if($P_count%10 ==0){
  $page_num=$page_num-1;
}

function is_haves($a,$b){
  if(in_array($a,$b)){
      return true;
  }else{
      return false;
  }
}

</fh-function>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="https://gmpg.org/xfn/11">
<title>[S_title] - [fh_title]</title>
<link href="media/[fh_ico]" rel="shortcut icon" />
<meta name="description" content="[S_content]" />
<meta name="keywords" content="[S_keywords]" />
<meta name='robots' content='max-image-preview:large' />
<link rel='stylesheet' id='app-css'  href='template/t15/wp-content/themes/fh/assets/css/app.css?ver=8.7.0' type='text/css' media='all' />
<link rel='stylesheet' id='ripro_chlid_style-css'  href='template/t15/wp-content/themes/fh2/diy.css?ver=5.7.2' type='text/css' media='all' />
<link rel='stylesheet' id='pure-highlightjs-style-css'  href='template/t15/wp-content/plugins/Pure-Highlightjs-master/highlight/styles/default.css?ver=0.9.2' type='text/css' media='all' />
<link rel='stylesheet' id='pure-highlightjs-css-css'  href='template/t15/wp-content/plugins/Pure-Highlightjs-master/assets/pure-highlight.css?ver=0.1.0' type='text/css' media='all' />
<link rel='stylesheet' id='external-css'  href='template/t15/wp-content/themes/fh/assets/css/external.css?ver=8.7.0' type='text/css' media='all' />
<link rel='stylesheet' id='sweetalert2-css'  href='template/t15/wp-content/themes/fh/assets/css/sweetalert2.min.css?ver=8.7.0' type='text/css' media='all' />
<link rel='stylesheet' id='diy-css'  href='template/t15/wp-content/themes/fh/assets/css/diy.css?ver=8.7.0' type='text/css' media='all' />
<script type='text/javascript' src='template/t15/wp-content/themes/fh/assets/js/jquery-2.2.4.min.js?ver=2.2.4' id='jquery-js'></script>
<script type='text/javascript' src='template/t15/wp-content/themes/fh/assets/js/plugins/sweetalert2.min.js?ver=8.7.0' id='sweetalert2-js'></script>
<link href="css/Pager.css" rel="stylesheet" type="text/css" />
<style type="text/css">@media (min-width: 1200px) { .container,.container-lg,.container-md,.container-sm,.container-xl { max-width:1300px } }
.footer-links {
    text-align: center;
}</style>	<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
    <!--[if lt IE 9]>
      <script src="template/t15/wp-content/themes/fh/assets/js/html5shiv.js"></script>
      <script src="template/t15/wp-content/themes/fh/assets/js/respond.min.js"></script>
    <![endif]-->
    <script>
	if(("standalone" in window.navigator) && window.navigator.standalone){
		var noddy, remotes = false;
		document.addEventListener('click', function(event) {
			noddy = event.target;
			while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {
				noddy = noddy.parentNode;
			}
			if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes)){
				event.preventDefault();
				document.location.href = noddy.href;
			}
	
		},false);
	}
	</script>
</head>

<body class="archive category category-9  max_width hfeed navbar-sticky navbar-slide sidebar-none pagination-infinite_button">

<div class="site">
    
[fh_header]

<div class="header-gap"></div><div class="term-bar lazyload visible" data-bg="[S_pic]">
  <h1 class="term-title">[S_title]</h1></div>    
    <div class="site-content">
    


<div class="container">
  

<div class="filter--content">
    <form class="mb-0" method="get" action="">
        <input type="hidden" name="s">
        <div class="form-box search-properties mb-0">
            <!-- 一级分类 -->

            <div class="filter-item">
                <ul class="filter-tag"><span><i class="fa fa-folder-open-o"></i> 分类筛选</span>

                	<li><a class="<fh-function>
  if($id==0){
$api=$api."on";
}else{
$api=$api."";
}</fh-function>" href="?type=product&id=0">全部</a></li>


<fh-function>
        $sql="select * from sl_psort where S_sub=0 and S_del=0 order by S_id desc";
        s[[
        if($id==$row["S_id"] || getrs("select * from sl_psort where S_id=$id","S_sub")==$row["S_id"]){
        $class="on";
    }else{
    $class="";
}
        $api=$api."<li><a href=\"?type=product&id=".$row["S_id"]."\"  class=\"".$class."\">".$row["S_title"]."</a></li>";
        ]]
        </fh-function>




                </ul>            </div>



<fh-function>
if($id!=0){	
if(getrs("select * from sl_psort where S_id=$id","S_sub")==0){
	$class="on";
	$idx=$id;
}else{
	$class="";
	$idx=getrs("select * from sl_psort where S_id=$id","S_sub");
}

$api=$api."<div class=\"filter-item\"><ul class=\"filter-tag\"><span><i class=\"fa fa-folder-open-o\"></i> 二级类目</span>
  <li><a href=\"?type=product&id=$idx\" class=\"$class\">全部</li>";

        $sql="select * from sl_psort where (S_sub=$id or S_sub=".getrs("select * from sl_psort where S_id=$id","S_sub").") and not S_sub=0 and S_del=0 order by S_id desc";
        s[[
        if($id==$row["S_id"]){
        $class="on";
    }else{
    $class="";
}
        $api=$api."<li><a href=\"?type=product&id=".$row["S_id"]."\"  class=\"".$class."\">".$row["S_title"]."</a></li>";
        ]]
$api=$api."</ul></div> ";
}
</fh-function>


<fh-function>

$arr = array();
if($id==0){
  //$sql="select * from sl_product where P_del=0 ".$M_pinfo."  $M_info order by P_top desc,P_order,P_time desc,P_id desc";
}else{
  if($S_sub==0){
    $sql="select * from sl_product,sl_psort where S_del=0 $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_sub=".$id." order by P_top desc,P_order,P_time desc,P_id desc";
  }else{
    $sql="select * from sl_product,sl_psort where S_del=0 $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_id=".$id." order by P_top desc,P_order,P_time desc,P_id desc";
  }
}

$result = mysqli_query($conn,  $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
        $sx=explode("\r\n",$row["P_shuxing"]);
        for($i=0;$i<count($sx);$i++){
          if(splitx($sx[$i],":",0)!=""){
            $c=json_decode("{\"S_title\":\"".splitx($sx[$i],":",0)."\"}",true);
            if(!is_haves($c,$arr)){
              array_push($arr,$c);
            }
          }
        }
    }
} 


for($i=0;$i<count($arr);$i++){
  $arr[$i]["list"]=array();
  $result = mysqli_query($conn,  $sql);
  if (mysqli_num_rows($result) > 0) {
  while($row = mysqli_fetch_assoc($result)) {
          $sx=explode("\r\n",$row["P_shuxing"]);
          for($m=0;$m<count($sx);$m++){
            $s=splitx($sx[$m],":",0);
            if($s==$arr[$i]["S_title"]){
              $v=splitx($sx[$m],":",1);
                if($v!=""){
                  $x=json_decode("{\"shuxing\":\"".$v."\"}",true);
                  if(!is_haves($x,$arr[$i]["list"])){
                    array_push($arr[$i]["list"],$x);
                  }
                }
            }
        }
      }
  }
}


for($i=0;$i<count($arr);$i++){
  for($j=0;$j<count($arr[$i]["list"]);$j++){
    if($_GET["f".$i]==$arr[$i]["S_title"].":".$arr[$i]["list"][$j]["shuxing"]){
      $selected="on";
    }else{
      $selected="";
    }


    $shuxing=$shuxing."<li><a href=\"".url($url,"f".$i,$_GET["f".$i])."&f".$i."=".$arr[$i]["S_title"].":".$arr[$i]["list"][$j]["shuxing"]."\" class=\"".$selected."\">".$arr[$i]["list"][$j]["shuxing"]."</a></li>";
  }

if($_GET["f".$i]==""){
  $selected="on";
}else{
  $selected="";
}

  $api=$api. "<div class=\"filter-item\">
  <ul class=\"filter-tag\"><span>".$arr[$i]["S_title"]."</span>
  <li><a href=\"".url($url,"f".$i,$_GET["f".$i])."&f".$i."=\" class=\"".$selected."\">不限</a>".$shuxing."</li>
  </ul></div>";
  
  $shuxing="";
}

</fh-function>



                <div class="filter-tab">
                <div class="row">
                    <div class="col-12 col-sm-6">
                        <ul class="filter-tag"><span><i class="fa fa-filter"></i> 价格</span>
    						<li><a href="<fh-function>$api=url($url,"part",$_GET["part"])."&part=all";</fh-function>" class="<fh-function>if($part=="all" || $part==""){$api="tab on";}else{$api="tab";}</fh-function>"><i></i><em>全部</em></a></li>
                          <li><a href="<fh-function>$api=url($url,"part",$_GET["part"])."&part=free";</fh-function>" class="<fh-function>if($part=="free"){$api="tab on";}else{$api="tab";}</fh-function>"><i></i><em>免费</em></a></li>
                          <li><a href="<fh-function>$api=url($url,"part",$_GET["part"])."&part=pay";</fh-function>" class="<fh-function>if($part=="pay"){$api="tab on";}else{$api="tab";}</fh-function>"><i></i><em>付费</em></a></li>
                          <li><a href="<fh-function>$api=url($url,"part",$_GET["part"])."&part=vip";</fh-function>" class="<fh-function>if($part=="vip"){$api="tab on";}else{$api="tab";}</fh-function>"><i></i><em>VIP免费</em></a></li>
                        </ul>                    </div>
                    <div class="col-12 col-sm-6">
                        <!-- 排序 -->
                        <ul class="filter-tag" style="width: 100%;"><div class="right">
                          <li class="rightss"><i class="fa fa-caret-down"></i> <a href="<fh-function>$api=url($url,"orderby",$_GET["orderby"])."&orderby=time";</fh-function>" class="<fh-function>if($orderby=="time"){$api="on";}else{$api="";}</fh-function>">发布日期</a></li>

                          <li class="rightss"><i class="fa fa-caret-down"></i> <a href="<fh-function>$api=url($url,"orderby",$_GET["orderby"])."&orderby=rand";</fh-function>" class="<fh-function>if($orderby=="rand"){$api="on";}else{$api="";}</fh-function>">随机</a></li>

                          <li class="rightss"><i class="fa fa-caret-down"></i> <a href="<fh-function>$api=url($url,"orderby",$_GET["orderby"])."&orderby=hot";</fh-function>" class="<fh-function>if($orderby=="hot"){$api="on";}else{$api="";}</fh-function>">热度</a></li>

                          <li class="rightss"><i class="fa fa-caret-down"></i> <a href="<fh-function>$api=url($url,"orderby",$_GET["orderby"])."&orderby=normal";</fh-function>" class="<fh-function>if($orderby=="normal" || $orderby==""){$api="on";}else{$api="";}</fh-function>">综合</a></li>


                        </div></ul>                        
                    </div>
                </div>
            </div>
            
            <!-- .row end -->
        </div>
        <!-- .form-box end -->
    </form>
</div>



  <div class="row">
    <div class="col-lg-12">
      <div class="content-area">
        <main class="site-main">
                      <div class="row posts-wrapper">


<fh-function>

if($id==0){
  $sql="select * from sl_product,sl_psort where P_sort=S_id and P_del=0 ".$pa.$M_pinfo."  ".shuxing("P_shuxing")." $M_info $order limit ".(($page-1)*10).",10";
}else{
  if($S_sub==0){
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_sub=".$id." $order limit ".(($page-1)*10).",10";
  }else{
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_id=".$id." $order limit ".(($page-1)*10).",10";
  }
}


   s[[
            if($row["P_limit"]>0 and $row["P_limitlong"]>0 and $row["P_limitlong"]-(time()-strtotime($row["P_limittime"]))/3600>0){
              $P_price=$row["P_limit"];
              $l=date('Y-m-d H:i:s',strtotime('+'.$row["P_limitlong"].' hour',strtotime($row["P_limittime"])));
            }else{
              $P_price=p($row["P_price"]);
              $l="";
            }

if($row['P_mid']==0){
  $author_pic=pic($C["C_ico"]);
}else{
  $author_pic=pic(getrs("select * from sl_member where M_id=".$row['P_mid'],"M_head"));
}

$sub_title=getrs("select * from sl_psort where S_id=".$row["S_sub"]);


      $api=$api.'<div class="col-lg-1-5 col-6 col-sm-6 col-md-4 col-lg-3">
  <article id="post-10742" class="post post-grid post-10742 type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized tag-65">
      <div class="entry-media">
    <div class="placeholder" style="padding-bottom: 60%;">
      <a  href="?type=productinfo&id='.$row['P_id'].'" >
        <img class="lazyload" data-src="'.pic(splitx($row['P_pic'],"|",0)).'" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="'.$row['P_title'].'">  
      </a>
          </div>
      </div>
      <div class="entry-wrapper">
              <a class="grid_author_avt" href="?type=productinfo&id='.$row['P_id'].'" ><div class="grid_author_bggo avatar bg-cover" style="background-image: url('.$author_pic.');"></div> </a>
            
  <header class="entry-header">          <div class="entry-meta">
                  <span class="meta-category">

                    <a href="?type=product&id='.$row['S_sub'].'" rel="category">
                  <i class="dot"></i>'.$sub_title["S_title"].'              </a>

                          <a href="?type=product&id='.$row['S_id'].'" rel="category">
                  <i class="dot"></i>'.$row['S_title'].'              </a>

                      </span>
      </div>
    
    <h2 class="entry-title"><a href="?type=productinfo&id='.$row['P_id'].'" title="'.$row['P_title'].'" rel="bookmark">'.$row['P_title'].'</a></h2>  </header>             <div class="entry-excerpt u-text-format">'.mb_substr(strip_tags($row["P_content"]),0,200,"utf-8").'</div>
            <div class="entry-footer">
  <ul class="post-meta-box">

        <li class="meta-date">
      <time datetime="2020-11-17T14:45:47+08:00"><i class="fa fa-clock-o"></i> '.date("Y-m-d",strtotime($row["P_time"])).'</time>
    </li>
            <li class="meta-views"><span><i class="fa fa-eye"></i> '.$row['P_view'].'</span></li>
            <li class="meta-price"><span> ￥'.$P_price.'</span></li>
          
  </ul>
</div>    </div>
  </article>
</div>';

                    ]]
</fh-function>







              
            </div>
            
  <div class="infinite-scroll-status">
    <div class="infinite-scroll-request"></div>
  </div>
  <div class="infinite-scroll-action">
    <div id="pager"></div>
  </div>
                  </main>
      </div>
    </div>

    

      </div>



</div>
</div><!-- end sitecoent --> 
<script src="js/jquery.pager.js" type="text/javascript"></script>
<script>


$(document).ready(function() {
  $("#pager").pager({ pagenumber: <fh-function> $api=$api.$page;</fh-function>, pagecount: <fh-function> $api=$api.$page_num;</fh-function>, buttonClickCallback: PageClick });
});

PageClick = function(pageclickednumber) {
  window.location="<fh-function>$api=$api.url($url,"page",$_GET["page"]);</fh-function>&page="+pageclickednumber;
}

function limit(){
  $(".sss").each(function(){
      if($(this).attr("limit")!=""){
      var leftTime = new Date($(this).attr("limit")) - new Date();
      var d, h, m, s;
      if (leftTime < 0) {
        return;
      }
      d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
      h = Math.floor((leftTime / 1000 / 60 / 60) % 24);
      m = Math.floor((leftTime / 1000 / 60) % 60);
      s = Math.floor((leftTime / 1000) % 60);
      const str = `${d}天${h}:${m}:${s}`;
        $(this).html("<div style=\"position: absolute;left: 0px;bottom: 0px;background: rgba(0,0,0,0.5);color: #fff;width:100%;height:25px;font-size:12px;line-height:25px;text-align:left\"><img src=\"https://misc.360buyimg.com/product/search/1.0.8/css/i/search.presell.gif\" style=\"margin:0 5px;display:inline-block\">限时特惠 "+str+" 后结束</div>");
      }
    });
}
limit();
setInterval(limit, 1000);
</script>
	[fh_footer]
</body>
</html>