<?php
/**
 * 东方云端 · 站点首页
 *
 * 只有两个入口：运营后台 / 开发者中心。没有面向消费者的页面。
 */

require __DIR__ . '/includes/bootstrap.php';

$installed = c_installed();
$plugins   = 0;
$clients   = 0;

if ($installed) {
    try {
        $plugins = (int) db_val('SELECT COUNT(*) FROM ' . T('plugin') . ' WHERE status = 1', [], 0);
        $clients = (int) db_val('SELECT COUNT(*) FROM ' . T('client'), [], 0);
    } catch (Throwable $e) {
        $plugins = 0;
    }
}
?><!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>东方云端</title>
<link rel="stylesheet" href="<?= h(site_url('assets/css/app.css')) ?>">
</head>
<body class="land-body">
<main class="land">
  <div class="brand brand-light land-brand">
    <span class="dot"></span>
    <div>
      <strong>东方云端</strong>
      <small>版本分发 · 插件市场 · 开发者生态</small>
    </div>
  </div>

  <?php if (!$installed): ?>
    <p class="land-lead">系统还没有安装。</p>
    <a class="btn btn-primary btn-lg" href="<?= h(site_url('other/install.php')) ?>">开始安装</a>
  <?php else: ?>
    <div class="land-stats">
      <div><strong><?= $plugins ?></strong><span>在售插件</span></div>
      <div><strong><?= $clients ?></strong><span>已登记商城</span></div>
    </div>

    <div class="land-entries">
      <a class="land-card" href="<?= h(site_url('admin/')) ?>">
        <strong>运营后台</strong>
        <span>发版本、上架插件、看台账、结算分成</span>
      </a>
      <a class="land-card" href="<?= h(site_url('user/')) ?>">
        <strong>开发者中心</strong>
        <span>第三方开发者提交插件、查看收益</span>
      </a>
    </div>
  <?php endif; ?>

  <footer class="land-foot">
    接口入口 <code>/other/api.php</code>　|　支付回调 <code>/other/notify.php</code>
  </footer>
</main>
</body>
</html>
