<?php

use app\app\GetLisit;

header("Content-Type:text/html;charset=utf-8");
require_once __DIR__ . '/mysqlcon.php';

$getlist = new GetLisit();

$re = !empty($_GET['re']) ? intval($_GET['re']) : 0;
if ($re !== 1) {
	echo '<script>window.location="../list/";</script>';
	die;
}

$get_val = 'dq,ks,fl,tt,px';

$get_arr = explode(",", $get_val);
foreach ($get_arr as $x) {
	$$x = isset($_GET[$x]) ? input_filter($_GET[$x]) : '';
}
$page = !empty($_GET['page']) ? intval($_GET['page']) : 1;
if (!$page) {
	$page = 1;
}

$tdq  = '';
$where = ' where 1 ';
if ($dq) {
	if (array_key_exists($dq, $dq_arr)) {
		$tdq = $dq_arr[$dq];
		$where .= " and 地区拼音 like '%" . $dq . "%'";
	} else {
		if (array_key_exists($dq, $ks_arr)) {
			$dqks = $ks_arr[$dq];
			$ks = $dq;
		}
		$dq = '';
	}
}
$tks = "公务员";
if ($ks) {
	if (array_key_exists($ks, $ks_arr)) {
		$tks = $ks_arr[$ks];
		$where .= " and 考类拼音 like '%" . $ks . "%'";
	} else {
		$ks = '';
	}
}
$tfl = '图书教材';
$tflj = '图书';
if ($fl == 'wx') {
	$where .= " and prices >300 ";
	$tfl = '在线视频课程';
	$tflj = '在线网课';
}
if ($tt != '') {
	$where .= " and goods like '%" . $tt . "%'";
}

$pxl = "";
if ($px == 'jga') {
	$pxl = " order by prices asc";
} else if ($px == 'jgd') {
	$pxl = " order by prices desc";
} else if ($px == 'xl') {
	$pxl = " order by sales desc";
} else if ($px == 'tj') {
	$pxl = " order by ratio desc";
} else if ($px == 'yh') {
	$where .= " and amount > 1";
	$pxl = " order by rank desc";
} else {
	$pxl = " order by rank desc";
}

$nums = $pdo->query("SELECT count(*) as nums  from " . TABLE . " " . $where . "")->fetch(PDO::FETCH_OBJ)->nums;
$pagesize = 20;
$perpage = ceil($nums / $pagesize);
$pagebegin = ($page - 1) * $pagesize;
?>
<!doctype html>
<html>

<head>
	<meta charset="utf-8" />
	<title>2025年<?= $tdq . $tks . $tfl ?>-华图<?= $tflj ?>官方商城</title>
	<meta name="keywords" content="<?= $tdq . $tks . $tfl ?>,<?= $tdq . $tks . $tfl ?>,华图<?= $tks . $tfl ?>" />
	<meta name="description" content="【华图<?= $tflj ?>官方商城】提供2025年<?= $tdq . $tks . $tfl ?>、<?= $tks . $tfl ?>,及华图<?= $tdq . $tks  ?>网课视频课程及图书教材,更多关注华图<?= $tks . $tflj ?>官方商城." />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
	<meta name="applicable-device" content="pc,mobile" />
	<link rel="stylesheet" href="/mall/css/css.css?3" rel="stylesheet">
	<style>
		.goods-list li i.hide.tjb {
			width: auto;
			padding: 1px 7px;
		}
	</style>
	<base target="_blank" />
</head>

