* Date: 2026-5-20
*/
if (!defined('ROOT_PATH')) { exit('Access Denied'); }
require_once __DIR__ . '/../_functions.php';
$recruitChannels = $db->fetchAll("SELECT * FROM {$db->table('channel')} WHERE channel_type = 9 AND is_show = 1 ORDER BY list_order ASC, id ASC");
$filterChannelId = intval($_GET['channel_id'] ?? 0);
$currentPage = max(1, intval($_GET['page'] ?? 1));
$pageSize = 8;
$heroChannel = !empty($recruitChannels[0]) ? $recruitChannels[0] : ['channel_name' => '人才招聘', 'channel_thumb' => ''];
$heroImage = k607_channel_hero_image($heroChannel, !empty($slides[0]['litpic']) ? $slides[0]['litpic'] : '');
$pageTitle = '人才招聘';
$where = " WHERE r.status = 1";
$params = [];
if ($filterChannelId > 0) {
$where .= " AND r.channel_id = ?";
$params[] = $filterChannelId;
}
$countRow = $db->fetch("SELECT COUNT(*) AS total FROM {$db->table('recruit')} r{$where}", $params);
$total = intval($countRow['total'] ?? 0);
$totalPages = max(1, (int) ceil($total / $pageSize));
$offset = ($currentPage - 1) * $pageSize;
$items = $db->fetchAll("SELECT r.*, c.channel_name FROM {$db->table('recruit')} r LEFT JOIN {$db->table('channel')} c ON r.channel_id = c.id{$where} ORDER BY r.create_time DESC LIMIT {$offset}, {$pageSize}", $params);
require_once __DIR__ . '/../_header.php';
?>