<?php
/**
 * 芋头CMS
 * ============================================================================
 * 版权所有 2016-2028 沅陵县乌托邦网络服务有限公司，并保留所有权利。
 * 网站地址: http://www.yutoucms.cn
 * ----------------------------------------------------------------------------
 * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷。
 * ============================================================================
 * Author: 芋头 <mxgsf@qq.com>
 * Date: 2026-5-30
 */
if (!defined('ROOT_PATH')) { exit('Access Denied'); }
$pageTitle = '人才招聘';
$allChannels = $db->fetchAll("SELECT * FROM {$db->table('channel')} WHERE channel_type = 9 AND is_show = 1 ORDER BY list_order ASC, id ASC");
$curChannelId = isset($_GET['channel_id']) ? intval($_GET['channel_id']) : 0;
$currentNavId = $curChannelId ?: intval($channel['id'] ?? 0);
$sql = "SELECT r.*, c.channel_name FROM {$db->table('recruit')} r LEFT JOIN {$db->table('channel')} c ON r.channel_id=c.id WHERE r.status=1";
$params = [];
if ($curChannelId > 0) { $sql .= " AND r.channel_id = ?"; $params[] = $curChannelId; }
$sql .= " ORDER BY r.create_time DESC LIMIT 100";
$recruitList = $db->fetchAll($sql, $params);
require_once __DIR__ . '/../_header.php';
?>
<div class="bannern c" style="background:url(<?php echo $site['template_dir']; ?>static/upload/image/20220801/1659354277651388.jpg) no-repeat center;"></div>
<div class="n_cont c">
  <div class="jz c">
    <div class="ny_nav" id="my_sticky">
      <div class="wjssbt c">人才招聘</div>
      <ul class="wjsndh c">
        <?php foreach ($allChannels as $ch): ?>
        <li class="c"><a href="?m=recruit&channel_id=<?php echo $ch['id']; ?>"<?php echo $currentNavId === intval($ch['id']) ? ' style="background:#108dee;color:#fff;"' : ''; ?>><?php echo htmlspecialchars($ch['channel_name']); ?> <span>></span></a></li>
        <?php endforeach; ?>
      </ul>
      <div class="search_l">
        <form method="get" action="<?php echo getUrl('search'); ?>">
          <input type="hidden" name="m" value="search">
          <input type="text" class="ip" name="keyword" placeholder="请输入关键字">
          <input type="submit" class="btn" value="搜索">
        </form>
      </div>
    </div>
    <div class="ny_zqw ny_zqw_chb">
      <div class="nw_top"><span class="top_tzbt l">人才招聘</span><span class="top_mbx r am-icon-home">您的位置： <a href="<?php echo getUrl('home'); ?>">首页</a> >> <a href="javascript:;">人才招聘</a></span></div>
      <div class="h20"></div>
      <div class="bjbld">
        <div class="job_list_box">
          <?php foreach ($recruitList as $r): ?>
          <div class="job_item">
            <div class="job_top">
              <h3><?php echo htmlspecialchars($r['title']); ?></h3>
              <span class="job_more"><a href="<?php echo getUrl('recruit', $r['id']); ?>">查看详情</a></span>
            </div>
            <div class="job_meta">
              <?php if (!empty($r['department'])): ?><span>部门：<?php echo htmlspecialchars($r['department']); ?></span><?php endif; ?>
              <?php if (!empty($r['region'])): ?><span>地点：<?php echo htmlspecialchars($r['region']); ?></span><?php endif; ?>
              <?php if (!empty($r['salary'])): ?><span>薪资：<?php echo htmlspecialchars($r['salary']); ?></span><?php endif; ?>
            </div>
          </div>
          <?php endforeach; ?>
        </div>
      </div>
    </div>
  </div>
</div>
<?php require_once __DIR__ . '/../_footer.php'; ?>