<body>
	<div class="g-header-wrap">
		<div class="g-header">
			<div class="g-container clearfix">
				<div class="daohang">
					<a href="/mall/" target="_self">
						<div class="g-logo"><img src="https://ah.huatu.com/v/images/g-logo.png"></div>
						<p>华图官方旗舰店</p>
					</a>
					<div class="links1"><a href="/mall/list/ts.html" target="_self">图书教材</a><a href="/mall/list/wx.html" class=" ydyc" target="_self">视频网课</a><a href="/mall/list/?px=yh" target="_self">优惠券</a></div>
				</div>
				<div class="search-box">
					<form action="/mall/list/" method="GET" id="form" name="form" target="_self"><input type="text" id="tt" name="tt" class="input1" value="<?php echo $tt; ?>" placeholder="搜一搜，发现更多"><input type="submit" class="search_btn" value="全网搜" name="" id="submit"></form>
				</div>
			</div>
		</div>
	</div>
	<div class="i_jobcz">
		<ul>
			<li><span>按考试</span></li>
			<?php
			echo $getlist->getReNavLiArr($ks_arr, $get_val, 'ks');
			?>
		</ul>
		<ul>
			<li><span>按地区</span></li>
			<?php
			echo $getlist->getReNavLiArr($dq_arr, $get_val, 'dq');
			?>
		</ul>
		<ul>
			<li><span>类型</span></li>
			<?php
			echo $getlist->getReNavLiArr($fl_arr, $get_val, 'fl');
			?>
			<li><span>排序</span></li>
			<?php
			$px_arr = 'all,tj,jgd,jga,xl,yh';
			$px_arr_val = '综合,推荐&#8595;,价格&#8595;,价格&#8593;,销量&#8595;,优惠券&#8595;';
			$getlist->getNavLival($px_arr, $px_arr_val, $get_val, 'px');
			?>
		</ul>

	</div>
	<div class="container main clearfix">

		<ul class="goods-list clearfix">
			<?php
			$tmp = '';
			$r = 1;
			if ($nums > 0) {
				$qrarr = $pdo->query("SELECT * from " . TABLE . " " . $where . " " . $pxl . " limit " . $pagebegin . "," . $pagesize . "")->fetchAll(PDO::FETCH_ASSOC);
				$pdo = null;
				foreach ($qrarr as $res) {
					$huodong = '';
					if ($res['amount'] > 0) {
						$yhqje = preg_replace('/满(\d+)元减(\d+)元/i', '$2', $res['denomination']);
						$huodong = '<i class="yhq">' . $yhqje . '元券</i>';
						$huodong = str_replace('元无条件券元券', '元无条件券', $huodong);
					}
					if (!empty($res['hdprices'])) {
						if ($res['hdprices'] < $res['prices']) {
							if ($res['hdprices'] > $res['优惠价']) {
								$hdprices = '<span class="przk">' . ACT . ' ￥' . $res['优惠价'] . '</span>';
							} else {
								$hdprices = '<span class="przk">' . ACT . ' ￥' . $res['hdprices'] . '</span>';
							}
						} else {
							$hdprices = '';
						}
					} else {
						$hdprices = '';
						if ($res['优惠价'] < $res['prices']) {
							$hdprices = '<span class="przk">' . ACT . ' ￥' . $res['优惠价'] . '</span>';
						}
					}
					$tmp .= '<li><a href="/mall/id/' . $res['id'] . '.html"><div class="image"><img src="' . ($res['pic'] ?: $res['photo']) . '" alt="' . $res['goods'] . '"></div><div class="title">' . mb_substr($res['goods'], 0, 45, 'utf-8') . '</div><div class="price"><b>￥</b><span>' . $res['prices'] . '</span>' . $hdprices . $huodong . '</div><p class="products"><span>月销<em>' . $res['sales'] . '+</em></span><span>热度<b>' . $res['rank'] . '</b></span></p></a></li>';
					$r++;
				}
			} else {
				$tmp .= '<p>暂未相关商品，请搜索其他词再试一试！</p>';
			}
			echo $tmp;
			?>
		</ul>
		<div class="pagination">
			<div class="fanye">
				<?php
				echo $getlist->getReFenYe($get_val, $page, $perpage)
				?>
			</div>
		</div>
	</div>
	<div class="container clearfix">
		<p style="background:#fff;text-align:center;">
			<img src="https://ah.huatu.com/mall/picture/tmall-ensure.jpg" style="max-width:100%;">
		</p>
	</div>

	<div class="footer">
		<div class="container">
			<div class="wrap">
				<img src="https://ah.huatu.com/zt/a/top/images/nav_logo.gif" alt="">

				<p>
					蜀ICP备2023044056号-2 川公网安备51018002000144号
				</p>
			</div>
		</div>
	</div>
	<div class="fx_rigxf">
		<div class="fx_fdnav">
			<a class="rigxf_navbb" href="/mall/">首页</a>
			<a class="rigxf_navzx" href="/mall/list/" target="_self">搜索</a>
			<span class="rigxf_navdb hide"></span>
		</div>
	</div>
	<script type="text/javascript" src="https://ah.huatu.com/z/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="/mall/js/js.js"></script>
	<div style="display:none">
		<script type="text/javascript" src="https://ah.huatu.com/z/js/zztj.js"></script>
		<script type="text/javascript" src="https://ah.huatu.com/z/js/zztj/mall.js"></script>
	</div>
</body>

</html>