From 4625e7c13085dd88fdb7b44f0b1140be8c6bd466 Mon Sep 17 00:00:00 2001
From: ingkele <598792849@qq.com>
Date: Tue, 13 Oct 2026 17:36:38 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=88=E5=90=8C=E5=AE=A1=E6=9F=A5?=
=?UTF-8?q?=E8=BD=AE=E8=AF=A2=E6=96=B9=E6=A1=88=EF=BC=88=E5=85=88=E5=AE=A1?=
=?UTF-8?q?=E6=9F=A5=E5=90=8E=E6=89=A3=E7=A7=AF=E5=88=86=E3=80=81HTML?=
=?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=B8=8B=E8=BD=BD=E3=80=81=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E5=BA=93=E8=AE=B0=E5=BD=95=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/ai-chat/ai-chat.vue | 8 +-
pages/contract/index.vue | 373 ++++++++++++------
.../cloudfunctions/router/package.json | 2 +-
.../service/client/ai/pub/getMyReports.js | 30 ++
.../service/client/ai/pub/getReviewResult.js | 66 ++--
.../service/client/ai/pub/jjxDoReview.js | 137 +++++++
.../router/service/client/ai/pub/review.js | 249 ++++++++++--
.../router/service/client/points/kh/getLog.js | 16 +-
uniCloud-tcb/database/jjx-account.schema.json | 1 +
uniCloud-tcb/database/jjx-ad.schema.json | 1 +
uniCloud-tcb/database/jjx-album.schema.json | 1 +
.../database/jjx-article-category.schema.json | 1 +
.../database/jjx-article-collect.schema.json | 1 +
.../database/jjx-article-download.schema.json | 1 +
uniCloud-tcb/database/jjx-article.schema.json | 1 +
.../database/jjx-balance-log.schema.json | 1 +
uniCloud-tcb/database/jjx-balance.schema.json | 1 +
.../database/jjx-business-card.schema.json | 1 +
.../database/jjx-business-contact.schema.json | 1 +
uniCloud-tcb/database/jjx-cart.schema.json | 1 +
uniCloud-tcb/database/jjx-cash.schema.json | 1 +
.../database/jjx-certificate.schema.json | 1 +
.../jjx-company-manage-change-log.schema.json | 1 +
.../jjx-contract-template.schema.json | 1 +
.../database/jjx-contract.schema.json | 25 +-
.../database/jjx-coop-config.schema.json | 1 +
uniCloud-tcb/database/jjx-dict.schema.json | 1 +
.../jjx-enquiry-attributes.schema.json | 1 +
.../database/jjx-enquiry-category.schema.json | 1 +
.../database/jjx-enquiry-package.schema.json | 1 +
.../database/jjx-enquiry-quote.schema.json | 21 +-
.../database/jjx-enquiry-sheet.schema.json | 1 +
.../database/jjx-enquiry-template.schema.json | 1 +
.../database/jjx-ensure-config.schema.json | 1 +
uniCloud-tcb/database/jjx-factory.schema.json | 1 +
.../database/jjx-goods-category.schema.json | 1 +
.../database/jjx-goods-cooperate.schema.json | 1 +
uniCloud-tcb/database/jjx-goods.schema.json | 1 +
.../database/jjx-industry.schema.json | 1 +
.../database/jjx-message-config.schema.json | 1 +
uniCloud-tcb/database/jjx-message.schema.json | 1 +
.../database/jjx-old-category.schema.json | 1 +
.../database/jjx-old-quote.schema.json | 1 +
uniCloud-tcb/database/jjx-old.schema.json | 1 +
.../database/jjx-order-goods.schema.json | 1 +
.../database/jjx-order-pay-list.schema.json | 1 +
.../jjx-order-selfProduct.schema.json | 1 +
uniCloud-tcb/database/jjx-order.schema.json | 1 +
.../jjx-other-article-category.schema.json | 1 +
.../database/jjx-other-article.schema.json | 1 +
.../database/jjx-points-log.schema.json | 64 +--
.../database/jjx-process-category.schema.json | 1 +
.../database/jjx-process-quote.schema.json | 1 +
.../database/jjx-process-sheet.schema.json | 1 +
.../database/jjx-quote-num-config.schema.json | 1 +
uniCloud-tcb/database/jjx-qyb-log.schema.json | 1 +
uniCloud-tcb/database/jjx-qyb.schema.json | 1 +
.../database/jjx-review-records.schema.json | 93 +++++
uniCloud-tcb/database/jjx-seal.schema.json | 1 +
.../jjx-self-support-quote-list.schema.json | 1 +
.../database/jjx-self-support.schema.json | 1 +
.../database/jjx-sign-pay_list.schema.json | 1 +
.../database/jjx-site-config.schema.json | 1 +
uniCloud-tcb/database/jjx-spot-ad.schema.json | 1 +
.../database/jjx-spot-amount.schema.json | 1 +
.../database/jjx-spot-category.schema.json | 1 +
.../database/jjx-spot-cooperate.schema.json | 1 +
.../database/jjx-spot-goods.schema.json | 1 +
.../database/jjx-steal-factory.schema.json | 1 +
.../database/jjx-user-address.schema.json | 1 +
.../database/jjx-user-article.schema.json | 1 +
.../database/jjx-user-balance-log.schema.json | 1 +
.../database/jjx-user-contract.schema.json | 1 +
.../database/jjx-user-level.schema.json | 1 +
.../database/jjx-user-points.schema.json | 41 +-
.../database/jjx-user-quote-num.schema.json | 1 +
.../vk-components-dynamic.schema.json | 1 +
.../database/vk-files-categories.schema.json | 1 +
uniCloud-tcb/database/vk-files.schema.json | 1 +
.../database/vk-global-data.schema.json | 1 +
.../database/vk-pay-config.schema.json | 1 +
.../database/vk-pay-orders.schema.json | 1 +
uniCloud-tcb/database/vk-test.schema.json | 1 +
83 files changed, 845 insertions(+), 350 deletions(-)
create mode 100644 uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getMyReports.js
create mode 100644 uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/jjxDoReview.js
create mode 100644 uniCloud-tcb/database/jjx-account.schema.json
create mode 100644 uniCloud-tcb/database/jjx-ad.schema.json
create mode 100644 uniCloud-tcb/database/jjx-album.schema.json
create mode 100644 uniCloud-tcb/database/jjx-article-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-article-collect.schema.json
create mode 100644 uniCloud-tcb/database/jjx-article-download.schema.json
create mode 100644 uniCloud-tcb/database/jjx-article.schema.json
create mode 100644 uniCloud-tcb/database/jjx-balance-log.schema.json
create mode 100644 uniCloud-tcb/database/jjx-balance.schema.json
create mode 100644 uniCloud-tcb/database/jjx-business-card.schema.json
create mode 100644 uniCloud-tcb/database/jjx-business-contact.schema.json
create mode 100644 uniCloud-tcb/database/jjx-cart.schema.json
create mode 100644 uniCloud-tcb/database/jjx-cash.schema.json
create mode 100644 uniCloud-tcb/database/jjx-certificate.schema.json
create mode 100644 uniCloud-tcb/database/jjx-company-manage-change-log.schema.json
create mode 100644 uniCloud-tcb/database/jjx-contract-template.schema.json
create mode 100644 uniCloud-tcb/database/jjx-coop-config.schema.json
create mode 100644 uniCloud-tcb/database/jjx-dict.schema.json
create mode 100644 uniCloud-tcb/database/jjx-enquiry-attributes.schema.json
create mode 100644 uniCloud-tcb/database/jjx-enquiry-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-enquiry-package.schema.json
create mode 100644 uniCloud-tcb/database/jjx-enquiry-sheet.schema.json
create mode 100644 uniCloud-tcb/database/jjx-enquiry-template.schema.json
create mode 100644 uniCloud-tcb/database/jjx-ensure-config.schema.json
create mode 100644 uniCloud-tcb/database/jjx-factory.schema.json
create mode 100644 uniCloud-tcb/database/jjx-goods-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-goods-cooperate.schema.json
create mode 100644 uniCloud-tcb/database/jjx-goods.schema.json
create mode 100644 uniCloud-tcb/database/jjx-industry.schema.json
create mode 100644 uniCloud-tcb/database/jjx-message-config.schema.json
create mode 100644 uniCloud-tcb/database/jjx-message.schema.json
create mode 100644 uniCloud-tcb/database/jjx-old-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-old-quote.schema.json
create mode 100644 uniCloud-tcb/database/jjx-old.schema.json
create mode 100644 uniCloud-tcb/database/jjx-order-goods.schema.json
create mode 100644 uniCloud-tcb/database/jjx-order-pay-list.schema.json
create mode 100644 uniCloud-tcb/database/jjx-order-selfProduct.schema.json
create mode 100644 uniCloud-tcb/database/jjx-order.schema.json
create mode 100644 uniCloud-tcb/database/jjx-other-article-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-other-article.schema.json
create mode 100644 uniCloud-tcb/database/jjx-process-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-process-quote.schema.json
create mode 100644 uniCloud-tcb/database/jjx-process-sheet.schema.json
create mode 100644 uniCloud-tcb/database/jjx-quote-num-config.schema.json
create mode 100644 uniCloud-tcb/database/jjx-qyb-log.schema.json
create mode 100644 uniCloud-tcb/database/jjx-qyb.schema.json
create mode 100644 uniCloud-tcb/database/jjx-review-records.schema.json
create mode 100644 uniCloud-tcb/database/jjx-seal.schema.json
create mode 100644 uniCloud-tcb/database/jjx-self-support-quote-list.schema.json
create mode 100644 uniCloud-tcb/database/jjx-self-support.schema.json
create mode 100644 uniCloud-tcb/database/jjx-sign-pay_list.schema.json
create mode 100644 uniCloud-tcb/database/jjx-site-config.schema.json
create mode 100644 uniCloud-tcb/database/jjx-spot-ad.schema.json
create mode 100644 uniCloud-tcb/database/jjx-spot-amount.schema.json
create mode 100644 uniCloud-tcb/database/jjx-spot-category.schema.json
create mode 100644 uniCloud-tcb/database/jjx-spot-cooperate.schema.json
create mode 100644 uniCloud-tcb/database/jjx-spot-goods.schema.json
create mode 100644 uniCloud-tcb/database/jjx-steal-factory.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-address.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-article.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-balance-log.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-contract.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-level.schema.json
create mode 100644 uniCloud-tcb/database/jjx-user-quote-num.schema.json
create mode 100644 uniCloud-tcb/database/vk-components-dynamic.schema.json
create mode 100644 uniCloud-tcb/database/vk-files-categories.schema.json
create mode 100644 uniCloud-tcb/database/vk-files.schema.json
create mode 100644 uniCloud-tcb/database/vk-global-data.schema.json
create mode 100644 uniCloud-tcb/database/vk-pay-config.schema.json
create mode 100644 uniCloud-tcb/database/vk-pay-orders.schema.json
create mode 100644 uniCloud-tcb/database/vk-test.schema.json
diff --git a/components/ai-chat/ai-chat.vue b/components/ai-chat/ai-chat.vue
index ad3dacc..ac7f93d 100644
--- a/components/ai-chat/ai-chat.vue
+++ b/components/ai-chat/ai-chat.vue
@@ -12,10 +12,10 @@
您好!我是金久信签约宝AI智能客服,可以帮您解答金久信签约宝使用过程中注册、操作、适用场景等问题。请问有什么可以帮您?
- 注册准备资料事项
- 关键字无法识别
- 金久信签约宝法律效力
- 电子签约不适用场景
+ 注册准备资料事项
+ 关键字无法识别
+ 金久信签约宝法律效力
+ 电子签约不适用场景
diff --git a/pages/contract/index.vue b/pages/contract/index.vue
index 6ddb611..51bba61 100644
--- a/pages/contract/index.vue
+++ b/pages/contract/index.vue
@@ -502,22 +502,27 @@
📋 AI 合同审查
-
-
- 💎
-
- 合同审查消耗积分
- 每页消耗 60 积分,上传后自动计算。
-
- 余额:{{ pointsBalance }} 分
-
-
-
- 📤
- 上传合同文件
- 支持 PDF / Word / 图片,最大 20MB
- 选择文件上传
+
+
+ 💎
+
+ 合同审查消耗积分
+ 根据文件大小自动计算,每 100KB 约 150 积分。审查后余额需保留至少 200 积分。
+ 余额:{{ pointsBalance }} 分
+
+
+
+ ⚠️
+ 请确保合同内容清晰可见。如因合同不清晰导致分析失败,平台不承担后果,积分正常消耗。
+
+
+
+ 📤
+ 上传合同文件
+ 仅支持 PDF / Word(.pdf .doc .docx),最大 20MB
+ 选择文件上传
+
@@ -547,11 +552,17 @@
{{ reviewPoints * 2 }} 积分
-->
-
-
- {{ reviewLoading ? '审查中...' : '开始审查(' + (reviewMode === 0 ? reviewPoints : reviewPoints * 2) + ' 积分)' }}
-
-
+
+
+ {{ reviewLoading ? '审查中...' : '开始审查(' + reviewPoints + ' 积分)' }}
+
+
+ ⚠️ 积分不足,当前余额 {{ pointsBalance }},需要 {{ reviewPoints }} 积分且审查后余额需保留至少 200 积分。
+ 去充值
+
+
@@ -560,8 +571,8 @@
-
-
+
+
- 📈 我的报告
+
+ 📈 我的报告
+ 🔍 查询报告
+
📋
- 暂无审查报告
+ 暂无审查报告,点击上方「查询报告」从服务器加载
- {{ r.fileName }}
- {{ r.time }}
+ 📄 {{ r.fileName }}
+ {{ r.time }} · 消耗 {{ Math.abs(r.amount) }} 积分
- 查看
+ 待审查
+ 审查中
+ 已完成
+ 失败
+ 查看报告
+ 查看文件
+
@@ -625,12 +646,15 @@
📖 积分使用说明
- • 标准审查:每页 60 积分 — 风险条款识别、合规性检查
- • 深度分析:标准审查 × 2 — 标准审查 + 估价参考 + 修改建议
+ • 合同审查:每 100KB 约 150 积分(根据文件大小自动计算)
• AI 客服:免费 — 签约宝专属问答
• 新用户注册自动赠送 500 体验积分
+ • 积分长期有效,不过期
+
+
+ 📜 积分明细
+ 🔍 查看
- 📜 积分明细
@@ -844,6 +868,10 @@
// 合同审查数据
reviewFile: null,
reviewFileId: null,
+ reviewRecordId: null,
+ reviewHtmlUrl: '',
+ reviewPdfUrl: '',
+ reviewContractInfo: {},
reviewUploading: false,
reviewMode: 0,
reviewPoints: 100,
@@ -1474,6 +1502,8 @@
this.userInfo = vk.getVuex('$user.userInfo')
this.getUserInfo()
this.getPointsBalance()
+ if (this.menuIndex === '6') this.getPointsLog();
+ if (this.menuIndex === '5') this.getReportList();
},
methods: {
dayjs,
@@ -1487,8 +1517,6 @@
this.isSignTips = false
// AI 智能服务菜单(3/4/5/6)不调 query,加载对应数据
if (e >= 3) {
- if (e === 6) this.getPointsLog();
- if (e === 5) this.getReportList();
if (e === 4 || e === 6) this.getPointsBalance();
return;
}
@@ -1640,6 +1668,35 @@
html = html.replace(/\n/g, '
');
return html;
},
+ openUrl(url) {
+ if (url) window.open(url, '_blank');
+ },
+ formatReviewResult(text) {
+ if (!text) return '';
+ let html = text;
+ // 处理 markdown 标题 ## / ###
+ html = html.replace(/^###\s+(.+)$/gm, '$1
');
+ html = html.replace(/^##\s+(.+)$/gm, '$1
');
+ // 处理加粗
+ html = html.replace(/\*\*(.*?)\*\*/g, '$1');
+ // 处理链接(PDF下载链接等)— 自动识别 http/https 链接
+ html = html.replace(/(https?:\/\/[^\s\)\]\"\<]+)/g, '$1');
+ // 处理列表
+ html = html.replace(/^[\-\•]\s+(.+)$/gm, '• $1
');
+ html = html.replace(/^(\d+)\.\s+(.+)$/gm, '$1. $2
');
+ // 处理表格行(简单的 | 分隔表格)
+ html = html.replace(/\|(.+)\|/g, function(match) {
+ const cells = match.split('|').filter(c => c.trim());
+ if (cells.length > 1) {
+ return '' +
+ cells.map(c => '' + c.trim() + '').join('') + '
';
+ }
+ return match;
+ });
+ // 换行
+ html = html.replace(/\n/g, '
');
+ return html;
+ },
// ===== 积分相关 =====
async getPointsBalance() {
try {
@@ -1663,36 +1720,64 @@
}
});
if (res.code === 0) {
- this.pointsLogList = (res.data.rows || []).map(r => ({
- ...r,
- _add_time_str: dayjs(r._add_time).format('YYYY-MM-DD HH:mm:ss')
+ this.pointsLogList = (res.data.rows || []).map(r => ({
+ ...r,
+ _add_time_str: dayjs(r._add_time && r._add_time['$date'] ? r._add_time['$date'] : r._add_time).format('YYYY-MM-DD HH:mm:ss')
}));
}
} catch (e) {
/* 静默 */ }
},
async getReportList() {
+ try {
+ const reports = JSON.parse(localStorage.getItem('jjx_review_reports') || '[]');
+ this.reportList = reports.map(r => ({
+ fileName: r.fileName,
+ fileSize: r.fileSize,
+ time: r.time,
+ amount: r.points,
+ result: r.result,
+ status: 'completed'
+ }));
+ } catch (e) { /* 静默 */ }
+ },
+ async queryReports() {
try {
const res = await vk.callFunction({
- url: 'client/points/kh/getLog',
- data: {
- pageIndex: 1,
- pageSize: 50,
- biz_type: 'contract_review'
- }
+ url: 'client/ai/pub/getMyReports',
+ data: { pageIndex: 1, pageSize: 50 }
});
- if (res.code === 0) {
- this.reportList = (res.data.rows || []).map(r => ({
- fileName: r.reason ? r.reason.replace('合同审查 — ', '') : '未知文件',
- time: dayjs(r._add_time).format('YYYY-MM-DD HH:mm:ss'),
- bizId: r.biz_id
+ if (res.code === 0 && res.data && res.data.rows) {
+ this.reportList = res.data.rows.map(r => ({
+ fileName: r.file_name,
+ fileSize: r.file_size,
+ fileUrl: r.file_url || '',
+ htmlUrl: r.html_url || '',
+ time: dayjs(r._add_time && r._add_time['$date'] ? r._add_time['$date'] : r._add_time).format('YYYY-MM-DD HH:mm:ss'),
+ amount: r.points_used || 0,
+ result: r.result,
+ status: r.status,
+ recordId: r._id
}));
+ this.$message.success('加载了 ' + this.reportList.length + ' 条报告');
}
} catch (e) {
- /* 静默 */ }
+ this.$message.error('查询失败');
+ }
},
viewReport(r) {
- this.$message.info('查看报告:' + r.fileName);
+ // 跳转到合同审查页并显示该报告的结果
+ this.menuIndex = '4';
+ this.reviewResult = r.result || '暂无审查结果';
+ this.reviewFile = { name: r.fileName, size: r.fileSize || 0 };
+ },
+ previewFile(r) {
+ if (!r.fileUrl) {
+ this.$message.warning('文件链接不存在');
+ return;
+ }
+ // 新窗口打开文件(PDF直接预览,Word下载)
+ window.open(r.fileUrl, '_blank');
},
formatFileSize(bytes) {
if (bytes < 1024) return bytes + ' B';
@@ -1703,7 +1788,7 @@
selectReviewFile() {
const input = document.createElement('input');
input.type = 'file';
- input.accept = '.pdf,.doc,.docx,.jpg,.png';
+ input.accept = '.pdf,.doc,.docx';
input.onchange = async (e) => {
const file = e.target.files[0];
if (!file) return;
@@ -1725,17 +1810,19 @@
reader.readAsDataURL(file);
});
- const res = await vk.callFunction({
- url: 'client/ai/pub/review',
- data: {
- file_base64: fileBase64,
- file_name: file.name,
- upload_only: true
- }
- });
+ const res = await vk.callFunction({
+ url: 'client/ai/pub/review',
+ data: {
+ file_base64: fileBase64,
+ file_name: file.name,
+ file_size: file.size,
+ upload_only: true
+ }
+ });
if (res.code === 0 && res.data && res.data.file_id) {
this.reviewFileId = res.data.file_id;
+ this.reviewRecordId = res.data.record_id; // 保存待审查记录ID
this.$message.success('文件上传成功');
} else {
this.$message.error(res.msg || '文件上传失败');
@@ -1755,83 +1842,125 @@
return;
}
- const pointsNeeded = this.reviewMode === 0 ? this.reviewPoints : this.reviewPoints * 2;
- if (this.pointsBalance < pointsNeeded) {
- this.$message.warning('积分不足,当前余额 ' + this.pointsBalance + ',需要 ' + pointsNeeded);
+ const pointsNeeded = this.reviewPoints;
+ if (this.pointsBalance < pointsNeeded + 200) {
+ this.$message.warning('积分不足,当前余额 ' + this.pointsBalance + ',需要 ' + pointsNeeded + ' 且审查后余额需保留至少 200 积分');
return;
}
this.reviewLoading = true;
this.reviewProgress = 0;
- // 模拟进度
- const interval = setInterval(() => {
- this.reviewProgress = Math.min(this.reviewProgress + Math.random() * 10, 95);
- }, 800);
+ // 模拟进度条
+ const progressTimer = setInterval(() => {
+ this.reviewProgress = Math.min(this.reviewProgress + 1, 90);
+ }, 1500);
try {
- // 1. 扣积分
- const deductRes = await vk.callFunction({
- url: 'client/points/kh/deduct',
+ // 1. 发起审查(只更新状态,立即返回)
+ const res = await vk.callFunction({
+ url: 'client/ai/pub/review',
data: {
- amount: pointsNeeded,
- reason: '合同审查 — ' + this.reviewFile.name,
- biz_type: 'contract_review'
+ file_id: this.reviewFileId,
+ record_id: this.reviewRecordId,
+ file_name: this.reviewFile.name,
+ file_size: this.reviewFile.size
}
});
- if (deductRes.code !== 0) {
- this.$message.error(deductRes.msg || '扣积分失败');
+
+ if (res.code !== 0) {
+ this.$message.error(res.msg || '审查发起失败');
this.reviewLoading = false;
- clearInterval(interval);
+ clearInterval(progressTimer);
return;
}
- this.pointsBalance = deductRes.data.balance;
- // 2. 调用合同审查(异步,立即返回)
- const res = await vk.callFunction({
- url: 'client/ai/pub/review',
- data: { file_id: this.reviewFileId, file_name: this.reviewFile.name }
- });
- if (res.code !== 0) {
- this.$message.error(res.msg || '审查发起失败');
- this.reviewLoading = false;
- clearInterval(interval);
- return;
+ const recordId = res.data.record_id;
+
+ // 2. 轮询结果(每 5 秒查一次,最多 10 分钟)
+ let result = '';
+ let pointsUsed = 0;
+ let htmlUrl = '';
+ let contractInfo = {};
+
+ for (let i = 0; i < 60; i++) {
+ await new Promise(r => setTimeout(r, 10000));
+
+ const pollRes = await vk.callFunction({
+ url: 'client/ai/pub/getReviewResult',
+ data: { record_id: recordId }
+ });
+
+ if (pollRes.code === 0 && pollRes.data) {
+ if (pollRes.data.status === 'completed') {
+ result = pollRes.data.result;
+ pointsUsed = pollRes.data.points_used || 0;
+ htmlUrl = pollRes.data.html_url || '';
+ contractInfo = pollRes.data.contract_info || {};
+ break;
+ }
+ if (pollRes.data.status === 'failed') {
+ this.$message.error(pollRes.data.result || '审查失败');
+ this.reviewLoading = false;
+ clearInterval(progressTimer);
+ return;
+ }
+ }
}
-
- const chatId = res.data.chat_id;
- const conversationId = res.data.conversation_id;
-
- // 3. 轮询结果(每 3 秒查一次,最多 5 分钟)
- let answer = '';
- for (let i = 0; i < 100; i++) {
- await new Promise(r => setTimeout(r, 3000));
- this.reviewProgress = Math.min(this.reviewProgress + 1, 95);
-
- const pollRes = await vk.callFunction({
- url: 'client/ai/pub/getReviewResult',
- data: { chat_id: chatId, conversation_id: conversationId }
- });
-
- if (pollRes.code === 0 && pollRes.data.status === 'completed') {
- answer = pollRes.data.answer;
- break;
- }
- }
-
- clearInterval(interval);
+
+ clearInterval(progressTimer);
this.reviewProgress = 100;
-
- if (answer) {
- this.reviewResult = answer;
- this.getReportList();
- this.$message.success('合同审查完成');
- } else {
- this.$message.error('审查超时,请稍后在「我的报告」中查看');
- }
+ if (result) {
+ // 解析 JSON 结果
+ try {
+ const jsonMatch = result.match(/```json\s*([\s\S]*?)```/);
+ if (jsonMatch) {
+ const info = JSON.parse(jsonMatch[1].trim());
+ this.reviewContractInfo = info;
+ // 生成摘要文本用于页面显示
+ let summary = '合同名称:' + (info.contract_name || '-') + '
';
+ summary += '合同类型:' + (info.contract_type || '-') + '
';
+ summary += '综合风险:' + (info.risk_level || '-') + '
';
+ summary += '风险统计:高 ' + (info.risk_count && info.risk_count.high || 0) + ' / 中 ' + (info.risk_count && info.risk_count.medium || 0) + ' / 低 ' + (info.risk_count && info.risk_count.low || 0) + '
';
+ summary += '总体评估:' + (info.risk_summary || '-') + '
';
+ // 高风险摘要
+ const highRisks = (info.risks || []).filter(r => r.level === 'high');
+ if (highRisks.length > 0) {
+ summary += '
⚠️ 高风险摘要:
';
+ highRisks.forEach(r => {
+ summary += '';
+ summary += '风险 #' + r.id + ' ' + (r.location || '') + ':' + (r.problem || '');
+ summary += '
';
+ });
+ }
+ this.reviewResult = summary;
+ } else {
+ this.reviewResult = result;
+ }
+ } catch (e) {
+ this.reviewResult = result;
+ }
+ this.reviewHtmlUrl = htmlUrl;
+ this.pointsBalance -= pointsUsed;
+ // 保存报告到本地
+ const reports = JSON.parse(localStorage.getItem('jjx_review_reports') || '[]');
+ reports.unshift({
+ fileName: this.reviewFile.name,
+ fileSize: this.reviewFile.size,
+ time: new Date().toLocaleString(),
+ points: pointsUsed,
+ result: result,
+ htmlUrl: htmlUrl
+ });
+ localStorage.setItem('jjx_review_reports', JSON.stringify(reports.slice(0, 50)));
+ this.getReportList();
+ this.$message.success('合同审查完成,消耗 ' + pointsUsed + ' 积分');
+ } else {
+ this.$message.warning('审查时间较长,请稍后在「我的报告」中查看结果');
+ }
} catch (e) {
- clearInterval(interval);
+ clearInterval(progressTimer);
this.$message.error('审查异常,请稍后重试');
}
@@ -1840,6 +1969,7 @@
resetReview() {
this.reviewFile = null;
this.reviewFileId = null;
+ this.reviewRecordId = null;
this.reviewUploading = false;
this.reviewResult = null;
this.reviewProgress = 0;
@@ -2739,6 +2869,13 @@
gap: 8px;
}
+ .disclaimer-notice {
+ display: flex; align-items: flex-start; gap: 8px;
+ background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px;
+ padding: 12px 16px; margin-bottom: 20px; font-size: 12px; color: #e6a23c;
+ }
+ .dn-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
+ .dn-text { line-height: 1.6; }
.points-notice {
display: flex;
align-items: center;
diff --git a/uniCloud-tcb/cloudfunctions/router/package.json b/uniCloud-tcb/cloudfunctions/router/package.json
index 55135b8..5f2cfc7 100644
--- a/uniCloud-tcb/cloudfunctions/router/package.json
+++ b/uniCloud-tcb/cloudfunctions/router/package.json
@@ -23,7 +23,7 @@
"concurrency": 1,
"memorySize": 512,
"path": "/http/router",
- "timeout": 60,
+ "timeout": 600,
"triggers": [],
"keepRunningAfterReturn": false
},
diff --git a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getMyReports.js b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getMyReports.js
new file mode 100644
index 0000000..8b8cdf8
--- /dev/null
+++ b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getMyReports.js
@@ -0,0 +1,30 @@
+module.exports = {
+ main: async (event) => {
+ let { data = {}, userInfo, util } = event;
+ let { db } = util;
+ const { pageIndex = 1, pageSize = 50 } = data;
+
+ const uid = (data && data.uid) || '';
+ if (!uid) return { code: -1, msg: '未登录' };
+
+ const where = { user_id: uid };
+
+ const countRes = await db.collection('jjx-review-records').where(where).count();
+
+ const listRes = await db.collection('jjx-review-records')
+ .where(where)
+ .orderBy('_add_time', 'desc')
+ .skip((pageIndex - 1) * pageSize)
+ .limit(pageSize)
+ .get();
+
+ return {
+ code: 0,
+ msg: 'ok',
+ data: {
+ total: countRes.total,
+ rows: listRes.data
+ }
+ };
+ }
+};
\ No newline at end of file
diff --git a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getReviewResult.js b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getReviewResult.js
index 93eb5df..266c9bf 100644
--- a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getReviewResult.js
+++ b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/getReviewResult.js
@@ -1,47 +1,27 @@
+// 云函数:client/ai/pub/getReviewResult
module.exports = {
main: async (event) => {
- let { data = {} } = event;
- const COZE_TOKEN = 'sat_OiXlI4Da5Q99fxmul6pNfExmA6hR898UbxBDwrvjZ638APxRSlFnXbz6zyFedKNG';
- const { chat_id, conversation_id } = data;
-
- if (!chat_id || !conversation_id) return { code: -1, msg: '参数不完整' };
-
- // 查询对话状态
- const statusRes = await uniCloud.httpclient.request(
- 'https://api.coze.cn/v3/chat?chat_id=' + chat_id + '&conversation_id=' + conversation_id + '&bot_id=7689821072762011698',
- { method: 'GET', dataType: 'text', headers: { 'Authorization': 'Bearer ' + COZE_TOKEN }, timeout: 15000 }
- );
-
- let status = 'unknown';
- try {
- const parsed = JSON.parse(statusRes.data);
- status = parsed.data && parsed.data.status;
- } catch (e) {}
-
- if (status !== 'completed') {
- return { code: 0, data: { status } };
- }
-
- // 获取消息
- const msgRes = await uniCloud.httpclient.request(
- 'https://api.coze.cn/v3/chat/message/list?chat_id=' + chat_id + '&conversation_id=' + conversation_id,
- { method: 'GET', dataType: 'text', headers: { 'Authorization': 'Bearer ' + COZE_TOKEN }, timeout: 15000 }
- );
-
- let answer = '';
- try {
- const parsed = JSON.parse(msgRes.data);
- const messages = parsed.data;
- if (Array.isArray(messages)) {
- for (const m of messages) {
- if (m.type === 'answer' && m.role === 'assistant') {
- answer = m.content;
- break;
- }
- }
+ let { data = {}, userInfo, util } = event;
+ let { db } = util;
+ const { record_id } = data;
+
+ if (!record_id) return { code: -1, msg: '缺少 record_id' };
+
+ const record = await db.collection('jjx-review-records').doc(record_id).get();
+ if (!record.data.length) return { code: -1, msg: '记录不存在' };
+
+ const rec = record.data[0];
+
+ return {
+ code: 0,
+ data: {
+ status: rec.status,
+ result: rec.result || '',
+ points_used: rec.points_used || 0,
+ html_url: rec.html_url || '',
+ contract_info: rec.contract_info || {},
+ error: rec.error || ''
}
- } catch (e) {}
-
- return { code: 0, data: { status: 'completed', answer } };
+ };
}
-};
+};
\ No newline at end of file
diff --git a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/jjxDoReview.js b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/jjxDoReview.js
new file mode 100644
index 0000000..4bc9ee4
--- /dev/null
+++ b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/jjxDoReview.js
@@ -0,0 +1,137 @@
+module.exports = {
+ main: async (event) => {
+ let { data = {}, userInfo } = event;
+ const { record_id, file_id, user_id, file_name, file_size } = data;
+
+ if (!record_id || !file_id) return { code: -1, msg: '参数错误' };
+
+ const COZE_TOKEN = 'sat_OiXlI4Da5Q99fxmul6pNfExmA6hR898UbxBDwrvjZ638APxRSlFnXbz6zyFedKNG';
+ const BOT_ID = '7689821072762011698';
+ const db = uniCloud.database();
+ const _ = db.command;
+
+ try {
+ // 构造请求
+ const objectString = JSON.stringify([
+ { type: 'file', file_id: file_id },
+ { type: 'text', text: '请审查这份合同' }
+ ]);
+
+ // 调用 Coze 接口(流式模式,等待完整响应,和 Demo 一致)
+ const chatRes = await uniCloud.httpclient.request('https://api.coze.cn/v3/chat', {
+ method: 'POST',
+ dataType: 'text',
+ contentType: 'json',
+ timeout: 300000, // 5分钟超时
+ headers: { 'Authorization': 'Bearer ' + COZE_TOKEN },
+ data: {
+ bot_id: BOT_ID,
+ user_id: user_id || 'anonymous',
+ stream: true,
+ auto_save_history: true,
+ additional_messages: [{
+ role: 'user',
+ content: objectString,
+ content_type: 'object_string'
+ }]
+ }
+ });
+
+ // 从 SSE 流中提取回答
+ let answer = '';
+ let conversationId = '';
+ const text = chatRes.data || '';
+ const lines = text.split('\n');
+ for (const line of lines) {
+ if (!line.startsWith('data:')) continue;
+ const d = line.slice(5).trim();
+ if (d === '[DONE]' || d === '"[DONE]"') continue;
+ try {
+ const p = JSON.parse(d);
+ if (p.conversation_id) conversationId = p.conversation_id;
+ if (p.type === 'answer' && p.content) answer += p.content;
+ if (p.type === 'tool_response' && p.content) {
+ try {
+ const toolData = JSON.parse(p.content);
+ if (toolData.url) answer += '\n\n📎 报告下载:' + toolData.url;
+ } catch (e) {
+ const urlMatch = p.content.match(/https?:\/\/[^\s\)\]\"\<]+\.pdf[^\s\)\]\"\<]*/i);
+ if (urlMatch) answer += '\n\n📎 报告下载:' + urlMatch[0];
+ }
+ }
+ } catch (e) {}
+ }
+
+ if (!answer) {
+ answer = '审查未能获取结果,请稍后重试';
+ }
+
+ // 计算消耗积分
+ const pointsUsed = Math.max(150, Math.ceil((file_size || 0) / (100 * 1024)) * 150);
+
+ // 扣积分
+ const userPoints = await db.collection('jjx-user-points').doc(user_id).get();
+ if (userPoints.data.length && userPoints.data[0].balance >= pointsUsed) {
+ await db.collection('jjx-user-points').doc(user_id).update({
+ balance: _.inc(-pointsUsed),
+ total_spent: _.inc(pointsUsed),
+ update_time: new Date()
+ });
+
+ const updatedPoints = await db.collection('jjx-user-points').doc(user_id).get();
+ await db.collection('jjx-points-log').add({
+ user_id: user_id,
+ type: 'spend',
+ amount: -pointsUsed,
+ balance_after: updatedPoints.data[0] ? updatedPoints.data[0].balance : 0,
+ reason: '合同审查 — ' + (file_name || ''),
+ biz_type: 'contract_review',
+ biz_id: record_id,
+ _add_time: new Date()
+ });
+ }
+
+ // 从回复中提取 HTML 报告下载链接
+ let htmlUrl = '';
+ try {
+ const linkMatch = answer.match(/\[([^\]]*\.html)\]\((https?:\/\/[^\)]+)\)/);
+ if (linkMatch) {
+ htmlUrl = linkMatch[2];
+ } else {
+ const urlMatch = answer.match(/https?:\/\/[^\s\)\]]+\.html[^\s\)\]]*/);
+ if (urlMatch) htmlUrl = urlMatch[0];
+ }
+ } catch (e) {}
+
+ // 解析 JSON 结构化数据
+ let contractInfo = {};
+ try {
+ const jsonMatch = answer.match(/```json\s*([\s\S]*?)```/);
+ if (jsonMatch) contractInfo = JSON.parse(jsonMatch[1].trim());
+ } catch (e) {}
+
+ // 更新审查记录为完成
+ await db.collection('jjx-review-records').doc(record_id).update({
+ status: 'completed',
+ result: answer,
+ html_url: htmlUrl,
+ contract_info: contractInfo,
+ points_used: pointsUsed,
+ conversation_id: conversationId || '',
+ update_time: new Date()
+ });
+
+ return { code: 0, msg: '审查完成' };
+
+ } catch (e) {
+ // 审查失败,更新记录
+ await db.collection('jjx-review-records').doc(record_id).update({
+ status: 'failed',
+ result: '审查失败: ' + e.message,
+ error: e.message,
+ update_time: new Date()
+ });
+ return { code: -1, msg: '审查失败: ' + e.message };
+ }
+ }
+};
\ No newline at end of file
diff --git a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/review.js b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/review.js
index a467025..3513643 100644
--- a/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/review.js
+++ b/uniCloud-tcb/cloudfunctions/router/service/client/ai/pub/review.js
@@ -1,12 +1,130 @@
+// Markdown 转 HTML
+function mdToHtml(md) {
+ if (!md) return '';
+ let html = md;
+ // 标题
+ html = html.replace(/^####\s+(.+)$/gm, '$1
');
+ html = html.replace(/^###\s+(.+)$/gm, '$1
');
+ html = html.replace(/^##\s+(.+)$/gm, '$1
');
+ html = html.replace(/^#\s+(.+)$/gm, '$1
');
+ // 加粗
+ html = html.replace(/\*\*(.*?)\*\*/g, '$1');
+ // 链接
+ html = html.replace(/(https?:\/\/[^\s\)\]\"\<]+)/g, '$1');
+ // 代码块
+ html = html.replace(/```[\w]*\n([\s\S]*?)```/g, '$1
');
+ // 行内代码
+ html = html.replace(/`([^`]+)`/g, '$1');
+ // 列表
+ html = html.replace(/^[\-\•]\s+(.+)$/gm, '$1');
+ html = html.replace(/^(\d+)\.\s+(.+)$/gm, '$1. $2');
+ // 换行
+ html = html.replace(/\n\n/g, '
');
+ html = html.replace(/\n/g, '
');
+ html = '
' + html + '
';
+ // 清理空段落
+ html = html.replace(/\s*<\/p>/g, '');
+ return html;
+}
+
+// 生成精美 HTML 报告
+function generateHtmlReport(markdown, fileName, reportDate, info) {
+ const riskLevel = info.risk_level || '待评估';
+ const riskSummary = info.risk_summary || '';
+ const riskCount = info.risk_count || { high: 0, medium: 0, low: 0 };
+ const contractName = info.contract_name || fileName || '合同审查报告';
+ const contractType = info.contract_type || '';
+
+ // 风险等级颜色
+ let riskColor = '#67c23a';
+ if (riskLevel.includes('高')) riskColor = '#f56c6c';
+ else if (riskLevel.includes('中高')) riskColor = '#e6a23c';
+ else if (riskLevel.includes('中')) riskColor = '#e6a23c';
+ else if (riskLevel.includes('中低')) riskColor = '#409eff';
+
+ return `
+
+
+
+
+${contractName} - 审查报告
+
+
+
+
+
+
+
+
综合风险等级
+
${riskLevel}
+
+
+
风险统计
+
${riskCount.high||0} / ${riskCount.medium||0} / ${riskCount.low||0}
+
+
+
合同类型
+
${contractType || '待识别'}
+
+
+
+
总体评估
+
${riskSummary || '暂无总体评估'}
+
详细审查意见
+ ${mdToHtml(markdown.replace(/```json[\s\S]*?```/, ''))}
+
+ ⚠️ 免责声明:本报告由 AI 系统自动生成,仅供参考,不构成正式法律意见。涉及重大金额或复杂交易的合同,建议咨询执业律师。
+
+
+
+
+
+`;
+}
+
module.exports = {
main: async (event) => {
let { data = {}, userInfo } = event;
const COZE_TOKEN = 'sat_OiXlI4Da5Q99fxmul6pNfExmA6hR898UbxBDwrvjZ638APxRSlFnXbz6zyFedKNG';
const BOT_ID = '7689821072762011698';
+ const db = uniCloud.database();
+ const _ = db.command;
let fileId = data.file_id;
- // 模式1:只上传文件(选文件时调用)
+ // ===== 模式1:上传文件 + 创建待审查记录 =====
if (data.upload_only && data.file_base64) {
const fileBuffer = Buffer.from(data.file_base64, 'base64');
const boundary = '----FormBoundary' + Date.now();
@@ -28,58 +146,121 @@ module.exports = {
'Content-Length': uploadBody.length.toString()
},
content: uploadBody,
- timeout: 60000
+ timeout: 600000
});
if (uploadRes.data.code !== 0) {
return { code: -1, msg: '文件上传失败: ' + uploadRes.data.msg };
}
fileId = uploadRes.data.data.id;
- return { code: 0, msg: 'ok', data: { file_id: fileId } };
+
+ // 同时上传到 uniCloud 云存储(用于查看/下载)
+ let fileUrl = '';
+ try {
+ const cloudPath = 'review-files/' + Date.now() + '_' + (data.file_name || 'file');
+ const uploadFileRes = await uniCloud.uploadFile({
+ cloudPath: cloudPath,
+ fileContent: fileBuffer
+ });
+ if (uploadFileRes.fileID) {
+ const urlRes = await uniCloud.getTempFileURL({
+ fileList: [uploadFileRes.fileID]
+ });
+ if (urlRes.fileList && urlRes.fileList[0]) {
+ fileUrl = urlRes.fileList[0].tempFileURL;
+ }
+ }
+ } catch (e) {
+ console.log('云存储上传失败(不影响审查):', e.message);
+ }
+
+ // 创建待审查记录
+ const recordRes = await db.collection('jjx-review-records').add({
+ user_id: (data && data.uid) || 'anonymous',
+ file_name: data.file_name || '',
+ file_size: data.file_size || 0,
+ file_id: fileId,
+ file_url: fileUrl,
+ chat_id: '',
+ conversation_id: '',
+ status: 'uploaded',
+ result: '',
+ points_used: 0,
+ _add_time: new Date(),
+ update_time: new Date()
+ });
+
+ return { code: 0, msg: 'ok', data: { file_id: fileId, record_id: recordRes.id, file_url: fileUrl } };
} catch (e) {
return { code: -1, msg: '上传异常: ' + e.message };
}
}
- // 模式2:发起审查(不等结果,立即返回 chat_id)
- if (!fileId) {
- return { code: -1, msg: '缺少 file_id' };
+ // ===== 模式2:发起审查(只更新状态,立即返回)=====
+ if (!fileId) return { code: -1, msg: '缺少 file_id' };
+
+ const recordId = data.record_id;
+ if (!recordId) return { code: -1, msg: '缺少 record_id' };
+
+ // 检查当前状态
+ const record = await db.collection('jjx-review-records').doc(recordId).get();
+ if (record.data.length) {
+ const rec = record.data[0];
+
+ // 已完成,直接返回结果
+ if (rec.status === 'completed') {
+ return {
+ code: 0, msg: 'ok',
+ data: {
+ record_id: recordId,
+ status: 'completed',
+ result: rec.result,
+ points_used: rec.points_used,
+ html_url: rec.html_url || '',
+ contract_info: rec.contract_info || {}
+ }
+ };
+ }
+
+ // 正在审查中,直接返回
+ if (rec.status === 'reviewing') {
+ return { code: 0, msg: 'ok', data: { record_id: recordId, status: 'reviewing' } };
+ }
+
+ // 失败,返回错误
+ if (rec.status === 'failed') {
+ return { code: 0, msg: 'ok', data: { record_id: recordId, status: 'failed', result: rec.result || '审查失败' } };
+ }
}
- const objectString = JSON.stringify([
- { type: 'file', file_id: fileId },
- { type: 'text', text: '请审查这份合同' }
- ]);
+ // 更新状态为审查中
+ await db.collection('jjx-review-records').doc(recordId).update({
+ file_id: fileId,
+ file_name: data.file_name || '',
+ file_size: data.file_size || 0,
+ status: 'reviewing',
+ review_started_at: new Date(),
+ update_time: new Date()
+ });
+ // ===== 触发实际审查(await 确保数据库更新完成)=====
try {
- const chatRes = await uniCloud.httpclient.request('https://api.coze.cn/v3/chat', {
- method: 'POST',
- dataType: 'json',
- contentType: 'json',
- timeout: 30000,
- headers: { 'Authorization': 'Bearer ' + COZE_TOKEN },
+ const doReview = require('./jjxDoReview.js');
+ await doReview.main({
data: {
- bot_id: BOT_ID,
+ record_id: recordId,
+ file_id: fileId,
user_id: (userInfo && userInfo.uid) || 'anonymous',
- stream: false,
- auto_save_history: true,
- additional_messages: [{
- role: 'user',
- content: objectString,
- content_type: 'object_string'
- }]
+ file_name: data.file_name || '',
+ file_size: data.file_size || 0
}
});
-
- const chatData = chatRes.data && chatRes.data.data;
- return {
- code: 0, msg: 'ok',
- data: {
- chat_id: chatData && chatData.id,
- conversation_id: chatData && chatData.conversation_id
- }
- };
} catch (e) {
- return { code: -1, msg: '审查发起失败: ' + e.message };
+ console.error('审查任务执行失败:', e);
}
+
+ return {
+ code: 0, msg: 'ok',
+ data: { record_id: recordId, status: 'reviewing' }
+ };
}
};
\ No newline at end of file
diff --git a/uniCloud-tcb/cloudfunctions/router/service/client/points/kh/getLog.js b/uniCloud-tcb/cloudfunctions/router/service/client/points/kh/getLog.js
index f438b59..b9d7e61 100644
--- a/uniCloud-tcb/cloudfunctions/router/service/client/points/kh/getLog.js
+++ b/uniCloud-tcb/cloudfunctions/router/service/client/points/kh/getLog.js
@@ -2,13 +2,23 @@
module.exports = {
main: async (event) => {
let { data = {}, userInfo, util } = event;
- let { db, _ } = util;
- const { pageIndex = 1, pageSize = 20, type } = data;
+ let { vk, db, _ } = util;
+ const { pageIndex = 1, pageSize = 50, biz_type } = data;
+
+ console.log('getLog uid:', userInfo.uid);
+
+ // 先查全部看看有没有数据
+ const allRes = await db.collection('jjx-points-log').limit(5).get();
+ console.log('getLog all data count:', allRes.data.length);
+ if (allRes.data.length > 0) {
+ console.log('getLog first record:', JSON.stringify(allRes.data[0]));
+ }
const where = { user_id: userInfo.uid };
- if (type) where.type = type; // 可选筛选 earn/spend
+ if (biz_type) where.biz_type = biz_type;
const countRes = await db.collection('jjx-points-log').where(where).count();
+ console.log('getLog filtered count:', countRes.total);
const listRes = await db.collection('jjx-points-log')
.where(where)
diff --git a/uniCloud-tcb/database/jjx-account.schema.json b/uniCloud-tcb/database/jjx-account.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-account.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-ad.schema.json b/uniCloud-tcb/database/jjx-ad.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-ad.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-album.schema.json b/uniCloud-tcb/database/jjx-album.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-album.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-article-category.schema.json b/uniCloud-tcb/database/jjx-article-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-article-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-article-collect.schema.json b/uniCloud-tcb/database/jjx-article-collect.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-article-collect.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-article-download.schema.json b/uniCloud-tcb/database/jjx-article-download.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-article-download.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-article.schema.json b/uniCloud-tcb/database/jjx-article.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-article.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-balance-log.schema.json b/uniCloud-tcb/database/jjx-balance-log.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-balance-log.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-balance.schema.json b/uniCloud-tcb/database/jjx-balance.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-balance.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-business-card.schema.json b/uniCloud-tcb/database/jjx-business-card.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-business-card.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-business-contact.schema.json b/uniCloud-tcb/database/jjx-business-contact.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-business-contact.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-cart.schema.json b/uniCloud-tcb/database/jjx-cart.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-cart.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-cash.schema.json b/uniCloud-tcb/database/jjx-cash.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-cash.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-certificate.schema.json b/uniCloud-tcb/database/jjx-certificate.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-certificate.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-company-manage-change-log.schema.json b/uniCloud-tcb/database/jjx-company-manage-change-log.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-company-manage-change-log.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-contract-template.schema.json b/uniCloud-tcb/database/jjx-contract-template.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-contract-template.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-contract.schema.json b/uniCloud-tcb/database/jjx-contract.schema.json
index 6c5b08a..e1e3915 100644
--- a/uniCloud-tcb/database/jjx-contract.schema.json
+++ b/uniCloud-tcb/database/jjx-contract.schema.json
@@ -1,24 +1 @@
-// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
-{
- "bsonType": "object",
- "required": [],
- "permission": {
- "read": false,
- "create": false,
- "update": false,
- "delete": false
- },
- "properties": {
- "_id": {
- "description": "ID,系统自动生成"
- },
- "status": {
- "bsonType": "int",
- "description": "状态 0待创建 1待签署 2已签署 -1已作废"
- },
- "partyList": {
- "bsonType": "array",
- "description": "当事人"
- }
- }
-}
\ No newline at end of file
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-coop-config.schema.json b/uniCloud-tcb/database/jjx-coop-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-coop-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-dict.schema.json b/uniCloud-tcb/database/jjx-dict.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-dict.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-attributes.schema.json b/uniCloud-tcb/database/jjx-enquiry-attributes.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-enquiry-attributes.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-category.schema.json b/uniCloud-tcb/database/jjx-enquiry-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-enquiry-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-package.schema.json b/uniCloud-tcb/database/jjx-enquiry-package.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-enquiry-package.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-quote.schema.json b/uniCloud-tcb/database/jjx-enquiry-quote.schema.json
index dd0c52d..e1e3915 100644
--- a/uniCloud-tcb/database/jjx-enquiry-quote.schema.json
+++ b/uniCloud-tcb/database/jjx-enquiry-quote.schema.json
@@ -1,20 +1 @@
-// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
-{
- "bsonType": "object",
- "required": [],
- "permission": {
- "read": false,
- "create": false,
- "update": false,
- "delete": false
- },
- "properties": {
- "_id": {
- "description": "ID,系统自动生成"
- },
- "status": {
- "bsonType": "int",
- "description": "状态 0默认 1已被选择"
- }
- }
-}
\ No newline at end of file
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-sheet.schema.json b/uniCloud-tcb/database/jjx-enquiry-sheet.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-enquiry-sheet.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-enquiry-template.schema.json b/uniCloud-tcb/database/jjx-enquiry-template.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-enquiry-template.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-ensure-config.schema.json b/uniCloud-tcb/database/jjx-ensure-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-ensure-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-factory.schema.json b/uniCloud-tcb/database/jjx-factory.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-factory.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-goods-category.schema.json b/uniCloud-tcb/database/jjx-goods-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-goods-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-goods-cooperate.schema.json b/uniCloud-tcb/database/jjx-goods-cooperate.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-goods-cooperate.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-goods.schema.json b/uniCloud-tcb/database/jjx-goods.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-goods.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-industry.schema.json b/uniCloud-tcb/database/jjx-industry.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-industry.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-message-config.schema.json b/uniCloud-tcb/database/jjx-message-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-message-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-message.schema.json b/uniCloud-tcb/database/jjx-message.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-message.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-old-category.schema.json b/uniCloud-tcb/database/jjx-old-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-old-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-old-quote.schema.json b/uniCloud-tcb/database/jjx-old-quote.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-old-quote.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-old.schema.json b/uniCloud-tcb/database/jjx-old.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-old.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-order-goods.schema.json b/uniCloud-tcb/database/jjx-order-goods.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-order-goods.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-order-pay-list.schema.json b/uniCloud-tcb/database/jjx-order-pay-list.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-order-pay-list.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-order-selfProduct.schema.json b/uniCloud-tcb/database/jjx-order-selfProduct.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-order-selfProduct.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-order.schema.json b/uniCloud-tcb/database/jjx-order.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-order.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-other-article-category.schema.json b/uniCloud-tcb/database/jjx-other-article-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-other-article-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-other-article.schema.json b/uniCloud-tcb/database/jjx-other-article.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-other-article.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-points-log.schema.json b/uniCloud-tcb/database/jjx-points-log.schema.json
index 7d7f12b..20e7ebd 100644
--- a/uniCloud-tcb/database/jjx-points-log.schema.json
+++ b/uniCloud-tcb/database/jjx-points-log.schema.json
@@ -1,63 +1 @@
-{
- "bsonType": "object",
- "required": [],
- "properties": {
- "_id": {
- "description": "记录ID,系统自动生成",
- "bsonType": "string"
- },
- "user_id": {
- "bsonType": "string",
- "title": "用户ID",
- "description": "关联 uni-id-users._id",
- "foreignKey": "uni-id-users._id"
- },
- "type": {
- "bsonType": "string",
- "title": "变动类型",
- "description": "earn=获得 spend=消耗",
- "enum": [
- { "text": "获得", "value": "earn" },
- { "text": "消耗", "value": "spend" }
- ]
- },
- "amount": {
- "bsonType": "number",
- "title": "变动数量",
- "description": "正数为获得,负数为消耗"
- },
- "balance_after": {
- "bsonType": "number",
- "title": "变动后余额",
- "description": "本次变动后的积分余额"
- },
- "reason": {
- "bsonType": "string",
- "title": "变动原因",
- "description": "如:新用户赠送、积分充值、合同审查消耗",
- "trim": "both"
- },
- "biz_type": {
- "bsonType": "string",
- "title": "业务类型",
- "description": "关联的业务类型",
- "enum": [
- { "text": "赠送", "value": "gift" },
- { "text": "充值", "value": "recharge" },
- { "text": "合同审查", "value": "contract_review" },
- { "text": "签到", "value": "checkin" },
- { "text": "其他", "value": "other" }
- ]
- },
- "biz_id": {
- "bsonType": "string",
- "title": "业务ID",
- "description": "关联的业务记录ID(如订单ID)"
- },
- "_add_time": {
- "bsonType": "date",
- "title": "创建时间",
- "description": "记录创建时间,系统自动填充"
- }
- }
-}
\ No newline at end of file
+{"bsonType":"object","required":[],"properties":{"_id":{"description":"记录ID,系统自动生成","bsonType":"string"},"user_id":{"bsonType":"string","title":"用户ID","description":"关联 uni-id-users._id","foreignKey":"uni-id-users._id"},"type":{"bsonType":"string","title":"变动类型","description":"earn=获得 spend=消耗","enum":[{"text":"获得","value":"earn"},{"text":"消耗","value":"spend"}]},"amount":{"bsonType":"number","title":"变动数量","description":"正数为获得,负数为消耗"},"balance_after":{"bsonType":"number","title":"变动后余额","description":"本次变动后的积分余额"},"reason":{"bsonType":"string","title":"变动原因","description":"如:新用户赠送、积分充值、合同审查消耗","trim":"both"},"biz_type":{"bsonType":"string","title":"业务类型","description":"关联的业务类型","enum":[{"text":"赠送","value":"gift"},{"text":"充值","value":"recharge"},{"text":"合同审查","value":"contract_review"},{"text":"签到","value":"checkin"},{"text":"其他","value":"other"}]},"biz_id":{"bsonType":"string","title":"业务ID","description":"关联的业务记录ID(如订单ID)"},"_add_time":{"bsonType":"date","title":"创建时间","description":"记录创建时间,系统自动填充"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-process-category.schema.json b/uniCloud-tcb/database/jjx-process-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-process-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-process-quote.schema.json b/uniCloud-tcb/database/jjx-process-quote.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-process-quote.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-process-sheet.schema.json b/uniCloud-tcb/database/jjx-process-sheet.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-process-sheet.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-quote-num-config.schema.json b/uniCloud-tcb/database/jjx-quote-num-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-quote-num-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-qyb-log.schema.json b/uniCloud-tcb/database/jjx-qyb-log.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-qyb-log.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-qyb.schema.json b/uniCloud-tcb/database/jjx-qyb.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-qyb.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-review-records.schema.json b/uniCloud-tcb/database/jjx-review-records.schema.json
new file mode 100644
index 0000000..2f6a2e9
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-review-records.schema.json
@@ -0,0 +1,93 @@
+{
+ "bsonType": "object",
+ "required": [],
+ "properties": {
+ "_id": {
+ "description": "记录ID,系统自动生成",
+ "bsonType": "string"
+ },
+ "user_id": {
+ "bsonType": "string",
+ "title": "用户ID",
+ "description": "关联 uni-id-users._id",
+ "foreignKey": "uni-id-users._id"
+ },
+ "file_name": {
+ "bsonType": "string",
+ "title": "文件名",
+ "description": "上传的合同文件名",
+ "trim": "both"
+ },
+ "file_size": {
+ "bsonType": "number",
+ "title": "文件大小",
+ "description": "文件大小(字节)"
+ },
+ "file_id": {
+ "bsonType": "string",
+ "title": "扣子文件ID",
+ "description": "上传到扣子后的 file_id"
+ },
+ "file_url": {
+ "bsonType": "string",
+ "title": "文件预览地址",
+ "description": "uniCloud 云存储临时链接,用于查看/下载原文件"
+ },
+ "html_url": {
+ "bsonType": "string",
+ "title": "HTML报告地址",
+ "description": "精美 HTML 审查报告链接"
+ },
+ "pdf_url": {
+ "bsonType": "string",
+ "title": "PDF报告地址",
+ "description": "PDF 审查报告下载链接"
+ },
+ "contract_info": {
+ "bsonType": "object",
+ "title": "合同结构化信息",
+ "description": "AI 返回的合同名称、风险等级、风险统计等"
+ },
+ "chat_id": {
+ "bsonType": "string",
+ "title": "对话ID",
+ "description": "扣子对话 chat_id"
+ },
+ "conversation_id": {
+ "bsonType": "string",
+ "title": "会话ID",
+ "description": "扣子会话 conversation_id"
+ },
+ "status": {
+ "bsonType": "string",
+ "title": "审查状态",
+ "description": "uploaded=待审查 reviewing=审查中 completed=已完成 failed=失败",
+ "enum": [
+ { "text": "待审查", "value": "uploaded" },
+ { "text": "审查中", "value": "reviewing" },
+ { "text": "已完成", "value": "completed" },
+ { "text": "失败", "value": "failed" }
+ ]
+ },
+ "result": {
+ "bsonType": "string",
+ "title": "审查结果",
+ "description": "AI 返回的审查结果内容"
+ },
+ "points_used": {
+ "bsonType": "number",
+ "title": "消耗积分",
+ "description": "本次审查消耗的积分数量"
+ },
+ "_add_time": {
+ "bsonType": "date",
+ "title": "创建时间",
+ "description": "记录创建时间"
+ },
+ "update_time": {
+ "bsonType": "date",
+ "title": "更新时间",
+ "description": "最后更新时间"
+ }
+ }
+}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-seal.schema.json b/uniCloud-tcb/database/jjx-seal.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-seal.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-self-support-quote-list.schema.json b/uniCloud-tcb/database/jjx-self-support-quote-list.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-self-support-quote-list.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-self-support.schema.json b/uniCloud-tcb/database/jjx-self-support.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-self-support.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-sign-pay_list.schema.json b/uniCloud-tcb/database/jjx-sign-pay_list.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-sign-pay_list.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-site-config.schema.json b/uniCloud-tcb/database/jjx-site-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-site-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-spot-ad.schema.json b/uniCloud-tcb/database/jjx-spot-ad.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-spot-ad.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-spot-amount.schema.json b/uniCloud-tcb/database/jjx-spot-amount.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-spot-amount.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-spot-category.schema.json b/uniCloud-tcb/database/jjx-spot-category.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-spot-category.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-spot-cooperate.schema.json b/uniCloud-tcb/database/jjx-spot-cooperate.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-spot-cooperate.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-spot-goods.schema.json b/uniCloud-tcb/database/jjx-spot-goods.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-spot-goods.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-steal-factory.schema.json b/uniCloud-tcb/database/jjx-steal-factory.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-steal-factory.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-address.schema.json b/uniCloud-tcb/database/jjx-user-address.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-address.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-article.schema.json b/uniCloud-tcb/database/jjx-user-article.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-article.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-balance-log.schema.json b/uniCloud-tcb/database/jjx-user-balance-log.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-balance-log.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-contract.schema.json b/uniCloud-tcb/database/jjx-user-contract.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-contract.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-level.schema.json b/uniCloud-tcb/database/jjx-user-level.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-level.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-points.schema.json b/uniCloud-tcb/database/jjx-user-points.schema.json
index dfc50eb..5d77842 100644
--- a/uniCloud-tcb/database/jjx-user-points.schema.json
+++ b/uniCloud-tcb/database/jjx-user-points.schema.json
@@ -1,40 +1 @@
-{
- "bsonType": "object",
- "required": [],
- "properties": {
- "_id": {
- "description": "用户ID(与 uni-id-users._id 对应)",
- "bsonType": "string"
- },
- "balance": {
- "bsonType": "number",
- "title": "积分余额",
- "description": "当前可用积分",
- "defaultValue": 0,
- "minimum": 0
- },
- "total_earned": {
- "bsonType": "number",
- "title": "累计获得",
- "description": "累计获得的积分总数",
- "defaultValue": 0
- },
- "total_spent": {
- "bsonType": "number",
- "title": "累计消耗",
- "description": "累计消耗的积分总数",
- "defaultValue": 0
- },
- "gift": {
- "bsonType": "number",
- "title": "赠送积分",
- "description": "新用户赠送的积分数量",
- "defaultValue": 500
- },
- "update_time": {
- "bsonType": "date",
- "title": "更新时间",
- "description": "最后更新时间"
- }
- }
-}
\ No newline at end of file
+{"bsonType":"object","required":[],"properties":{"_id":{"description":"用户ID(与 uni-id-users._id 对应)","bsonType":"string"},"balance":{"bsonType":"number","title":"积分余额","description":"当前可用积分","defaultValue":0,"minimum":0},"total_earned":{"bsonType":"number","title":"累计获得","description":"累计获得的积分总数","defaultValue":0},"total_spent":{"bsonType":"number","title":"累计消耗","description":"累计消耗的积分总数","defaultValue":0},"gift":{"bsonType":"number","title":"赠送积分","description":"新用户赠送的积分数量","defaultValue":500},"update_time":{"bsonType":"date","title":"更新时间","description":"最后更新时间"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/jjx-user-quote-num.schema.json b/uniCloud-tcb/database/jjx-user-quote-num.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/jjx-user-quote-num.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-components-dynamic.schema.json b/uniCloud-tcb/database/vk-components-dynamic.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-components-dynamic.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-files-categories.schema.json b/uniCloud-tcb/database/vk-files-categories.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-files-categories.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-files.schema.json b/uniCloud-tcb/database/vk-files.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-files.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-global-data.schema.json b/uniCloud-tcb/database/vk-global-data.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-global-data.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-pay-config.schema.json b/uniCloud-tcb/database/vk-pay-config.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-pay-config.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-pay-orders.schema.json b/uniCloud-tcb/database/vk-pay-orders.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-pay-orders.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file
diff --git a/uniCloud-tcb/database/vk-test.schema.json b/uniCloud-tcb/database/vk-test.schema.json
new file mode 100644
index 0000000..e1e3915
--- /dev/null
+++ b/uniCloud-tcb/database/vk-test.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"}}}
\ No newline at end of file