仰望星辰工作室

feat(qmzl_domain): 新增启明智联域名注册插件完整功能

Y yang1145 提交于 2026-08-08 10:32 · 21c348b ·父提交 7ad0145
feat(qmzl_domain): 新增启明智联域名注册插件完整功能

实现了客户自注册与代理商两种运营模式,包含:
1. 插件基础配置与数据库表结构
2. 后台账号管理、订单管理与设置页面
3. 用户端域名查询、购买、支付、账号绑定与我的域名功能
4. 完整的API对接文档
17 个文件变更 +4808 -0 13172193298@163.com
•app_plugins/qmzl_domain/admin/accounts.php +99 -0
•app_plugins/qmzl_domain/admin/orders.php +118 -0
•app_plugins/qmzl_domain/admin/settings.php +223 -0
•app_plugins/qmzl_domain/assets/qmzl.css +116 -0
•app_plugins/qmzl_domain/assets/qmzl.js +94 -0
•app_plugins/qmzl_domain/bootstrap.php +721 -0
•app_plugins/qmzl_domain/install.sql +52 -0
•app_plugins/qmzl_domain/lib/api.php +665 -0
•app_plugins/qmzl_domain/lib/helper.php +529 -0
•app_plugins/qmzl_domain/plugin.json +10 -0
•app_plugins/qmzl_domain/uninstall.sql +2 -0
•app_plugins/qmzl_domain/views/account.php +415 -0
•app_plugins/qmzl_domain/views/domains.php +172 -0
•app_plugins/qmzl_domain/views/index.php +443 -0
•app_plugins/qmzl_domain/views/pay.php +190 -0
•app_plugins/qmzl_domain/views/templates.php +422 -0
•"app_plugins/qmzl_domain/\345\237\237\345\220\215\346\263\250\345\206\214API\345\257\271\346\216\245\346\226\207\346\241\243.md" +537 -0
变更内容
diff --git a/app_plugins/qmzl_domain/admin/accounts.php b/app_plugins/qmzl_domain/admin/accounts.php
new file mode 100644
index 0000000..b8b0c09
--- /dev/null
+++ b/app_plugins/qmzl_domain/admin/accounts.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * qmzl_domain - 后台用户云账号管理
+ * 查看 / 解绑各用户绑定的启明智联平台账号。
+ */
+if (!defined('IN_CRONLITE')) exit;
+mnbt_admin_include('head');
+?>
+<div class="container-fluid p-t-15">
+  <div class="card">
+    <header class="card-header"><div class="card-title">启明智联域名 - 用户云账号</div></header>
+    <div class="card-body">
+      <div class="callout callout-info">
+        <p class="small">展示所有绑定启明智联平台账号的用户。账号密码加密存储于 <code>plg_qmzl_account</code>,此处仅用于排查与支持。</p>
+      </div>
+      <div id="toolbar" class="toolbar-btn-action">
+        <div class="form-inline">
+          <input type="text" class="form-control" id="search_keyword" placeholder="用户名 / 平台账号" style="width:220px;margin-right:8px;">
+          <button type="button" class="btn btn-primary" onclick="loadList(1)">
+            <span class="mdi mdi-magnify"></span> 查询
+          </button>
+        </div>
+      </div>
+      <table id="tb_accounts" data-page-size="10"></table>
+    </div>
+  </div>
+</div>
+
+<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/bootstrap-table.min.js')?>"></script>
+<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')?>"></script>
+
+<script type="text/javascript">
+var $table = $("#tb_accounts");
+
+function loadList(page) {
+  msloading('加载中...');
+  $.post('ajax.php', {
+    gn: 'p_qmzl_admin_accounts',
+    page: 1,
+    limit: 1000,
+    keyword: $('#search_keyword').val() || ''
+  }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk !== 1) { msalert(3, jsoe.msg || '加载失败', 4000); return; }
+    var data = jsoe.data || {};
+    $table.bootstrapTable('load', {
+      total: data.total || 0,
+      rows: data.rows || []
+    });
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+
+function unbindAccount(userId, username) {
+  if (!confirm('确定解绑用户 ' + username + ' 的启明智联账号?')) return;
+  msloading('处理中...');
+  $.post('ajax.php', { gn: 'p_qmzl_admin_account_unbind', user_id: userId }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk === 1) { msalert(1, '已解绑', 3000); loadList(1); }
+    else { msalert(3, jsoe.msg || '解绑失败', 4000); }
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+
+$(function () {
+  $table.bootstrapTable({
+    columns: [
+      { field: 'id', title: 'ID', width: 60, align: 'center' },
+      { field: 'user_id', title: '用户ID', width: 80, align: 'center' },
+      { field: 'username', title: '用户名' },
+      { field: 'account', title: '平台账号' },
+      {
+        field: 'status', title: '状态', width: 90, align: 'center',
+        formatter: function (v) {
+          return v === 'error'
+            ? '<span class="label label-danger">异常</span>'
+            : '<span class="label label-success">正常</span>';
+        }
+      },
+      { field: 'last_msg', title: '最近信息', formatter: function (v) { return v || '-'; } },
+      { field: 'created_at', title: '绑定时间' },
+      { field: 'updated_at', title: '更新时间' },
+      {
+        field: 'op', title: '操作', width: 100, align: 'center', formatter: function (v, r) {
+          return '<button type="button" class="btn btn-xs btn-danger" onclick="unbindAccount(' + (parseInt(r.user_id, 10) || 0) + ',\'' + (r.username || '').replace(/'/g, '') + '\')">解绑</button>';
+        }
+      }
+    ],
+    pagination: true,
+    sidePagination: 'client',
+    pageSize: 10,
+    pageList: [10, 20, 50],
+    showRefresh: false
+  });
+  loadList(1);
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/admin/orders.php b/app_plugins/qmzl_domain/admin/orders.php
new file mode 100644
index 0000000..1b99fc2
--- /dev/null
+++ b/app_plugins/qmzl_domain/admin/orders.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * qmzl_domain - 后台订单记录
+ * 全部域名订单(client 模式上游订单 / agent 模式本地订单),支持失败重试。
+ */
+if (!defined('IN_CRONLITE')) exit;
+mnbt_admin_include('head');
+$mode = qmzl_mode();
+?>
+<div class="container-fluid p-t-15">
+  <div class="card">
+    <header class="card-header"><div class="card-title">启明智联域名 - 订单记录</div></header>
+    <div class="card-body">
+      <div class="callout callout-info">
+        <p class="small">
+          当前模式:<strong><?= $mode === 'agent' ? '代理商模式' : '客户自注册' ?></strong>。
+          <?= $mode === 'agent' ? '代理商模式下,支付成功且上游余额支付成功的订单显示「已支付」;余额不足的订单显示「失败」,可在补足余额后点击「重试注册」。' : '客户自注册模式下,订单支付发生在启明智联平台,本表记录下单与支付状态。' ?>
+        </p>
+      </div>
+      <div id="toolbar" class="toolbar-btn-action">
+        <div class="form-inline">
+          <select class="form-control" id="f_status" style="width:120px;margin-right:8px;">
+            <option value="">全部状态</option>
+            <option value="Pending">待支付</option>
+            <option value="Paid">已支付</option>
+            <option value="Failed">失败</option>
+            <option value="Cancelled">已取消</option>
+          </select>
+          <input type="text" class="form-control" id="f_keyword" placeholder="域名 / 用户 / 订单号" style="width:220px;margin-right:8px;">
+          <button type="button" class="btn btn-primary" onclick="loadList(1)">
+            <span class="mdi mdi-magnify"></span> 查询
+          </button>
+        </div>
+      </div>
+      <table id="tb_orders" data-page-size="20"></table>
+    </div>
+  </div>
+</div>
+
+<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/bootstrap-table.min.js')?>"></script>
+<script type="text/javascript" src="<?=mnbt_asset_url('js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')?>"></script>
+
+<script type="text/javascript">
+var $table = $("#tb_orders");
+var QZ_MODE = '<?= $mode ?>';
+
+function loadList(page) {
+  msloading('加载中...');
+  $.post('ajax.php', {
+    gn: 'p_qmzl_admin_orders',
+    page: page || 1,
+    limit: 20,
+    status: $('#f_status').val() || '',
+    keyword: $('#f_keyword').val() || ''
+  }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk !== 1) { msalert(3, jsoe.msg || '加载失败', 4000); return; }
+    var data = jsoe.data || {};
+    $table.bootstrapTable('load', {
+      total: data.total || 0,
+      rows: data.rows || []
+    });
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+
+function retryOrder(id) {
+  if (!confirm('确定重新为该订单执行上游注册?(将再次加入购物车、结算并用代理商余额支付)')) return;
+  msloading('处理中...');
+  $.post('ajax.php', { gn: 'p_qmzl_admin_order_retry', id: id }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk === 1) { msalert(1, jsoe.msg || '重试成功', 4000); loadList(1); }
+    else { msalert(3, jsoe.msg || '重试失败', 4000); }
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+
+$(function () {
+  $table.bootstrapTable({
+    columns: [
+      { field: 'id', title: 'ID', width: 60, align: 'center' },
+      { field: 'username', title: '用户', width: 100 },
+      { field: 'domain', title: '域名' },
+      { field: 'year', title: '年限', width: 70, align: 'center', formatter: function (v) { return v + ' 年'; } },
+      { field: 'amount', title: '金额', width: 90, align: 'center', formatter: function (v) { return '¥' + (v || '0.00'); } },
+      { field: 'gateway', title: '支付方式', width: 130, formatter: function (v) { return v || '-'; } },
+      {
+        field: 'status', title: '状态', width: 90, align: 'center',
+        formatter: function (v) {
+          var map = { Pending: ['待支付', 'warning'], Paid: ['已支付', 'success'], Failed: ['失败', 'danger'], Cancelled: ['已取消', 'default'] };
+          var m = map[v] || [v || '未知', 'default'];
+          return '<span class="label label-' + m[1] + '">' + m[0] + '</span>';
+        }
+      },
+      { field: 'remark', title: '备注', formatter: function (v) { return v || '-'; } },
+      { field: 'ddh', title: '本站订单号', formatter: function (v) { return v || '-'; } },
+      { field: 'cloud_order_id', title: '上游订单号', formatter: function (v) { return v || '-'; } },
+      { field: 'created_at', title: '下单时间', width: 150 },
+      {
+        field: 'op', title: '操作', width: 110, align: 'center', formatter: function (v, r) {
+          if (QZ_MODE === 'agent' && r.status === 'Failed') {
+            return '<button type="button" class="btn btn-xs btn-danger" onclick="retryOrder(' + (parseInt(r.id, 10) || 0) + ')">重试注册</button>';
+          }
+          return '<span class="text-muted">-</span>';
+        }
+      }
+    ],
+    pagination: true,
+    sidePagination: 'client',
+    pageSize: 20,
+    pageList: [20, 50, 100],
+    showRefresh: false
+  });
+  loadList(1);
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/admin/settings.php b/app_plugins/qmzl_domain/admin/settings.php
new file mode 100644
index 0000000..9274cb2
--- /dev/null
+++ b/app_plugins/qmzl_domain/admin/settings.php
@@ -0,0 +1,223 @@
+<?php
+/**
+ * qmzl_domain - 后台插件设置
+ * 运营模式切换 + 代理商账号配置。
+ */
+if (!defined('IN_CRONLITE')) exit;
+mnbt_admin_include('head');
+$enabled  = qmzl_setting_get('enabled', 'true') === 'true';
+$mode     = qmzl_mode();
+$agentUsername = (string)qmzl_setting_get('agent_username', '');
+$agentStatus  = (string)qmzl_setting_get('agent_status', '');
+$agentMsg     = (string)qmzl_setting_get('agent_msg', '');
+$agentExp     = (int)qmzl_setting_get('agent_jwt_expire', 0);
+$markupMap  = qmzl_markup_map();
+$agentSuffixes = [];
+if ($mode === 'agent') {
+	$tok = qmzl_agent_token();
+	if ($tok['ok']) {
+		$cfg = qmzl_config($tok['data']['jwt']);
+		if ($cfg['ok'] && !empty($cfg['data']['specify_search_domain']) && is_array($cfg['data']['specify_search_domain'])) {
+			$agentSuffixes = $cfg['data']['specify_search_domain'];
+		}
+	}
+}
+// 合并已配置溢价的未列出后缀,并补全默认后缀兜底
+if (empty($agentSuffixes)) $agentSuffixes = ['.com', '.cn', '.net', '.com.cn', '.top', '.xyz'];
+$suffixSet = [];
+foreach ($agentSuffixes as $s) {
+	$suffixSet[trim((string)$s)] = true;
+}
+foreach (array_keys($markupMap) as $s) {
+	if (!isset($suffixSet[$s])) $suffixSet[$s] = true;
+}
+$suffixList = array_keys($suffixSet);
+?>
+<div class="container-fluid p-t-15">
+  <div class="row">
+    <div class="col-lg-8">
+      <div class="card">
+        <header class="card-header"><div class="card-title">启明智联域名注册 - 插件设置</div></header>
+        <div class="card-body">
+
+          <div class="callout callout-info">
+            <p class="small">
+              本插件对接 <strong>启明智联平台</strong> 域名注册 API(地址写死:<code>https://cloud.qimingidc.cn/console/v1</code>)。<br>
+              <strong>前置依赖:</strong>需要先安装并启用 <code>user_info</code> 插件(独立用户系统)。
+            </p>
+          </div>
+
+          <div class="form-group">
+            <label class="btn-block">用户端功能开关</label>
+            <div class="col-xs-6">
+              <div class="custom-control custom-switch custom-info">
+                <input type="checkbox" class="custom-control-input" name="enabled" id="enabled" <?= $enabled ? 'checked' : '' ?>>
+                <label class="custom-control-label" for="enabled">启用后,用户端提供域名注册功能</label>
+              </div>
+            </div>
+          </div>
+
+          <div class="form-group">
+            <label class="control-label">运营模式</label>
+            <select class="form-control" id="mode" style="max-width:420px;" onchange="toggleMode()">
+              <option value="client" <?= $mode === 'client' ? 'selected' : '' ?>>客户自注册(每个客户绑定自己的启明智联账号,支付跳转上游)</option>
+              <option value="agent" <?= $mode === 'agent' ? 'selected' : '' ?>>代理商模式(用管理员账号代注册,客户走本站支付系统)</option>
+            </select>
+            <small class="text-muted">
+              客户自注册入口:<code>index.php?_r=/qmzl</code>;
+              代理商模式入口:<code>index.php?_r=/qmzl_domain</code>
+            </small>
+          </div>
+
+          <div class="form-group">
+            <button type="button" class="btn btn-primary" onclick="saveSetting()">
+              <span class="mdi mdi-content-save"></span> 保存设置
+            </button>
+          </div>
+        </div>
+      </div>
+
+      <!-- 代理商模式配置 -->
+      <div class="card" id="agent-card" style="<?= $mode === 'agent' ? '' : 'display:none;' ?>">
+        <header class="card-header"><div class="card-title">代理商鉴权(开放接口 API 密钥)</div></header>
+        <div class="card-body">
+          <div class="callout callout-info">
+            <p class="small">
+              上游登录需人机验证,无法用密码自动换取凭证。管理员请使用 <strong>开放接口鉴权</strong>:
+              在 <a href="https://cloud.qimingidc.cn" target="_blank">cloud.qimingidc.cn</a> 控制台 → 「API密钥」→ 创建,得到 API 密钥 token;
+              此处填写平台注册账号(邮箱/手机号)与 API 密钥,插件调用 <code>POST /api/v1/auth</code> 自动换取 JWT(过期自动续期,无需人机验证),
+              并用于代注册与余额支付。
+            </p>
+          </div>
+          <?php if ($agentUsername !== ''): ?>
+            <div class="callout <?= $agentStatus === 'error' ? 'callout-danger' : 'callout-success' ?>">
+              <p class="small">
+                当前代理商账号:<code><?= htmlspecialchars($agentUsername, ENT_QUOTES, 'UTF-8') ?></code>
+                <?php if ($agentStatus === 'error'): ?>
+                  <br><span class="text-danger">最近鉴权失败:<?= htmlspecialchars($agentMsg, ENT_QUOTES, 'UTF-8') ?></span>
+                <?php else: ?>
+                  <br><span class="text-success">鉴权正常<?= $agentExp > 0 ? ',凭证有效期至 ' . date('Y-m-d H:i', $agentExp) : '' ?></span>
+                <?php endif; ?>
+              </p>
+            </div>
+          <?php endif; ?>
+          <div class="form-group">
+            <label class="control-label">平台账号(注册邮箱/手机号)</label>
+            <input type="text" class="form-control" id="agent_username" placeholder="启明智联平台注册账号" style="max-width:420px;" value="<?= htmlspecialchars($agentUsername, ENT_QUOTES, 'UTF-8') ?>">
+          </div>
+          <div class="form-group">
+            <label class="control-label">API 密钥 token</label>
+            <input type="password" class="form-control" id="agent_api_token" placeholder="控制台 → API密钥 → 创建 得到的 token" style="max-width:420px;" autocomplete="off">
+          </div>
+          <div class="form-group">
+            <button type="button" class="btn btn-info" onclick="agentTest()">
+              <span class="mdi mdi-connection"></span> 验证并保存
+            </button>
+          </div>
+        </div>
+      </div>
+
+      <!-- 后缀溢价(仅代理商模式) -->
+      <div class="card" id="markup-card" style="<?= $mode === 'agent' ? '' : 'display:none;' ?>">
+        <header class="card-header"><div class="card-title">后缀溢价(代理商模式)</div></header>
+        <div class="card-body">
+          <div class="callout callout-info">
+            <p class="small">为各后缀设置<b>一次性溢价</b>(元):客户下单时将在上游价格基础上加收该金额,并计入本站支付订单金额。留空或填 0 表示不加价。修改后点「保存设置」生效。</p>
+          </div>
+          <table class="table table-bordered" style="max-width:520px;">
+            <thead>
+              <tr><th style="width:140px;">后缀</th><th>溢价(元)</th><th style="width:60px;"></th></tr>
+            </thead>
+            <tbody id="markup-tbody">
+              <?php foreach ($suffixList as $s): ?>
+                <tr>
+                  <td><input type="text" class="form-control mk-suffix" value="<?= htmlspecialchars($s, ENT_QUOTES, 'UTF-8') ?>" style="font-family:monospace;"></td>
+                  <td><input type="number" class="form-control mk-amount" step="0.01" min="0" value="<?= htmlspecialchars((string)($markupMap[$s] ?? ''), ENT_QUOTES, 'UTF-8') ?>" placeholder="0"></td>
+                  <td><button type="button" class="btn btn-xs btn-danger" onclick="$(this).closest('tr').remove()">删除</button></td>
+                </tr>
+              <?php endforeach; ?>
+            </tbody>
+          </table>
+          <button type="button" class="btn btn-xs btn-default" onclick="addMarkupRow()">
+            <span class="mdi mdi-plus"></span> 添加后缀
+          </button>
+        </div>
+      </div>
+    </div>
+
+    <div class="col-lg-4">
+      <div class="card">
+        <header class="card-header"><div class="card-title">说明</div></header>
+        <div class="card-body">
+          <p class="small text-muted">
+            <strong>客户自注册模式:</strong>客户在「云账号」页绑定自己的启明智联账号(需完成人机验证),查询/价格/信息模板均以客户账号数据为准,下单后跳转上游支付。
+          </p>
+          <p class="small text-muted">
+            <strong>代理商模式:</strong>管理员配置平台账号 + API 密钥(开放接口鉴权,无需人机验证,JWT 过期自动续期)。客户下单走本站支付系统(MN_dd + 已启用的支付插件),支付成功后自动代注册并扣减账户余额。余额不足时订单标记为失败,可在「订单记录」中重试。
+          </p>
+          <p class="small text-muted">
+            <strong>信息模板:</strong>两种模式下客户都需先创建并完成实名认证的信息模板;代理商模式下模板创建在管理员账号名下。
+          </p>
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+
+<script type="text/javascript">
+function toggleMode() {
+  var agent = $('#mode').val() === 'agent';
+  $('#agent-card').toggle(agent);
+  $('#markup-card').toggle(agent);
+}
+
+function addMarkupRow() {
+  $('#markup-tbody').append(
+    '<tr>' +
+      '<td><input type="text" class="form-control mk-suffix" style="font-family:monospace;" placeholder=".com"></td>' +
+      '<td><input type="number" class="form-control mk-amount" step="0.01" min="0" placeholder="0"></td>' +
+      '<td><button type="button" class="btn btn-xs btn-danger" onclick="$(this).closest(\'tr\').remove()">删除</button></td>' +
+    '</tr>'
+  );
+}
+
+function saveSetting() {
+  var markup = {};
+  $('#markup-tbody tr').each(function () {
+    var suffix = $.trim($(this).find('.mk-suffix').val());
+    var amount = parseFloat($(this).find('.mk-amount').val());
+    if (suffix && !isNaN(amount) && amount > 0) markup[suffix] = amount;
+  });
+  msloading('保存中...');
+  $.post('ajax.php', {
+    gn: 'p_qmzl_setting_save',
+    enabled: $('#enabled').prop('checked') ? 1 : 0,
+    mode: $('#mode').val(),
+    markup: JSON.stringify(markup)
+  }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk === 1) { msalert(1, '保存成功', 4000); }
+    else { msalert(3, jsoe.msg || '保存失败', 4000); }
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+
+function agentTest() {
+  var username = $('#agent_username').val();
+  var apiToken = $('#agent_api_token').val();
+  if (!username || !apiToken) { msalert(3, '请填写平台账号和 API 密钥', 4000); return; }
+  msloading('验证中...');
+  $.post('ajax.php', {
+    gn: 'p_qmzl_agent_test',
+    username: username,
+    api_token: apiToken
+  }, function (date) {
+    msloadingde();
+    var jsoe = typeof date === 'string' ? JSON.parse(date) : date;
+    if (jsoe.qk === 1) { msalert(1, '验证成功,代理商凭证已保存', 4000); }
+    else { msalert(3, jsoe.msg || '验证失败', 4000); }
+  }).fail(function () { msloadingde(); msalert(3, '网络错误', 4000); });
+}
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/assets/qmzl.css b/app_plugins/qmzl_domain/assets/qmzl.css
new file mode 100644
index 0000000..e649df5
--- /dev/null
+++ b/app_plugins/qmzl_domain/assets/qmzl.css
@@ -0,0 +1,116 @@
+/* qmzl_domain 插件共享样式(用户端自包含页面) */
+*,
+*::before,
+*::after { box-sizing: border-box; }
+
+:root {
+  --qz-brand: #4f46e5;
+  --qz-brand-dark: #4338ca;
+  --qz-brand-soft: #eef2ff;
+  --qz-bg: #f4f6fb;
+  --qz-card: #ffffff;
+  --qz-border: #e6e8f0;
+  --qz-text: #1f2937;
+  --qz-text-2: #6b7280;
+  --qz-text-3: #9ca3af;
+  --qz-danger: #dc2626;
+  --qz-success: #16a34a;
+  --qz-warn: #d97706;
+  --qz-radius: 12px;
+  --qz-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);
+}
+.qz-wrap { width: 100%; max-width: 960px; margin: 0 auto; }
+.qz-head { margin-bottom: 20px; }
+.qz-head h1 { margin: 0; font-size: 22px; color: var(--qz-text); }
+.qz-head p { margin: 6px 0 0; color: var(--qz-text-2); }
+.qz-card {
+  background: var(--qz-card);
+  border: 1px solid var(--qz-border);
+  border-radius: var(--qz-radius);
+  box-shadow: var(--qz-shadow);
+  margin-bottom: 18px;
+}
+.qz-card-head { padding: 14px 20px; border-bottom: 1px solid #f0f1f6; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
+.qz-card-head h3 { margin: 0; font-size: 16px; color: var(--qz-text); }
+.qz-card-body { padding: 20px; }
+.qz-btn {
+  display: inline-flex; align-items: center; gap: 6px;
+  padding: 8px 18px; border-radius: 8px; border: 1px solid transparent;
+  font-size: 14px; font-weight: 500; cursor: pointer; transition: all .18s;
+  background: var(--qz-brand); color: #fff; text-decoration: none; line-height: 1.4;
+}
+.qz-btn:hover { background: var(--qz-brand-dark); color: #fff; text-decoration: none; }
+.qz-btn:disabled { opacity: .55; cursor: not-allowed; }
+.qz-btn--ghost { background: #fff; color: var(--qz-text-2); border-color: var(--qz-border); }
+.qz-btn--ghost:hover { background: #f6f7fb; color: var(--qz-text); }
+.qz-btn--danger { background: #fff; color: var(--qz-danger); border-color: #f3c9c9; }
+.qz-btn--danger:hover { background: #fef2f2; }
+.qz-btn--sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
+.qz-input, .qz-select, .qz-textarea {
+  width: 100%; padding: 9px 12px; border: 1px solid var(--qz-border); border-radius: 8px;
+  font-size: 14px; color: var(--qz-text); background: #fff; outline: none; transition: border-color .18s, box-shadow .18s;
+}
+.qz-input:focus, .qz-select:focus, .qz-textarea:focus { border-color: var(--qz-brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
+.qz-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
+.qz-form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
+.qz-form-item { display: flex; flex-direction: column; gap: 6px; }
+.qz-form-item--full { grid-column: 1 / -1; }
+.qz-form-item label { font-size: 13px; color: var(--qz-text-2); }
+.qz-form-item .req { color: var(--qz-danger); }
+.qz-hint { font-size: 12px; color: var(--qz-text-3); }
+.qz-tip {
+  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; line-height: 1.6;
+  background: var(--qz-brand-soft); border: 1px solid #dfe4ff; color: #3730a3;
+}
+.qz-tip--danger { background: #fef2f2; border-color: #f3c9c9; color: #991b1b; }
+.qz-tip--success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
+.qz-tip--warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
+.qz-table { width: 100%; border-collapse: collapse; font-size: 14px; }
+.qz-table th, .qz-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #f0f1f6; }
+.qz-table th { color: var(--qz-text-2); font-weight: 500; background: #fafbfd; white-space: nowrap; }
+.qz-table td { color: var(--qz-text); }
+.qz-table tr:last-child td { border-bottom: none; }
+.qz-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
+.qz-badge--green { background: #dcfce7; color: #15803d; }
+.qz-badge--gray { background: #f1f3f6; color: #6b7280; }
+.qz-badge--red { background: #fee2e2; color: #b91c1c; }
+.qz-badge--yellow { background: #fef9c3; color: #a16207; }
+.qz-badge--blue { background: #dbeafe; color: #1d4ed8; }
+.qz-empty { text-align: center; padding: 40px 16px; color: var(--qz-text-3); font-size: 14px; }
+.qz-loading { text-align: center; padding: 32px 16px; color: var(--qz-text-3); }
+.qz-actions { display: flex; gap: 8px; flex-wrap: wrap; }
+.qz-actions .qz-btn { white-space: nowrap; }
+.qz-mask { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 900; display: none; align-items: center; justify-content: center; padding: 16px; }
+.qz-mask.show { display: flex; }
+.qz-modal { background: #fff; border-radius: 14px; max-width: 680px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 24px 60px -12px rgba(16,24,40,.35); }
+.qz-modal-head { padding: 16px 22px; border-bottom: 1px solid #f0f1f6; display: flex; align-items: center; justify-content: space-between; }
+.qz-modal-head h3 { margin: 0; font-size: 16px; }
+.qz-modal-close { background: none; border: none; font-size: 22px; color: var(--qz-text-3); cursor: pointer; line-height: 1; padding: 4px; }
+.qz-modal-body { padding: 20px 22px; }
+.qz-modal-foot { padding: 14px 22px; border-top: 1px solid #f0f1f6; display: flex; justify-content: flex-end; gap: 10px; }
+.qz-toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 1200; padding: 10px 20px; border-radius: 8px; font-size: 14px; color: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
+.qz-toast.show { opacity: 1; }
+.qz-toast--success { background: #10b981; }
+.qz-toast--error { background: #ef4444; }
+.qz-toast--info { background: #4f46e5; }
+.qz-search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
+.qz-search-row .qz-input { flex: 1; min-width: 200px; }
+.qz-search-row .qz-select { width: auto; min-width: 110px; }
+.qz-tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; background: #f1f3f6; color: var(--qz-text-2); margin: 2px 4px 2px 0; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
+.qz-tag:hover { border-color: var(--qz-border); }
+.qz-tag.on { background: var(--qz-brand-soft); color: var(--qz-brand); border-color: var(--qz-brand); }
+.qz-monospace { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; }
+.qz-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
+.qz-grow { flex: 1; min-width: 0; }
+.qz-muted { color: var(--qz-text-3); font-size: 12px; }
+.qz-price { font-size: 15px; font-weight: 600; color: var(--qz-text); }
+.qz-price em { color: var(--qz-brand); font-style: normal; }
+.qz-seg { display: inline-flex; border: 1px solid var(--qz-border); border-radius: 8px; overflow: hidden; }
+.qz-seg button { padding: 7px 14px; border: none; background: #fff; font-size: 13px; color: var(--qz-text-2); cursor: pointer; transition: all .15s; }
+.qz-seg button.on { background: var(--qz-brand); color: #fff; }
+@media (max-width: 640px) {
+  .qz-form-grid, .qz-form-grid--3 { grid-template-columns: 1fr; }
+  .qz-card-body { padding: 14px; }
+  .qz-table { font-size: 13px; }
+  .qz-table th, .qz-table td { padding: 9px 8px; }
+}
diff --git a/app_plugins/qmzl_domain/assets/qmzl.js b/app_plugins/qmzl_domain/assets/qmzl.js
new file mode 100644
index 0000000..848fb56
--- /dev/null
+++ b/app_plugins/qmzl_domain/assets/qmzl.js
@@ -0,0 +1,94 @@
+/* qmzl_domain 插件共享 JS 工具 */
+window.QZ = (function () {
+  function esc(s) {
+    return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
+      return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c];
+    });
+  }
+
+  function toast(msg, type) {
+    type = type || 'info';
+    var old = document.querySelector('.qz-toast');
+    if (old) old.remove();
+    var el = document.createElement('div');
+    el.className = 'qz-toast qz-toast--' + type;
+    el.textContent = msg;
+    document.body.appendChild(el);
+    requestAnimationFrame(function () { el.classList.add('show'); });
+    setTimeout(function () { el.classList.remove('show'); setTimeout(function () { el.remove(); }, 300); }, 2600);
+  }
+
+  /** POST 到指定路由 URL(自动带 CSRF),成功回调 res,失败回调 (msg) */
+  function post(url, params, ok, fail) {
+    params = params || {};
+    $.ajax({
+      url: url,
+      type: 'POST',
+      data: params,
+      dataType: 'json',
+      timeout: 90000
+    }).done(function (res) {
+      if (res && (res.qk === 1 || res.success === true)) {
+        if (typeof ok === 'function') ok(res);
+      } else {
+        if (res && res.login_url) { window.location.href = res.login_url; return; }
+        if (typeof fail === 'function') fail((res && res.msg) || '请求失败');
+        else toast((res && res.msg) || '请求失败', 'error');
+      }
+    }).fail(function (xhr) {
+      var msg = '网络错误,请稍后重试';
+      try {
+        var j = xhr.responseJSON;
+        if (j && j.msg) msg = j.msg;
+        if (j && j.login_url) { window.location.href = j.login_url; return; }
+      } catch (e) {}
+      if (typeof fail === 'function') fail(msg);
+      else toast(msg, 'error');
+    });
+  }
+
+  /** FormData POST(文件上传),成功回调 res,失败回调 (msg) */
+  function postForm(url, formData, ok, fail) {
+    formData = formData || new FormData();
+    $.ajax({
+      url: url,
+      type: 'POST',
+      data: formData,
+      processData: false,
+      contentType: false,
+      dataType: 'json',
+      timeout: 120000
+    }).done(function (res) {
+      if (res && (res.qk === 1 || res.success === true)) {
+        if (typeof ok === 'function') ok(res);
+      } else {
+        if (res && res.login_url) { window.location.href = res.login_url; return; }
+        if (typeof fail === 'function') fail((res && res.msg) || '请求失败');
+        else toast((res && res.msg) || '请求失败', 'error');
+      }
+    }).fail(function (xhr) {
+      var msg = '网络错误,请稍后重试';
+      try {
+        var j = xhr.responseJSON;
+        if (j && j.msg) msg = j.msg;
+        if (j && j.login_url) { window.location.href = j.login_url; return; }
+      } catch (e) {}
+      if (typeof fail === 'function') fail(msg);
+      else toast(msg, 'error');
+    });
+  }
+
+  function loading(show) {
+    var el = document.getElementById('qz-loading');
+    if (!el) {
+      el = document.createElement('div');
+      el.id = 'qz-loading';
+      el.style.cssText = 'position:fixed;inset:0;background:rgba(255,255,255,.7);z-index:999;display:none;align-items:center;justify-content:center;';
+      el.innerHTML = '<span style="font-size:14px;color:#6b7280;">处理中...</span>';
+      document.body.appendChild(el);
+    }
+    el.style.display = show ? 'flex' : 'none';
+  }
+
+  return { esc: esc, toast: toast, post: post, postForm: postForm, loading: loading };
+})();
diff --git a/app_plugins/qmzl_domain/bootstrap.php b/app_plugins/qmzl_domain/bootstrap.php
new file mode 100644
index 0000000..22bc22f
--- /dev/null
+++ b/app_plugins/qmzl_domain/bootstrap.php
@@ -0,0 +1,721 @@
+<?php
+/**
+ * qmzl_domain 插件入口
+ *
+ * 对接启明智联平台域名注册 API(https://cloud.qimingidc.cn/console/v1):
+ * - 前置依赖 user_info 插件,用户维度 = user_info 用户(MN_plugin_user)
+ *
+ * 两种运营模式(后台设置切换):
+ *  1. client 客户自注册:每个客户绑定自己的启明智联账号,查询/下单/支付均在客户账号内完成;
+ *     用户端路径:/qmzl
+ *  2. agent  代理商模式:管理员配置代理商账号,客户下单走 MNBT 内置支付系统
+ *     (MN_dd + 支付插件),支付成功后插件自动用代理商账号余额代注册;
+ *     用户端路径:/qmzl_domain
+ */
+if (!defined('IN_CRONLITE')) exit;
+
+require_once __DIR__ . '/lib/api.php';
+require_once __DIR__ . '/lib/helper.php';
+
+// 表结构自动升级(兼容已安装站点)
+qmzl_schema_upgrade();
+
+mnbt_plugin_register('qmzl_domain', ['name' => '启明智联域名注册']);
+
+/* ============================================================
+ * 1. 后台菜单
+ * ============================================================ */
+mnbt_register_menu('admin', [
+	'title'    => '启明智联域名',
+	'icon'     => 'mdi-web',
+	'order'    => 35,
+	'children' => [
+		[
+			'title'     => '插件设置',
+			'page'      => 'settings',
+			'icon'      => 'mdi-web',
+			'order'     => 10,
+			'multitabs' => true,
+		],
+		[
+			'title'     => '订单记录',
+			'page'      => 'orders',
+			'icon'      => 'mdi-receipt',
+			'order'     => 20,
+			'multitabs' => true,
+		],
+		[
+			'title'     => '用户云账号',
+			'page'      => 'accounts',
+			'icon'      => 'mdi-account-key',
+			'order'     => 30,
+			'multitabs' => true,
+		],
+	],
+]);
+
+mnbt_register_page('admin', 'settings', 'admin/settings.php', '启明智联域名设置');
+mnbt_register_page('admin', 'orders',   'admin/orders.php',   '域名订单记录');
+mnbt_register_page('admin', 'accounts', 'admin/accounts.php', '用户云账号');
+
+// 插件管理页快捷入口
+mnbt_register_settings_tab([
+	'title' => '启明智联域名',
+	'page'  => 'settings',
+	'order' => 30,
+]);
+
+/* ============================================================
+ * 2. 后台 AJAX
+ * ============================================================ */
+
+/** 保存插件设置(开关 + 模式 + 后缀溢价) */
+mnbt_register_ajax('admin', 'p_qmzl_setting_save', function () {
+	mnbt_plugin_require_admin();
+	$enabled = isset($_POST['enabled']) ? (bool)$_POST['enabled'] : true;
+	$mode = $_POST['mode'] ?? 'client';
+	$mode = ($mode === 'agent') ? 'agent' : 'client';
+	qmzl_setting_set('enabled', $enabled ? 'true' : 'false');
+	qmzl_setting_set('mode', $mode);
+
+	// 后缀溢价表 {"suffix": "溢价金额"}
+	$markup = [];
+	$raw = (string)($_POST['markup'] ?? '');
+	$arr = json_decode($raw, true);
+	if (is_array($arr)) {
+		foreach ($arr as $suffix => $val) {
+			$suffix = trim((string)$suffix);
+			$f = round((float)$val, 2);
+			if ($suffix !== '' && $f > 0) {
+				$markup[$suffix] = (string)$f;
+			}
+		}
+	}
+	qmzl_setting_set('agent_markup', json_encode($markup, JSON_UNESCAPED_SLASHES));
+	json_exit_success('已保存');
+});
+
+/** 保存并验证代理商开放接口凭证(平台账号 + API 密钥) */
+mnbt_register_ajax('admin', 'p_qmzl_agent_test', function () {
+	mnbt_plugin_require_admin();
+	$username = trim((string)($_POST['username'] ?? ''));
+	$apiToken = trim((string)($_POST['api_token'] ?? ''));
+	if ($username === '' || $apiToken === '') {
+		json_exit_error('请填写平台账号和 API 密钥');
+	}
+	$login = qmzl_agent_save($username, $apiToken);
+	if (!$login['ok']) {
+		json_exit_error($login['msg']);
+	}
+	json_exit_success('验证成功,代理商凭证已保存', ['exp' => $login['data']['exp']]);
+});
+
+/** 后台:用户云账号列表 */
+mnbt_register_ajax('admin', 'p_qmzl_admin_accounts', function () {
+	mnbt_plugin_require_admin();
+	$page    = max(1, (int)($_POST['page'] ?? 1));
+	$limit   = min(1000, max(1, (int)($_POST['limit'] ?? 200)));
+	$keyword = trim((string)($_POST['keyword'] ?? ''));
+	$data = qmzl_account_list($page, $limit, $keyword);
+	json_exit_success('ok', $data);
+});
+
+/** 后台:解绑某用户云账号 */
+mnbt_register_ajax('admin', 'p_qmzl_admin_account_unbind', function () {
+	mnbt_plugin_require_admin();
+	$user_id = (int)($_POST['user_id'] ?? 0);
+	if ($user_id <= 0) json_exit_error('参数错误');
+	if (!qmzl_account_delete($user_id)) json_exit_error('解绑失败');
+	json_exit_success('已解绑');
+});
+
+/** 后台:订单列表 */
+mnbt_register_ajax('admin', 'p_qmzl_admin_orders', function () {
+	mnbt_plugin_require_admin();
+	$page    = max(1, (int)($_POST['page'] ?? 1));
+	$limit   = min(200, max(1, (int)($_POST['limit'] ?? 20)));
+	$status  = trim((string)($_POST['status'] ?? ''));
+	$keyword = trim((string)($_POST['keyword'] ?? ''));
+	$data = qmzl_order_admin_list($page, $limit, $status, $keyword);
+	json_exit_success('ok', $data);
+});
+
+/** 后台:重试失败的代理商注册订单 */
+mnbt_register_ajax('admin', 'p_qmzl_admin_order_retry', function () {
+	mnbt_plugin_require_admin();
+	$id = (int)($_POST['id'] ?? 0);
+	$order = qmzl_order_get_by_id($id);
+	if (!$order) json_exit_error('订单不存在');
+	if (qmzl_mode() !== 'agent') json_exit_error('仅代理商模式支持重试注册');
+	$r = qmzl_agent_register_domain($id);
+	if (!$r['ok']) json_exit_error($r['msg']);
+	json_exit_success($r['msg']);
+});
+
+/* ============================================================
+ * 3. 钩子:代理商模式支付成功后自动注册
+ * ============================================================ */
+mnbt_add_action('order.paid', function ($order_row, $ctx = []) {
+	if (!is_array($order_row)) return;
+	if (qmzl_mode() !== 'agent') return;
+	if (($order_row['lx'] ?? '') !== 'qmzl_domain') return;
+	$ddh = (string)($order_row['ddh'] ?? '');
+	if ($ddh === '') return;
+	$local = qmzl_order_get_by_ddh($ddh);
+	if (!$local) return;
+	if (($local['status'] ?? '') === 'Paid') return; // 已注册
+	$r = qmzl_agent_register_domain((int)$local['id']);
+	if (function_exists('mnbt_log')) {
+		mnbt_log('系统', '插件-qmzl_domain', '代理商注册域名 ' . $local['domain'] . ':' . ($r['msg'] ?? ''), $r['ok'] ? '成功' : '失败', $GLOBALS['DB']);
+	}
+}, 10);
+
+/* ============================================================
+ * 4. 用户端(受后台「用户端功能开关」控制,依赖 user_info)
+ * ============================================================ */
+if (qmzl_setting_get('enabled', 'true') === 'true') {
+
+$qzRoute = qmzl_route_prefix(); // client → qmzl / agent → qmzl_domain
+
+/* ---------- 4.1 页面路由 ---------- */
+
+// 域名注册(查询/价格/下单)
+mnbt_register_route('GET', '/' . $qzRoute, function ($params, $ctx) {
+	$user = qmzl_require_user();
+	qmzl_render('index', ['current_user' => $user, 'mode' => qmzl_mode()]);
+});
+
+// 信息模板
+mnbt_register_route('GET', '/' . $qzRoute . '/templates', function ($params, $ctx) {
+	$user = qmzl_require_user();
+	qmzl_render('templates', ['current_user' => $user, 'mode' => qmzl_mode()]);
+});
+
+// 我的域名
+mnbt_register_route('GET', '/' . $qzRoute . '/domains', function ($params, $ctx) {
+	$user = qmzl_require_user();
+	qmzl_render('domains', ['current_user' => $user, 'mode' => qmzl_mode()]);
+});
+
+// 云账号绑定(仅 client 模式)
+if (qmzl_mode() === 'client') {
+	mnbt_register_route('GET', '/' . $qzRoute . '/account', function ($params, $ctx) {
+		$user = qmzl_require_user();
+		qmzl_render('account', ['current_user' => $user, 'mode' => 'client']);
+	});
+
+	// 支付页(?order=上游订单号,仅 client 模式)
+	mnbt_register_route('GET', '/' . $qzRoute . '/pay', function ($params, $ctx) {
+		$user = qmzl_require_user();
+		$orderId = isset($_GET['order']) ? (int)$_GET['order'] : 0;
+		$order = $orderId > 0 ? qmzl_order_get($orderId) : false;
+		$valid = $order && (int)$order['user_id'] === (int)$user['id'];
+		qmzl_render('pay', [
+			'current_user' => $user,
+			'order'        => $order ?: null,
+			'order_id'     => $orderId,
+			'order_valid'  => $valid,
+			'mode'         => 'client',
+		]);
+	});
+}
+
+/* ---------- 4.2 用户端 API 路由 ---------- */
+
+/** 当前绑定信息 / 模式 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/account_info', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	if (qmzl_mode() === 'agent') {
+		json_exit_success('ok', ['bound' => true, 'mode' => 'agent']);
+	}
+	$row = qmzl_account_get((int)$user['id']);
+	if (!$row) {
+		json_exit_success('未绑定', ['bound' => false, 'mode' => 'client']);
+	}
+	$account = (string)$row['account'];
+	$masked = strlen($account) > 4 ? mb_substr($account, 0, 2) . '***' . mb_substr($account, -2) : '***';
+	json_exit_success('ok', [
+		'bound'   => true,
+		'mode'    => 'client',
+		'account' => $account,
+		'masked'  => $masked,
+		'status'  => $row['status'],
+		'last_msg' => (string)$row['last_msg'],
+		'updated_at' => (string)$row['updated_at'],
+	]);
+});
+
+/** 获取人机验证码图片(代理上游 QmCaptcha) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/captcha_refresh', function ($params, $ctx) {
+	qmzl_require_user(true);
+	$res = qmzl_captcha_refresh();
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '获取验证码失败');
+	json_exit_success('ok', $res['data']);
+});
+
+/** 校验人机验证码(代理上游) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/captcha_verify', function ($params, $ctx) {
+	qmzl_require_user(true);
+	$captcha = trim((string)($_POST['captcha'] ?? ''));
+	$token   = trim((string)($_POST['token'] ?? ''));
+	if ($captcha === '' || $token === '') json_exit_error('参数错误');
+	$res = qmzl_captcha_verify($captcha, $token);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '验证失败');
+	json_exit_success('验证通过');
+});
+
+/** 绑定/更新云账号并测试登录(仅 client 模式,需先过人机验证) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/save_account', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$userId = (int)$user['id'];
+	if (qmzl_mode() !== 'client') json_exit_error('代理商模式下无需绑定账号');
+	$account  = trim((string)($_POST['account'] ?? ''));
+	$password = (string)($_POST['password'] ?? '');
+	$captcha  = trim((string)($_POST['captcha'] ?? ''));
+	$captchaToken = trim((string)($_POST['captcha_token'] ?? ''));
+
+	if ($account === '' || $password === '') {
+		json_exit_error('账号和密码不能为空');
+	}
+	if (mb_strlen($account) > 200) {
+		json_exit_error('账号过长');
+	}
+	if (strlen($password) > 100) {
+		json_exit_error('密码过长');
+	}
+	if ($captcha === '' || $captchaToken === '') {
+		json_exit_error('请先完成人机验证');
+	}
+
+	// 先登录测试(密码经 AES 加密,携带人机验证结果)
+	$login = qmzl_login($account, $password, $captcha, $captchaToken);
+	if (!$login['ok']) {
+		json_exit_error('登录失败:' . $login['msg']);
+	}
+
+	if (!qmzl_account_save_cred($userId, (string)$user['username'], $account, $password)) {
+		json_exit_error('保存失败,请重试');
+	}
+	qmzl_account_set_token($userId, $login['data']['jwt'], $login['data']['exp']);
+	qmzl_account_update_status($userId, 'ok', '');
+	json_exit_success('绑定成功', ['exp' => $login['data']['exp']]);
+});
+
+/** 解绑(仅 client 模式) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/unbind', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	if (qmzl_mode() !== 'client') json_exit_error('代理商模式下无需绑定账号');
+	if (!qmzl_account_delete((int)$user['id'])) json_exit_error('解绑失败');
+	json_exit_success('已解绑');
+});
+
+/** 域名配置(后缀/协议) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/config', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+
+	$config = qmzl_config($tok['data']['jwt']);
+	if (!$config['ok']) json_exit_error($config['msg'] ?: '获取配置失败');
+
+	// 兜底后缀列表
+	$suffixes = [];
+	$d = $config['data'] ?: [];
+	if (!empty($d['specify_search_domain']) && is_array($d['specify_search_domain'])) {
+		foreach ($d['specify_search_domain'] as $s) {
+			$suffixes[] = ['suffix' => (string)$s];
+		}
+	}
+	if (empty($suffixes)) {
+		$sp = qmzl_suffixes($tok['data']['jwt']);
+		if ($sp['ok'] && !empty($sp['data']) && is_array($sp['data'])) {
+			$suffixes = $sp['data'];
+		}
+	}
+	if (empty($suffixes)) {
+		$suffixes = [['suffix' => '.com'], ['suffix' => '.cn'], ['suffix' => '.net']];
+	}
+	json_exit_success('ok', [
+		'config'   => $d,
+		'suffixes' => $suffixes,
+	]);
+});
+
+/** 域名可用性查询 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/check_domain', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$domain = trim((string)($_POST['domain'] ?? ''));
+	$suffix = trim((string)($_POST['suffix'] ?? '.com'));
+
+	if (!preg_match('/^[a-z0-9]([a-z0-9\-]{0,62}[a-z0-9])?$/i', $domain)) {
+		json_exit_error('域名前缀格式不正确');
+	}
+	if (!preg_match('/^\.[a-z0-9\-.]+$/i', $suffix)) {
+		json_exit_error('后缀格式不正确');
+	}
+
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+
+	$res = qmzl_check($tok['data']['jwt'], strtolower($domain), strtolower($suffix));
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '查询失败');
+	$list = $res['data'];
+	if (isset($list['list'])) $list = $list['list'];
+	if (!is_array($list)) $list = [];
+	json_exit_success('ok', ['list' => $list]);
+});
+
+/** 域名价格(agent 模式自动加上该后缀溢价) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/price', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$name = trim((string)($_POST['name'] ?? ''));
+	if (!preg_match('/^[a-z0-9]([a-z0-9\-]*[a-z0-9])?\.[a-z0-9\-.]+$/i', $name)) {
+		json_exit_error('域名格式不正确');
+	}
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_price($tok['data']['jwt'], strtolower($name));
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '获取价格失败');
+	$list = $res['data'];
+	if (isset($list['list'])) $list = $list['list'];
+	if (!is_array($list)) $list = [];
+	$markup = qmzl_apply_markup($list, strtolower($name));
+	json_exit_success('ok', ['list' => $list, 'markup' => $markup]);
+});
+
+/** 支付方式:agent 模式用 MNBT 内置支付,client 模式用上游网关 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/gateways', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	if (qmzl_mode() === 'agent') {
+		$methods = function_exists('mnbt_get_enabled_payment_methods') ? mnbt_get_enabled_payment_methods() : [];
+		$list = [];
+		foreach ($methods as $m) {
+			$list[] = [
+				'name'  => (string)($m['plugin'] ?? '') . '__' . (string)($m['method'] ?? ''),
+				'title' => (string)($m['display_name'] ?? ($m['method'] ?? '')),
+			];
+		}
+		json_exit_success('ok', ['list' => $list]);
+	}
+	$res = qmzl_gateways();
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '获取支付方式失败');
+	$list = is_array($res['data']['list'] ?? null) ? $res['data']['list'] : [];
+	json_exit_success('ok', ['list' => $list]);
+});
+
+/** 信息模板列表(agent 模式仅显示当前用户创建的模板) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/templates', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_templates($tok['data']['jwt']);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '获取模板失败');
+	$list = [];
+	if (isset($res['data']['list'])) {
+		$list = $res['data']['list'];
+	} elseif (is_array($res['data'])) {
+		$list = $res['data'];
+	}
+	if (!is_array($list)) $list = [];
+	if (qmzl_mode() === 'agent') {
+		$mine = qmzl_template_ids_by_user((int)$user['id']);
+		$list = array_values(array_filter($list, function ($t) use ($mine) {
+			return isset($mine[(int)($t['id'] ?? 0)]);
+		}));
+	}
+	json_exit_success('ok', ['list' => $list]);
+});
+
+/** 创建/更新模板(含证件照片上传) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/template_save', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$id = (int)($_POST['id'] ?? 0);
+	$newId = 0;
+
+	$fields = [];
+	foreach ([
+		'type', 'zh_owner', 'zh_all_name', 'zh_last_name', 'zh_first_name',
+		'en_owner', 'en_all_name', 'en_last_name', 'en_first_name',
+		'email', 'phone', 'zh_address', 'en_address', 'postal_code',
+		'country', 'idtype', 'idnum',
+	] as $k) {
+		if (isset($_POST[$k])) {
+			$fields[$k] = trim((string)$_POST[$k]);
+		}
+	}
+	if (empty($fields['type']) || !in_array($fields['type'], ['personal', 'enterprise'], true)) {
+		json_exit_error('请选择模板类型');
+	}
+	foreach (['zh_owner', 'en_owner', 'email', 'phone', 'zh_address', 'en_address', 'idtype', 'idnum'] as $k) {
+		if (($fields[$k] ?? '') === '') {
+			json_exit_error('必填项缺失:' . $k);
+		}
+	}
+	if (empty($fields['country'])) $fields['country'] = 'CN';
+
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+
+	// agent 模式:仅允许操作本人创建的模板
+	if (qmzl_mode() === 'agent' && $id > 0 && !qmzl_template_owned($id, (int)$user['id'])) {
+		json_exit_error('无权操作该模板');
+	}
+
+	$files = ['img_front' => $_FILES['img_front'] ?? null, 'img_back' => $_FILES['img_back'] ?? null];
+	foreach ($files as $k => $f) {
+		if (!empty($f['tmp_name']) && $f['size'] > 5 * 1024 * 1024) {
+			json_exit_error('证件照片不能超过 5MB');
+		}
+	}
+	if ($id > 0) {
+		$res = qmzl_template_update($tok['data']['jwt'], $id, $fields, $files);
+	} else {
+		if (empty($files['img_front']['tmp_name'])) {
+			json_exit_error('证件正面照片为必传项');
+		}
+		$res = qmzl_template_create($tok['data']['jwt'], $fields, $files);
+	}
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '保存失败');
+	// agent 模式:记录新模板归属
+	if (qmzl_mode() === 'agent' && $id <= 0) {
+		$newId = 0;
+		$d = $res['data'];
+		if (is_array($d)) {
+			if (!empty($d['id'])) {
+				$newId = (int)$d['id'];
+			} elseif (!empty($d['template_id'])) {
+				$newId = (int)$d['template_id'];
+			} elseif (is_array($d['info_template'] ?? null) && !empty($d['info_template']['id'])) {
+				$newId = (int)$d['info_template']['id'];
+			}
+		}
+		if ($newId > 0) {
+			qmzl_template_record($newId, (int)$user['id'], (string)$user['username']);
+		}
+	}
+	json_exit_success($id > 0 ? '模板已更新' : '模板已创建', ['id' => $id > 0 ? $id : $newId]);
+});
+
+/** 删除模板 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/template_delete', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$id = (int)($_POST['id'] ?? 0);
+	if ($id <= 0) json_exit_error('参数错误');
+	if (qmzl_mode() === 'agent' && !qmzl_template_owned($id, (int)$user['id'])) {
+		json_exit_error('无权操作该模板');
+	}
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_template_delete($tok['data']['jwt'], $id);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '删除失败');
+	json_exit_success('已删除');
+});
+
+/** 提交实名认证 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/template_certify', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$id = (int)($_POST['id'] ?? 0);
+	if ($id <= 0) json_exit_error('参数错误');
+	if (qmzl_mode() === 'agent' && !qmzl_template_owned($id, (int)$user['id'])) {
+		json_exit_error('无权操作该模板');
+	}
+	$files = ['img_front' => $_FILES['img_front'] ?? null, 'img_back' => $_FILES['img_back'] ?? null];
+	if (empty($files['img_front']['tmp_name'])) {
+		json_exit_error('请上传证件正面照片');
+	}
+	foreach ($files as $k => $f) {
+		if (!empty($f['tmp_name']) && $f['size'] > 5 * 1024 * 1024) {
+			json_exit_error('证件照片不能超过 5MB');
+		}
+	}
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_template_certify($tok['data']['jwt'], $id, $files);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '提交失败');
+	json_exit_success('已提交实名认证,请等待审核');
+});
+
+/** 下单:agent 模式走 MNBT 支付,client 模式走上游购物车结算 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/place_order', function ($params, $ctx) {
+	global $DB, $date, $siteurl;
+	$user = qmzl_require_user(true);
+	$userId = (int)$user['id'];
+	$domain     = strtolower(trim((string)($_POST['domain'] ?? '')));
+	$year       = (int)($_POST['year'] ?? 1);
+	$templateId = (int)($_POST['template_id'] ?? 0);
+	$gateway    = trim((string)($_POST['gateway'] ?? ''));
+	$autoRenew  = isset($_POST['auto_renew']) ? (int)$_POST['auto_renew'] : 1;
+	$lockStatus = isset($_POST['lock_status']) ? (int)$_POST['lock_status'] : 1;
+
+	if (!preg_match('/^[a-z0-9]([a-z0-9\-]*[a-z0-9])?\.[a-z0-9\-.]+$/i', $domain)) {
+		json_exit_error('域名格式不正确');
+	}
+	if ($year < 1 || $year > 10) {
+		json_exit_error('购买年限不正确');
+	}
+	if ($templateId <= 0) {
+		json_exit_error('请选择信息模板');
+	}
+	if (qmzl_mode() === 'agent' && !qmzl_template_owned($templateId, $userId)) {
+		json_exit_error('信息模板不存在或不属于你,请先创建并完成实名认证');
+	}
+	if ($gateway === '') {
+		json_exit_error('请选择支付方式');
+	}
+
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$jwt = $tok['data']['jwt'];
+
+	// 1) 取价格(以当次查询为准)
+	$priceRes = qmzl_price($jwt, $domain);
+	if (!$priceRes['ok']) json_exit_error($priceRes['msg'] ?: '获取价格失败');
+	$priceList = $priceRes['data'];
+	if (isset($priceList['list'])) $priceList = $priceList['list'];
+	if (!is_array($priceList)) $priceList = [];
+	$amount = '';
+	foreach ($priceList as $p) {
+		if ((int)($p['buyyear'] ?? 0) === $year) {
+			$amount = (string)($p['buyprice'] ?? '');
+			break;
+		}
+	}
+	if ($amount === '') {
+		json_exit_error('未获取到该域名 ' . $year . ' 年价格');
+	}
+	// agent 模式:加上该后缀溢价
+	if (qmzl_mode() === 'agent') {
+		$markup = qmzl_apply_markup($priceList, $domain);
+		if ($markup > 0) {
+			$amount = (string)round((float)$amount + $markup, 2);
+		}
+	}
+
+	/* ---- agent 模式:创建 MN_dd 订单走系统支付 ---- */
+	if (qmzl_mode() === 'agent') {
+		$out_trade_no = date("YmdHis") . mt_rand(100, 999);
+		$cs = json_encode([
+			'user_id'     => $userId,
+			'username'    => (string)$user['username'],
+			'domain'      => $domain,
+			'year'        => $year,
+			'template_id' => $templateId,
+			'auto_renew'  => $autoRenew,
+			'lock_status' => $lockStatus,
+			'amount'      => $amount,
+			'gateway'     => $gateway,
+		], 256);
+		$ip = $_SERVER["REMOTE_ADDR"] ?? '127.0.0.1';
+		$row1 = $DB->get_row_prepare("SELECT * FROM MN_dd WHERE 1 order by id desc limit 1");
+		$dd_id = $row1 ? ((int)$row1['id'] + 1) : 1;
+		$ok = $DB->query_prepare(
+			"INSERT INTO MN_dd (id, cs, date, zffs, je, ddh, lx, qk, ip) VALUES (?,?,?,?,?,?,?,?,?)",
+			[$dd_id, $cs, $date, $gateway, $amount, $out_trade_no, 'qmzl_domain', 'false', $ip]
+		);
+		if (!$ok) json_exit_error('创建订单失败,请稍后重试');
+
+		// 本地订单记录(ddh 关联,待支付)
+		qmzl_order_create($userId, (string)$user['username'], $out_trade_no, $domain, $year, $amount, $templateId, '', $gateway, '等待支付');
+
+		// 分发到 MNBT 支付插件
+		$order_context = [
+			'out_trade_no' => $out_trade_no,
+			'name'         => '域名注册:' . $domain,
+			'money'        => $amount,
+			'type'         => $gateway,
+			'siteurl'      => $siteurl,
+			'pay_lx'       => 'qmzl_domain',
+		];
+		$html = function_exists('mnbt_pay_dispatch_gateway') ? mnbt_pay_dispatch_gateway($gateway, $order_context) : false;
+		if ($html === false) {
+			json_exit_error('支付方式不可用,请检查支付插件是否已启用');
+		}
+		json_exit_success('下单成功,请完成支付', ['mode' => 'agent', 'html' => $html, 'order_no' => $out_trade_no]);
+	}
+
+	/* ---- client 模式:上游购物车 + 结算 ---- */
+	$productId = qmzl_product_id($jwt);
+	if ($productId <= 0) {
+		json_exit_error('未找到域名产品,请联系平台确认');
+	}
+	$cart = qmzl_cart_add($jwt, $productId, $domain, $year);
+	if (!$cart['ok']) json_exit_error('加入购物车失败:' . $cart['msg']);
+
+	$settle = qmzl_cart_settle($jwt, $templateId, $autoRenew, $lockStatus);
+	if (!$settle['ok']) json_exit_error('下单失败:' . $settle['msg']);
+	$orderId = 0;
+	if (isset($settle['data']['order_id'])) {
+		$orderId = (int)$settle['data']['order_id'];
+	} elseif (!empty($settle['data']['ids']) && is_array($settle['data']['ids'])) {
+		$orderId = (int)$settle['data']['ids'][0];
+	}
+	if ($orderId <= 0) json_exit_error('下单失败:未返回订单号');
+
+	qmzl_order_create($userId, (string)$user['username'], '', $domain, $year, $amount, $templateId, $orderId, $gateway, '等待支付');
+
+	json_exit_success('下单成功,请前往支付', [
+		'mode'          => 'client',
+		'order_id'      => $orderId,
+		'amount'        => $amount,
+		'gateway'       => $gateway,
+		'cloud_pay_url' => QMZL_SITE . '/console/payment?orderId=' . $orderId . '&amount=' . rawurlencode($amount) . '&gateway=' . rawurlencode($gateway),
+	]);
+});
+
+/** 发起支付(仅 client 模式,返回三方 HTML) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/pay', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	if (qmzl_mode() !== 'client') json_exit_error('代理商模式无需此操作');
+	$userId = (int)$user['id'];
+	$orderId = (int)($_POST['order_id'] ?? 0);
+	$gateway = trim((string)($_POST['gateway'] ?? ''));
+	if ($orderId <= 0 || $gateway === '') json_exit_error('参数错误');
+	$rec = qmzl_order_get($orderId);
+	if ($rec && (int)$rec['user_id'] !== $userId) json_exit_error('订单不存在');
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_pay($tok['data']['jwt'], $orderId, $gateway);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '发起支付失败');
+	if (!empty($res['paid'])) {
+		qmzl_order_update_status($orderId, 'Paid');
+		json_exit_success('该订单已支付', ['code' => 'Paid']);
+	}
+	json_exit_success('ok', ['code' => '', 'html' => $res['pay_html']]);
+});
+
+/** 支付状态轮询(仅 client 模式) */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/pay_status', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	if (qmzl_mode() !== 'client') json_exit_error('代理商模式无需此操作');
+	$userId = (int)$user['id'];
+	$orderId = (int)($_POST['order_id'] ?? 0);
+	if ($orderId <= 0) json_exit_error('参数错误');
+	$rec = qmzl_order_get($orderId);
+	if ($rec && (int)$rec['user_id'] !== $userId) json_exit_error('订单不存在');
+	$tok = qmzl_require_token($user);
+	if (!$tok['ok']) json_exit_error($tok['msg']);
+	$res = qmzl_pay_status($tok['data']['jwt'], $orderId);
+	if (!$res['ok']) json_exit_error($res['msg'] ?: '查询失败');
+	if (!empty($res['paid'])) {
+		qmzl_order_update_status($orderId, 'Paid');
+	}
+	json_exit_success('ok', ['paid' => !empty($res['paid'])]);
+});
+
+/** 我的域名 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/domains', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$data = qmzl_my_domains($user);
+	if (!$data['ok']) json_exit_error($data['msg']);
+	json_exit_success('ok', ['list' => $data['list']]);
+});
+
+/** 本地订单记录 */
+mnbt_register_route('POST', '/' . $qzRoute . '/api/orders', function ($params, $ctx) {
+	$user = qmzl_require_user(true);
+	$page = max(1, (int)($_POST['page'] ?? 1));
+	$data = qmzl_order_list((int)$user['id'], $page, 20);
+	json_exit_success('ok', $data);
+});
+
+} // end 用户端开关
diff --git a/app_plugins/qmzl_domain/install.sql b/app_plugins/qmzl_domain/install.sql
new file mode 100644
index 0000000..cfc7022
--- /dev/null
+++ b/app_plugins/qmzl_domain/install.sql
@@ -0,0 +1,52 @@
+-- qmzl_domain 插件数据表
+-- 用户维度 = user_info 插件用户(MN_plugin_user.id / username)
+-- 模式:client(客户自注册上游账号)/ agent(代理商模式,管理员代注册)
+-- 1) 用户绑定的启明智联账号(仅 client 模式使用,含加密密码与 JWT)
+CREATE TABLE IF NOT EXISTS `plg_qmzl_account` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'user_info 用户 ID',
+  `username` varchar(64) NOT NULL DEFAULT '' COMMENT 'user_info 用户名',
+  `account` varchar(255) NOT NULL DEFAULT '' COMMENT '启明智联账号(手机/邮箱)',
+  `password` text COMMENT '启明智联密码(authcode 加密)',
+  `jwt` text COMMENT '登录 token',
+  `jwt_expire` varchar(20) NOT NULL DEFAULT '0' COMMENT 'token 过期时间戳',
+  `status` varchar(20) NOT NULL DEFAULT 'ok' COMMENT 'ok / error',
+  `last_msg` varchar(255) NOT NULL DEFAULT '' COMMENT '最近一次错误信息',
+  `created_at` varchar(50) NOT NULL DEFAULT '',
+  `updated_at` varchar(50) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `uq_user_id` (`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='启明智联域名-用户账号';
+
+-- 2) 本地订单记录(下单即记,支付状态可轮询)
+CREATE TABLE IF NOT EXISTS `plg_qmzl_order` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'user_info 用户 ID',
+  `username` varchar(64) NOT NULL DEFAULT '' COMMENT 'user_info 用户名',
+  `ddh` varchar(64) NOT NULL DEFAULT '' COMMENT 'MNBT 订单号(agent 模式)',
+  `domain` varchar(255) NOT NULL DEFAULT '' COMMENT '完整域名',
+  `year` int(11) NOT NULL DEFAULT 1 COMMENT '购买年限',
+  `amount` varchar(20) NOT NULL DEFAULT '0' COMMENT '金额(元)',
+  `template_id` int(11) NOT NULL DEFAULT 0 COMMENT '信息模板 ID',
+  `cloud_order_id` varchar(64) NOT NULL DEFAULT '' COMMENT '上游订单 ID',
+  `gateway` varchar(64) NOT NULL DEFAULT '' COMMENT '支付网关标识',
+  `status` varchar(20) NOT NULL DEFAULT 'Pending' COMMENT 'Pending/Paid/Cancelled/Failed',
+  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '状态备注',
+  `created_at` varchar(50) NOT NULL DEFAULT '',
+  `updated_at` varchar(50) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  KEY `idx_user` (`user_id`),
+  KEY `idx_ddh` (`ddh`),
+  KEY `idx_order` (`cloud_order_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='启明智联域名-订单记录';
+
+-- 3) 模板归属记录(agent 模式:客户创建的模板记录归属,用于隔离查看)
+CREATE TABLE IF NOT EXISTS `plg_qmzl_template` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `template_id` int(11) NOT NULL DEFAULT 0 COMMENT '上游模板 ID',
+  `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'user_info 用户 ID',
+  `username` varchar(64) NOT NULL DEFAULT '' COMMENT 'user_info 用户名',
+  `created_at` varchar(50) NOT NULL DEFAULT '',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `uq_tpl` (`template_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='启明智联域名-模板归属';
diff --git a/app_plugins/qmzl_domain/lib/api.php b/app_plugins/qmzl_domain/lib/api.php
new file mode 100644
index 0000000..ddf5fbb
--- /dev/null
+++ b/app_plugins/qmzl_domain/lib/api.php
@@ -0,0 +1,665 @@
+<?php
+/**
+ * qmzl_domain 插件 - 启明智联平台 API 客户端
+ *
+ * 上游:https://cloud.qimingidc.cn/console/v1(地址写死)
+ * 认证:Authorization: Bearer {jwt}(用户各自绑定账号,密码登录获取)
+ *
+ * 覆盖接口(参考 qmzl_domain/域名注册API对接文档.md 与 idcsmart-api.md):
+ *   POST /login                                登录(密码方式)
+ *   GET  /idcsmart_domain/config               域名配置
+ *   GET  /idcsmart_domain/domain_suffix        后缀列表
+ *   GET  /idcsmart_domain/check_domain         可用性
+ *   GET  /idcsmart_domain/get_price            价格
+ *   GET  /idcsmart_domain/info_template        模板列表
+ *   POST/PUT /idcsmart_domain/info_template    创建/更新模板(multipart)
+ *   DELETE /idcsmart_domain/info_template/{id} 删除模板
+ *   POST /idcsmart_domain/info_template/{id}/certifications 提交实名认证
+ *   GET  /product/group/first | /product/group/second | /product  域名产品 ID
+ *   GET  /gateway                              支付网关
+ *   POST /cart                                 加入购物车
+ *   POST /cart/settle                          结算创建订单
+ *   POST /pay                                  发起支付(返回三方 HTML)
+ *   GET  /pay/{id}/status                      支付状态
+ *   GET  /host                                 已购产品(域名)
+ */
+if (!defined('IN_CRONLITE')) exit;
+
+/** 上游 API 地址(写死) */
+define('QMZL_API_BASE', 'https://cloud.qimingidc.cn/console/v1');
+/** 上游站点根(支付页跳转兜底用) */
+define('QMZL_SITE', 'https://cloud.qimingidc.cn');
+
+/* ============================================================
+ * 1. HTTP 基础
+ * ============================================================ */
+
+/**
+ * 统一解析上游响应
+ * @param array $res mnbt_http_* / curl 的结果数组
+ * @return array {ok,status,msg,data}
+ */
+function qmzl_parse_response($res)
+{
+	$out = ['ok' => false, 'status' => 0, 'msg' => '', 'data' => null, 'code' => null];
+	$body = trim((string)($res['body'] ?? ''));
+	$j = null;
+	if ($body !== '') {
+		$j = json_decode($body, true);
+	}
+	if (empty($res['ok'])) {
+		if (is_array($j) && isset($j['status'])) {
+			$out['status'] = (int)$j['status'];
+			$out['msg'] = (string)($j['msg'] ?? '');
+			$out['data'] = $j['data'] ?? null;
+			$out['code'] = $j['code'] ?? null;
+			$out['ok'] = $out['status'] === 200;
+			return $out;
+		}
+		$out['msg'] = $res['error'] ?: ('HTTP ' . $res['code']);
+		return $out;
+	}
+	if ($body === '') {
+		$out['msg'] = '上游返回空响应';
+		return $out;
+	}
+	if (!is_array($j)) {
+		$out['msg'] = '上游返回非 JSON 内容';
+		return $out;
+	}
+	$out['status'] = isset($j['status']) ? (int)$j['status'] : 0;
+	$out['msg'] = (string)($j['msg'] ?? '');
+	$out['data'] = $j['data'] ?? null;
+	$out['code'] = $j['code'] ?? null;
+	$out['ok'] = $out['status'] === 200;
+	return $out;
+}
+
+/**
+ * JSON 请求(GET/POST/PUT/DELETE)
+ */
+function qmzl_http_json($method, $path, $token = '', $body = null, $params = [])
+{
+	$url = QMZL_API_BASE . '/' . ltrim($path, '/');
+	if ($params) {
+		$url .= (strpos($url, '?') === false ? '?' : '&') . http_build_query($params);
+	}
+	$headers = [];
+	if ($token !== '') {
+		$headers[] = 'Authorization: Bearer ' . $token;
+	}
+	$method = strtoupper($method ?: 'GET');
+	if ($method === 'GET') {
+		$res = mnbt_http_get($url, ['timeout' => 25, 'headers' => $headers]);
+	} elseif ($method === 'POST') {
+		$res = mnbt_http_post($url, $body, ['timeout' => 25, 'headers' => $headers]);
+	} else {
+		// PUT / DELETE:手动 curl
+		$ch = curl_init($url);
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
+		curl_setopt($ch, CURLOPT_TIMEOUT, 25);
+		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+		curl_setopt($ch, CURLOPT_USERAGENT, 'MNBT-Plugin/1.83');
+		if ($body !== null) {
+			$headers[] = 'Content-Type: application/json; charset=utf-8';
+			curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($body) ? json_encode($body, JSON_UNESCAPED_UNICODE) : $body);
+		}
+		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+		$resp = curl_exec($ch);
+		$code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
+		$err = curl_error($ch);
+		curl_close($ch);
+		$res = ['ok' => $code >= 200 && $code < 300, 'code' => $code, 'body' => (string)$resp, 'error' => $err];
+	}
+	return qmzl_parse_response($res);
+}
+
+/**
+ * multipart/form-data 请求(模板创建/更新、提交实名认证需传证件照片)
+ */
+function qmzl_http_multipart($method, $path, $token, $fields = [], $files = [])
+{
+	$url = QMZL_API_BASE . '/' . ltrim($path, '/');
+	$post = $fields;
+	foreach ($files as $k => $f) {
+		if (!empty($f['tmp_name']) && is_file($f['tmp_name'])) {
+			$post[$k] = new CURLFile(
+				$f['tmp_name'],
+				($f['type'] && $f['type'] !== 'application/octet-stream') ? $f['type'] : 'application/octet-stream',
+				$f['name']
+			);
+		}
+	}
+	$headers = [];
+	if ($token !== '') {
+		$headers[] = 'Authorization: Bearer ' . $token;
+	}
+	$ch = curl_init($url);
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method ?: 'POST'));
+	curl_setopt($ch, CURLOPT_TIMEOUT, 90);
+	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+	curl_setopt($ch, CURLOPT_USERAGENT, 'MNBT-Plugin/1.83');
+	curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // 数组+文件 → 自动 multipart
+	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+	$resp = curl_exec($ch);
+	$code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
+	$err = curl_error($ch);
+	curl_close($ch);
+	return qmzl_parse_response(['ok' => $code >= 200 && $code < 300, 'code' => $code, 'body' => (string)$resp, 'error' => $err]);
+}
+
+/* ============================================================
+ * 2. 账号与 Token
+ * ============================================================ */
+
+/** 密码加密(与系统 authcode 保持一致,SYS_KEY 做密钥) */
+function qmzl_encrypt_pwd($pwd)
+{
+	if ($pwd === '') return '';
+	return authcode($pwd, 'ENCODE', SYS_KEY);
+}
+
+function qmzl_decrypt_pwd($enc)
+{
+	if ($enc === '') return '';
+	return authcode($enc, 'DECODE', SYS_KEY);
+}
+
+/**
+ * 上游登录密码加密(AES-128-CBC,与 qiming-web AuthView.vue 一致)
+ * key=idcsmart.finance  iv=9311019310287172  输出 base64
+ */
+function qmzl_encrypt_upstream_password($password)
+{
+	if (!function_exists('openssl_encrypt')) {
+		return '';
+	}
+	$enc = openssl_encrypt((string)$password, 'aes-128-cbc', 'idcsmart.finance', OPENSSL_RAW_DATA, '9311019310287172');
+	return $enc === false ? '' : base64_encode($enc);
+}
+
+/** 解析 JWT 的 exp */
+function qmzl_jwt_exp($jwt)
+{
+	if (!is_string($jwt) || $jwt === '') return 0;
+	$parts = explode('.', $jwt);
+	if (count($parts) < 2) return 0;
+	$payload = strtr($parts[1], '-_', '+/');
+	$j = json_decode((string)base64_decode($payload), true);
+	if (is_array($j) && isset($j['exp'])) return (int)$j['exp'];
+	return 0;
+}
+
+/**
+ * 密码方式登录(上游登录需要人机验证时传入 $captcha/$captchaToken)
+ * @return array {ok,status,msg,data:{jwt,exp,client_id}}
+ */
+function qmzl_login($account, $password, $captcha = '', $captchaToken = '')
+{
+	$enc = qmzl_encrypt_upstream_password($password);
+	if ($enc === '') {
+		return ['ok' => false, 'status' => 0, 'msg' => '服务器不支持密码加密(缺少 openssl 扩展)', 'data' => null];
+	}
+	$body = [
+		'type'              => 'password',
+		'account'           => (string)$account,
+		'password'          => $enc,
+		'remember_password' => '1',
+	];
+	if ($captcha !== '' && $captchaToken !== '') {
+		$body['captcha'] = (string)$captcha;
+		$body['token']   = (string)$captchaToken;
+	}
+	$res = qmzl_http_json('POST', 'login', '', $body);
+	if (!$res['ok']) {
+		return ['ok' => false, 'status' => $res['status'], 'msg' => $res['msg'] ?: '登录失败', 'data' => null];
+	}
+	$jwt = is_array($res['data']) ? (string)($res['data']['jwt'] ?? '') : '';
+	if ($jwt === '') {
+		return ['ok' => false, 'status' => 0, 'msg' => '登录成功但未返回 token', 'data' => null];
+	}
+	$exp = qmzl_jwt_exp($jwt);
+	return [
+		'ok'     => true,
+		'status' => 200,
+		'msg'    => '登录成功',
+		'data'   => [
+			'jwt'       => $jwt,
+			'exp'       => $exp ?: (time() + 7200),
+			'client_id' => (int)(is_array($res['data']) ? ($res['data']['client_id'] ?? 0) : 0),
+		],
+	];
+}
+
+/**
+ * 获取上游人机验证码图片(QmCaptcha 点选验证,路径在站点根,不在 /console/v1 下)。
+ * 使用浏览器头规避反爬,返回字段宽松解析(部分环境不返回 status)。
+ * @return array {ok,msg,data:{base64,captcha_icon,sign}}
+ */
+function qmzl_captcha_refresh()
+{
+	$url = rtrim(QMZL_SITE, '/') . '/captcha/qm_captcha/index/refresh';
+	$ch = curl_init($url);
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+	curl_setopt($ch, CURLOPT_TIMEOUT, 25);
+	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
+	curl_setopt($ch, CURLOPT_HTTPHEADER, [
+		'Accept: application/json',
+		'Referer: ' . rtrim(QMZL_SITE, '/') . '/',
+	]);
+	$resp = curl_exec($ch);
+	$err  = curl_error($ch);
+	curl_close($ch);
+
+	$j = json_decode(trim((string)$resp), true);
+	if (!is_array($j)) {
+		return ['ok' => false, 'msg' => $err ?: '获取验证码失败(接口返回异常)', 'data' => null];
+	}
+	$base64 = (string)($j['base64'] ?? '');
+	$sign   = (string)($j['sign'] ?? '');
+	if ($base64 === '' || $sign === '') {
+		return ['ok' => false, 'msg' => (string)($j['msg'] ?? '获取验证码失败'), 'data' => null];
+	}
+	return ['ok' => true, 'msg' => '', 'data' => [
+		'base64'       => $base64,
+		'captcha_icon' => (string)($j['captcha_icon'] ?? ''),
+		'sign'         => $sign,
+	]];
+}
+
+/** 校验人机验证码(点选坐标) */
+function qmzl_captcha_verify($captcha, $token)
+{
+	$url = rtrim(QMZL_SITE, '/') . '/captcha/qm_captcha/index/verify';
+	$ch = curl_init($url);
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+	curl_setopt($ch, CURLOPT_POST, true);
+	curl_setopt($ch, CURLOPT_TIMEOUT, 25);
+	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
+	curl_setopt($ch, CURLOPT_HTTPHEADER, [
+		'Accept: application/json',
+		'Referer: ' . rtrim(QMZL_SITE, '/') . '/',
+	]);
+	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
+		'captcha' => (string)$captcha,
+		'token'   => (string)$token,
+	]));
+	$resp = curl_exec($ch);
+	$code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
+	$err  = curl_error($ch);
+	curl_close($ch);
+	$j = json_decode(trim((string)$resp), true);
+	if (!is_array($j) || !isset($j['status'])) {
+		return ['ok' => false, 'msg' => $err ?: '验证失败', 'data' => null];
+	}
+	if ((int)$j['status'] !== 200) {
+		return ['ok' => false, 'msg' => (string)($j['msg'] ?? '验证失败'), 'data' => null];
+	}
+	return ['ok' => true, 'msg' => '验证通过', 'data' => $j];
+}
+
+/**
+ * 开放接口鉴权登录(管理员/代理商用,换取 JWT,无需人机验证)
+ * POST {site}/api/v1/auth
+ * 请求:{username: 注册邮箱或手机号, password: API密钥 token}
+ * 返回:data.jwt
+ * @return array {ok,status,msg,data:{jwt,exp}}
+ */
+function qmzl_openapi_auth($username, $apiToken)
+{
+	$url = rtrim(QMZL_SITE, '/') . '/api/v1/auth';
+	$res = mnbt_http_post($url, [
+		'username' => (string)$username,
+		'password' => (string)$apiToken,
+	], ['timeout' => 25]);
+	$j = json_decode(trim((string)($res['body'] ?? '')), true);
+	$jwt = is_array($j) && isset($j['data']) && is_array($j['data']) ? (string)($j['data']['jwt'] ?? '') : '';
+	if ($jwt === '') {
+		return ['ok' => false, 'status' => (int)($j['status'] ?? 0), 'msg' => (string)($j['msg'] ?? '鉴权失败'), 'data' => null];
+	}
+	$exp = qmzl_jwt_exp($jwt);
+	return ['ok' => true, 'status' => 200, 'msg' => '鉴权成功', 'data' => ['jwt' => $jwt, 'exp' => $exp ?: (time() + 7200)]];
+}
+
+/**
+ * 获取当前 user_info 用户的有效 token,过期自动重新登录
+ * @return array {ok,status,msg,data:{jwt}}
+ */
+function qmzl_get_token($user_id)
+{
+	$row = qmzl_account_get($user_id);
+	if (!$row) {
+		return ['ok' => false, 'status' => 0, 'msg' => '请先绑定启明智联账号', 'data' => null];
+	}
+	$jwt = (string)($row['jwt'] ?? '');
+	$exp = (int)($row['jwt_expire'] ?? 0);
+	if ($jwt !== '' && $exp > time() + 300) {
+		return ['ok' => true, 'status' => 200, 'msg' => '', 'data' => ['jwt' => $jwt]];
+	}
+	// token 失效,用存储的密码重新登录
+	$password = qmzl_decrypt_pwd((string)$row['password']);
+	if ($password === '') {
+		return ['ok' => false, 'status' => 0, 'msg' => '账号密码缺失,请重新绑定', 'data' => null];
+	}
+	$login = qmzl_login($row['account'], $password);
+	if (!$login['ok']) {
+		// 上游登录需人机验证时自动刷新失败,提示重新绑定
+		$msg = $login['msg'];
+		if (mb_strpos($msg, '验证码') !== false || mb_strpos($msg, 'captcha') !== false || mb_strpos($msg, '人机') !== false) {
+			$msg = '登录需要人机验证,请到「云账号」页重新验证绑定';
+		}
+		qmzl_account_update_status($user_id, 'error', $msg);
+		$login['msg'] = $msg;
+		return $login;
+	}
+	qmzl_account_set_token($user_id, $login['data']['jwt'], $login['data']['exp']);
+	qmzl_account_update_status($user_id, 'ok', '');
+	return ['ok' => true, 'status' => 200, 'msg' => '', 'data' => ['jwt' => $login['data']['jwt']]];
+}
+
+/* ============================================================
+ * 3. 域名接口
+ * ============================================================ */
+
+/** 获取域名配置(协议链接 / 可搜索后缀 / 默认后缀) */
+function qmzl_config($token)
+{
+	return qmzl_http_json('GET', 'idcsmart_domain/config', $token);
+}
+
+/** 获取后缀列表 */
+function qmzl_suffixes($token)
+{
+	return qmzl_http_json('GET', 'idcsmart_domain/domain_suffix', $token);
+}
+
+/** 查询域名可用性,$suffix 形如 .com,可传数组 */
+function qmzl_check($token, $domain, $suffix = '.com')
+{
+	$suffix = is_array($suffix) ? $suffix[0] : $suffix;
+	return qmzl_http_json('GET', 'idcsmart_domain/check_domain', $token, null, [
+		'domain'  => $domain,
+		'suffix'  => $suffix,
+		'host_id' => 0,
+	]);
+}
+
+/** 查询域名价格(各年限) */
+function qmzl_price($token, $name)
+{
+	return qmzl_http_json('GET', 'idcsmart_domain/get_price', $token, null, [
+		'name'    => $name,
+		'host_id' => 0,
+	]);
+}
+
+/** 信息模板列表 */
+function qmzl_templates($token)
+{
+	return qmzl_http_json('GET', 'idcsmart_domain/info_template', $token);
+}
+
+/** 创建模板($fields 表单字段,$files 证件照片) */
+function qmzl_template_create($token, $fields, $files)
+{
+	return qmzl_http_multipart('POST', 'idcsmart_domain/info_template', $token, $fields, $files);
+}
+
+/** 更新模板 */
+function qmzl_template_update($token, $id, $fields, $files)
+{
+	return qmzl_http_multipart('PUT', 'idcsmart_domain/info_template/' . (int)$id, $token, $fields, $files);
+}
+
+/** 删除模板 */
+function qmzl_template_delete($token, $id)
+{
+	return qmzl_http_json('DELETE', 'idcsmart_domain/info_template/' . (int)$id, $token);
+}
+
+/** 提交实名认证 */
+function qmzl_template_certify($token, $id, $files)
+{
+	return qmzl_http_multipart('POST', 'idcsmart_domain/info_template/' . (int)$id . '/certifications', $token, [], $files);
+}
+
+/** 查找域名产品 ID(遍历产品分组 + 关键词兜底) */
+function qmzl_product_id($token)
+{
+	// 1) 关键词搜索
+	$res = qmzl_http_json('GET', 'product', $token, null, ['keywords' => '域名']);
+	if ($res['ok'] && !empty($res['data']['list']) && is_array($res['data']['list'])) {
+		foreach ($res['data']['list'] as $p) {
+			$name = (string)($p['name'] ?? '');
+			if (mb_strpos($name, '域名') !== false || stripos($name, 'domain') !== false) {
+				return (int)$p['id'];
+			}
+		}
+		if (isset($res['data']['list'][0]['id'])) return (int)$res['data']['list'][0]['id'];
+	}
+	// 2) 一级分组遍历
+	$r1 = qmzl_http_json('GET', 'product/group/first', $token);
+	if ($r1['ok'] && !empty($r1['data']['list']) && is_array($r1['data']['list'])) {
+		foreach ($r1['data']['list'] as $g) {
+			$r2 = qmzl_http_json('GET', 'product/group/second', $token, null, ['id' => (int)$g['id']]);
+			if (!$r2['ok'] || empty($r2['data']['list'])) continue;
+			foreach ($r2['data']['list'] as $sg) {
+				$rp = qmzl_http_json('GET', 'product', $token, null, ['id' => (int)$sg['id']]);
+				if (!$rp['ok'] || empty($rp['data']['list'])) continue;
+				foreach ($rp['data']['list'] as $p) {
+					$name = (string)($p['name'] ?? '');
+					if (mb_strpos($name, '域名') !== false || stripos($name, 'domain') !== false) {
+						return (int)$p['id'];
+					}
+				}
+			}
+		}
+	}
+	return 0;
+}
+
+/** 支付网关列表 */
+function qmzl_gateways($token = '')
+{
+	return qmzl_http_json('GET', 'gateway', $token);
+}
+
+/** 加入购物车 */
+function qmzl_cart_add($token, $productId, $domain, $year)
+{
+	return qmzl_http_json('POST', 'cart', $token, [
+		'product_id'     => (int)$productId,
+		'config_options' => [
+			'domain' => (string)$domain,
+			'year'   => (int)$year,
+		],
+		'qty'        => 1,
+		'customfield' => ['is_domain' => 1],
+	]);
+}
+
+/** 结算创建订单 */
+function qmzl_cart_settle($token, $templateId, $autoRenew = 1, $lockStatus = 1)
+{
+	return qmzl_http_json('POST', 'cart/settle', $token, [
+		'positions'   => [0],
+		'customfield' => [
+			'auto_renew'  => $autoRenew ? 1 : 0,
+			'lock_status' => $lockStatus ? 1 : 0,
+			'c_sysid'     => (string)$templateId,
+			'host_id'     => 0,
+		],
+	]);
+}
+
+/** 发起支付,返回三方 HTML */
+function qmzl_pay($token, $orderId, $gateway)
+{
+	$res = qmzl_http_json('POST', 'pay', $token, [
+		'id'      => (int)$orderId,
+		'gateway' => (string)$gateway,
+	]);
+	if (!$res['ok']) return $res;
+	$data = is_array($res['data']) ? $res['data'] : [];
+	$code = (string)($res['code'] ?? ($data['code'] ?? ''));
+	$res['paid'] = ($code === 'Paid');
+	$res['pay_html'] = (string)($data['html'] ?? '');
+	return $res;
+}
+
+/** 支付状态:返回 {ok,status,msg,data,paid} */
+function qmzl_pay_status($token, $orderId)
+{
+	$res = qmzl_http_json('GET', 'pay/' . (int)$orderId . '/status', $token);
+	if (!$res['ok']) return $res;
+	$code = (string)($res['code'] ?? '');
+	if ($code === '' && is_array($res['data'])) {
+		$code = (string)($res['data']['code'] ?? '');
+	}
+	$res['paid'] = ($code === 'Paid');
+	return $res;
+}
+
+/** 使用账户余额支付上游订单(agent 模式自动注册用) */
+function qmzl_credit_pay($token, $orderId)
+{
+	return qmzl_http_json('POST', 'credit', $token, [
+		'id'  => (int)$orderId,
+		'use' => 1,
+	]);
+}
+
+/** 已购产品列表(域名) */
+function qmzl_hosts($token, $page = 1, $limit = 100)
+{
+	return qmzl_http_json('GET', 'host', $token, null, ['page' => (int)$page, 'limit' => (int)$limit]);
+}
+
+/**
+ * 获取当前用户已购域名列表。
+ * client 模式:按用户自己的上游账号 /host 过滤 type=domain;
+ * agent 模式:用管理员代理商账号取全部域名,再过滤该用户本地已支付订单的域名。
+ * @param array $user user_info 用户数组
+ * @return array {ok,msg,list}
+ */
+function qmzl_my_domains($user)
+{
+	$agent = qmzl_mode() === 'agent';
+	$tok = $agent ? qmzl_agent_token() : qmzl_get_token((int)$user['id']);
+	if (!$tok['ok']) return ['ok' => false, 'msg' => $tok['msg'], 'list' => []];
+	$res = qmzl_hosts($tok['data']['jwt'], 1, 100);
+	if (!$res['ok']) return ['ok' => false, 'msg' => $res['msg'] ?: '获取失败', 'list' => []];
+	$all = (is_array($res['data'] ?? null)) ? ($res['data']['list'] ?? []) : [];
+	if (!is_array($all)) $all = [];
+
+	if ($agent) {
+		// 该用户本地已支付订单的域名集合
+		$orders = qmzl_order_list((int)$user['id'], 1, 200);
+		$mine = [];
+		foreach ($orders['rows'] as $o) {
+			if (($o['status'] ?? '') === 'Paid' && ($o['domain'] ?? '') !== '') {
+				$mine[strtolower($o['domain'])] = true;
+			}
+		}
+		$list = [];
+		foreach ($all as $h) {
+			$name = strtolower((string)($h['name'] ?? $h['domain'] ?? ''));
+			if ($name !== '' && isset($mine[$name])) {
+				$list[] = $h;
+			}
+		}
+		return ['ok' => true, 'msg' => '', 'list' => $list];
+	}
+
+	$list = [];
+	foreach ($all as $h) {
+		if (($h['type'] ?? '') === 'domain') {
+			$list[] = $h;
+		}
+	}
+	return ['ok' => true, 'msg' => '', 'list' => $list];
+}
+
+/**
+ * 代理商模式:支付成功后自动在上游注册域名(加入购物车 + 结算 + 余额支付)。
+ * @param int $orderId plg_qmzl_order.id
+ * @return array {ok,msg}
+ */
+function qmzl_agent_register_domain($orderId)
+{
+	$order = qmzl_order_get_by_id($orderId);
+	if (!$order) return ['ok' => false, 'msg' => '本地订单不存在'];
+
+	$tok = qmzl_agent_token();
+	if (!$tok['ok']) return ['ok' => false, 'msg' => $tok['msg']];
+	$jwt = $tok['data']['jwt'];
+
+	$domain = (string)$order['domain'];
+	$year   = (int)$order['year'];
+	$tplId  = (int)$order['template_id'];
+	if ($domain === '' || $year < 1 || $tplId <= 0) {
+		qmzl_order_update($order['id'], ['status' => 'Failed', 'remark' => '订单参数不完整']);
+		return ['ok' => false, 'msg' => '订单参数不完整'];
+	}
+
+	// 1) 域名产品 ID
+	$productId = qmzl_product_id($jwt);
+	if ($productId <= 0) {
+		qmzl_order_update($order['id'], ['status' => 'Failed', 'remark' => '未找到域名产品']);
+		return ['ok' => false, 'msg' => '未找到域名产品,请联系平台确认'];
+	}
+
+	// 2) 加入购物车
+	$cart = qmzl_cart_add($jwt, $productId, $domain, $year);
+	if (!$cart['ok']) {
+		qmzl_order_update($order['id'], ['status' => 'Failed', 'remark' => '加入购物车失败:' . $cart['msg']]);
+		return ['ok' => false, 'msg' => '加入购物车失败:' . $cart['msg']];
+	}
+
+	// 3) 结算创建上游订单
+	$settle = qmzl_cart_settle($jwt, $tplId, 1, 1);
+	if (!$settle['ok']) {
+		qmzl_order_update($order['id'], ['status' => 'Failed', 'remark' => '上游下单失败:' . $settle['msg']]);
+		return ['ok' => false, 'msg' => '上游下单失败:' . $settle['msg']];
+	}
+	$cloudOrderId = 0;
+	if (isset($settle['data']['order_id'])) {
+		$cloudOrderId = (int)$settle['data']['order_id'];
+	} elseif (!empty($settle['data']['ids']) && is_array($settle['data']['ids'])) {
+		$cloudOrderId = (int)$settle['data']['ids'][0];
+	}
+	if ($cloudOrderId <= 0) {
+		qmzl_order_update($order['id'], ['status' => 'Failed', 'remark' => '上游未返回订单号']);
+		return ['ok' => false, 'msg' => '上游未返回订单号'];
+	}
+
+	// 4) 用代理商账号余额支付
+	$credit = qmzl_credit_pay($jwt, $cloudOrderId);
+	if (!$credit['ok']) {
+		qmzl_order_update($order['id'], [
+			'cloud_order_id' => (string)$cloudOrderId,
+			'status'         => 'Failed',
+			'remark'         => '上游余额支付失败:' . $credit['msg'],
+		]);
+		return ['ok' => false, 'msg' => '上游余额支付失败:' . $credit['msg'] . '(请检查代理商账号余额)'];
+	}
+
+	qmzl_order_update($order['id'], [
+		'cloud_order_id' => (string)$cloudOrderId,
+		'status'         => 'Paid',
+		'remark'         => '已注册(上游订单 ' . $cloudOrderId . ')',
+	]);
+	return ['ok' => true, 'msg' => '域名注册成功'];
+}
diff --git a/app_plugins/qmzl_domain/lib/helper.php b/app_plugins/qmzl_domain/lib/helper.php
new file mode 100644
index 0000000..0d3ed12
--- /dev/null
+++ b/app_plugins/qmzl_domain/lib/helper.php
@@ -0,0 +1,529 @@
+<?php
+/**
+ * qmzl_domain 插件 - 账号与订单辅助函数
+ *
+ * 用户维度:user_info 插件用户(MN_plugin_user),前置依赖 user_info。
+ */
+if (!defined('IN_CRONLITE')) exit;
+
+/* ============================================================
+ * URL / 渲染 / 登录辅助
+ * ============================================================ */
+
+/** 生成带站点 base path 前缀的 URL(index.php?_r= 查询参数路由)。 */
+function qmzl_url($path = '')
+{
+	$scriptName = isset($_SERVER['SCRIPT_NAME']) ? str_replace('\\', '/', $_SERVER['SCRIPT_NAME']) : '';
+	$basePath = rtrim(str_replace('\\', '/', dirname($scriptName)), '/');
+	if ($basePath === '.' || $basePath === '/') {
+		$basePath = '';
+	}
+	$p = ltrim($path, '/');
+	$qpos = strpos($p, '?');
+	if ($qpos !== false) {
+		$route = substr($p, 0, $qpos);
+		$query = substr($p, $qpos + 1);
+		return $basePath . '/index.php?_r=/' . $route . '&' . $query;
+	}
+	return $basePath . '/index.php?_r=/' . $p;
+}
+
+/** 插件静态资源 URL。 */
+function qmzl_asset_url($path = '')
+{
+	return mnbt_plugin_url('qmzl_domain', 'assets/' . ltrim($path, '/'));
+}
+
+/** 输出 JSON 并退出(与 balance/hosting 一致)。 */
+function qmzl_json($code, $extra = [])
+{
+	@header('Content-Type: application/json; charset=UTF-8');
+	$payload = ['code' => $code];
+	if (is_array($extra)) {
+		$payload = array_merge($payload, $extra);
+	}
+	echo json_encode($payload, JSON_UNESCAPED_UNICODE);
+	exit;
+}
+
+/**
+ * 获取当前登录的 user_info 用户;未登录跳转登录页。
+ * $json=true 时输出 JSON 错误(供 API 路由使用)。
+ * @return array|void
+ */
+function qmzl_require_user($json = false)
+{
+	if (!function_exists('user_info_auth_current')) {
+		if ($json) qmzl_json('需要先启用 user_info 插件');
+		http_response_code(500);
+		echo '需要先启用 user_info 插件';
+		exit;
+	}
+	$user = user_info_auth_current();
+	if (!$user) {
+		if ($json) {
+			qmzl_json('请先登录', ['msg' => '请先登录', 'login_url' => qmzl_url('account/login')]);
+		}
+		header('Location: ' . qmzl_url('account/login'));
+		exit;
+	}
+	return $user;
+}
+
+/** 渲染用户端视图(views/ 目录,自包含页面)。 */
+function qmzl_render($view, $vars = [])
+{
+	$vars['current_user'] = $vars['current_user'] ?? (function_exists('user_info_auth_current') ? user_info_auth_current() : null);
+	extract($vars, EXTR_SKIP);
+	$viewFile = mnbt_plugin_path('qmzl_domain') . 'views/' . $view . '.php';
+	if (!is_file($viewFile)) {
+		http_response_code(500);
+		echo 'View not found: ' . htmlspecialchars($view);
+		return;
+	}
+	include $viewFile;
+}
+
+/* ============================================================
+ * 表结构自动升级(bootstrap 时调用一次,兼容已安装站点)
+ * ============================================================ */
+function qmzl_schema_upgrade()
+{
+	global $DB;
+	if (!isset($DB) || !is_object($DB)) return;
+
+	$tbl = $DB->get_row_prepare("SHOW TABLES LIKE 'plg_qmzl_account'");
+	if (!$tbl) {
+		@$DB->query("CREATE TABLE IF NOT EXISTS `plg_qmzl_account` (
+			`id` int(11) NOT NULL AUTO_INCREMENT,
+			`user_id` int(11) NOT NULL DEFAULT 0,
+			`username` varchar(64) NOT NULL DEFAULT '',
+			`account` varchar(255) NOT NULL DEFAULT '',
+			`password` text,
+			`jwt` text,
+			`jwt_expire` varchar(20) NOT NULL DEFAULT '0',
+			`status` varchar(20) NOT NULL DEFAULT 'ok',
+			`last_msg` varchar(255) NOT NULL DEFAULT '',
+			`created_at` varchar(50) NOT NULL DEFAULT '',
+			`updated_at` varchar(50) NOT NULL DEFAULT '',
+			PRIMARY KEY (`id`),
+			UNIQUE KEY `uq_user_id` (`user_id`)
+		) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+	}
+
+	$tbl = $DB->get_row_prepare("SHOW TABLES LIKE 'plg_qmzl_order'");
+	if (!$tbl) {
+		@$DB->query("CREATE TABLE IF NOT EXISTS `plg_qmzl_order` (
+			`id` int(11) NOT NULL AUTO_INCREMENT,
+			`user_id` int(11) NOT NULL DEFAULT 0,
+			`username` varchar(64) NOT NULL DEFAULT '',
+			`ddh` varchar(64) NOT NULL DEFAULT '',
+			`domain` varchar(255) NOT NULL DEFAULT '',
+			`year` int(11) NOT NULL DEFAULT 1,
+			`amount` varchar(20) NOT NULL DEFAULT '0',
+			`template_id` int(11) NOT NULL DEFAULT 0,
+			`cloud_order_id` varchar(64) NOT NULL DEFAULT '',
+			`gateway` varchar(64) NOT NULL DEFAULT '',
+			`status` varchar(20) NOT NULL DEFAULT 'Pending',
+			`remark` varchar(255) NOT NULL DEFAULT '',
+			`created_at` varchar(50) NOT NULL DEFAULT '',
+			`updated_at` varchar(50) NOT NULL DEFAULT '',
+			PRIMARY KEY (`id`),
+			KEY `idx_user` (`user_id`),
+			KEY `idx_ddh` (`ddh`),
+			KEY `idx_order` (`cloud_order_id`)
+		) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+	} else {
+		// 老表补齐字段
+		$cols = $DB->get_all_prepare("SHOW COLUMNS FROM `plg_qmzl_order` LIKE 'ddh'") ?: [];
+		if (empty($cols)) @$DB->query("ALTER TABLE `plg_qmzl_order` ADD COLUMN `ddh` varchar(64) NOT NULL DEFAULT '' AFTER `username`");
+		$cols = $DB->get_all_prepare("SHOW COLUMNS FROM `plg_qmzl_order` LIKE 'template_id'") ?: [];
+		if (empty($cols)) @$DB->query("ALTER TABLE `plg_qmzl_order` ADD COLUMN `template_id` int(11) NOT NULL DEFAULT 0 AFTER `amount`");
+		$cols = $DB->get_all_prepare("SHOW COLUMNS FROM `plg_qmzl_order` LIKE 'remark'") ?: [];
+		if (empty($cols)) @$DB->query("ALTER TABLE `plg_qmzl_order` ADD COLUMN `remark` varchar(255) NOT NULL DEFAULT '' AFTER `status`");
+		$cols = $DB->get_all_prepare("SHOW COLUMNS FROM `plg_qmzl_order` LIKE 'updated_at'") ?: [];
+		if (empty($cols)) @$DB->query("ALTER TABLE `plg_qmzl_order` ADD COLUMN `updated_at` varchar(50) NOT NULL DEFAULT '' AFTER `created_at`");
+	}
+
+	// 模板归属表
+	$tbl = $DB->get_row_prepare("SHOW TABLES LIKE 'plg_qmzl_template'");
+	if (!$tbl) {
+		@$DB->query("CREATE TABLE IF NOT EXISTS `plg_qmzl_template` (
+			`id` int(11) NOT NULL AUTO_INCREMENT,
+			`template_id` int(11) NOT NULL DEFAULT 0,
+			`user_id` int(11) NOT NULL DEFAULT 0,
+			`username` varchar(64) NOT NULL DEFAULT '',
+			`created_at` varchar(50) NOT NULL DEFAULT '',
+			PRIMARY KEY (`id`),
+			UNIQUE KEY `uq_tpl` (`template_id`)
+		) ENGINE=MyISAM DEFAULT CHARSET=utf8");
+	}
+}
+
+/* ============================================================
+ * 账号(按 user_id)
+ * ============================================================ */
+
+/** 获取用户绑定记录 */
+function qmzl_account_get($user_id)
+{
+	global $DB;
+	$user_id = (int)$user_id;
+	if ($user_id <= 0) return false;
+	return $DB->get_row_prepare("SELECT * FROM plg_qmzl_account WHERE user_id=? LIMIT 1", [$user_id]);
+}
+
+/** 保存/更新绑定凭证(密码加密存储,登录后再写 token) */
+function qmzl_account_save_cred($user_id, $username, $account, $password)
+{
+	global $DB, $date;
+	$enc = qmzl_encrypt_pwd($password);
+	$exist = qmzl_account_get($user_id);
+	if ($exist) {
+		return (bool)$DB->query_prepare(
+			"UPDATE plg_qmzl_account SET username=?, account=?, password=?, updated_at=? WHERE user_id=?",
+			[$username, $account, $enc, $date, (int)$user_id]
+		);
+	}
+	return (bool)$DB->query_prepare(
+		"INSERT INTO plg_qmzl_account (user_id, username, account, password, jwt, jwt_expire, status, last_msg, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?)",
+		[(int)$user_id, $username, $account, $enc, '', '0', 'ok', '', $date, $date]
+	);
+}
+
+/** 写 token 与过期时间 */
+function qmzl_account_set_token($user_id, $jwt, $expire)
+{
+	global $DB, $date;
+	return (bool)$DB->query_prepare(
+		"UPDATE plg_qmzl_account SET jwt=?, jwt_expire=?, updated_at=? WHERE user_id=?",
+		[(string)$jwt, (string)$expire, $date, (int)$user_id]
+	);
+}
+
+/** 更新状态(登录失败等) */
+function qmzl_account_update_status($user_id, $status, $msg = '')
+{
+	global $DB, $date;
+	$status = ($status === 'error') ? 'error' : 'ok';
+	$msg = mb_substr((string)$msg, 0, 250);
+	return (bool)$DB->query_prepare(
+		"UPDATE plg_qmzl_account SET status=?, last_msg=?, updated_at=? WHERE user_id=?",
+		[$status, $msg, $date, (int)$user_id]
+	);
+}
+
+/** 解绑账号 */
+function qmzl_account_delete($user_id)
+{
+	global $DB;
+	return (bool)$DB->query_prepare("DELETE FROM plg_qmzl_account WHERE user_id=? LIMIT 1", [(int)$user_id]);
+}
+
+/** 后台:账号列表 */
+function qmzl_account_list($page = 1, $limit = 200, $keyword = '')
+{
+	global $DB;
+	$page = max(1, (int)$page);
+	$limit = min(1000, max(1, (int)$limit));
+	$where = '';
+	$args = [];
+	if ($keyword !== '') {
+		$where = "WHERE username LIKE ? OR account LIKE ?";
+		$kw = '%' . $keyword . '%';
+		$args = [$kw, $kw];
+	}
+	$row = $DB->get_row_prepare("SELECT COUNT(*) AS c FROM plg_qmzl_account " . $where, $args);
+	$total = (int)($row['c'] ?? 0);
+	$offset = ($page - 1) * $limit;
+	$rows = $DB->get_all_prepare("SELECT * FROM plg_qmzl_account " . $where . " ORDER BY id DESC LIMIT {$limit} OFFSET {$offset}", $args) ?: [];
+	return ['total' => $total, 'rows' => $rows];
+}
+
+/* ============================================================
+ * 模式 / 代理商(agent)
+ * ============================================================ */
+
+/** 当前模式:client(客户自注册)/ agent(代理商) */
+function qmzl_mode()
+{
+	return qmzl_setting_get('mode', 'client') === 'agent' ? 'agent' : 'client';
+}
+
+/** 用户端路由前缀:client → qmzl,agent → qmzl_domain */
+function qmzl_route_prefix()
+{
+	return qmzl_mode() === 'agent' ? 'qmzl_domain' : 'qmzl';
+}
+
+/**
+ * 保存代理商开放接口凭证(平台账号 + API 密钥)并立即鉴权换取 JWT。
+ * 上游登录需人机验证,但开放接口鉴权(/api/v1/auth)用 API 密钥,无需人机验证。
+ */
+function qmzl_agent_save($username, $apiToken)
+{
+	$username = trim((string)$username);
+	$apiToken = trim((string)$apiToken);
+	if ($username === '' || $apiToken === '') {
+		return ['ok' => false, 'status' => 0, 'msg' => '平台账号和 API 密钥不能为空', 'data' => null];
+	}
+	$auth = qmzl_openapi_auth($username, $apiToken);
+	if (!$auth['ok']) {
+		qmzl_setting_set('agent_status', 'error');
+		qmzl_setting_set('agent_msg', $auth['msg']);
+		return ['ok' => false, 'status' => 0, 'msg' => '鉴权失败:' . $auth['msg'] . '(请确认平台账号与 API 密钥正确)', 'data' => null];
+	}
+	qmzl_setting_set('agent_username', $username);
+	qmzl_setting_set('agent_api_token', qmzl_encrypt_pwd($apiToken));
+	qmzl_setting_set('agent_jwt', $auth['data']['jwt']);
+	qmzl_setting_set('agent_jwt_expire', (string)$auth['data']['exp']);
+	qmzl_setting_set('agent_status', 'ok');
+	qmzl_setting_set('agent_msg', '');
+	return $auth;
+}
+
+/** 获取有效的代理商 JWT(过期自动用 API 密钥重新换取) */
+function qmzl_agent_token()
+{
+	$jwt = (string)qmzl_setting_get('agent_jwt', '');
+	$exp = (int)qmzl_setting_get('agent_jwt_expire', 0);
+	if ($jwt !== '' && $exp > time() + 300) {
+		return ['ok' => true, 'status' => 200, 'msg' => '', 'data' => ['jwt' => $jwt]];
+	}
+	$username = (string)qmzl_setting_get('agent_username', '');
+	$apiToken = qmzl_decrypt_pwd((string)qmzl_setting_get('agent_api_token', ''));
+	if ($username === '' || $apiToken === '') {
+		return ['ok' => false, 'status' => 0, 'msg' => '请先在后台配置代理商平台账号与 API 密钥', 'data' => null];
+	}
+	$auth = qmzl_openapi_auth($username, $apiToken);
+	if (!$auth['ok']) {
+		qmzl_setting_set('agent_status', 'error');
+		qmzl_setting_set('agent_msg', $auth['msg']);
+		return $auth;
+	}
+	qmzl_setting_set('agent_jwt', $auth['data']['jwt']);
+	qmzl_setting_set('agent_jwt_expire', (string)$auth['data']['exp']);
+	qmzl_setting_set('agent_status', 'ok');
+	qmzl_setting_set('agent_msg', '');
+	return $auth;
+}
+
+/**
+ * 获取上游 token(统一入口):
+ * agent 模式用管理员代理商账号,client 模式用用户绑定账号。
+ * @param array $user user_info 用户数组
+ */
+function qmzl_require_token($user)
+{
+	if (qmzl_mode() === 'agent') {
+		return qmzl_agent_token();
+	}
+	return qmzl_get_token((int)$user['id']);
+}
+
+/* ============================================================
+ * 模板归属(agent 模式:客户创建的模板记录归属,隔离查看/操作)
+ * ============================================================ */
+
+/** 查询上游模板的归属用户 ID(0 = 未记录/管理员私有) */
+function qmzl_template_owner_id($templateId)
+{
+	global $DB;
+	$r = $DB->get_row_prepare("SELECT user_id FROM plg_qmzl_template WHERE template_id=? LIMIT 1", [(int)$templateId]);
+	return $r ? (int)$r['user_id'] : 0;
+}
+
+/** 记录模板归属(已存在则忽略) */
+function qmzl_template_record($templateId, $userId, $username)
+{
+	global $DB, $date;
+	if ((int)$templateId <= 0 || (int)$userId <= 0) return false;
+	if (qmzl_template_owner_id($templateId) > 0) return true;
+	return (bool)$DB->query_prepare(
+		"INSERT INTO plg_qmzl_template (template_id, user_id, username, created_at) VALUES (?,?,?,?)",
+		[(int)$templateId, (int)$userId, $username, $date]
+	);
+}
+
+/** 模板是否属于该用户(agent 模式权限校验用) */
+function qmzl_template_owned($templateId, $userId)
+{
+	$owner = qmzl_template_owner_id($templateId);
+	return $owner > 0 && $owner === (int)$userId;
+}
+
+/** 某用户拥有的上游模板 ID 集合 */
+function qmzl_template_ids_by_user($userId)
+{
+	global $DB;
+	$rows = $DB->get_all_prepare("SELECT template_id FROM plg_qmzl_template WHERE user_id=? ORDER BY id DESC", [(int)$userId]) ?: [];
+	$ids = [];
+	foreach ($rows as $r) {
+		$ids[(int)$r['template_id']] = true;
+	}
+	return $ids;
+}
+
+/* ============================================================
+ * 后缀溢价(agent 模式:管理员为各后缀设置的一次性加价,元)
+ * ============================================================ */
+
+/** 溢价配置表:{".com": "10", ...} */
+function qmzl_markup_map()
+{
+	if (qmzl_mode() !== 'agent') return [];
+	$raw = qmzl_setting_get('agent_markup', '');
+	$map = json_decode((string)$raw, true);
+	return is_array($map) ? $map : [];
+}
+
+/** 某后缀的溢价金额(元,无则 0) */
+function qmzl_markup_for_suffix($suffix)
+{
+	$map = qmzl_markup_map();
+	$key = strtolower((string)$suffix);
+	if ($key !== '' && $key[0] !== '.') $key = '.' . ltrim($key, '.');
+	$v = (string)($map[$key] ?? '0');
+	$f = (float)$v;
+	return $f > 0 ? $f : 0;
+}
+
+/** 某完整域名的溢价金额(取第一个点之后的后缀) */
+function qmzl_markup_for_domain($domain)
+{
+	$pos = strpos((string)$domain, '.');
+	if ($pos === false) return 0;
+	return qmzl_markup_for_suffix(substr($domain, $pos));
+}
+
+/** 对价格列表应用溢价(agent 模式),返回溢价金额 */
+function qmzl_apply_markup(&$list, $domain)
+{
+	if (qmzl_mode() !== 'agent' || !is_array($list)) return 0;
+	$markup = qmzl_markup_for_domain($domain);
+	if ($markup <= 0) return 0;
+	foreach ($list as &$p) {
+		if (is_array($p) && isset($p['buyprice'])) {
+			$p['buyprice'] = (string)(round((float)$p['buyprice'] + $markup, 2));
+			$p['markup'] = $markup;
+		}
+	}
+	unset($p);
+	return $markup;
+}
+
+/* ============================================================
+ * 订单(按 user_id)
+ * ============================================================ */
+
+/** 新增本地订单记录 */
+function qmzl_order_create($user_id, $username, $ddh, $domain, $year, $amount, $templateId, $cloudOrderId, $gateway, $remark = '')
+{
+	global $DB, $date;
+	return (bool)$DB->query_prepare(
+		"INSERT INTO plg_qmzl_order (user_id, username, ddh, domain, year, amount, template_id, cloud_order_id, gateway, status, remark, created_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
+		[(int)$user_id, $username, (string)$ddh, $domain, (int)$year, (string)$amount, (int)$templateId, (string)$cloudOrderId, (string)$gateway, 'Pending', $remark, $date, $date]
+	);
+}
+
+/** 按本地主键查订单 */
+function qmzl_order_get_by_id($id)
+{
+	global $DB;
+	return $DB->get_row_prepare("SELECT * FROM plg_qmzl_order WHERE id=? LIMIT 1", [(int)$id]);
+}
+
+/** 按上游订单号查本地记录(client 模式) */
+function qmzl_order_get($cloudOrderId)
+{
+	global $DB;
+	return $DB->get_row_prepare("SELECT * FROM plg_qmzl_order WHERE cloud_order_id=? LIMIT 1", [(string)$cloudOrderId]);
+}
+
+/** 按 MNBT 订单号查本地记录(agent 模式) */
+function qmzl_order_get_by_ddh($ddh)
+{
+	global $DB;
+	return $DB->get_row_prepare("SELECT * FROM plg_qmzl_order WHERE ddh=? LIMIT 1", [(string)$ddh]);
+}
+
+/** 更新订单(白名单字段) */
+function qmzl_order_update($id, $fields = [])
+{
+	global $DB, $date;
+	$whitelist = ['ddh', 'domain', 'year', 'amount', 'template_id', 'cloud_order_id', 'gateway', 'status', 'remark'];
+	$set = [];
+	$args = [];
+	foreach ($fields as $k => $v) {
+		if (in_array($k, $whitelist, true)) {
+			$set[] = "`{$k}`=?";
+			$args[] = $v;
+		}
+	}
+	if (!$set) return false;
+	$set[] = "`updated_at`=?";
+	$args[] = $date;
+	$args[] = (int)$id;
+	return (bool)$DB->query_prepare("UPDATE plg_qmzl_order SET " . implode(', ', $set) . " WHERE id=?", $args);
+}
+
+/** 更新订单状态(按上游订单号,client 模式) */
+function qmzl_order_update_status($cloudOrderId, $status)
+{
+	global $DB, $date;
+	return (bool)$DB->query_prepare(
+		"UPDATE plg_qmzl_order SET status=?, updated_at=? WHERE cloud_order_id=?",
+		[$status, $date, (string)$cloudOrderId]
+	);
+}
+
+/** 用户订单列表 */
+function qmzl_order_list($user_id, $page = 1, $limit = 20)
+{
+	global $DB;
+	$page = max(1, (int)$page);
+	$limit = min(100, max(1, (int)$limit));
+	$row = $DB->get_row_prepare("SELECT COUNT(*) AS c FROM plg_qmzl_order WHERE user_id=?", [(int)$user_id]);
+	$total = (int)($row['c'] ?? 0);
+	$offset = ($page - 1) * $limit;
+	$rows = $DB->get_all_prepare("SELECT * FROM plg_qmzl_order WHERE user_id=? ORDER BY id DESC LIMIT {$limit} OFFSET {$offset}", [(int)$user_id]) ?: [];
+	return ['total' => $total, 'rows' => $rows];
+}
+
+/** 后台:全部订单列表 */
+function qmzl_order_admin_list($page = 1, $limit = 20, $status = '', $keyword = '')
+{
+	global $DB;
+	$page = max(1, (int)$page);
+	$limit = min(200, max(1, (int)$limit));
+	$where = '';
+	$args = [];
+	if ($status !== '' && in_array($status, ['Pending', 'Paid', 'Cancelled', 'Failed'], true)) {
+		$where = "WHERE status=?";
+		$args[] = $status;
+	}
+	if ($keyword !== '') {
+		$where .= ($where === '' ? 'WHERE ' : ' AND ') . "(domain LIKE ? OR username LIKE ? OR ddh LIKE ? OR cloud_order_id LIKE ?)";
+		$kw = '%' . $keyword . '%';
+		array_push($args, $kw, $kw, $kw, $kw);
+	}
+	$row = $DB->get_row_prepare("SELECT COUNT(*) AS c FROM plg_qmzl_order " . $where, $args);
+	$total = (int)($row['c'] ?? 0);
+	$offset = ($page - 1) * $limit;
+	$rows = $DB->get_all_prepare("SELECT * FROM plg_qmzl_order " . $where . " ORDER BY id DESC LIMIT {$limit} OFFSET {$offset}", $args) ?: [];
+	return ['total' => $total, 'rows' => $rows];
+}
+
+/* ============================================================
+ * 插件设置
+ * ============================================================ */
+
+function qmzl_setting_get($key, $default = '')
+{
+	return mnbt_plugin_option_get('qmzl_domain', $key, $default);
+}
+
+function qmzl_setting_set($key, $value)
+{
+	return mnbt_plugin_option_set('qmzl_domain', $key, $value);
+}
diff --git a/app_plugins/qmzl_domain/plugin.json b/app_plugins/qmzl_domain/plugin.json
new file mode 100644
index 0000000..938035c
--- /dev/null
+++ b/app_plugins/qmzl_domain/plugin.json
@@ -0,0 +1,10 @@
+{
+  "id": "qmzl_domain",
+  "name": "启明智联域名注册",
+  "version": "1.0.0",
+  "author": "启明智联",
+  "description": "对接启明智联平台域名注册 API:域名可用性查询、价格查询、信息模板管理、下单支付(跳转上游支付)、已购域名列表。用户使用自己的启明智联账号登录后即可注册域名。",
+  "requires_mnbt": "1.81",
+  "type": ["business"],
+  "requires_plugins": ["user_info"]
+}
diff --git a/app_plugins/qmzl_domain/uninstall.sql b/app_plugins/qmzl_domain/uninstall.sql
new file mode 100644
index 0000000..c64dcee
--- /dev/null
+++ b/app_plugins/qmzl_domain/uninstall.sql
@@ -0,0 +1,2 @@
+DROP TABLE IF EXISTS `plg_qmzl_account`;
+DROP TABLE IF EXISTS `plg_qmzl_order`;
diff --git a/app_plugins/qmzl_domain/views/account.php b/app_plugins/qmzl_domain/views/account.php
new file mode 100644
index 0000000..521ef20
--- /dev/null
+++ b/app_plugins/qmzl_domain/views/account.php
@@ -0,0 +1,415 @@
+<?php
+/**
+ * qmzl_domain - 用户端云账号绑定页(仅 client 模式)
+ *
+ * 上游启明智联登录需人机验证(QmCaptcha 点选),参照 qiming-web AuthView.vue 实现:
+ * 先获取验证码图片 → 点击图中指定图标 → 校验 → 再以 AES 加密密码登录换取 JWT。
+ */
+if (!defined('IN_CRONLITE')) exit;
+$qzCss   = qmzl_asset_url('qmzl.css');
+$qzJs    = qmzl_asset_url('qmzl.js');
+$qzMdi   = mnbt_asset_url('css/materialdesignicons.min.css');
+$qzJq    = mnbt_asset_url('js/jquery.min.js');
+$qzApi   = qmzl_url(qmzl_route_prefix() . '/api');
+$qzIdxUrl = qmzl_url(qmzl_route_prefix());
+$qzTplUrl = qmzl_url(qmzl_route_prefix() . '/templates');
+$qzDomUrl = qmzl_url(qmzl_route_prefix() . '/domains');
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>云账号 - 域名服务</title>
+<link rel="stylesheet" href="<?= htmlspecialchars($qzMdi, ENT_QUOTES, 'UTF-8') ?>">
+<link rel="stylesheet" href="<?= htmlspecialchars($qzCss, ENT_QUOTES, 'UTF-8') ?>">
+<style>
+body { margin: 0; background: var(--qz-bg); color: var(--qz-text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; padding: 24px 16px 48px; }
+.qz-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
+.qz-nav a { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 13px; background: #fff; border: 1px solid var(--qz-border); color: var(--qz-text-2); text-decoration: none; transition: all .15s; }
+.qz-nav a:hover { border-color: var(--qz-brand); color: var(--qz-brand); }
+
+/* 绑定卡片居中 */
+.qz-bind-card { max-width: 640px; margin: 0 auto; }
+
+/* 步骤条 */
+.qz-steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
+.qz-steps .step { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--qz-text-3); }
+.qz-steps .step i { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: #f1f3f6; color: var(--qz-text-3); font-style: normal; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
+.qz-steps .step.on { color: var(--qz-brand); }
+.qz-steps .step.on i { background: var(--qz-brand); color: #fff; }
+
+/* 人机验证区 */
+.qz-captcha-box { margin: 18px 0; padding: 14px 16px; border: 1px dashed var(--qz-border); border-radius: 10px; background: #fafbfd; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
+.qz-captcha-box .cap-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--qz-text-2); }
+
+/* 全宽按钮 */
+.qz-btn--block { display: flex; width: 100%; justify-content: center; align-items: center; padding: 11px; font-size: 15px; }
+
+/* 账号密码纵向排列 */
+.qz-form-stack { display: flex; flex-direction: column; gap: 14px; }
+
+/* 已绑定摘要 */
+.qz-bound-summary { display: flex; align-items: center; gap: 14px; padding: 4px 0 16px; margin-bottom: 6px; border-bottom: 1px solid #f0f1f6; }
+.qz-bound-summary .avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--qz-brand-soft); color: var(--qz-brand); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
+.qz-bound-summary .acc { font-size: 16px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
+.qz-bound-summary .meta { font-size: 12px; color: var(--qz-text-3); margin-top: 2px; }
+
+/* 使用说明网格 */
+.qz-feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
+.qz-feat { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--qz-border); border-radius: 10px; background: #fff; }
+.qz-feat .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--qz-brand-soft); color: var(--qz-brand); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
+.qz-feat .t { font-size: 13px; color: var(--qz-text); font-weight: 600; }
+.qz-feat .d { font-size: 12px; color: var(--qz-text-3); margin-top: 3px; line-height: 1.55; }
+
+/* 验证码弹窗 */
+.cap-wrap { position: relative; width: 100%; max-width: 340px; margin: 0 auto; border-radius: 10px; overflow: hidden; background: #f5f5f5; }
+.cap-wrap img { width: 100%; display: block; cursor: pointer; }
+.cap-dot { position: absolute; width: 28px; height: 28px; border-radius: 50%; background: rgba(22,163,74,.8); color: #fff; text-align: center; line-height: 28px; font-size: 13px; pointer-events: none; z-index: 3; }
+.cap-loading { position: absolute; inset: 0; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; z-index: 5; }
+.cap-spinner { width: 30px; height: 30px; border: 3px solid #e5e7eb; border-top-color: var(--qz-brand); border-radius: 50%; animation: qzSpin .7s linear infinite; }
+@keyframes qzSpin { to { transform: rotate(360deg); } }
+
+@media (max-width: 640px) {
+  .qz-feat-grid { grid-template-columns: 1fr; }
+}
+</style>
+</head>
+<body>
+<div class="qz-wrap">
+
+  <div class="qz-head">
+    <h1>启明智联账号</h1>
+    <p>绑定你的启明智联平台账号后即可注册域名,支付在启明智联平台完成。</p>
+    <div class="qz-nav" style="margin-top:12px;">
+      <a href="<?= htmlspecialchars($qzIdxUrl, ENT_QUOTES, 'UTF-8') ?>">域名注册</a>
+      <a href="<?= htmlspecialchars($qzTplUrl, ENT_QUOTES, 'UTF-8') ?>">信息模板</a>
+      <a href="<?= htmlspecialchars($qzDomUrl, ENT_QUOTES, 'UTF-8') ?>">我的域名</a>
+    </div>
+  </div>
+
+  <!-- 未绑定:绑定表单 -->
+  <div id="qz-unbound" style="display:none;">
+    <div class="qz-card qz-bind-card">
+      <div class="qz-card-head"><h3>绑定启明智联账号</h3></div>
+      <div class="qz-card-body">
+        <div class="qz-tip">请填写你在 <a href="https://cloud.qimingidc.cn" target="_blank" rel="noopener" style="color:var(--qz-brand)">cloud.qimingidc.cn</a> 注册的账号与登录密码,并完成人机验证。账号密码仅用于向平台换取登录凭证,加密存储于本站。</div>
+
+        <div class="qz-steps">
+          <span class="step on"><i>1</i> 填写账号密码</span>
+          <span class="step"><i>2</i> 人机验证</span>
+          <span class="step"><i>3</i> 完成绑定</span>
+        </div>
+
+        <div class="qz-form-stack">
+          <div class="qz-form-item">
+            <label>平台账号 <span class="req">*</span></label>
+            <input type="text" class="qz-input" id="qz-account" placeholder="手机号或邮箱" maxlength="200" autocomplete="username">
+          </div>
+          <div class="qz-form-item">
+            <label>平台密码 <span class="req">*</span></label>
+            <input type="password" class="qz-input" id="qz-password" placeholder="登录密码" maxlength="100" autocomplete="current-password">
+          </div>
+        </div>
+
+        <div class="qz-captcha-box">
+          <span class="cap-label"><span class="mdi mdi-shield-check-outline" style="color:var(--qz-brand);font-size:20px;"></span> 人机验证 <span class="req">*</span></span>
+          <button type="button" class="qz-btn qz-btn--ghost" id="qz-btn-captcha" style="padding:7px 16px;">
+            <span id="qz-cap-status">请完成人机验证</span>
+          </button>
+        </div>
+
+        <button type="button" class="qz-btn qz-btn--block" id="qz-btn-save"><span class="mdi mdi-link-variant"></span> 绑定并验证</button>
+      </div>
+    </div>
+  </div>
+
+  <!-- 已绑定:当前绑定信息 -->
+  <div id="qz-bound" style="display:none;">
+    <div class="qz-card qz-bind-card">
+      <div class="qz-card-head"><h3>当前绑定</h3></div>
+      <div class="qz-card-body">
+        <div class="qz-bound-summary">
+          <div class="avatar"><span class="mdi mdi-account"></span></div>
+          <div class="qz-grow">
+            <div class="acc" id="qz-bound-account">-</div>
+            <div class="meta" id="qz-bound-updated">-</div>
+          </div>
+          <span id="qz-bound-status"></span>
+        </div>
+        <div class="qz-tip" id="qz-bound-status-tip"></div>
+        <div class="qz-actions" style="margin-top:16px;">
+          <button type="button" class="qz-btn" id="qz-btn-edit"><span class="mdi mdi-pencil-outline"></span> 更换账号</button>
+          <button type="button" class="qz-btn qz-btn--danger" id="qz-btn-unbind"><span class="mdi mdi-link-variant-off"></span> 解绑</button>
+        </div>
+      </div>
+    </div>
+  </div>
+
+  <!-- 使用说明 -->
+  <div class="qz-card qz-bind-card">
+    <div class="qz-card-head"><h3>使用说明</h3></div>
+    <div class="qz-card-body">
+      <div class="qz-feat-grid">
+        <div class="qz-feat">
+          <div class="ic"><span class="mdi mdi-account-search-outline"></span></div>
+          <div><div class="t">账号数据为准</div><div class="d">域名查询、价格、信息模板均以你的平台账号数据为准。</div></div>
+        </div>
+        <div class="qz-feat">
+          <div class="ic"><span class="mdi mdi-shield-key-outline"></span></div>
+          <div><div class="t">凭证过期重绑</div><div class="d">登录凭证过期后需重新完成人机验证并绑定。</div></div>
+        </div>
+        <div class="qz-feat">
+          <div class="ic"><span class="mdi mdi-id-card"></span></div>
+          <div><div class="t">模板实名认证</div><div class="d">信息模板需先完成实名认证(上传证件照片)后才能注册域名。</div></div>
+        </div>
+        <div class="qz-feat">
+          <div class="ic"><span class="mdi mdi-cash-multiple"></span></div>
+          <div><div class="t">支付在上游</div><div class="d">下单后由你自行在平台完成支付,支付成功域名即注册生效。</div></div>
+        </div>
+      </div>
+    </div>
+  </div>
+
+</div>
+
+<!-- 人机验证弹窗(点选验证) -->
+<div class="qz-mask" id="qz-mask-captcha">
+  <div class="qz-modal" style="max-width:420px;">
+    <div class="qz-modal-head">
+      <h3>人机验证</h3>
+      <button type="button" class="qz-modal-close" data-close>&times;</button>
+    </div>
+    <div class="qz-modal-body" style="text-align:center;">
+      <div class="cap-wrap" id="cap-wrap">
+        <img id="cap-img" alt="验证码" style="opacity:0;">
+        <div class="cap-loading" id="cap-loading"><div class="cap-spinner"></div></div>
+      </div>
+      <div style="margin-top:12px;font-size:14px;">请依次点击图中的:<span id="cap-icons" style="color:var(--qz-brand);font-weight:600;">...</span></div>
+      <div id="cap-msg" class="qz-tip qz-tip--danger" style="display:none;margin-top:10px;"></div>
+    </div>
+    <div class="qz-modal-foot">
+      <button type="button" class="qz-btn qz-btn--ghost" id="qz-cap-refresh"><span class="mdi mdi-refresh"></span> 刷新图片</button>
+    </div>
+  </div>
+</div>
+
+<script src="<?= htmlspecialchars($qzJq, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script src="<?= htmlspecialchars($qzJs, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script>
+$(function () {
+  var QZ_API = <?= json_encode($qzApi, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var bound = null;
+  var ICON_MAP = { star: '★', tri: '▲', square: '■', round: '●' };
+  var captcha = { base64: '', icon: '', sign: '', dots: [] };
+  var verifiedCaptcha = '';
+  var verifiedToken = '';
+  var capLoading = false;
+
+  function maskAccount(acc) {
+    if (!acc) return '-';
+    return acc.length > 4 ? acc.slice(0, 2) + '***' + acc.slice(-2) : '***';
+  }
+
+  function iconSymbols(str) {
+    if (!str) return '...';
+    return String(str).split(',').map(function (n) {
+      var t = n.trim();
+      return ICON_MAP[t] || t;
+    }).join(' ');
+  }
+
+  function render() {
+    if (bound) {
+      $('#qz-bound').show();
+      $('#qz-unbound').hide();
+      $('#qz-bound-account').text(maskAccount(bound.account));
+      $('#qz-bound-updated').text('最近更新:' + (bound.updated_at || '-'));
+      if (bound.status === 'error') {
+        $('#qz-bound-status').html('<span class="qz-badge qz-badge--red">异常</span>');
+        $('#qz-bound-status-tip').addClass('qz-tip--danger').removeClass('qz-tip--success')
+          .html('上次登录验证失败:' + QZ.esc(bound.last_msg || '未知原因') + ',可更换账号重新绑定。').show();
+      } else {
+        $('#qz-bound-status').html('<span class="qz-badge qz-badge--green">正常</span>');
+        $('#qz-bound-status-tip').addClass('qz-tip--success').removeClass('qz-tip--danger')
+          .html('账号绑定正常,可正常使用域名注册服务。').show();
+      }
+    } else {
+      $('#qz-bound').hide();
+      $('#qz-unbound').show();
+    }
+  }
+
+  function loadInfo() {
+    QZ.post(QZ_API + '/account_info', {}, function (res) {
+      if (res.qk === 1) {
+        bound = res.data && res.data.bound ? res.data : null;
+      } else {
+        bound = null;
+      }
+      render();
+    }, function () { bound = null; render(); });
+  }
+
+  /* ---------- 人机验证 ---------- */
+  function clearCapLoad() {
+    capLoading = false;
+    $('#cap-loading').hide();
+  }
+
+  function refreshCaptcha() {
+    capLoading = true;
+    $('#cap-loading').show();
+    $('#cap-msg').hide();
+    captcha = { base64: '', icon: '', sign: '', dots: [] };
+    renderDots();
+
+    var $img = $('#cap-img');
+    $img.css('opacity', 0).off('load').off('error');
+    // 先绑定事件再设置 src,避免图片缓存导致 load 先于事件挂载而永远不显示
+    $img.on('load', function () {
+      $(this).css('opacity', 1);
+      clearCapLoad();
+    });
+    $img.on('error', function () {
+      clearCapLoad();
+      $('#cap-msg').text('验证码图片加载失败,请点击刷新重试').show();
+    });
+
+    QZ.post(QZ_API + '/captcha_refresh', {}, function (res) {
+      var d = res.data || {};
+      if (!d.base64 || !d.sign) {
+        clearCapLoad();
+        QZ.toast('获取验证码失败', 'error');
+        return;
+      }
+      captcha.base64 = d.base64;
+      captcha.icon = d.captcha_icon || '';
+      captcha.sign = d.sign;
+      var src = d.base64.indexOf('data:') === 0 ? d.base64 : 'data:image/png;base64,' + d.base64;
+      $img.attr('src', src);
+      $('#cap-icons').text(iconSymbols(d.captcha_icon));
+    }, function (msg) {
+      clearCapLoad();
+      QZ.toast(msg || '获取验证码失败', 'error');
+    });
+  }
+
+  function renderDots() {
+    $('#cap-wrap .cap-dot').remove();
+    captcha.dots.forEach(function (d, i) {
+      $('<div class="cap-dot" style="left:' + d.x + 'px;top:' + d.y + 'px;">' + (i + 1) + '</div>').appendTo('#cap-wrap');
+    });
+  }
+
+  function onImgClick(e) {
+    if (capLoading || captcha.dots.length >= 3) return;
+    var img = document.getElementById('cap-img');
+    if (!img || !img.naturalWidth) return;
+    var rect = img.getBoundingClientRect();
+    if (rect.width === 0 || rect.height === 0) return;
+    var displayX = e.clientX - rect.left;
+    var displayY = e.clientY - rect.top;
+    var scaleX = img.naturalWidth / rect.width;
+    var scaleY = img.naturalHeight / rect.height;
+    captcha.dots.push({
+      x: displayX - 14,
+      y: displayY - 14,
+      imgX: displayX * scaleX,
+      imgY: displayY * scaleY
+    });
+    renderDots();
+    if (captcha.dots.length === 3) verifyCaptcha();
+  }
+
+  function verifyCaptcha() {
+    if (capLoading) return;
+    var poi = captcha.dots.map(function (d) {
+      return Math.round(d.imgX) + '-' + Math.round(d.imgY);
+    }).join(',');
+    var value = '28||' + poi;
+    capLoading = true;
+    $('#cap-loading').show();
+    QZ.post(QZ_API + '/captcha_verify', { captcha: value, token: captcha.sign }, function (res) {
+      verifiedCaptcha = value;
+      verifiedToken = captcha.sign;
+      clearCapLoad();
+      $('#qz-mask-captcha').removeClass('show');
+      $('#qz-cap-status').text('已通过人机验证');
+      $('#qz-btn-captcha').css({ 'border-color': 'var(--qz-success)', 'color': 'var(--qz-success)', 'background': '#ecfdf5' });
+    }, function (msg) {
+      clearCapLoad();
+      $('#cap-msg').text(msg || '验证失败,请重试').show();
+      setTimeout(refreshCaptcha, 1000);
+    });
+  }
+
+  $('#qz-btn-captcha').on('click', function () {
+    $('#qz-mask-captcha').addClass('show');
+    refreshCaptcha();
+  });
+  $('#qz-cap-refresh').on('click', refreshCaptcha);
+  $('#cap-wrap').on('click', function (e) {
+    if (e.target === this || e.target.id === 'cap-loading') return;
+    onImgClick(e);
+  });
+
+  /* ---------- 绑定 ---------- */
+  $('#qz-btn-save').on('click', function () {
+    var account = $.trim($('#qz-account').val());
+    var password = $('#qz-password').val();
+    if (!account || !password) { QZ.toast('请输入账号和密码', 'error'); return; }
+    if (!verifiedCaptcha || !verifiedToken) {
+      QZ.toast('请先完成人机验证', 'error');
+      $('#qz-mask-captcha').addClass('show');
+      refreshCaptcha();
+      return;
+    }
+    $(this).prop('disabled', true);
+    QZ.post(QZ_API + '/save_account', {
+      account: account,
+      password: password,
+      captcha: verifiedCaptcha,
+      captcha_token: verifiedToken
+    }, function (res) {
+      if (res.qk === 1) {
+        QZ.toast('绑定成功', 'success');
+        $('#qz-account').val('');
+        $('#qz-password').val('');
+        $('#qz-btn-captcha').css({});
+        $('#qz-cap-status').text('请完成人机验证');
+        verifiedCaptcha = '';
+        verifiedToken = '';
+        loadInfo();
+      } else {
+        QZ.toast(res.msg || '绑定失败', 'error');
+      }
+      $('#qz-btn-save').prop('disabled', false);
+    }, function (msg) {
+      QZ.toast(msg, 'error');
+      $('#qz-btn-save').prop('disabled', false);
+    });
+  });
+
+  $('#qz-btn-edit').on('click', function () {
+    $('#qz-bound').hide();
+    $('#qz-unbound').show();
+    $('#qz-account').val(bound ? bound.account : '');
+    $('#qz-password').val('').focus();
+  });
+
+  $('#qz-btn-unbind').on('click', function () {
+    if (!confirm('确定解绑当前启明智联账号?')) return;
+    QZ.post(QZ_API + '/unbind', {}, function (res) {
+      if (res.qk === 1) { QZ.toast('已解绑', 'success'); loadInfo(); }
+      else QZ.toast(res.msg || '解绑失败', 'error');
+    });
+  });
+
+  $('[data-close]').on('click', function () { $(this).closest('.qz-mask').removeClass('show'); });
+
+  loadInfo();
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/views/domains.php b/app_plugins/qmzl_domain/views/domains.php
new file mode 100644
index 0000000..0e1e3f8
--- /dev/null
+++ b/app_plugins/qmzl_domain/views/domains.php
@@ -0,0 +1,172 @@
+<?php
+/**
+ * qmzl_domain - 用户端我的域名页
+ *
+ * 已购域名同步自启明智联平台(GET /host,过滤 type=domain),
+ * 另展示本地下单记录与支付状态。
+ */
+if (!defined('IN_CRONLITE')) exit;
+$mode = qmzl_mode();
+$qzCss   = qmzl_asset_url('qmzl.css');
+$qzJs    = qmzl_asset_url('qmzl.js');
+$qzMdi   = mnbt_asset_url('css/materialdesignicons.min.css');
+$qzJq    = mnbt_asset_url('js/jquery.min.js');
+$qzApi   = qmzl_url(qmzl_route_prefix() . '/api');
+$qzAccUrl = qmzl_url(qmzl_route_prefix() . '/account');
+$qzIdxUrl = qmzl_url(qmzl_route_prefix());
+$qzPayBase = qmzl_url(qmzl_route_prefix() . '/pay');
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>我的域名 - 域名服务</title>
+<link rel="stylesheet" href="<?= htmlspecialchars($qzMdi, ENT_QUOTES, 'UTF-8') ?>">
+<link rel="stylesheet" href="<?= htmlspecialchars($qzCss, ENT_QUOTES, 'UTF-8') ?>">
+<style>
+body { margin: 0; background: var(--qz-bg); color: var(--qz-text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; padding: 24px 16px 48px; }
+.qz-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
+.qz-nav a { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 13px; background: #fff; border: 1px solid var(--qz-border); color: var(--qz-text-2); text-decoration: none; transition: all .15s; }
+.qz-nav a:hover { border-color: var(--qz-brand); color: var(--qz-brand); }
+</style>
+</head>
+<body>
+<div class="qz-wrap">
+
+  <div class="qz-head">
+    <h1>我的域名</h1>
+    <p>已购域名数据同步自启明智联平台。</p>
+    <div class="qz-nav" style="margin-top:12px;">
+      <a href="<?= htmlspecialchars($qzIdxUrl, ENT_QUOTES, 'UTF-8') ?>">域名注册</a>
+      <?php if ($mode === 'client'): ?>
+        <a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>">云账号</a>
+      <?php endif; ?>
+    </div>
+  </div>
+
+  <?php if ($mode === 'client'): ?>
+  <div id="qz-tip-unbound" class="qz-tip qz-tip--warn" style="display:none;">
+    尚未绑定启明智联账号,无法同步域名数据。<a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>" style="color:var(--qz-brand);font-weight:600;">立即绑定</a>
+  </div>
+  <?php endif; ?>
+
+  <div class="qz-card">
+    <div class="qz-card-head">
+      <h3>已购域名</h3>
+      <button type="button" class="qz-btn qz-btn--ghost qz-btn--sm" id="qz-btn-refresh"><span class="mdi mdi-refresh"></span> 刷新</button>
+    </div>
+    <div class="qz-card-body" id="qz-domains">
+      <div class="qz-loading">加载中...</div>
+    </div>
+  </div>
+
+  <div class="qz-card">
+    <div class="qz-card-head"><h3>购买记录</h3></div>
+    <div class="qz-card-body" id="qz-orders">
+      <div class="qz-loading">加载中...</div>
+    </div>
+  </div>
+
+</div>
+
+<script src="<?= htmlspecialchars($qzJq, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script src="<?= htmlspecialchars($qzJs, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script>
+$(function () {
+  var QZ_MODE = <?= json_encode($mode, JSON_UNESCAPED_UNICODE) ?>;
+  var QZ_API = <?= json_encode($qzApi, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var PAY_BASE = <?= json_encode($qzPayBase, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var STATUS = {
+    Active: ['正常', 'green'], Suspended: ['已暂停', 'red'], Pending: ['处理中', 'yellow'],
+    Expired: ['已过期', 'red'], Deleted: ['已删除', 'gray'], Cancelled: ['已取消', 'gray'], Fraud: ['欺诈', 'red']
+  };
+  var ORDER_STATUS = { Pending: ['待支付', 'yellow'], Paid: ['已支付', 'green'], Cancelled: ['已取消', 'gray'], Failed: ['失败', 'red'] };
+
+  if (QZ_MODE === 'client') {
+    QZ.post(QZ_API + '/account_info', {}, function (res) {
+      if (!(res.data && res.data.bound)) $('#qz-tip-unbound').show();
+    }, function () { $('#qz-tip-unbound').show(); });
+  }
+
+  function fmtTime(ts) {
+    if (!ts) return '-';
+    var d = new Date(parseInt(ts, 10) * 1000);
+    if (isNaN(d.getTime())) return '-';
+    var p = function (n) { return (n < 10 ? '0' : '') + n; };
+    return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) + ' ' + p(d.getHours()) + ':' + p(d.getMinutes());
+  }
+
+  function loadDomains() {
+    $('#qz-domains').html('<div class="qz-loading">加载中...</div>');
+    QZ.post(QZ_API + '/domains', {}, function (res) {
+      var list = (res.data && res.data.list) || [];
+      if (!list.length) {
+        $('#qz-domains').html('<div class="qz-empty">暂无已购域名</div>');
+        return;
+      }
+      var html = '<table class="qz-table"><thead><tr>' +
+        '<th>域名</th><th>注册商</th><th>状态</th><th>到期时间</th><th>转移锁</th>' +
+        '</tr></thead><tbody>';
+      $.each(list, function (i, h) {
+        var st = STATUS[h.status] || [h.status || '未知', 'gray'];
+        html += '<tr>' +
+          '<td class="qz-monospace">' + QZ.esc(h.name || h.domain || '-') + '</td>' +
+          '<td>' + QZ.esc(h.module_name || h.registrar || '-') + '</td>' +
+          '<td><span class="qz-badge qz-badge--' + st[1] + '">' + st[0] + '</span></td>' +
+          '<td>' + fmtTime(h.due_time) + '</td>' +
+          '<td>' + (h.lock_status === 1 ? '<span class="qz-badge qz-badge--blue">已开启</span>' : '<span class="qz-badge qz-badge--gray">未开启</span>') + '</td>' +
+          '</tr>';
+      });
+      html += '</tbody></table>';
+      $('#qz-domains').html(html);
+    }, function (msg) {
+      $('#qz-domains').html('<div class="qz-empty">' + QZ.esc(msg) + '</div>');
+    });
+  }
+
+  function loadOrders() {
+    $('#qz-orders').html('<div class="qz-loading">加载中...</div>');
+    QZ.post(QZ_API + '/orders', {}, function (res) {
+      var list = (res.data && res.data.rows) || [];
+      if (!list.length) {
+        $('#qz-orders').html('<div class="qz-empty">暂无购买记录</div>');
+        return;
+      }
+      var html = '<table class="qz-table"><thead><tr>' +
+        '<th>域名</th><th>年限</th><th>金额</th><th>状态</th><th>备注</th><th>下单时间</th><th>操作</th>' +
+        '</tr></thead><tbody>';
+      $.each(list, function (i, o) {
+        var st = ORDER_STATUS[o.status] || [o.status || '未知', 'gray'];
+        var op = '-';
+        if (QZ_MODE === 'client' && o.status === 'Pending' && o.cloud_order_id) {
+          op = '<a class="qz-btn qz-btn--sm" href="' + PAY_BASE + '&order=' + parseInt(o.cloud_order_id, 10) + '">去支付</a>';
+        }
+        html += '<tr>' +
+          '<td class="qz-monospace">' + QZ.esc(o.domain) + '</td>' +
+          '<td>' + parseInt(o.year, 10) + ' 年</td>' +
+          '<td>¥' + QZ.esc(o.amount) + '</td>' +
+          '<td><span class="qz-badge qz-badge--' + st[1] + '">' + st[0] + '</span></td>' +
+          '<td class="qz-muted">' + QZ.esc(o.remark || '-') + '</td>' +
+          '<td>' + QZ.esc(o.created_at) + '</td>' +
+          '<td>' + op + '</td>' +
+          '</tr>';
+      });
+      html += '</tbody></table>';
+      $('#qz-orders').html(html);
+    }, function (msg) {
+      $('#qz-orders').html('<div class="qz-empty">' + QZ.esc(msg) + '</div>');
+    });
+  }
+
+  $('#qz-btn-refresh').on('click', function () {
+    loadDomains();
+    loadOrders();
+  });
+
+  loadDomains();
+  loadOrders();
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/views/index.php b/app_plugins/qmzl_domain/views/index.php
new file mode 100644
index 0000000..6002008
--- /dev/null
+++ b/app_plugins/qmzl_domain/views/index.php
@@ -0,0 +1,443 @@
+<?php
+/**
+ * qmzl_domain - 用户端域名注册页
+ *
+ * 流程:查询可用性 → 查看各年限价格 → 选择信息模板/支付方式 → 下单。
+ * client 模式:跳转上游支付;agent 模式:走本站支付系统(MN_dd + 支付插件)。
+ */
+if (!defined('IN_CRONLITE')) exit;
+$mode = qmzl_mode();
+$qzCss   = qmzl_asset_url('qmzl.css');
+$qzJs    = qmzl_asset_url('qmzl.js');
+$qzMdi   = mnbt_asset_url('css/materialdesignicons.min.css');
+$qzJq    = mnbt_asset_url('js/jquery.min.js');
+$qzApi   = qmzl_url(qmzl_route_prefix() . '/api');
+$qzAccUrl  = qmzl_url(qmzl_route_prefix() . '/account');
+$qzTplUrl  = qmzl_url(qmzl_route_prefix() . '/templates');
+$qzDomUrl  = qmzl_url(qmzl_route_prefix() . '/domains');
+$qzPayBase = qmzl_url(qmzl_route_prefix() . '/pay');
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>域名注册 - 域名服务</title>
+<link rel="stylesheet" href="<?= htmlspecialchars($qzMdi, ENT_QUOTES, 'UTF-8') ?>">
+<link rel="stylesheet" href="<?= htmlspecialchars($qzCss, ENT_QUOTES, 'UTF-8') ?>">
+<style>
+body { margin: 0; background: var(--qz-bg); color: var(--qz-text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; padding: 24px 16px 48px; }
+.qz-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--qz-border); border-radius: 10px; margin-bottom: 10px; transition: border-color .15s, background .15s; }
+.qz-result:hover { border-color: #c7cbdd; }
+.qz-result.avail { border-color: #c6f6d5; background: #f7fef9; }
+.qz-result.avail:hover { border-color: #86efac; }
+.qz-result .r-domain { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
+.qz-year { display: flex; gap: 8px; flex-wrap: wrap; }
+.qz-year button { padding: 8px 14px; border: 1px solid var(--qz-border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; transition: all .15s; }
+.qz-year button.on { border-color: var(--qz-brand); background: var(--qz-brand-soft); color: var(--qz-brand); font-weight: 600; }
+.qz-opt { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; cursor: pointer; }
+.qz-opt input { margin-top: 3px; accent-color: var(--qz-brand); }
+.qz-tpl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--qz-border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
+.qz-tpl-item.on { border-color: var(--qz-brand); background: var(--qz-brand-soft); }
+.qz-tpl-item input { accent-color: var(--qz-brand); }
+.qz-agree { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
+.qz-agree input { accent-color: var(--qz-brand); }
+.qz-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid #f0f1f6; }
+.qz-total { font-size: 22px; font-weight: 700; color: var(--qz-brand); }
+.qz-total small { font-size: 13px; color: var(--qz-text-2); font-weight: 400; }
+.qz-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
+.qz-nav a { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 13px; background: #fff; border: 1px solid var(--qz-border); color: var(--qz-text-2); text-decoration: none; transition: all .15s; }
+.qz-nav a:hover { border-color: var(--qz-brand); color: var(--qz-brand); }
+</style>
+</head>
+<body>
+<div class="qz-wrap">
+
+  <div class="qz-head">
+    <h1>域名注册</h1>
+    <p>查询域名可用性,选择年限与信息模板完成注册。</p>
+    <div class="qz-nav" style="margin-top:12px;">
+      <?php if ($mode === 'client'): ?>
+        <a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>">云账号</a>
+      <?php endif; ?>
+      <a href="<?= htmlspecialchars($qzTplUrl, ENT_QUOTES, 'UTF-8') ?>">信息模板</a>
+      <a href="<?= htmlspecialchars($qzDomUrl, ENT_QUOTES, 'UTF-8') ?>">我的域名</a>
+    </div>
+  </div>
+
+  <?php if ($mode === 'client'): ?>
+  <div id="qz-tip-unbound" class="qz-tip qz-tip--warn" style="display:none;">
+    尚未绑定启明智联账号,无法使用域名注册服务。<a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>" style="color:var(--qz-brand);font-weight:600;">立即绑定</a>
+  </div>
+  <?php endif; ?>
+
+  <?php if ($mode === 'agent'): ?>
+  <div class="qz-tip">代理商模式:下单后通过本站支付系统完成支付,支付成功后域名将自动注册。</div>
+  <?php endif; ?>
+
+  <!-- 搜索 -->
+  <div class="qz-card">
+    <div class="qz-card-body">
+      <div class="qz-search-row">
+        <input type="text" class="qz-input qz-monospace" id="qz-domain" placeholder="输入想要注册的域名前缀,如 mydomain" maxlength="63" autocomplete="off">
+        <select class="qz-select" id="qz-suffix"></select>
+        <button type="button" class="qz-btn" id="qz-btn-check"><span class="mdi mdi-magnify"></span> 查询</button>
+      </div>
+      <div style="margin-top:12px;">
+        <span class="qz-muted">热门后缀:</span>
+        <span id="qz-hot-tlds"></span>
+      </div>
+    </div>
+  </div>
+
+  <!-- 查询结果 -->
+  <div class="qz-card" id="qz-results-card" style="display:none;">
+    <div class="qz-card-head">
+      <h3>查询结果</h3>
+      <span class="qz-muted" id="qz-results-count"></span>
+    </div>
+    <div class="qz-card-body" id="qz-results"></div>
+  </div>
+
+  <!-- 注册面板 -->
+  <div class="qz-card" id="qz-register-card" style="display:none;">
+    <div class="qz-card-head">
+      <h3>注册域名 <span class="qz-monospace" id="qz-reg-domain" style="color:var(--qz-brand);"></span></h3>
+      <button type="button" class="qz-btn qz-btn--ghost qz-btn--sm" id="qz-btn-cancel"><span class="mdi mdi-close"></span> 取消</button>
+    </div>
+    <div class="qz-card-body">
+
+      <!-- 年限 -->
+      <div class="qz-form-item" style="margin-bottom:18px;">
+        <label>注册年限</label>
+        <div class="qz-year" id="qz-years"></div>
+      </div>
+
+      <!-- 选项 -->
+      <div class="qz-form-item" style="margin-bottom:8px;">
+        <label>域名选项</label>
+        <label class="qz-opt"><input type="checkbox" id="qz-opt-renew" checked> <span>到期自动续费 <span class="qz-muted">(默认开启,可在平台关闭)</span></span></label>
+        <label class="qz-opt"><input type="checkbox" id="qz-opt-lock" checked> <span>开启转移锁 <span class="qz-muted">(防止域名被非法转移)</span></span></label>
+      </div>
+
+      <!-- 信息模板 -->
+      <div class="qz-form-item" style="margin-bottom:12px;">
+        <label>信息模板 <span class="req">*</span>
+          <a href="<?= htmlspecialchars($qzTplUrl, ENT_QUOTES, 'UTF-8') ?>" target="_blank" style="float:right;font-size:12px;color:var(--qz-brand);">管理模板</a>
+        </label>
+        <div id="qz-templates"></div>
+      </div>
+
+      <!-- 协议 -->
+      <div class="qz-form-item" style="margin-bottom:16px;">
+        <label class="qz-agree"><input type="checkbox" id="qz-agree1"> <span>我已阅读并同意 <a href="javascript:void(0)" id="qz-agr1" target="_blank" style="color:var(--qz-brand)">《域名注册协议》</a></span></label>
+        <label class="qz-agree"><input type="checkbox" id="qz-agree2"> <span>我已阅读并同意 <a href="javascript:void(0)" id="qz-agr2" target="_blank" style="color:var(--qz-brand)">《域名信息服务协议》</a></span></label>
+      </div>
+
+      <!-- 汇总 -->
+      <div class="qz-summary">
+        <div>
+          <div style="font-size:13px;color:var(--qz-text-2);">支付方式 <span class="req">*</span></div>
+          <select class="qz-select" id="qz-gateway" style="width:200px;margin-top:4px;"></select>
+        </div>
+        <div style="text-align:right;">
+          <div class="qz-total"><small>合计:</small>¥<span id="qz-total">0.00</span></div>
+          <div class="qz-muted" id="qz-markup-note" style="display:none;"></div>
+          <div class="qz-muted"><?= $mode === 'agent' ? '使用本站支付系统' : '支付将在启明智联平台完成' ?></div>
+        </div>
+        <button type="button" class="qz-btn" id="qz-btn-order" style="font-size:16px;padding:10px 32px;"><span class="mdi mdi-arrow-right"></span> 去支付</button>
+      </div>
+
+    </div>
+  </div>
+
+</div>
+
+<script src="<?= htmlspecialchars($qzJq, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script src="<?= htmlspecialchars($qzJs, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script>
+$(function () {
+  var QZ_MODE = <?= json_encode($mode, JSON_UNESCAPED_UNICODE) ?>;
+  var QZ_API = <?= json_encode($qzApi, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var PAY_BASE = <?= json_encode($qzPayBase, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var TPL_URL = <?= json_encode($qzTplUrl, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+
+  var state = {
+    suffixes: [{ suffix: '.com' }, { suffix: '.cn' }, { suffix: '.net' }],
+    defaultSuffix: '.com',
+    agreements: { register: '#', service: '#' },
+    results: [],
+    selected: null,          // {name, prefix, suffix}
+    prices: [],              // [{buyyear, buyprice}]
+    templates: [],
+    templateId: 0,
+    gateways: [],
+    gateway: '',
+    bound: false
+  };
+
+  var $domain = $('#qz-domain'), $suffix = $('#qz-suffix'), $results = $('#qz-results'),
+      $registerCard = $('#qz-register-card'), $resultsCard = $('#qz-results-card');
+
+  /* ---------- 初始化 ---------- */
+  if (QZ_MODE === 'agent') {
+    state.bound = true;
+  } else {
+    QZ.post(QZ_API + '/account_info', {}, function (res) {
+      state.bound = !!(res.data && res.data.bound);
+      if (!state.bound) $('#qz-tip-unbound').show();
+    }, function () { $('#qz-tip-unbound').show(); });
+  }
+
+  QZ.post(QZ_API + '/config', {}, function (res) {
+    var d = res.data || {};
+    if (d.suffixes && d.suffixes.length) state.suffixes = d.suffixes;
+    if (d.config) {
+      if (d.config.domain_register_agreement_url) state.agreements.register = d.config.domain_register_agreement_url;
+      if (d.config.domain_information_service_agreement_url) state.agreements.service = d.config.domain_information_service_agreement_url;
+      if (d.config.default_search_domain) state.defaultSuffix = d.config.default_search_domain;
+    }
+    buildSuffixes();
+  }, function (msg) { buildSuffixes(); });
+
+  QZ.post(QZ_API + '/gateways', {}, function (res) {
+    state.gateways = (res.data && res.data.list) || [];
+    var $g = $('#qz-gateway');
+    $g.empty();
+    if (!state.gateways.length) {
+      $g.append('<option value="">无可用支付方式</option>');
+      return;
+    }
+    $.each(state.gateways, function (i, gw) {
+      $g.append('<option value="' + QZ.esc(gw.name) + '">' + QZ.esc(gw.title || gw.name) + '</option>');
+    });
+    state.gateway = state.gateways[0].name;
+  });
+
+  QZ.post(QZ_API + '/templates', {}, function (res) {
+    state.templates = (res.data && res.data.list) || [];
+  }, function () {});
+
+  function buildSuffixes() {
+    var $s = $('#qz-suffix');
+    $s.empty();
+    var defaultFound = false;
+    $.each(state.suffixes, function (i, it) {
+      var sfx = it.suffix;
+      $s.append('<option value="' + QZ.esc(sfx) + '">' + QZ.esc(sfx) + '</option>');
+      if (sfx === state.defaultSuffix) defaultFound = true;
+    });
+    $s.val(defaultFound ? state.defaultSuffix : (state.suffixes[0] ? state.suffixes[0].suffix : '.com'));
+    // 热门后缀标签
+    var hot = state.suffixes.slice(0, 6);
+    var html = hot.map(function (it) {
+      return '<span class="qz-tag" data-sfx="' + QZ.esc(it.suffix) + '">' + QZ.esc(it.suffix) + '</span>';
+    }).join('');
+    $('#qz-hot-tlds').html(html);
+    $('#qz-hot-tlds').off('click').on('click', '.qz-tag', function () {
+      $s.val($(this).data('sfx'));
+      $s.trigger('change');
+    });
+  }
+
+  $('#qz-suffix').on('change', function () {
+    $('#qz-domain').focus();
+  });
+
+  /* ---------- 查询 ---------- */
+  function doCheck() {
+    var domain = $.trim($domain.val());
+    if (!domain) { QZ.toast('请输入域名前缀', 'error'); return; }
+    if (!/^[a-z0-9]([a-z0-9\-]{0,62}[a-z0-9])?$/i.test(domain)) { QZ.toast('域名前缀格式不正确', 'error'); return; }
+    if (!state.bound) { QZ.toast('请先绑定启明智联账号', 'error'); return; }
+
+    $('#qz-btn-check').prop('disabled', true).html('<span class="mdi mdi-loading mdi-spin"></span> 查询中');
+    QZ.post(QZ_API + '/check_domain', { domain: domain, suffix: $suffix.val() }, function (res) {
+      state.results = (res.data && res.data.list) || [];
+      renderResults();
+      $('#qz-btn-check').prop('disabled', false).html('<span class="mdi mdi-magnify"></span> 查询');
+    }, function (msg) {
+      $('#qz-btn-check').prop('disabled', false).html('<span class="mdi mdi-magnify"></span> 查询');
+      QZ.toast(msg, 'error');
+    });
+  }
+
+  $('#qz-btn-check').on('click', doCheck);
+  $domain.on('keydown', function (e) { if (e.which === 13) doCheck(); });
+
+  function renderResults() {
+    if (!state.results.length) {
+      $resultsCard.hide();
+      return;
+    }
+    $resultsCard.show();
+    $('#qz-results-count').text('共 ' + state.results.length + ' 个结果');
+    var html = state.results.map(function (r) {
+      var avail = r.avail === 1;
+      var parts = r.name.split('.');
+      var prefix = parts[0], tld = '.' + parts.slice(1).join('.');
+      return '<div class="qz-result ' + (avail ? 'avail' : '') + '">' +
+        '<div class="qz-flex" style="gap:12px;">' +
+          (avail
+            ? '<span class="qz-badge qz-badge--green">可注册</span>'
+            : '<span class="qz-badge qz-badge--gray">已注册</span>') +
+          '<span class="r-domain">' + QZ.esc(r.name) + '</span>' +
+        '</div>' +
+        (avail
+          ? '<button type="button" class="qz-btn qz-btn--sm" data-name="' + QZ.esc(r.name) + '" data-prefix="' + QZ.esc(prefix) + '" data-tld="' + QZ.esc(tld) + '">立即注册</button>'
+          : '') +
+      '</div>';
+    }).join('');
+    $results.html(html);
+    $results.find('[data-name]').on('click', function () {
+      openRegister($(this).data('prefix'), $(this).data('name'));
+    });
+  }
+
+  /* ---------- 注册面板 ---------- */
+  function openRegister(prefix, name) {
+    if (!state.bound) { QZ.toast('请先绑定启明智联账号', 'error'); return; }
+    state.selected = { prefix: prefix, name: name };
+    state.prices = [];
+    state.markup = 0;
+    state.templateId = 0;
+    $('#qz-reg-domain').text(name);
+    $registerCard.show();
+    $('#qz-years').empty().append('<span class="qz-muted">加载价格中...</span>');
+    $('#qz-total').text('0.00');
+    $('#qz-markup-note').hide();
+    // 自动滚动到下方信息确认区
+    $('html, body').animate({ scrollTop: $registerCard.offset().top - 14 }, 400);
+
+    QZ.post(QZ_API + '/price', { name: name }, function (res) {
+      state.prices = (res.data && res.data.list) || [];
+      state.markup = parseFloat((res.data && res.data.markup) || 0) || 0;
+      renderYears();
+    }, function (msg) {
+      QZ.toast(msg, 'error');
+      $('#qz-years').empty().append('<span class="qz-muted">获取价格失败</span>');
+    });
+    renderTemplates();
+  }
+
+  function renderYears() {
+    var $y = $('#qz-years');
+    $y.empty();
+    if (!state.prices.length) {
+      $y.append('<span class="qz-muted">暂无价格数据</span>');
+      return;
+    }
+    $.each(state.prices, function (i, p) {
+      var avg = (Number(p.buyprice) / Number(p.buyyear)).toFixed(2);
+      $y.append('<button type="button" data-year="' + p.buyyear + '" data-price="' + p.buyprice + '">' +
+        p.buyyear + ' 年 <span class="qz-muted">¥' + avg + '/年</span></button>');
+    });
+    $y.children().first().addClass('on');
+    $('#qz-total').text(Number(state.prices[0].buyprice).toFixed(2));
+    if (state.markup > 0) {
+      $('#qz-markup-note').show().text('已包含后缀溢价 ¥' + state.markup.toFixed(2));
+    } else {
+      $('#qz-markup-note').hide();
+    }
+    $y.off('click').on('click', 'button', function () {
+      $y.children().removeClass('on');
+      $(this).addClass('on');
+      $('#qz-total').text(Number($(this).data('price')).toFixed(2));
+    });
+  }
+
+  var TPL_STATUS = { 0: ['未认证', 'red'], 1: ['已认证', 'green'], 2: ['审核中', 'yellow'], 3: ['认证失败', 'red'], 4: ['异常', 'red'] };
+  function renderTemplates() {
+    var $t = $('#qz-templates');
+    $t.empty();
+    if (!state.templates.length) {
+      $t.append('<div class="qz-empty">暂无信息模板,<a href="' + TPL_URL + '" style="color:var(--qz-brand);">去创建</a></div>');
+      return;
+    }
+    $.each(state.templates, function (i, t) {
+      var st = TPL_STATUS[String(t.status)] || ['未知', 'gray'];
+      var typeName = t.type === 'enterprise' ? '企业' : '个人';
+      $t.append('<label class="qz-tpl-item" data-id="' + t.id + '">' +
+        '<input type="radio" name="qz-tpl" value="' + t.id + '">' +
+        '<div class="qz-grow">' +
+          '<div><strong>' + QZ.esc(t.zh_owner || t.en_owner || '未命名') + '</strong> <span class="qz-muted">' + typeName + '</span></div>' +
+          '<div class="qz-muted">' + QZ.esc(t.email || '') + ' · ' + QZ.esc(t.phone || '') + '</div>' +
+        '</div>' +
+        '<span class="qz-badge qz-badge--' + st[1] + '">' + st[0] + '</span>' +
+      '</label>');
+    });
+    // 默认选中第一个已认证模板
+    var pick = null;
+    $.each(state.templates, function (i, t) { if (t.status === 1 && !pick) pick = t.id; });
+    if (!pick && state.templates.length) pick = state.templates[0].id;
+    $t.find('input[value="' + pick + '"]').prop('checked', true);
+    state.templateId = pick;
+    $t.off('click').on('click', 'label', function () {
+      $(this).find('input').prop('checked', true);
+      state.templateId = parseInt($(this).data('id'), 10);
+    });
+  }
+
+  // 协议链接
+  $('#qz-agr1').on('click', function (e) {
+    if (state.agreements.register && state.agreements.register !== '#') { window.open(state.agreements.register); e.preventDefault(); }
+  });
+  $('#qz-agr2').on('click', function (e) {
+    if (state.agreements.service && state.agreements.service !== '#') { window.open(state.agreements.service); e.preventDefault(); }
+  });
+
+  $('#qz-gateway').on('change', function () { state.gateway = $(this).val(); });
+
+  $('#qz-btn-cancel').on('click', function () {
+    $registerCard.hide();
+    state.selected = null;
+    state.prices = [];
+  });
+
+  /* ---------- 下单 ---------- */
+  $('#qz-btn-order').on('click', function () {
+    if (!state.selected) { QZ.toast('请先选择域名', 'error'); return; }
+    if (!state.templateId) { QZ.toast('请选择信息模板', 'error'); return; }
+    if (!$('#qz-agree1').prop('checked') || !$('#qz-agree2').prop('checked')) { QZ.toast('请先阅读并同意注册协议', 'error'); return; }
+    if (!state.gateway) { QZ.toast('请选择支付方式', 'error'); return; }
+
+    var year = parseInt($('#qz-years .on').data('year'), 10) || 1;
+    var $btn = $('#qz-btn-order');
+    $btn.prop('disabled', true).html('<span class="mdi mdi-loading mdi-spin"></span> 下单中...');
+    QZ.post(QZ_API + '/place_order', {
+      domain: state.selected.name,
+      year: year,
+      template_id: state.templateId,
+      gateway: state.gateway,
+      auto_renew: $('#qz-opt-renew').prop('checked') ? 1 : 0,
+      lock_status: $('#qz-opt-lock').prop('checked') ? 1 : 0
+    }, function (res) {
+      var d = res.data || {};
+      if (d.mode === 'agent') {
+        // 代理商模式:渲染支付插件返回的 HTML(自动提交表单 / 二维码)
+        if (d.html) {
+          document.open();
+          document.write(d.html);
+          document.close();
+        } else {
+          $btn.prop('disabled', false).html('<span class="mdi mdi-arrow-right"></span> 去支付');
+          QZ.toast('支付跳转失败,请重试', 'error');
+        }
+        return;
+      }
+      var orderId = d.order_id;
+      if (orderId) {
+        location.href = PAY_BASE + '&order=' + orderId;
+      } else {
+        $btn.prop('disabled', false).html('<span class="mdi mdi-arrow-right"></span> 去支付');
+        QZ.toast(res.msg || '下单失败', 'error');
+      }
+    }, function (msg) {
+      $btn.prop('disabled', false).html('<span class="mdi mdi-arrow-right"></span> 去支付');
+      QZ.toast(msg, 'error');
+    });
+  });
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/views/pay.php b/app_plugins/qmzl_domain/views/pay.php
new file mode 100644
index 0000000..c0387c6
--- /dev/null
+++ b/app_plugins/qmzl_domain/views/pay.php
@@ -0,0 +1,190 @@
+<?php
+/**
+ * qmzl_domain - 用户端支付页
+ *
+ * 下单后跳转到本页(index.php?_r=/qmzl/pay&order={上游订单ID}),
+ * 路由处理器已校验订单归属并传入 $order / $order_id / $order_valid。
+ * 前端调用 /qmzl/api/pay 发起支付并渲染三方返回的 HTML(自动提交表单 / 二维码),
+ * 同时轮询 /qmzl/api/pay_status 直到支付完成。
+ */
+if (!defined('IN_CRONLITE')) exit;
+$order      = $order ?? null;
+$orderId    = (int)($order_id ?? 0);
+$orderValid = !empty($order_valid);
+$qzCss   = qmzl_asset_url('qmzl.css');
+$qzJs    = qmzl_asset_url('qmzl.js');
+$qzMdi   = mnbt_asset_url('css/materialdesignicons.min.css');
+$qzJq    = mnbt_asset_url('js/jquery.min.js');
+$qzApi   = qmzl_url(qmzl_route_prefix() . '/api');
+$qzDomUrl = qmzl_url(qmzl_route_prefix() . '/domains');
+$qzIdxUrl = qmzl_url(qmzl_route_prefix());
+$orderDomain = is_array($order) ? (string)($order['domain'] ?? '') : '';
+$orderAmount = is_array($order) ? (string)($order['amount'] ?? '0.00') : '0.00';
+$orderGateway = is_array($order) ? (string)($order['gateway'] ?? '') : '';
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>域名支付 - 域名服务</title>
+<link rel="stylesheet" href="<?= htmlspecialchars($qzMdi, ENT_QUOTES, 'UTF-8') ?>">
+<link rel="stylesheet" href="<?= htmlspecialchars($qzCss, ENT_QUOTES, 'UTF-8') ?>">
+<style>
+body { margin: 0; background: var(--qz-bg); color: var(--qz-text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; padding: 24px 16px 48px; }
+#qz-pay-html { display: flex; justify-content: center; margin-top: 8px; }
+#qz-pay-html form, #qz-pay-html .qr-wrap { width: 100%; max-width: 380px; margin: 0 auto; text-align: center; }
+#qz-pay-html img.qr { width: 240px; height: 240px; border: 1px solid var(--qz-border); border-radius: 12px; }
+#qz-pay-html .btn-pay-link { display: inline-block; margin-top: 16px; }
+.spin { display: inline-block; animation: qzSpin 1s linear infinite; }
+@keyframes qzSpin { to { transform: rotate(360deg); } }
+.qz-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
+.qz-nav a { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 13px; background: #fff; border: 1px solid var(--qz-border); color: var(--qz-text-2); text-decoration: none; transition: all .15s; }
+.qz-nav a:hover { border-color: var(--qz-brand); color: var(--qz-brand); }
+</style>
+</head>
+<body>
+<div class="qz-wrap" style="max-width:720px;">
+
+  <div class="qz-head">
+    <h1>域名支付</h1>
+    <p>订单 <span class="qz-monospace" id="qz-order-id"><?= (int)$orderId ?></span> · 域名 <span class="qz-monospace" id="qz-domain"><?= htmlspecialchars($orderDomain, ENT_QUOTES, 'UTF-8') ?></span></p>
+    <div class="qz-nav" style="margin-top:12px;">
+      <a href="<?= htmlspecialchars($qzIdxUrl, ENT_QUOTES, 'UTF-8') ?>">域名注册</a>
+      <a href="<?= htmlspecialchars($qzDomUrl, ENT_QUOTES, 'UTF-8') ?>">我的域名</a>
+    </div>
+  </div>
+
+  <div class="qz-card">
+    <div class="qz-card-body">
+      <!-- 加载中 -->
+      <div id="qz-loading" style="text-align:center;padding:36px 0;color:var(--qz-text-3);">
+        <span class="spin mdi mdi-loading" style="font-size:28px;"></span>
+        <div style="margin-top:10px;">正在创建支付订单...</div>
+      </div>
+
+      <!-- 支付内容 -->
+      <div id="qz-pay-html" style="display:none;"></div>
+
+      <!-- 支付失败 -->
+      <div id="qz-error" style="display:none;text-align:center;padding:24px 0;">
+        <div style="font-size:40px;color:var(--qz-danger);"><span class="mdi mdi-alert-circle-outline"></span></div>
+        <div style="margin:10px 0 18px;color:var(--qz-text-2);" id="qz-error-msg"></div>
+        <button type="button" class="qz-btn" id="qz-btn-retry"><span class="mdi mdi-refresh"></span> 重试</button>
+        <a class="qz-btn qz-btn--ghost" style="margin-left:8px;" href="<?= htmlspecialchars($qzDomUrl, ENT_QUOTES, 'UTF-8') ?>">我的域名</a>
+      </div>
+
+      <!-- 已支付 -->
+      <div id="qz-paid" style="display:none;text-align:center;padding:24px 0;">
+        <div style="font-size:44px;color:var(--qz-success);"><span class="mdi mdi-check-circle"></span></div>
+        <div style="margin:10px 0 4px;font-size:17px;font-weight:600;">支付成功</div>
+        <div style="color:var(--qz-text-2);margin-bottom:20px;">域名注册处理中,稍后可在“我的域名”中查看</div>
+        <a class="qz-btn" href="<?= htmlspecialchars($qzDomUrl, ENT_QUOTES, 'UTF-8') ?>"><span class="mdi mdi-earth"></span> 查看我的域名</a>
+      </div>
+    </div>
+  </div>
+
+  <div class="qz-card">
+    <div class="qz-card-head"><h3>订单信息</h3></div>
+    <div class="qz-card-body">
+      <table class="qz-table">
+        <tr><th style="width:130px;">域名</th><td class="qz-monospace"><?= htmlspecialchars($orderDomain ?: '-', ENT_QUOTES, 'UTF-8') ?></td></tr>
+        <tr><th>金额</th><td style="color:var(--qz-brand);font-weight:700;">¥<?= htmlspecialchars($orderAmount ?: '0.00', ENT_QUOTES, 'UTF-8') ?></td></tr>
+        <tr><th>状态</th><td id="qz-order-status">-</td></tr>
+      </table>
+    </div>
+  </div>
+
+</div>
+
+<script src="<?= htmlspecialchars($qzJq, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script src="<?= htmlspecialchars($qzJs, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script>
+$(function () {
+  var QZ_API = <?= json_encode($qzApi, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var ORDER_ID = <?= (int)$orderId ?>;
+  var GATEWAY = <?= json_encode($orderGateway, JSON_UNESCAPED_UNICODE) ?>;
+  var ORDER_VALID = <?= $orderValid ? 'true' : 'false' ?>;
+  var pollTimer = null;
+
+  function setStatus(txt) { $('#qz-order-status').html(txt); }
+  setStatus('<span class="qz-badge qz-badge--yellow">待支付</span>');
+
+  function renderPaidHtml(html) {
+    $('#qz-loading').hide();
+    var $wrap = $('#qz-pay-html');
+    $wrap.show().html(html);
+
+    // 自动提交支付表单(跳转到三方网关)
+    var $form = $wrap.find('form').first();
+    if ($form.length) {
+      var btn = '<div style="margin-top:14px;"><a class="qz-btn" id="qz-open-gateway" href="javascript:void(0)">若未自动跳转,点击此处进入支付</a></div>';
+      $wrap.append(btn);
+      setTimeout(function () {
+        try { $form.submit(); } catch (e) {}
+      }, 300);
+      $('#qz-open-gateway').on('click', function () {
+        try { $form.submit(); } catch (e) {}
+      });
+    }
+
+    // 二维码 / 图片
+    if ($wrap.find('img').length) {
+      $wrap.find('img').addClass('qr');
+      var tip = '<div class="qz-muted" style="margin-top:12px;">请使用' + (GATEWAY || '支付工具') + '扫码完成支付,支付完成后将自动确认</div>';
+      $wrap.append(tip);
+    }
+
+    startPoll();
+  }
+
+  function startPoll() {
+    if (pollTimer) clearInterval(pollTimer);
+    pollTimer = setInterval(function () {
+      QZ.post(QZ_API + '/pay_status', { order_id: ORDER_ID }, function (res) {
+        if (res.data && res.data.paid) {
+          clearInterval(pollTimer);
+          onPaid();
+        }
+      }, function () {});
+    }, 2500);
+  }
+
+  function onPaid() {
+    $('#qz-pay-html').hide();
+    $('#qz-paid').show();
+    setStatus('<span class="qz-badge qz-badge--green">已支付</span>');
+  }
+
+  function initPay() {
+    QZ.post(QZ_API + '/pay', { order_id: ORDER_ID, gateway: GATEWAY }, function (res) {
+      if (res.data && res.data.code === 'Paid') { onPaid(); return; }
+      var html = (res.data && res.data.html) || '';
+      if (!html) { onPaid(); return; }
+      renderPaidHtml(html);
+    }, function (msg) {
+      $('#qz-loading').hide();
+      $('#qz-error').show();
+      $('#qz-error-msg').text(msg || '发起支付失败');
+    });
+  }
+
+  $('#qz-btn-retry').on('click', function () {
+    $('#qz-error').hide();
+    $('#qz-loading').show();
+    $('#qz-pay-html').hide();
+    initPay();
+  });
+
+  if (!ORDER_VALID) {
+    $('#qz-loading').hide();
+    $('#qz-error').show();
+    $('#qz-error-msg').text('订单不存在或不属于当前账号');
+    setStatus('<span class="qz-badge qz-badge--gray">无效</span>');
+    return;
+  }
+  initPay();
+});
+</script>
+</body>
+</html>
diff --git a/app_plugins/qmzl_domain/views/templates.php b/app_plugins/qmzl_domain/views/templates.php
new file mode 100644
index 0000000..352d078
--- /dev/null
+++ b/app_plugins/qmzl_domain/views/templates.php
@@ -0,0 +1,422 @@
+<?php
+/**
+ * qmzl_domain - 用户端信息模板管理页
+ *
+ * 信息模板用于域名注册时提交所有者实名信息(上游实名认证)。
+ * 支持:列表 / 创建 / 编辑 / 删除 / 提交实名认证(证件照片上传)。
+ */
+if (!defined('IN_CRONLITE')) exit;
+$mode = qmzl_mode();
+$qzCss   = qmzl_asset_url('qmzl.css');
+$qzJs    = qmzl_asset_url('qmzl.js');
+$qzMdi   = mnbt_asset_url('css/materialdesignicons.min.css');
+$qzJq    = mnbt_asset_url('js/jquery.min.js');
+$qzApi   = qmzl_url(qmzl_route_prefix() . '/api');
+$qzAccUrl = qmzl_url(qmzl_route_prefix() . '/account');
+$qzIdxUrl = qmzl_url(qmzl_route_prefix());
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>信息模板 - 域名服务</title>
+<link rel="stylesheet" href="<?= htmlspecialchars($qzMdi, ENT_QUOTES, 'UTF-8') ?>">
+<link rel="stylesheet" href="<?= htmlspecialchars($qzCss, ENT_QUOTES, 'UTF-8') ?>">
+<style>
+body { margin: 0; background: var(--qz-bg); color: var(--qz-text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; padding: 24px 16px 48px; }
+.file-box { display: flex; align-items: center; gap: 10px; min-width: 0; }
+.file-name { font-size: 12px; color: var(--qz-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
+.qz-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
+.qz-nav a { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 13px; background: #fff; border: 1px solid var(--qz-border); color: var(--qz-text-2); text-decoration: none; transition: all .15s; }
+.qz-nav a:hover { border-color: var(--qz-brand); color: var(--qz-brand); }
+
+/* 模板表单弹窗:加宽 + flex 行布局(避免 grid 重叠) */
+#qz-mask-form .qz-modal { max-width: 780px; }
+#qz-mask-form .qz-modal-body { padding: 20px 24px; }
+.f-rows { display: flex; flex-direction: column; gap: 14px; }
+.f-row { display: flex; gap: 20px; }
+.f-cell { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
+.f-cell--full { flex-basis: 100%; }
+@media (max-width: 640px) { .f-row { flex-direction: column; gap: 14px; } }
+</style>
+</head>
+<body>
+<div class="qz-wrap">
+
+  <div class="qz-head">
+    <h1>信息模板</h1>
+    <p>域名注册时需提交所有者实名信息,请先创建并完成实名认证。</p>
+    <div class="qz-nav" style="margin-top:12px;">
+      <a href="<?= htmlspecialchars($qzIdxUrl, ENT_QUOTES, 'UTF-8') ?>">域名注册</a>
+      <?php if ($mode === 'client'): ?>
+        <a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>">云账号</a>
+      <?php endif; ?>
+    </div>
+  </div>
+
+  <?php if ($mode === 'client'): ?>
+  <div id="qz-tip-unbound" class="qz-tip qz-tip--warn" style="display:none;">
+    尚未绑定启明智联账号。<a href="<?= htmlspecialchars($qzAccUrl, ENT_QUOTES, 'UTF-8') ?>" style="color:var(--qz-brand);font-weight:600;">立即绑定</a>
+  </div>
+  <?php endif; ?>
+
+  <div class="qz-card">
+    <div class="qz-card-head">
+      <h3>模板列表</h3>
+      <button type="button" class="qz-btn qz-btn--sm" id="qz-btn-add"><span class="mdi mdi-plus"></span> 新建模板</button>
+    </div>
+    <div class="qz-card-body" id="qz-tpl-list">
+      <div class="qz-loading">加载中...</div>
+    </div>
+  </div>
+
+</div>
+
+<!-- 模板表单弹窗 -->
+<div class="qz-mask" id="qz-mask-form">
+  <div class="qz-modal">
+    <div class="qz-modal-head">
+      <h3 id="qz-form-title">新建模板</h3>
+      <button type="button" class="qz-modal-close" data-close>&times;</button>
+    </div>
+    <div class="qz-modal-body">
+      <input type="hidden" id="f-id" value="0">
+      <div class="f-rows">
+        <div class="f-row">
+          <div class="f-cell">
+            <label>模板类型 <span class="req">*</span></label>
+            <select class="qz-select" id="f-type">
+              <option value="personal">个人</option>
+              <option value="enterprise">企业</option>
+            </select>
+          </div>
+          <div class="f-cell">
+            <label>证件类型 <span class="req">*</span></label>
+            <select class="qz-select" id="f-idtype"></select>
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell">
+            <label>所有者(中文)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-zh_owner" maxlength="120">
+            <span class="qz-hint">个人填姓名,企业填公司名</span>
+          </div>
+          <div class="f-cell">
+            <label>联系人全名(中文)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-zh_all_name" maxlength="120">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell">
+            <label>所有者(英文/拼音大写)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-en_owner" maxlength="120" placeholder="ZHANG SAN">
+          </div>
+          <div class="f-cell">
+            <label>联系人姓氏(英文)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-en_last_name" maxlength="60" placeholder="ZHANG">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell">
+            <label>联系人名字(英文)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-en_first_name" maxlength="60" placeholder="SAN">
+          </div>
+          <div class="f-cell">
+            <label>电子邮箱 <span class="req">*</span></label>
+            <input type="email" class="qz-input" id="f-email" maxlength="120">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell">
+            <label>手机号码 <span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-phone" maxlength="30">
+          </div>
+          <div class="f-cell">
+            <label>证件号码 <span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-idnum" maxlength="60">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell">
+            <label>邮政编码</label>
+            <input type="text" class="qz-input" id="f-postal_code" maxlength="20" value="">
+          </div>
+          <div class="f-cell">
+            <label>国家代码</label>
+            <input type="text" class="qz-input" id="f-country" maxlength="10" value="CN">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell f-cell--full">
+            <label>中文地址 <span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-zh_address" maxlength="255" placeholder="省市区 + 详细地址">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell f-cell--full">
+            <label>英文地址(拼音大写)<span class="req">*</span></label>
+            <input type="text" class="qz-input" id="f-en_address" maxlength="255" placeholder="XXX ROAD, XXX DISTRICT, BEIJING, CHINA">
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell f-cell--full">
+            <label>证件正面照片 <span class="req">*</span></label>
+            <div class="file-box">
+              <label class="qz-btn qz-btn--ghost qz-btn--sm" style="cursor:pointer;flex-shrink:0;">选择文件<input type="file" id="f-img_front" accept="image/*" style="display:none;"></label>
+              <span class="file-name" id="f-img_front-name">未选择</span>
+            </div>
+          </div>
+        </div>
+        <div class="f-row">
+          <div class="f-cell f-cell--full">
+            <label>证件反面照片(可选)</label>
+            <div class="file-box">
+              <label class="qz-btn qz-btn--ghost qz-btn--sm" style="cursor:pointer;flex-shrink:0;">选择文件<input type="file" id="f-img_back" accept="image/*" style="display:none;"></label>
+              <span class="file-name" id="f-img_back-name">未选择</span>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="qz-modal-foot">
+      <button type="button" class="qz-btn qz-btn--ghost" data-close>取消</button>
+      <button type="button" class="qz-btn" id="qz-btn-save"><span class="mdi mdi-content-save"></span> 保存</button>
+    </div>
+  </div>
+</div>
+
+<!-- 实名认证弹窗 -->
+<div class="qz-mask" id="qz-mask-cert">
+  <div class="qz-modal" style="max-width:440px;">
+    <div class="qz-modal-head">
+      <h3>提交实名认证</h3>
+      <button type="button" class="qz-modal-close" data-close>&times;</button>
+    </div>
+    <div class="qz-modal-body">
+      <input type="hidden" id="c-id" value="0">
+      <div class="qz-tip">提交证件照片进行实名认证,审核通过后(状态为“已认证”)方可注册域名。</div>
+      <div class="qz-form-item" style="margin-bottom:12px;">
+        <label>证件正面照片 <span class="req">*</span></label>
+        <div class="file-box">
+          <label class="qz-btn qz-btn--ghost qz-btn--sm" style="cursor:pointer;">选择文件<input type="file" id="c-img_front" accept="image/*" style="display:none;"></label>
+          <span class="file-name" id="c-img_front-name">未选择</span>
+        </div>
+      </div>
+      <div class="qz-form-item">
+        <label>证件反面照片(可选)</label>
+        <div class="file-box">
+          <label class="qz-btn qz-btn--ghost qz-btn--sm" style="cursor:pointer;">选择文件<input type="file" id="c-img_back" accept="image/*" style="display:none;"></label>
+          <span class="file-name" id="c-img_back-name">未选择</span>
+        </div>
+      </div>
+    </div>
+    <div class="qz-modal-foot">
+      <button type="button" class="qz-btn qz-btn--ghost" data-close>取消</button>
+      <button type="button" class="qz-btn" id="qz-btn-cert"><span class="mdi mdi-shield-check-outline"></span> 提交认证</button>
+    </div>
+  </div>
+</div>
+
+<script src="<?= htmlspecialchars($qzJq, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script src="<?= htmlspecialchars($qzJs, ENT_QUOTES, 'UTF-8') ?>"></script>
+<script>
+$(function () {
+  var QZ_MODE = <?= json_encode($mode, JSON_UNESCAPED_UNICODE) ?>;
+  var QZ_API = <?= json_encode($qzApi, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
+  var IDTYPE = {
+    personal: [['SFZ', '身份证'], ['HZ', '护照'], ['GAJMTX', '港澳通行证'], ['TWJMTX', '台湾通行证']],
+    enterprise: [['YYZZ', '营业执照'], ['ORG', '组织机构代码证'], ['TYDM', '统一社会信用代码证']]
+  };
+  var STATUS = { 0: ['未认证', 'red'], 1: ['已认证', 'green'], 2: ['审核中', 'yellow'], 3: ['认证失败', 'red'], 4: ['异常', 'red'] };
+  var editing = null; // 当前编辑的模板对象
+
+  if (QZ_MODE === 'client') {
+    QZ.post(QZ_API + '/account_info', {}, function (res) {
+      if (!(res.data && res.data.bound)) $('#qz-tip-unbound').show();
+    }, function () { $('#qz-tip-unbound').show(); });
+  }
+
+  function renderIdType() {
+    var type = $('#f-type').val();
+    var $sel = $('#f-idtype');
+    $sel.empty();
+    $.each(IDTYPE[type] || IDTYPE.personal, function (i, it) {
+      $sel.append('<option value="' + it[0] + '">' + it[1] + '</option>');
+    });
+  }
+
+  function loadList() {
+    QZ.post(QZ_API + '/templates', {}, function (res) {
+      var list = (res.data && res.data.list) || [];
+      var $box = $('#qz-tpl-list');
+      if (!list.length) {
+        $box.html('<div class="qz-empty">暂无模板,点击右上角“新建模板”创建</div>');
+        return;
+      }
+      var html = '<table class="qz-table"><thead><tr>' +
+        '<th>所有者</th><th>类型</th><th>邮箱</th><th>手机</th><th>认证状态</th><th style="width:220px;">操作</th>' +
+        '</tr></thead><tbody>';
+      $.each(list, function (i, t) {
+        var st = STATUS[String(t.status)] || ['未知', 'gray'];
+        var typeName = t.type === 'enterprise' ? '企业' : '个人';
+        html += '<tr>' +
+          '<td>' + QZ.esc(t.zh_owner || t.en_owner || '未命名') + '</td>' +
+          '<td>' + typeName + '</td>' +
+          '<td>' + QZ.esc(t.email || '-') + '</td>' +
+          '<td>' + QZ.esc(t.phone || '-') + '</td>' +
+          '<td><span class="qz-badge qz-badge--' + st[1] + '">' + st[0] + '</span></td>' +
+          '<td class="qz-actions">' +
+            '<button type="button" class="qz-btn qz-btn--ghost qz-btn--sm" data-act="edit" data-id="' + t.id + '">编辑</button>' +
+            '<button type="button" class="qz-btn qz-btn--ghost qz-btn--sm" data-act="cert" data-id="' + t.id + '">实名认证</button>' +
+            '<button type="button" class="qz-btn qz-btn--danger qz-btn--sm" data-act="del" data-id="' + t.id + '">删除</button>' +
+          '</td></tr>';
+      });
+      html += '</tbody></table>';
+      $box.html(html);
+
+      $box.find('[data-act]').on('click', function () {
+        var act = $(this).data('act'), id = parseInt($(this).data('id'), 10);
+        var t = null;
+        $.each(list, function (i, x) { if (parseInt(x.id, 10) === id) t = x; });
+        if (!t) return;
+        if (act === 'edit') openForm(t);
+        else if (act === 'cert') openCert(id);
+        else if (act === 'del') delTemplate(id);
+      });
+    }, function (msg) {
+      $('#qz-tpl-list').html('<div class="qz-empty">' + QZ.esc(msg) + '</div>');
+    });
+  }
+
+  /* ---------- 表单 ---------- */
+  function openForm(t) {
+    editing = t || null;
+    $('#f-id').val(t ? t.id : 0);
+    $('#qz-form-title').text(t ? '编辑模板' : '新建模板');
+    $('#f-type').val(t ? (t.type || 'personal') : 'personal');
+    renderIdType();
+    $('#f-zh_owner').val(t ? (t.zh_owner || '') : '');
+    $('#f-zh_all_name').val(t ? (t.zh_all_name || '') : '');
+    $('#f-en_owner').val(t ? (t.en_owner || '') : '');
+    $('#f-en_last_name').val(t ? (t.en_last_name || '') : '');
+    $('#f-en_first_name').val(t ? (t.en_first_name || '') : '');
+    $('#f-email').val(t ? (t.email || '') : '');
+    $('#f-phone').val(t ? (t.phone || '') : '');
+    $('#f-idtype').val(t ? (t.idtype || 'SFZ') : 'SFZ');
+    $('#f-idnum').val(t ? (t.idnum || '') : '');
+    $('#f-zh_address').val(t ? (t.zh_address || '') : '');
+    $('#f-en_address').val(t ? (t.en_address || '') : '');
+    $('#f-postal_code').val(t ? (t.postal_code || '') : '');
+    $('#f-country').val(t ? (t.country || 'CN') : 'CN');
+    $('#f-img_front').val(''); $('#f-img_front-name').text('未选择');
+    $('#f-img_back').val(''); $('#f-img_back-name').text('未选择');
+    $('#qz-mask-form').addClass('show');
+  }
+
+  function buildFormData() {
+    var fd = new FormData();
+    if (editing && editing.id) fd.append('id', editing.id);
+    fd.append('type', $('#f-type').val());
+    fd.append('zh_owner', $('#f-zh_owner').val());
+    fd.append('zh_all_name', $('#f-zh_all_name').val());
+    fd.append('en_owner', $('#f-en_owner').val());
+    fd.append('en_last_name', $('#f-en_last_name').val());
+    fd.append('en_first_name', $('#f-en_first_name').val());
+    fd.append('email', $('#f-email').val());
+    fd.append('phone', $('#f-phone').val());
+    fd.append('idtype', $('#f-idtype').val());
+    fd.append('idnum', $('#f-idnum').val());
+    fd.append('zh_address', $('#f-zh_address').val());
+    fd.append('en_address', $('#f-en_address').val());
+    fd.append('postal_code', $('#f-postal_code').val());
+    fd.append('country', $('#f-country').val());
+    if ($('#f-img_front')[0].files[0]) fd.append('img_front', $('#f-img_front')[0].files[0]);
+    if ($('#f-img_back')[0].files[0]) fd.append('img_back', $('#f-img_back')[0].files[0]);
+    return fd;
+  }
+
+  $('#f-type').on('change', renderIdType);
+
+  $('#f-img_front').on('change', function () {
+    $('#f-img_front-name').text(this.files[0] ? this.files[0].name : '未选择');
+  });
+  $('#f-img_back').on('change', function () {
+    $('#f-img_back-name').text(this.files[0] ? this.files[0].name : '未选择');
+  });
+
+  $('#qz-btn-save').on('click', function () {
+    var $btn = $(this);
+    // 基础校验
+    var required = ['zh_owner', 'en_owner', 'email', 'phone', 'zh_address', 'en_address', 'idnum'];
+    var labels = { zh_owner: '所有者(中文)', en_owner: '所有者(英文)', email: '邮箱', phone: '手机', zh_address: '中文地址', en_address: '英文地址', idnum: '证件号码' };
+    for (var i = 0; i < required.length; i++) {
+      var v = $('#f-' + required[i]).val();
+      if (!$.trim(v || '')) { QZ.toast('请填写' + labels[required[i]], 'error'); return; }
+    }
+    $btn.prop('disabled', true);
+    QZ.postForm(QZ_API + '/template_save', buildFormData(), function (res) {
+      QZ.toast(res.msg || '已保存', 'success');
+      $('#qz-mask-form').removeClass('show');
+      $btn.prop('disabled', false);
+      loadList();
+    }, function (msg) {
+      QZ.toast(msg, 'error');
+      $btn.prop('disabled', false);
+    });
+  });
+
+  /* ---------- 实名认证 ---------- */
+  function openCert(id) {
+    $('#c-id').val(id);
+    $('#c-img_front').val(''); $('#c-img_front-name').text('未选择');
+    $('#c-img_back').val(''); $('#c-img_back-name').text('未选择');
+    $('#qz-mask-cert').addClass('show');
+  }
+
+  $('#c-img_front').on('change', function () {
+    $('#c-img_front-name').text(this.files[0] ? this.files[0].name : '未选择');
+  });
+  $('#c-img_back').on('change', function () {
+    $('#c-img_back-name').text(this.files[0] ? this.files[0].name : '未选择');
+  });
+
+  $('#qz-btn-cert').on('click', function () {
+    var id = $('#c-id').val();
+    if (!id) { QZ.toast('参数错误', 'error'); return; }
+    if (!$('#c-img_front')[0].files[0]) { QZ.toast('请选择证件正面照片', 'error'); return; }
+    var fd = new FormData();
+    fd.append('id', id);
+    fd.append('img_front', $('#c-img_front')[0].files[0]);
+    if ($('#c-img_back')[0].files[0]) fd.append('img_back', $('#c-img_back')[0].files[0]);
+    var $btn = $(this).prop('disabled', true);
+    QZ.postForm(QZ_API + '/template_certify', fd, function (res) {
+      QZ.toast(res.msg || '已提交', 'success');
+      $('#qz-mask-cert').removeClass('show');
+      $btn.prop('disabled', false);
+      loadList();
+    }, function (msg) {
+      QZ.toast(msg, 'error');
+      $btn.prop('disabled', false);
+    });
+  });
+
+  /* ---------- 删除 ---------- */
+  function delTemplate(id) {
+    if (!confirm('确定删除该模板?')) return;
+    QZ.post(QZ_API + '/template_delete', { id: id }, function (res) {
+      QZ.toast('已删除', 'success');
+      loadList();
+    }, function (msg) { QZ.toast(msg, 'error'); });
+  }
+
+  /* ---------- 通用 ---------- */
+  $('#qz-btn-add').on('click', function () { openForm(null); });
+  $('[data-close]').on('click', function () { $(this).closest('.qz-mask').removeClass('show'); });
+  $('.qz-mask').on('click', function (e) { if (e.target === this) $(this).removeClass('show'); });
+
+  loadList();
+});
+</script>
+</body>
+</html>
diff --git "a/app_plugins/qmzl_domain/\345\237\237\345\220\215\346\263\250\345\206\214API\345\257\271\346\216\245\346\226\207\346\241\243.md" "b/app_plugins/qmzl_domain/\345\237\237\345\220\215\346\263\250\345\206\214API\345\257\271\346\216\245\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..4128492
--- /dev/null
+++ "b/app_plugins/qmzl_domain/\345\237\237\345\220\215\346\263\250\345\206\214API\345\257\271\346\216\245\346\226\207\346\241\243.md"
@@ -0,0 +1,537 @@
+# 域名注册 API 对接文档
+
+## 基本信息
+
+| 项目 | 说明 |
+|------|------|
+| **Base URL** | `{host}/console/v1` |
+| **认证方式** | `Authorization: Bearer {token}`(token 存储于 localStorage `auth_token`) |
+| **Content-Type** | `application/json`(文件上传除外,使用 `multipart/form-data`) |
+| **响应格式** | `{ status: 200, msg: "...", data: {...} }` |
+| **成功判断** | `status === 200` |
+
+---
+
+## 1. 域名配置
+
+### 1.1 获取域名配置
+
+获取系统配置:域名注册协议链接、域名信息服务协议链接、可搜索的后缀列表、默认搜索后缀。
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/config` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "msg": "success",
+  "data": {
+    "domain_register_agreement_url": "https://xxx.com/agreement/register",
+    "domain_information_service_agreement_url": "https://xxx.com/agreement/service",
+    "specify_search_domain": [".com", ".cn", ".net", ".com.cn", ".xyz", ".top"],
+    "default_search_domain": ".com"
+  }
+}
+```
+
+---
+
+## 2. 域名后缀
+
+### 2.1 获取域名后缀列表
+
+获取系统支持的所有 TLD 后缀列表(兜底数据,config 接口已包含时可不调用)。
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/domain_suffix` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": [
+    { "suffix": ".com" },
+    { "suffix": ".cn" },
+    { "suffix": ".net" }
+  ]
+}
+```
+
+---
+
+## 3. 域名查询
+
+### 3.1 查询域名可注册状态
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/check_domain` |
+
+**请求参数:**
+
+| 参数 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `domain` | string | 是 | 域名前缀,不含后缀。如 `mydomain` |
+| `suffix` | string | 是 | 后缀,含点号。如 `.com` |
+| `host_id` | int | 是 | 固定传 `0` |
+
+**调用示例:**
+
+```
+GET /console/v1/idcsmart_domain/check_domain?domain=mydomain&suffix=.com&host_id=0
+```
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": [
+    {
+      "name": "mydomain.com",
+      "avail": 1
+    },
+    {
+      "name": "mydomain.net",
+      "avail": 0
+    },
+    {
+      "name": "mydomain.cn",
+      "avail": 1
+    }
+  ]
+}
+```
+
+**字段说明:**
+
+| 字段 | 类型 | 说明 |
+|------|------|------|
+| `name` | string | 完整域名 |
+| `avail` | int | `1` = 可注册,`0` = 已注册 |
+
+---
+
+## 4. 域名价格
+
+### 4.1 获取域名注册价格
+
+查询指定域名的注册价格(按年限)。
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/get_price` |
+
+**请求参数:**
+
+| 参数 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `name` | string | 是 | 完整域名,如 `mydomain.com` |
+| `host_id` | int | 是 | 固定传 `0` |
+
+**调用示例:**
+
+```
+GET /console/v1/idcsmart_domain/get_price?name=mydomain.com&host_id=0
+```
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": [
+    { "buyyear": 1, "buyprice": "55.00" },
+    { "buyyear": 3, "buyprice": "150.00" },
+    { "buyyear": 5, "buyprice": "230.00" },
+    { "buyyear": 10, "buyprice": "420.00" }
+  ]
+}
+```
+
+**字段说明:**
+
+| 字段 | 类型 | 说明 |
+|------|------|------|
+| `buyyear` | int | 购买年限 |
+| `buyprice` | string | 该年限总价(元)。前端计算年均价:`buyprice / buyyear` |
+
+---
+
+## 5. 信息模板
+
+信息模板用于域名注册时提交所有者实名信息。模板状态说明:
+
+| status | 含义 |
+|--------|------|
+| `0` | 未认证 |
+| `1` | 已认证 |
+| `2` | 审核中 |
+| `3` | 认证失败 |
+| `4` | 异常 |
+
+### 5.1 获取模板列表
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/info_template` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": {
+    "list": [
+      {
+        "id": 1,
+        "type": "personal",
+        "status": 1,
+        "zh_owner": "张三",
+        "en_owner": "ZHANG SAN",
+        "email": "zhangsan@example.com",
+        "phone": "13800138000",
+        "zh_address": "北京市朝阳区xxx路xxx号",
+        "en_address": "XXX ROAD, CHAOYANG, BEIJING, CHINA",
+        "postal_code": "100000",
+        "country": "CN",
+        "idtype": "SFZ",
+        "idnum": "110101199001011234"
+      }
+    ]
+  }
+}
+```
+
+### 5.2 获取模板详情
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/idcsmart_domain/info_template/{id}` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": {
+    "info_template": {
+      "id": 1,
+      "type": "personal",
+      "status": 1,
+      "zh_owner": "张三",
+      "zh_all_name": "张三",
+      "zh_last_name": "张",
+      "zh_first_name": "三",
+      "en_owner": "ZHANG SAN",
+      "en_all_name": "ZHANG SAN",
+      "en_last_name": "ZHANG",
+      "en_first_name": "SAN",
+      "email": "zhangsan@example.com",
+      "phone": "13800138000",
+      "zh_address": "北京市朝阳区xxx路xxx号",
+      "en_address": "XXX ROAD, CHAOYANG, BEIJING, CHINA",
+      "postal_code": "100000",
+      "country": "CN",
+      "idtype": "SFZ",
+      "idnum": "110101199001011234"
+    }
+  }
+}
+```
+
+### 5.3 创建模板
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `POST` |
+| **路径** | `/idcsmart_domain/info_template` |
+| **Content-Type** | `multipart/form-data`(**不设** `Content-Type`,由浏览器自动生成) |
+
+**请求参数(FormData):**
+
+| 字段 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `type` | string | 是 | `personal`(个人)或 `enterprise`(企业) |
+| `zh_owner` | string | 是 | 域名所有者(中文),个人填姓名,企业填公司名 |
+| `zh_all_name` | string | 是 | 联系人全名(中文) |
+| `zh_last_name` | string | 否 | 联系人姓(中文) |
+| `zh_first_name` | string | 否 | 联系人名(中文) |
+| `en_owner` | string | 是 | 域名所有者(英文/拼音大写) |
+| `en_all_name` | string | 否 | 联系人全名(英文) |
+| `en_last_name` | string | 是 | 联系人姓氏(英文/拼音大写) |
+| `en_first_name` | string | 是 | 联系人名字(英文/拼音大写) |
+| `email` | string | 是 | 电子邮箱 |
+| `phone` | string | 是 | 手机号码 |
+| `zh_address` | string | 是 | 中文地址 |
+| `en_address` | string | 是 | 英文地址(拼音大写) |
+| `postal_code` | string | 否 | 邮政编码 |
+| `country` | string | 否 | 国家代码,默认 `CN` |
+| `idtype` | string | 是 | 证件类型(见下表) |
+| `idnum` | string | 是 | 证件号码 |
+| `img_front` | File | 是 | 证件正面照片 |
+| `img_back` | File | 否 | 证件反面照片 |
+
+**证件类型(idtype)枚举:**
+
+| 值 | 适用类型 | 说明 |
+|------|----------|------|
+| `SFZ` | personal | 身份证 |
+| `HZ` | personal | 护照 |
+| `GAJMTX` | personal | 港澳通行证 |
+| `TWJMTX` | personal | 台湾通行证 |
+| `YYZZ` | enterprise | 营业执照 |
+| `ORG` | enterprise | 组织机构代码证 |
+| `TYDM` | enterprise | 统一社会信用代码证 |
+
+### 5.4 更新模板
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `PUT` |
+| **路径** | `/idcsmart_domain/info_template/{id}` |
+| **Content-Type** | `multipart/form-data` |
+
+参数同 5.3 创建模板。
+
+### 5.5 删除模板
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `DELETE` |
+| **路径** | `/idcsmart_domain/info_template/{id}` |
+
+### 5.6 提交实名认证
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `POST` |
+| **路径** | `/idcsmart_domain/info_template/{id}/certifications` |
+| **Content-Type** | `multipart/form-data` |
+
+**请求参数(FormData):**
+
+| 字段 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `img_front` | File | 是 | 证件正面照片 |
+| `img_back` | File | 否 | 证件反面照片 |
+
+---
+
+## 6. 购物车与下单
+
+### 6.1 加入购物车
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `POST` |
+| **路径** | `/cart` |
+| **Content-Type** | `application/json` |
+
+**请求体:**
+
+```json
+{
+  "product_id": 12,
+  "config_options": {
+    "domain": "mydomain.com",
+    "year": 3
+  },
+  "qty": 1,
+  "customfield": {
+    "is_domain": 1
+  }
+}
+```
+
+| 字段 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `product_id` | int | 是 | 域名产品 ID |
+| `config_options.domain` | string | 是 | 完整域名 |
+| `config_options.year` | int | 是 | 购买年限 |
+| `qty` | int | 是 | 数量,固定 `1` |
+| `customfield.is_domain` | int | 是 | 标记为域名订单,固定 `1` |
+
+### 6.2 结算创建订单
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `POST` |
+| **路径** | `/cart/settle` |
+| **Content-Type** | `application/json` |
+
+**请求体:**
+
+```json
+{
+  "positions": [0],
+  "customfield": {
+    "auto_renew": 1,
+    "lock_status": 1,
+    "c_sysid": "1",
+    "host_id": 0
+  }
+}
+```
+
+| 字段 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `positions` | int[] | 是 | 购物车位置索引,固定 `[0]` |
+| `customfield.auto_renew` | int | 是 | 自动续费:`1` 开 / `0` 关 |
+| `customfield.lock_status` | int | 是 | 转移锁:`1` 开 / `0` 关 |
+| `customfield.c_sysid` | string | 是 | 信息模板 ID |
+| `customfield.host_id` | int | 是 | 固定 `0` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": {
+    "order_id": 202401010001
+  }
+}
+```
+
+下单成功后,跳转到支付页面:
+
+```
+/console/payment?orderId={order_id}&amount={总价}&gateway={支付网关名称}
+```
+
+---
+
+## 7. 已购域名列表
+
+获取用户已购买的域名列表。
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/host` |
+
+**请求参数:**
+
+| 参数 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `page` | int | 是 | 页码 |
+| `limit` | int | 是 | 每页条数,建议 `50` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": {
+    "list": [
+      {
+        "id": 1001,
+        "name": "mydomain.com",
+        "domain": "mydomain.com",
+        "type": "domain",
+        "product_name": "域名注册",
+        "status": "Active",
+        "module_name": "xxx注册商",
+        "registrar": "xxx注册商",
+        "active_time": 1700000000,
+        "create_time": 1700000000,
+        "due_time": 1731536000,
+        "lock_status": 1
+      }
+    ]
+  }
+}
+```
+
+**status 枚举:**
+
+| 值 | 含义 |
+|------|------|
+| `Active` | 正常 |
+| `Suspended` | 已暂停 |
+| `Pending` | 处理中 |
+| `Expired` | 已过期 |
+| `Deleted` | 已删除 |
+| `Cancelled` | 已取消 |
+| `Fraud` | 欺诈 |
+
+---
+
+## 8. 辅助接口
+
+### 8.1 获取域名产品 ID
+
+通过产品分组遍历查找域名产品,用于加入购物车。
+
+| 方法 | 路径 | 说明 |
+|------|------|------|
+| `GET` | `/product/group/first` | 获取一级产品分组 |
+| `GET` | `/product/group/second?id={group_id}` | 获取二级产品分组 |
+| `GET` | `/product?id={second_group_id}` | 获取分组下的产品列表 |
+| `GET` | `/product?keywords=域名` | 按关键词搜索产品 |
+
+在产品列表中查找 `name` 包含"域名"或"domain"的产品,取其 `id` 作为 `product_id`。
+
+### 8.2 获取支付网关
+
+| 项目 | 说明 |
+|------|------|
+| **方法** | `GET` |
+| **路径** | `/gateway` |
+
+**响应示例:**
+
+```json
+{
+  "status": 200,
+  "data": {
+    "list": [
+      { "name": "alipay", "title": "支付宝" },
+      { "name": "wxpay", "title": "微信支付" }
+    ]
+  }
+}
+```
+
+---
+
+## 9. 完整注册流程
+
+```
+1. GET  /idcsmart_domain/config              → 获取配置(后缀列表、协议链接)
+2. GET  /idcsmart_domain/domain_suffix       → 获取后缀列表(兜底)
+3. GET  /idcsmart_domain/check_domain        → 查询域名是否可注册
+4. GET  /idcsmart_domain/get_price           → 获取域名各年限价格
+5. GET  /idcsmart_domain/info_template       → 获取用户信息模板列表
+6. POST /cart                                → 加入购物车
+7. POST /cart/settle                         → 结算、创建订单
+8. 跳转 /console/payment?orderId=xxx          → 支付页面
+```
+
+---
+
+## 10. 错误处理
+
+所有接口统一错误格式:
+
+```json
+{
+  "status": 400,
+  "msg": "错误描述信息"
+}
+```
+
+- 网络异常时前端提示"网络错误,请检查连接后重试"
+- 业务异常时展示 `msg` 字段内容
+- 非 JSON 响应(如 CDN 错误页)时提示"服务器返回异常"