init: 导入团队知识库内容
@@ -0,0 +1,211 @@
|
|||||||
|
# UI 设计规范 — Ant Design 阿里云风格
|
||||||
|
|
||||||
|
> 本项目的报告页面、索引页面均遵循此规范。
|
||||||
|
> 设计灵感来源于 Ant Design v5 + 阿里云控制台主题。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 配色方案
|
||||||
|
|
||||||
|
### 1.1 品牌色
|
||||||
|
|
||||||
|
| 用途 | Token | 值 | 说明 |
|
||||||
|
|------|-------|------|------|
|
||||||
|
| 品牌主色 | `--color-primary` | `#1677FF` | Ant Design v5 默认品牌蓝 |
|
||||||
|
| 悬停态 | `--color-primary-hover` | `#4096FF` | 主色上浮一级 |
|
||||||
|
| 激活态 | `--color-primary-active` | `#0958D9` | 主色下压一级 |
|
||||||
|
| 浅色背景 | `--color-primary-bg` | `#E6F4FF` | 品牌蓝 6% 不透明度 |
|
||||||
|
|
||||||
|
### 1.2 功能色
|
||||||
|
|
||||||
|
| 用途 | Token | 值 |
|
||||||
|
|------|-------|------|
|
||||||
|
| 成功 | `--color-success` | `#52C41A` |
|
||||||
|
| 警告 | `--color-warning` | `#FAAD14` |
|
||||||
|
| 错误 | `--color-error` | `#FF4D4F` |
|
||||||
|
| 信息 | `--color-info` | `#1677FF` |
|
||||||
|
|
||||||
|
### 1.3 中性色(亮色主题 / 报告页用暗色主题变体)
|
||||||
|
|
||||||
|
| 用途 | Token | 亮色值 | 暗色值 |
|
||||||
|
|------|-------|--------|--------|
|
||||||
|
| 页面背景 | `--bg` | `#F5F5F5` | `#0B0F1A` |
|
||||||
|
| 容器背景 | `--bg-container` | `#FFFFFF` | `#111827` |
|
||||||
|
| 二级背景 | `--bg-elevated` | `#FAFAFA` | `#1A2235` |
|
||||||
|
| 边框 | `--border` | `#D9D9D9` | `#1E2A3A` |
|
||||||
|
| 边框浅 | `--border-light` | `#F0F0F0` | `#151D2E` |
|
||||||
|
| 主文字 | `--text-primary` | `#141414` | `#E8ECF1` |
|
||||||
|
| 次要文字 | `--text-secondary` | `#595959` | `#8892A4` |
|
||||||
|
| 辅助文字 | `--text-tertiary` | `#8C8C8C` | `#5A6478` |
|
||||||
|
|
||||||
|
### 1.4 渐变色
|
||||||
|
|
||||||
|
| 用途 | 值 |
|
||||||
|
|------|------|
|
||||||
|
| 标题渐变 | `linear-gradient(135deg, #1677FF 0%, #722ED1 100%)` |
|
||||||
|
| 成功渐变 | `linear-gradient(135deg, #52C41A 0%, #1677FF 100%)` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 字体规范
|
||||||
|
|
||||||
|
基于 Ant Design 动态秩序原则,基准字号 **14px**,行高 **22px**。
|
||||||
|
|
||||||
|
| 级别 | 字号 | 行高 | 字重 | 场景 |
|
||||||
|
|------|------|------|------|------|
|
||||||
|
| H1 页面标题 | 30px | 38px | 700 | 报告页眉标题 |
|
||||||
|
| H2 区块标题 | 24px | 32px | 600 | 报告 section 标题 |
|
||||||
|
| H3 小节标题 | 20px | 28px | 600 | 子章节标题 |
|
||||||
|
| H4 小标题 | 16px | 24px | 600 | 卡片内标题 |
|
||||||
|
| Body 正文 | 14px | 22px | 400 | 正文内容 |
|
||||||
|
| Caption 辅助 | 12px | 20px | 400 | 标签、注释、日期 |
|
||||||
|
|
||||||
|
### 字体族
|
||||||
|
|
||||||
|
```css
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||||
|
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
|
||||||
|
'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
```
|
||||||
|
|
||||||
|
代码字体:
|
||||||
|
|
||||||
|
```css
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 圆角规范
|
||||||
|
|
||||||
|
Ant Design v5 四级圆角体系:
|
||||||
|
|
||||||
|
| Token | 值 | 使用场景 |
|
||||||
|
|-------|------|---------|
|
||||||
|
| `radius-xs` | 2px | Tag、Badge |
|
||||||
|
| `radius-sm` | 6px | Input、Button、小卡片 |
|
||||||
|
| `radius-md` | 8px | Card、Panel、大卡片 |
|
||||||
|
| `radius-lg` | 12px | Modal、弹窗、大容器 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 间距规范
|
||||||
|
|
||||||
|
基于 **8px** 基准单位:
|
||||||
|
|
||||||
|
| Token | 值 | 使用场景 |
|
||||||
|
|-------|------|---------|
|
||||||
|
| `space-xs` | 4px | 极紧凑间距 |
|
||||||
|
| `space-sm` | 8px | 小间距 |
|
||||||
|
| `space-md` | 12px | 中等间距 |
|
||||||
|
| `space-lg` | 16px | 标准间距 |
|
||||||
|
| `space-xl` | 24px | 大间距 |
|
||||||
|
| `space-2xl` | 32px | 区块间距 |
|
||||||
|
| `space-3xl` | 48px | 大区块间距 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 布局规范
|
||||||
|
|
||||||
|
| 元素 | 值 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| 顶栏高度 | `64px` | Ant Design 标准顶栏 |
|
||||||
|
| 侧栏宽度 | `260px` | 目录导航栏 |
|
||||||
|
| 内容区最大宽度 | `1200px` | 居中显示 |
|
||||||
|
| 内容区内边距 | `32px 40px` | 桌面端 |
|
||||||
|
| 移动端内边距 | `16px` | ≤768px |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. 阴影规范
|
||||||
|
|
||||||
|
| Token | 值 | 使用场景 |
|
||||||
|
|-------|------|---------|
|
||||||
|
| `shadow-sm` | `0 1px 2px rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02)` | 小卡片 |
|
||||||
|
| `shadow-md` | `0 2px 4px rgba(0,0,0,0.04), 0 4px 12px -2px rgba(0,0,0,0.04)` | 卡片悬停 |
|
||||||
|
| `shadow-lg` | `0 4px 8px rgba(0,0,0,0.06), 0 8px 24px -4px rgba(0,0,0,0.08)` | 弹窗、下拉 |
|
||||||
|
|
||||||
|
暗色主题变体将 rgba 的 alpha 值减半。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. 组件规范
|
||||||
|
|
||||||
|
### 7.1 卡片 Card
|
||||||
|
|
||||||
|
- 背景:`--bg-container`
|
||||||
|
- 边框:`1px solid --border`
|
||||||
|
- 圆角:`8px`
|
||||||
|
- 内边距:`24px`
|
||||||
|
- 悬停:边框色变为 `--color-primary`,添加 `shadow-md`
|
||||||
|
- 过渡:`all 0.2s ease`
|
||||||
|
|
||||||
|
### 7.2 标签 Badge
|
||||||
|
|
||||||
|
- 内边距:`2px 10px`
|
||||||
|
- 圆角:`12px`(胶囊形)
|
||||||
|
- 字号:`12px`
|
||||||
|
- 字重:`600`
|
||||||
|
- 背景:对应功能色的 10% 不透明度
|
||||||
|
- 边框:`1px solid` 对应功能色的 25% 不透明度
|
||||||
|
|
||||||
|
### 7.3 表格 Table
|
||||||
|
|
||||||
|
- 表头背景:`--bg-elevated`
|
||||||
|
- 表头字重:`600`
|
||||||
|
- 单元格背景:`--bg-container`
|
||||||
|
- 单元格内边距:`10px 14px`
|
||||||
|
- 边框:`1px solid --border`
|
||||||
|
- 表头 sticky top: 0
|
||||||
|
- 行悬停:背景色变为 `--color-primary-bg`
|
||||||
|
|
||||||
|
### 7.4 代码 Code
|
||||||
|
|
||||||
|
- 背景:`--bg-elevated`
|
||||||
|
- 内边距:`2px 8px`
|
||||||
|
- 圆角:`4px`
|
||||||
|
- 字号:`13px`
|
||||||
|
- 字体:monospace
|
||||||
|
- 颜色:`--color-success`(暗色主题)/ `--color-primary`(亮色主题)
|
||||||
|
|
||||||
|
### 7.5 代码块 CodeBlock
|
||||||
|
|
||||||
|
- 背景:`--bg-elevated`
|
||||||
|
- 边框:`1px solid --border`
|
||||||
|
- 圆角:`8px`
|
||||||
|
- 内边距:`16px`
|
||||||
|
- 行高:`1.7`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. 主题
|
||||||
|
|
||||||
|
全部页面(索引页 + 报告页)统一使用**亮色主题**。
|
||||||
|
|
||||||
|
主题切换通过 CSS 自定义属性实现,所有颜色 Token 同时定义亮色和暗色两套值。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. 动画与过渡
|
||||||
|
|
||||||
|
| 元素 | 过渡 |
|
||||||
|
|------|------|
|
||||||
|
| 卡片悬停 | `all 0.2s ease` |
|
||||||
|
| 链接颜色 | `color 0.15s ease` |
|
||||||
|
| 侧栏导航激活态 | `all 0.15s ease` |
|
||||||
|
| 滚动指示器 | `all 0.15s ease` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. 响应式断点
|
||||||
|
|
||||||
|
| 断点 | 值 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| sm | 576px | 手机横屏 |
|
||||||
|
| md | 768px | 平板竖屏 |
|
||||||
|
| lg | 992px | 平板横屏 |
|
||||||
|
| xl | 1200px | 桌面 |
|
||||||
|
|
||||||
|
- `≤768px`:隐藏侧栏,全宽内容
|
||||||
|
- `≤992px`:缩小侧栏至 220px,减小内边距
|
||||||
|
- `>992px`:完整布局
|
||||||
@@ -0,0 +1,544 @@
|
|||||||
|
---
|
||||||
|
name: deep-research
|
||||||
|
description: |
|
||||||
|
Generate format-controlled research reports with evidence tracking, citations, source governance, and multi-pass synthesis.
|
||||||
|
This skill should be used when users request a research report, literature review, market or industry analysis,
|
||||||
|
competitive landscape, policy or technical brief. Triggers: "帮我调研一下", "深度研究", "综述报告", "深入分析",
|
||||||
|
"research this topic", "write a report on", "survey the literature on", "competitive analysis of",
|
||||||
|
"技术选型分析", "竞品研究", "政策分析", "行业报告".
|
||||||
|
V6 adds: source-type governance, AS_OF freshness checks, mandatory counter-review, and citation registry. V6.1 adds: source accessibility (circular verification forbidden, exclusive advantage encouraged).
|
||||||
|
---
|
||||||
|
|
||||||
|
# Deep Research
|
||||||
|
|
||||||
|
Create high-fidelity research reports with strict format control, evidence mapping, source governance, and multi-pass synthesis.
|
||||||
|
|
||||||
|
## Architecture: Lead Agent + Subagents
|
||||||
|
|
||||||
|
```
|
||||||
|
Lead Agent (coordinator — minimizes raw search context)
|
||||||
|
|
|
||||||
|
P0: Environment + source policy setup
|
||||||
|
|
|
||||||
|
P1: Research Task Board (roles, queries, parallel groups)
|
||||||
|
|
|
||||||
|
Dispatch ──→ Subagent A ──→ writes task-a.md ──┐
|
||||||
|
──→ Subagent B ──→ writes task-b.md ──┤ (parallel)
|
||||||
|
──→ Subagent C ──→ writes task-c.md ──┘
|
||||||
|
| |
|
||||||
|
| research-notes/ <────────────────────────┘
|
||||||
|
|
|
||||||
|
P2: Build citation registry with source_type + as_of + authority
|
||||||
|
P3: Evidence-mapped outline with counter-claim flags
|
||||||
|
P4: Draft from notes (never from raw search results)
|
||||||
|
P5: Counter-review (claims, confidence, alternatives)
|
||||||
|
P6: Verify (every [n] in registry, traceability check)
|
||||||
|
P7: Polish → final report with confidence markers
|
||||||
|
```
|
||||||
|
|
||||||
|
**Context efficiency:** Subagents' raw search results stay in their context and are discarded. Lead agent sees only distilled notes (~60-70% context reduction).
|
||||||
|
|
||||||
|
## Mode Selection
|
||||||
|
|
||||||
|
Determine the research mode before starting:
|
||||||
|
|
||||||
|
| Dimension | Options |
|
||||||
|
|-----------|---------|
|
||||||
|
| **Topic Mode** | Enterprise Research (company/corporation) OR General Research (industry/policy/tech) |
|
||||||
|
| **Depth Mode** | Standard (5-6 tasks, 3000-8000 words) OR Lightweight (3-4 tasks, 2000-4000 words) |
|
||||||
|
|
||||||
|
- **Enterprise Research Mode**: Six-dimension data collection with structured analysis frameworks (SWOT, risk matrix, competitive barrier quantification)
|
||||||
|
- **General Research Mode**: Standard P0-P7 research pipeline with source governance
|
||||||
|
- **Depth Selection**: Lightweight for single entity/concept < 30 words; Standard for multi-entity comparison or "深入"/"comprehensive" requests
|
||||||
|
|
||||||
|
## Source Governance (V6)
|
||||||
|
|
||||||
|
### Source Accessibility Classification
|
||||||
|
|
||||||
|
**CRITICAL RULE**: Every source must be classified by accessibility:
|
||||||
|
|
||||||
|
| Accessibility | Definition | Examples | Usage Rule |
|
||||||
|
|--------------|------------|----------|------------|
|
||||||
|
| `public` | Available to any external researcher without authentication | Public websites, news articles, WHOIS (without privacy), academic papers | ✅ Always allowed |
|
||||||
|
| `semi-public` | Requires registration or limited access | LinkedIn profiles, Crunchbase basic, industry reports (free tier) | ✅ Allowed with disclosure |
|
||||||
|
| `exclusive-user-provided` | User's paid subscriptions, private APIs, proprietary databases | Crunchbase Pro, PitchBook, private data feeds, internal databases | ✅ **ALLOWED** for third-party research |
|
||||||
|
| `private-user-owned` | User's own accounts when researching themselves | User's registrar for user's own company, user's bank for user's own finances | ❌ **FORBIDDEN** - circular verification |
|
||||||
|
|
||||||
|
**⚠️ CIRCULAR VERIFICATION BAN**: You must NOT:
|
||||||
|
- Use user's private data to "discover" what they already know about themselves
|
||||||
|
- Research user's own company by accessing user's private accounts
|
||||||
|
- Present user's private knowledge as "research findings"
|
||||||
|
|
||||||
|
**✅ EXCLUSIVE INFORMATION ADVANTAGE**: You SHOULD:
|
||||||
|
- Use user's Crunchbase Pro to research competitors
|
||||||
|
- Use user's proprietary databases for market research
|
||||||
|
- Use user's private APIs for investment analysis
|
||||||
|
- Leverage any exclusive source user provides for third-party research
|
||||||
|
|
||||||
|
### Source Type Labels
|
||||||
|
|
||||||
|
Every source MUST also be tagged with:
|
||||||
|
|
||||||
|
| Label | Definition | Examples |
|
||||||
|
|-------|------------|----------|
|
||||||
|
| `official` | Primary source, official documentation | Company SEC filings, government reports, official blog |
|
||||||
|
| `academic` | Peer-reviewed research | Journal articles, conference papers, dissertations |
|
||||||
|
| `secondary-industry` | Professional analysis | Industry reports, analyst coverage, trade publications |
|
||||||
|
| `journalism` | News reporting | Reputable media outlets, investigative journalism |
|
||||||
|
| `community` | User-generated content | Forums, reviews, social media, Q&A sites |
|
||||||
|
| `other` | Uncategorized or mixed | Aggregators, unverified sources |
|
||||||
|
|
||||||
|
**Quality Gates:**
|
||||||
|
- Standard mode: ≥30% official sources in final approved set
|
||||||
|
- Lightweight mode: ≥20% official sources
|
||||||
|
- Maximum single-source share: ≤25% (Standard), ≤30% (Lightweight)
|
||||||
|
- Minimum unique domains: 5 (Standard), 3 (Lightweight)
|
||||||
|
|
||||||
|
## AS_OF Date Policy
|
||||||
|
|
||||||
|
Set `AS_OF` date explicitly at P0. For all time-sensitive claims:
|
||||||
|
- Include source publication date with every citation
|
||||||
|
- Downgrade confidence if source is older than relevant horizon
|
||||||
|
- Flag stale sources in registry (studies >3 years, news >6 months for fast-moving topics)
|
||||||
|
|
||||||
|
## P0: Environment & Policy Setup
|
||||||
|
|
||||||
|
Check capabilities before starting:
|
||||||
|
|
||||||
|
| Check | Requirement | Impact if Missing |
|
||||||
|
|-------|-------------|-------------------|
|
||||||
|
| web_search available | Required | Stop - cannot proceed |
|
||||||
|
| web_fetch available | Required for DEEP tasks | SCAN-only mode |
|
||||||
|
| Subagent dispatch | Preferred | Degrade to sequential |
|
||||||
|
| Filesystem writable | Required | In-memory notes only |
|
||||||
|
|
||||||
|
Set policy variables:
|
||||||
|
- `AS_OF`: Today's date (YYYY-MM-DD) - mandatory for timed topics
|
||||||
|
- `MODE`: Standard (default) or Lightweight
|
||||||
|
- `SOURCE_TYPE_POLICY`: Enforce official/academic/secondary/journalism/community/other labels
|
||||||
|
- `COUNTER_REVIEW_PLAN`: What opposing interpretation to test
|
||||||
|
|
||||||
|
Report: `[P0 complete] Subagent: {yes/no}. Mode: {standard/lightweight}. AS_OF: {YYYY-MM-DD}.`
|
||||||
|
|
||||||
|
When researching a specific company/enterprise, follow this specialized workflow that ensures six-dimension coverage, quantified analysis frameworks, and three-level quality control.
|
||||||
|
|
||||||
|
### Enterprise Workflow Overview
|
||||||
|
|
||||||
|
```
|
||||||
|
Enterprise Research Progress:
|
||||||
|
- [ ] E1: Intake — confirm company entity, research depth, format contract
|
||||||
|
- [ ] E2: Six-dimension data collection (parallel where possible)
|
||||||
|
- [ ] D1: Company fundamentals (entity, founding, funding, ownership)
|
||||||
|
- [ ] D2: Business & products (segments, products, revenue structure)
|
||||||
|
- [ ] D3: Competitive position (industry rank, competitors, barriers)
|
||||||
|
- [ ] D4: Financial & operations (3-year financials, efficiency metrics)
|
||||||
|
- [ ] D5: Recent developments (6-month events, strategic signals)
|
||||||
|
- [ ] D6: Internal/proprietary sources (or note limitation)
|
||||||
|
- [ ] E3: Structured analysis frameworks
|
||||||
|
- [ ] SWOT analysis (evidence-backed, 4 quadrants × 3-5 entries)
|
||||||
|
- [ ] Competitive barrier quantification (7 dimensions, weighted score)
|
||||||
|
- [ ] Risk matrix (8 categories, probability × impact)
|
||||||
|
- [ ] Comprehensive scorecard (6 dimensions, weighted total)
|
||||||
|
- [ ] E4: L1/L2/L3 quality checks at each stage transition
|
||||||
|
- [ ] E5: Draft report using 7-chapter enterprise template
|
||||||
|
- [ ] E6: Multi-pass drafting + UNION merge (same as general Step 6-7)
|
||||||
|
- [ ] E7: Present draft for human review and iterate
|
||||||
|
```
|
||||||
|
|
||||||
|
## P1: Research Task Board
|
||||||
|
|
||||||
|
Decompose the research question into 4-6 investigation tasks (Standard) or 3-4 tasks (Lightweight).
|
||||||
|
|
||||||
|
Each task assignment includes:
|
||||||
|
- **Expert Role**: Specialist persona (e.g., "Policy Historian", "Ecosystem Mapper")
|
||||||
|
- **Objective**: One-sentence investigation goal
|
||||||
|
- **Queries**: 2-3 pre-planned search queries
|
||||||
|
- **Depth**: DEEP (fetch 2-3 full articles) or SCAN (snippets sufficient)
|
||||||
|
- **Output**: Path to research notes file
|
||||||
|
- **Parallel Group**: Group A (independent) or Group B (depends on Group A)
|
||||||
|
|
||||||
|
### Task Decomposition Rules
|
||||||
|
|
||||||
|
1. Each task covers one coherent sub-topic a specialist would own
|
||||||
|
2. Group A tasks must be independent and source-diverse
|
||||||
|
3. Max 3 tasks per parallel group (concurrency limit)
|
||||||
|
4. Every task must flag time-sensitive claims and expected citation aging risk
|
||||||
|
|
||||||
|
### Enterprise Research Integration
|
||||||
|
|
||||||
|
When in Enterprise Research Mode, task board maps to six dimensions:
|
||||||
|
- Task A: Company fundamentals (entity, founding, funding, ownership)
|
||||||
|
- Task B: Business & products (segments, products, revenue structure)
|
||||||
|
- Task C: Competitive position (industry rank, competitors, barriers)
|
||||||
|
- Task D: Financial & operations (3-year financials, efficiency metrics)
|
||||||
|
- Task E: Recent developments (6-month events, strategic signals)
|
||||||
|
- Task F: Internal/proprietary sources (or document limitation)
|
||||||
|
|
||||||
|
Report: `[P1 complete] {N} tasks in {M} groups. Dispatching Group A.`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Enterprise Research Mode (Specialized Pipeline)
|
||||||
|
|
||||||
|
When researching a specific company/enterprise, follow this specialized workflow that ensures six-dimension coverage, quantified analysis frameworks, and three-level quality control.
|
||||||
|
|
||||||
|
### E1: Intake
|
||||||
|
|
||||||
|
Same as P0/P1 above, plus:
|
||||||
|
- Confirm the exact legal entity being researched (parent vs subsidiary)
|
||||||
|
- Select research depth: Quick scan (3-5 pages) / Standard (10-20 pages) / Deep (20-40 pages)
|
||||||
|
- Identify any specific comparison targets (benchmark companies)
|
||||||
|
|
||||||
|
## P2: Dispatch + Investigate
|
||||||
|
|
||||||
|
Subagents execute tasks using [references/subagent_prompt.md](references/subagent_prompt.md) and output to [references/research_notes_format.md](references/research_notes_format.md).
|
||||||
|
|
||||||
|
### With Subagents (Claude Code / Cowork / DeerFlow)
|
||||||
|
|
||||||
|
1. Dispatch Group A tasks in parallel (max 3 concurrent)
|
||||||
|
2. Each subagent searches, fetches, and tags source types
|
||||||
|
3. Every source line includes `Source-Type` and `As Of`
|
||||||
|
4. Wait for Group A completion
|
||||||
|
5. Dispatch Group B (can read Group A notes)
|
||||||
|
|
||||||
|
### Subagent Output Requirements
|
||||||
|
|
||||||
|
Each task-{id}.md must contain:
|
||||||
|
- **Sources section**: URLs from actual search results with Source-Type, As Of, Authority (1-10)
|
||||||
|
- **Findings section**: Max 10 one-sentence facts with source numbers
|
||||||
|
- **Deep Read Notes** (DEEP tasks): 2-3 sources read in full with key data/insights
|
||||||
|
- **Gaps section**: What was searched but NOT found, alternative interpretations
|
||||||
|
|
||||||
|
### Without Subagents (Degraded Mode)
|
||||||
|
|
||||||
|
Lead agent executes tasks sequentially, acting as each specialist. Raw search results are discarded after writing notes.
|
||||||
|
|
||||||
|
### Enterprise Research: Six-Dimension Collection
|
||||||
|
|
||||||
|
Follow [references/enterprise_research_methodology.md](references/enterprise_research_methodology.md) for:
|
||||||
|
- Detailed collection workflow per dimension (query strategies, data fields, validation)
|
||||||
|
- Data source priority matrix (P0-P3 ranking)
|
||||||
|
- Cross-validation rules (min sources, max deviation thresholds)
|
||||||
|
|
||||||
|
**Key principles**:
|
||||||
|
- Evidence-driven: every conclusion must trace to a citable source
|
||||||
|
- Multi-source validation: key data requires ≥2 independent sources
|
||||||
|
- Restrained judgment: mark speculation explicitly, avoid unsubstantiated claims
|
||||||
|
- Structured presentation: complex information via tables, lists, hierarchies
|
||||||
|
|
||||||
|
Run L1 quality check after completing each dimension (see enterprise_quality_checklist.md).
|
||||||
|
|
||||||
|
Status per task: `[P2 task-{id} complete] {N} sources, {M} findings.`
|
||||||
|
Status all: `[P2 complete] {N} tasks done, {M} total sources. Building registry.`
|
||||||
|
|
||||||
|
### E3: Structured Analysis Frameworks
|
||||||
|
|
||||||
|
Apply frameworks from [references/enterprise_analysis_frameworks.md](references/enterprise_analysis_frameworks.md) in order:
|
||||||
|
1. **SWOT analysis** — each entry with evidence + source + impact assessment
|
||||||
|
2. **Competitive barrier quantification** — 7 dimensions with weighted scoring → A+/A/B+/B/C+/C rating
|
||||||
|
3. **Risk matrix** — 8 mandatory categories, probability × impact → Red/Yellow/Green
|
||||||
|
4. **Comprehensive scorecard** — 6-dimension weighted total → X/10
|
||||||
|
|
||||||
|
Run L2 quality check after analysis is complete.
|
||||||
|
|
||||||
|
### E4: Quality Control
|
||||||
|
|
||||||
|
Three-level checks from [references/enterprise_quality_checklist.md](references/enterprise_quality_checklist.md):
|
||||||
|
- **L1 (Data)**: Source count, attribution, cross-validation, timeliness
|
||||||
|
- **L2 (Analysis)**: SWOT completeness, risk coverage, barrier scoring, conclusion support
|
||||||
|
- **L3 (Document)**: Structure compliance, format consistency, readability, appendices
|
||||||
|
|
||||||
|
### E5: Draft Using Enterprise Template
|
||||||
|
|
||||||
|
Use the 7-chapter enterprise report template from enterprise_quality_checklist.md:
|
||||||
|
1. Company Overview
|
||||||
|
2. Business & Product Structure
|
||||||
|
3. Market & Competitive Position
|
||||||
|
4. Financial & Operations Analysis
|
||||||
|
5. Risks & Concerns
|
||||||
|
6. Recent Developments
|
||||||
|
7. Comprehensive Assessment & Conclusion
|
||||||
|
|
||||||
|
Plus appendices: Data Source Index, Glossary, Disclaimer.
|
||||||
|
|
||||||
|
### E3-E7: Enterprise Analysis, Drafting, and Review
|
||||||
|
|
||||||
|
- **E3: Structured Analysis** — Apply frameworks from [references/enterprise_analysis_frameworks.md](references/enterprise_analysis_frameworks.md)
|
||||||
|
- **E4: Quality Control** — Run L1/L2/L3 checks per [references/enterprise_quality_checklist.md](references/enterprise_quality_checklist.md)
|
||||||
|
- **E5: Draft** — Use 7-chapter enterprise template
|
||||||
|
- **E6-E7: Multi-Pass Drafting and Review** — Same as P4-P7 below
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## P3: Citation Registry + Source Governance
|
||||||
|
|
||||||
|
Lead agent reads all task notes and builds unified registry.
|
||||||
|
|
||||||
|
### Registry Process
|
||||||
|
|
||||||
|
1. Read every task file's `## Sources` section
|
||||||
|
2. Merge all sources, deduplicate by URL
|
||||||
|
3. Assign sequential [n] numbers by first appearance
|
||||||
|
4. Tag: source_type, as_of date, authority score (1-10), task id
|
||||||
|
5. **Apply quality gates:**
|
||||||
|
- Standard: ≥12 approved sources, ≥5 unique domains, ≥30% official
|
||||||
|
- Lightweight: ≥6 approved sources, ≥3 unique domains, ≥20% official
|
||||||
|
- Max single-source share: ≤25% (Standard), ≤30% (Lightweight)
|
||||||
|
6. **Drop sources** below threshold and list them explicitly
|
||||||
|
|
||||||
|
### Registry Output Format
|
||||||
|
|
||||||
|
```
|
||||||
|
CITATION REGISTRY
|
||||||
|
|
||||||
|
Approved:
|
||||||
|
[1] Author/Org — Title | URL | Source-Type: official | Accessibility: public | Date: 2026-03-01 | Auth: 8 | task-a
|
||||||
|
[2] ...
|
||||||
|
|
||||||
|
Dropped:
|
||||||
|
x Source | URL | Source-Type: community | Accessibility: privileged | Auth: 3 | Reason: PRIVILEGED SOURCE - NOT ALLOWED
|
||||||
|
|
||||||
|
Stats: {approved}/{total}, {N} domains, official_share {xx}%
|
||||||
|
Privileged sources rejected: {N}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Critical rule:** These [n] are FINAL. P5 may only cite from Approved list. Dropped sources never reappear.
|
||||||
|
|
||||||
|
**Circular verification handling**: When researching the user's own company/assets, if you discover data in user's private accounts (e.g., user's domain registrar showing they own domains), you MUST:
|
||||||
|
1. Reject it from the registry (user already knows this)
|
||||||
|
2. Note it as "CIRCULAR - USER ALREADY KNOWS" in Dropped
|
||||||
|
3. Search for equivalent PUBLIC sources (e.g., public WHOIS, news articles)
|
||||||
|
4. Report from external investigator perspective only
|
||||||
|
|
||||||
|
**Exclusive source handling**: When user EXPLICITLY PROVIDES their paid subscriptions or private APIs for third-party research (e.g., "Use my Crunchbase Pro to research competitors"), you SHOULD:
|
||||||
|
1. Accept it as "exclusive-user-provided" accessibility
|
||||||
|
2. Use it as competitive advantage
|
||||||
|
3. Cite it properly in registry
|
||||||
|
4. If no public equivalent exists, mark as [unverified] or omit the claim
|
||||||
|
|
||||||
|
Report: `[P3 complete] {approved}/{total} sources. {N} domains. Official share: {xx}%. Privileged rejected: {N}.`
|
||||||
|
|
||||||
|
### Handling Information Black Box
|
||||||
|
|
||||||
|
When researching entities with no public footprint (like the "字节跳动子公司" example):
|
||||||
|
|
||||||
|
**What an external researcher would find:**
|
||||||
|
- WHOIS: Privacy protected → No owner info
|
||||||
|
- Web search: No news, no press releases
|
||||||
|
- Social media: No company pages
|
||||||
|
- Business registries: No public API or requires local access
|
||||||
|
- Result: **Complete information black box**
|
||||||
|
|
||||||
|
**Correct response:**
|
||||||
|
```
|
||||||
|
Findings: NO PUBLIC INFORMATION AVAILABLE
|
||||||
|
|
||||||
|
Sources checked:
|
||||||
|
- WHOIS (public): Privacy protected [failed]
|
||||||
|
- Company registry (public): Access denied/No API [failed]
|
||||||
|
- News media: No coverage [failed]
|
||||||
|
- Corporate website: Placeholder only [minimal]
|
||||||
|
|
||||||
|
Verdict: UNABLE TO VERIFY COMPANY EXISTENCE from external perspective
|
||||||
|
Sources found: 0 (or minimal, e.g., only WHOIS showing domain exists)
|
||||||
|
Confidence: N/A - Insufficient evidence
|
||||||
|
```
|
||||||
|
|
||||||
|
**DO NOT:**
|
||||||
|
- ❌ Use user's own credentials to "fill in the gaps"
|
||||||
|
- ❌ Assume the company exists based on domain registration alone
|
||||||
|
- ❌ Fill missing data with speculation
|
||||||
|
- ❌ Claim to have "verified" information you accessed through privileged means
|
||||||
|
|
||||||
|
**DO:**
|
||||||
|
- ✅ Clearly state what an external researcher can/cannot verify
|
||||||
|
- ✅ Document all failed search attempts
|
||||||
|
- ✅ Mark claims as [unverified] or omit entirely
|
||||||
|
- ✅ Downgrade mode to Lightweight or stop if insufficient public sources
|
||||||
|
- ✅ Recommend direct contact for due diligence
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## P4: Evidence-Mapped Outline
|
||||||
|
|
||||||
|
Lead agent reads notes + registry to build outline.
|
||||||
|
|
||||||
|
1. Identify cross-task patterns
|
||||||
|
2. Design sections topic-first, not task-order-first
|
||||||
|
3. Map each section to specific findings with source numbers
|
||||||
|
4. Flag sections needing counter-review
|
||||||
|
5. Mark recency-sensitive claims with AS_OF checks
|
||||||
|
|
||||||
|
Outline format:
|
||||||
|
```
|
||||||
|
## N. {Section Title}
|
||||||
|
Sources: [1][3][7] from tasks a, b
|
||||||
|
Claims: {claim from task-a finding 3}, {claim from task-b finding 1}
|
||||||
|
Counter-claim candidates: {alternative explanations}
|
||||||
|
Recency checks: {source dates + AS_OF}
|
||||||
|
Gaps: {limited official evidence}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## P5: Draft from Notes
|
||||||
|
|
||||||
|
Write section by section using [references/report_template_v6.md](references/report_template_v6.md).
|
||||||
|
|
||||||
|
**Rules:**
|
||||||
|
- Every factual claim needs citation [n]
|
||||||
|
- Numbers/percentages must have source
|
||||||
|
- Add **confidence marker** per section: High/Medium/Low with rationale
|
||||||
|
- Add **counter-claim sentence** when evidence conflicts
|
||||||
|
- No new sources may be introduced
|
||||||
|
- Use [unverified] for unsupported statements
|
||||||
|
|
||||||
|
**Anti-hallucination:**
|
||||||
|
- Lead agent never invents URLs — only from subagent notes
|
||||||
|
- Lead agent never fabricates data — mark [unverified] if number not in notes
|
||||||
|
|
||||||
|
Status: `[P5 in progress] {N}/{M} sections, ~{words} words.`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## P6: Counter-Review (Mandatory)
|
||||||
|
|
||||||
|
For each major conclusion, perform opposite-view checks:
|
||||||
|
|
||||||
|
1. **Could the conclusion be wrong?**
|
||||||
|
2. **Which high-impact claims depend on a single source?**
|
||||||
|
3. **Which claims lack official/academic support?**
|
||||||
|
4. **Are stale sources used for time-sensitive claims?**
|
||||||
|
5. **Find ≥3 issues** (re-examine if 0 found)
|
||||||
|
|
||||||
|
### Using Counter-Review Team (Recommended)
|
||||||
|
|
||||||
|
For comprehensive parallel review, use the Counter-Review Team:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Prepare inputs
|
||||||
|
counter-review-inputs/
|
||||||
|
├── draft_report.md
|
||||||
|
├── citation_registry.md
|
||||||
|
├── task-notes/
|
||||||
|
└── p0_config.md
|
||||||
|
|
||||||
|
# 2. Dispatch to 4 specialist agents in parallel
|
||||||
|
SendMessage to: claim-validator
|
||||||
|
SendMessage to: source-diversity-checker
|
||||||
|
SendMessage to: recency-validator
|
||||||
|
SendMessage to: contradiction-finder
|
||||||
|
|
||||||
|
# 3. Wait for all specialists to complete
|
||||||
|
|
||||||
|
# 4. Send to coordinator for synthesis
|
||||||
|
SendMessage to: counter-review-coordinator
|
||||||
|
inputs: [4 specialist reports]
|
||||||
|
|
||||||
|
# 5. Receive final P6 Counter-Review Report
|
||||||
|
```
|
||||||
|
|
||||||
|
See [references/counter_review_team_guide.md](references/counter_review_team_guide.md) for detailed usage.
|
||||||
|
|
||||||
|
### Manual Counter-Review (Fallback)
|
||||||
|
|
||||||
|
If Counter-Review Team is unavailable, perform manual checks:
|
||||||
|
- Verify every high-confidence claim has ≥2 sources
|
||||||
|
- Check official/academic backing for key claims
|
||||||
|
- Verify AS_OF dates on time-sensitive claims
|
||||||
|
- Document opposing interpretations
|
||||||
|
|
||||||
|
### Output
|
||||||
|
|
||||||
|
Include in final report:
|
||||||
|
```
|
||||||
|
## 核心争议 / Key Controversies
|
||||||
|
- **争议 1:** [主张 A 与反向证据 B 对比] [n][m]
|
||||||
|
- **争议 2:** ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Report: `[P6 complete] {N} issues found: {critical} critical, {high} high, {medium} medium.`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## P7: Verify
|
||||||
|
|
||||||
|
Cross-check before finalization:
|
||||||
|
|
||||||
|
1. **Registry cross-check:** List every [n] in report vs approved registry
|
||||||
|
2. **Spot-check 5+ claims:** Trace to task notes
|
||||||
|
3. **Remove/fix non-traceable claims**
|
||||||
|
4. **Validate no dropped source resurrected**
|
||||||
|
5. **Check source concentration** for key claims
|
||||||
|
|
||||||
|
Report: `[P7 complete] {N} spot-checks, {M} violations fixed.`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Requirements
|
||||||
|
|
||||||
|
- Match the requested language and tone
|
||||||
|
- Preserve technical terms in English
|
||||||
|
- Respect the report spec and formatting rules
|
||||||
|
- Include a references section or bibliography
|
||||||
|
|
||||||
|
## Reference Files
|
||||||
|
|
||||||
|
### Core V6 Pipeline References
|
||||||
|
|
||||||
|
| File | When to Load |
|
||||||
|
| --- | --- |
|
||||||
|
| [source_accessibility_policy.md](references/source_accessibility_policy.md) | **P0 (CRITICAL)**: Source classification rules - read first |
|
||||||
|
| [subagent_prompt.md](references/subagent_prompt.md) | P2: Task dispatch to subagents |
|
||||||
|
| [research_notes_format.md](references/research_notes_format.md) | P2: Subagent output format |
|
||||||
|
| [report_template_v6.md](references/report_template_v6.md) | P5: Draft with confidence markers and counter-review |
|
||||||
|
| [quality_gates.md](references/quality_gates.md) | All phases: Quality thresholds and anti-hallucination checks |
|
||||||
|
|
||||||
|
### General Research References
|
||||||
|
|
||||||
|
| File | When to Load |
|
||||||
|
| --- | --- |
|
||||||
|
| [research_report_template.md](references/research_report_template.md) | Build outline and draft structure |
|
||||||
|
| [formatting_rules.md](references/formatting_rules.md) | Enforce section formatting and citation rules |
|
||||||
|
| [source_quality_rubric.md](references/source_quality_rubric.md) | Score and triage sources |
|
||||||
|
| [research_plan_checklist.md](references/research_plan_checklist.md) | Build research plan and query set |
|
||||||
|
| [completeness_review_checklist.md](references/completeness_review_checklist.md) | Review for coverage, citations, and compliance |
|
||||||
|
|
||||||
|
### Enterprise Research References (load when in Enterprise Research Mode)
|
||||||
|
|
||||||
|
| File | When to Load |
|
||||||
|
| --- | --- |
|
||||||
|
| [enterprise_research_methodology.md](references/enterprise_research_methodology.md) | Six-dimension data collection workflow, source priority, cross-validation rules |
|
||||||
|
| [enterprise_analysis_frameworks.md](references/enterprise_analysis_frameworks.md) | SWOT template, competitive barrier quantification, risk matrix, comprehensive scoring |
|
||||||
|
| [enterprise_quality_checklist.md](references/enterprise_quality_checklist.md) | L1/L2/L3 quality checks, per-dimension checklists, 7-chapter report template |
|
||||||
|
|
||||||
|
## Anti-Patterns
|
||||||
|
|
||||||
|
- Single-pass drafting without parallel complete passes
|
||||||
|
- Splitting passes by section instead of full report drafts
|
||||||
|
- Ignoring the format contract or user template
|
||||||
|
- Claims without citations or evidence table mapping
|
||||||
|
- Mixing conflicting dates without calling out discrepancies
|
||||||
|
- Copying external AI output without verification
|
||||||
|
- Deleting intermediate drafts or raw research outputs
|
||||||
|
- **Lead agent reading raw search results** — only read subagent notes
|
||||||
|
- **Inventing URLs** — only use URLs from actual search results
|
||||||
|
- **Resurrecting dropped sources** — dropped in P3 never reappear
|
||||||
|
- **Missing AS_OF for time-sensitive claims** — always include source date
|
||||||
|
- **Skipping counter-review** — mandatory P6 must find ≥3 issues
|
||||||
|
- **CIRCULAR VERIFICATION** — never use user's private data to "discover" what they already know about themselves
|
||||||
|
- **IGNORING EXCLUSIVE SOURCES** — when user provides Crunchbase Pro etc. for competitor research, USE IT
|
||||||
|
|
||||||
|
## Next Step: Verify and Deliver
|
||||||
|
|
||||||
|
After completing research, suggest verification and output:
|
||||||
|
|
||||||
|
```
|
||||||
|
Research report complete: [N] sources cited, [M] claims made.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
A) Verify facts — run /fact-checker on the report (Recommended)
|
||||||
|
B) Create slides — run /ppt-creator from the findings
|
||||||
|
C) Export as PDF — run /pdf-creator for formal delivery
|
||||||
|
D) No thanks — the report is ready as-is
|
||||||
|
```
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
# Deep Research Skill V6.1 Improvements
|
||||||
|
|
||||||
|
**Date**: 2026-04-03
|
||||||
|
**Version**: 2.3.0 → 2.4.0
|
||||||
|
**Based on**: User feedback and "字节跳动" case study
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary of Changes
|
||||||
|
|
||||||
|
### 1. Source Accessibility Policy - Critical Correction
|
||||||
|
|
||||||
|
**Problem Identified**:
|
||||||
|
Previously, we incorrectly banned all "privileged" sources. This was wrong because it prevented users from leveraging their competitive information advantages.
|
||||||
|
|
||||||
|
**The Real Issue**:
|
||||||
|
The problem is not using user's private information—it's **circular verification**: using user's data to "discover" what they already know about themselves.
|
||||||
|
|
||||||
|
**Example of the Error**:
|
||||||
|
```
|
||||||
|
User: "Research my company 字节跳动子公司"
|
||||||
|
❌ WRONG: Access user's Spaceship → "You own 25 domains"
|
||||||
|
→ This is circular: user already knows they own these domains
|
||||||
|
|
||||||
|
✅ RIGHT: Check public WHOIS → "Privacy protected, ownership not visible"
|
||||||
|
→ This is external research perspective
|
||||||
|
```
|
||||||
|
|
||||||
|
**Correct Classification**:
|
||||||
|
|
||||||
|
| Accessibility | For Self-Research | For Third-Party Research |
|
||||||
|
|--------------|-------------------|-------------------------|
|
||||||
|
| `public` | ✅ Use | ✅ Use |
|
||||||
|
| `semi-public` | ✅ Use | ✅ Use |
|
||||||
|
| `exclusive-user-provided` | ⚠️ Careful* | ✅ **ENCOURAGED** |
|
||||||
|
| `private-user-owned` | ❌ **FORBIDDEN** | N/A |
|
||||||
|
|
||||||
|
\* When user provides exclusive sources for their own company, evaluate if it's circular
|
||||||
|
|
||||||
|
### 2. Counter-Review Team V2
|
||||||
|
|
||||||
|
**Created**: 5-agent parallel review team
|
||||||
|
- 🔵 claim-validator: Claim validation
|
||||||
|
- 🟢 source-diversity-checker: Source diversity analysis
|
||||||
|
- 🟡 recency-validator: Recency/freshness checks
|
||||||
|
- 🟣 contradiction-finder: Contradiction and bias detection
|
||||||
|
- 🟠 counter-review-coordinator: Synthesis and reporting
|
||||||
|
|
||||||
|
**Usage**:
|
||||||
|
```bash
|
||||||
|
# 1. Dispatch to 4 specialists in parallel
|
||||||
|
SendMessage to: claim-validator
|
||||||
|
SendMessage to: source-diversity-checker
|
||||||
|
SendMessage to: recency-validator
|
||||||
|
SendMessage to: contradiction-finder
|
||||||
|
|
||||||
|
# 2. Send to coordinator for synthesis
|
||||||
|
SendMessage to: counter-review-coordinator
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Methodology Clarifications
|
||||||
|
|
||||||
|
#### When Researching User's Own Company
|
||||||
|
- **Approach**: External investigator perspective
|
||||||
|
- **Use**: Public sources only
|
||||||
|
- **Do NOT use**: User's private accounts (creates circular verification)
|
||||||
|
- **Report**: "From public perspective: X, Y, Z gaps"
|
||||||
|
|
||||||
|
#### When User Provides Exclusive Sources for Third-Party Research
|
||||||
|
- **Approach**: Leverage competitive advantage
|
||||||
|
- **Use**: User's paid subscriptions, private APIs, proprietary databases
|
||||||
|
- **Cite**: Mark as `exclusive-user-provided`
|
||||||
|
- **Report**: "Per user's exclusive source [Crunchbase Pro], competitor X raised $Y"
|
||||||
|
|
||||||
|
### 4. Registry Format Update
|
||||||
|
|
||||||
|
**Added fields**:
|
||||||
|
- `Accessibility`: public / semi-public / exclusive-user-provided / private-user-owned
|
||||||
|
- `Circular rejection tracking`: Note when sources are rejected for circular verification
|
||||||
|
|
||||||
|
**Updated anti-patterns**:
|
||||||
|
- ❌ **CIRCULAR VERIFICATION**: Never use user's private data to "discover" what they already know
|
||||||
|
- ✅ **USE EXCLUSIVE SOURCES**: When user provides Crunchbase Pro etc. for competitor research, USE IT
|
||||||
|
|
||||||
|
### 5. Documentation Updates
|
||||||
|
|
||||||
|
**New/Updated Files**:
|
||||||
|
- `source_accessibility_policy.md`: Complete rewrite explaining circular vs. competitive advantage distinction
|
||||||
|
- `counter_review_team_guide.md`: Usage guide for the 5-agent team
|
||||||
|
- `SKILL.md`: Updated Source Governance section with correct classification
|
||||||
|
- `marketplace.json`: Updated description
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Principles Summary
|
||||||
|
|
||||||
|
1. **Circular Verification is Bad**: Don't use user's data to tell them what they already know
|
||||||
|
2. **Exclusive Information Advantage is Good**: Use user's paid tools to research competitors
|
||||||
|
3. **External Perspective for Self-Research**: When researching user's own company, act like an external investigator
|
||||||
|
4. **Leverage Everything for Third-Party**: When researching others, use every advantage user provides
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
|
||||||
|
| Version | Changes |
|
||||||
|
|---------|---------|
|
||||||
|
| 2.0.0 | Initial Enterprise Research Mode |
|
||||||
|
| 2.1.0 | V6 features: source governance, AS_OF, counter-review |
|
||||||
|
| 2.2.0 | Counter-Review Team |
|
||||||
|
| 2.3.0 | Source accessibility (initial, incorrect ban on privileged) |
|
||||||
|
| **2.4.0** | **Corrected: circular vs. exclusive advantage distinction** |
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Completeness Review Checklist
|
||||||
|
|
||||||
|
Verify the draft meets all requirements before delivery.
|
||||||
|
|
||||||
|
## Structure and Format
|
||||||
|
- All required sections present and ordered
|
||||||
|
- Headings match the format contract
|
||||||
|
- Length targets met per section
|
||||||
|
|
||||||
|
## Evidence and Citations
|
||||||
|
- Every claim has a citation
|
||||||
|
- Every numeric claim has at least one Tier A or B source
|
||||||
|
- Conflicting sources are explicitly noted
|
||||||
|
- Evidence table maps claims to sources
|
||||||
|
|
||||||
|
## Content Quality
|
||||||
|
- Findings answer the research questions
|
||||||
|
- Recommendations are tied to evidence
|
||||||
|
- Limitations and uncertainty are documented
|
||||||
|
- Terminology is consistent
|
||||||
|
|
||||||
|
## Final Checks
|
||||||
|
- Dates and time ranges are consistent
|
||||||
|
- No unsupported claims
|
||||||
|
- No duplicate or conflicting statements
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
# Counter-Review Team 使用指南
|
||||||
|
|
||||||
|
Deep Research V6 P6 阶段的专用 Agent Team,并行执行多维度审查。
|
||||||
|
|
||||||
|
## Team 架构
|
||||||
|
|
||||||
|
```
|
||||||
|
counter-review-coordinator (协调者)
|
||||||
|
├── claim-validator (声明验证器)
|
||||||
|
├── source-diversity-checker (来源多样性检查器)
|
||||||
|
├── recency-validator (时效性验证器)
|
||||||
|
└── contradiction-finder (矛盾发现器)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Agent 职责
|
||||||
|
|
||||||
|
| Agent | 职责 | 输出 |
|
||||||
|
|-------|------|------|
|
||||||
|
| **claim-validator** | 验证声明准确性,识别无证据/弱证据声明 | Claim Validation Report |
|
||||||
|
| **source-diversity-checker** | 检查单一来源依赖,source-type 分布 | Source Diversity Report |
|
||||||
|
| **recency-validator** | 验证时敏声明的新鲜度,AS_OF 合规 | Recency Validation Report |
|
||||||
|
| **contradiction-finder** | 发现内部矛盾,缺失的反向观点 | Contradiction and Bias Report |
|
||||||
|
| **counter-review-coordinator** | 整合所有报告,生成最终 P6 报告 | P6 Counter-Review Report |
|
||||||
|
|
||||||
|
## 使用流程
|
||||||
|
|
||||||
|
### 1. 准备输入材料
|
||||||
|
|
||||||
|
在 P5 (Draft) 完成后,收集以下材料:
|
||||||
|
|
||||||
|
```
|
||||||
|
inputs/
|
||||||
|
├── draft_report.md # P5 起草的报告
|
||||||
|
├── citation_registry.md # P3 的引用注册表
|
||||||
|
├── task-notes/
|
||||||
|
│ ├── task-a.md # 子代理研究笔记
|
||||||
|
│ ├── task-b.md
|
||||||
|
│ └── ...
|
||||||
|
└── p0_config.md # P0 配置 (AS_OF 日期, Mode 等)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 并行分发任务
|
||||||
|
|
||||||
|
向 4 个 specialist agent 同时发送任务:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 向 claim-validator 发送
|
||||||
|
SendMessage to: claim-validator
|
||||||
|
输入: draft_report.md + citation_registry.md + task-notes/
|
||||||
|
指令: 验证所有声明的证据支持
|
||||||
|
|
||||||
|
# 向 source-diversity-checker 发送
|
||||||
|
SendMessage to: source-diversity-checker
|
||||||
|
输入: draft_report.md + citation_registry.md
|
||||||
|
指令: 检查来源多样性和单一来源依赖
|
||||||
|
|
||||||
|
# 向 recency-validator 发送
|
||||||
|
SendMessage to: recency-validator
|
||||||
|
输入: draft_report.md + citation_registry.md + p0_config.md
|
||||||
|
指令: 验证时敏声明的新鲜度
|
||||||
|
|
||||||
|
# 向 contradiction-finder 发送
|
||||||
|
SendMessage to: contradiction-finder
|
||||||
|
输入: draft_report.md + task-notes/ + citation_registry.md
|
||||||
|
指令: 发现矛盾和缺失的反向观点
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 协调汇总
|
||||||
|
|
||||||
|
等待 4 个 specialist 完成后,发送给 coordinator:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
SendMessage to: counter-review-coordinator
|
||||||
|
输入:
|
||||||
|
- Claim Validation Report
|
||||||
|
- Source Diversity Report
|
||||||
|
- Recency Validation Report
|
||||||
|
- Contradiction and Bias Report
|
||||||
|
指令: 整合所有报告,生成最终 P6 Counter-Review Report
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 获取最终输出
|
||||||
|
|
||||||
|
Coordinator 输出包含:
|
||||||
|
- 问题汇总(必须 ≥3 个)
|
||||||
|
- 关键争议部分(可直接复制到最终报告)
|
||||||
|
- 强制修复清单
|
||||||
|
- 质量门状态
|
||||||
|
|
||||||
|
## 质量门要求
|
||||||
|
|
||||||
|
| 检查项 | 标准模式 | 轻量模式 | 失败处理 |
|
||||||
|
|--------|---------|---------|---------|
|
||||||
|
| 发现问题数 | ≥3 | ≥3 | 重新审查 |
|
||||||
|
| 关键声明单来源 | 0 | 0 | 补充来源或降级 |
|
||||||
|
| 官方来源占比 | ≥30% | ≥20% | 补充官方来源 |
|
||||||
|
| AS_OF 日期完整 | 100% | 100% | 补充日期 |
|
||||||
|
| 核心争议文档化 | 必填 | 必填 | 补充争议部分 |
|
||||||
|
|
||||||
|
## 输出示例
|
||||||
|
|
||||||
|
### Coordinator 最终报告结构
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
# P6 Counter-Review Report
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
- Total issues found: 7 (critical: 2, high: 3, medium: 2)
|
||||||
|
- Must-fix before publish: 2
|
||||||
|
- Recommended improvements: 5
|
||||||
|
|
||||||
|
## Critical Issues (Block Publish)
|
||||||
|
| # | Issue | Location | Source | Fix Required |
|
||||||
|
|---|-------|----------|--------|--------------|
|
||||||
|
| 1 | 市场份额声明无来源 | 3.2节 | 无 | 补充来源或删除 |
|
||||||
|
| 2 | 单一社区来源支持收入数据 | 4.1节 | [12] community | 找官方来源替代 |
|
||||||
|
|
||||||
|
## 核心争议 / Key Controversies
|
||||||
|
|
||||||
|
- **争议 1:** 公司声称增长 50% vs 分析师报告增长 30%
|
||||||
|
- 证据强度: official(公司财报) vs academic(第三方研究)
|
||||||
|
- 建议: 并列呈现两种数据,说明差异原因
|
||||||
|
|
||||||
|
## Mandatory Fixes Checklist
|
||||||
|
- [ ] 补充 3.2 节市场份额来源
|
||||||
|
- [ ] 替换 4.1 节收入数据来源
|
||||||
|
- [ ] 添加 AS_OF: 2026-04-03 到所有时敏声明
|
||||||
|
|
||||||
|
## Quality Gates Status
|
||||||
|
| Gate | Status | Notes |
|
||||||
|
|------|--------|-------|
|
||||||
|
| P6 ≥3 issues found | ✅ | 发现 7 个问题 |
|
||||||
|
| No critical claim single-sourced | ❌ | 2 个问题待修复 |
|
||||||
|
| AS_OF dates present | ❌ | 3 处缺失 |
|
||||||
|
| Counter-claims documented | ✅ | 已添加 |
|
||||||
|
```
|
||||||
|
|
||||||
|
## 集成到 SKILL.md 工作流
|
||||||
|
|
||||||
|
在 SKILL.md 的 P6 阶段,添加以下指令:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## P6: Counter-Review (Mandatory)
|
||||||
|
|
||||||
|
**使用 Counter-Review Team 执行并行审查:**
|
||||||
|
|
||||||
|
1. **准备材料**: draft_report.md, citation_registry.md, task-notes/, p0_config.md
|
||||||
|
2. **并行分发**: 同时发送给 4 个 specialist agent
|
||||||
|
3. **等待完成**: 收集 4 份 specialist 报告
|
||||||
|
4. **协调汇总**: 发送给 coordinator 生成最终 P6 报告
|
||||||
|
5. **强制执行**: 所有 Critical 问题必须在 P7 前修复
|
||||||
|
6. **输出**: 将"核心争议"部分复制到最终报告
|
||||||
|
|
||||||
|
**Report**: `[P6 complete] {N} issues found: {critical} critical, {high} high, {medium} medium.`
|
||||||
|
```
|
||||||
|
|
||||||
|
## 团队管理
|
||||||
|
|
||||||
|
### 查看团队状态
|
||||||
|
```bash
|
||||||
|
cat ~/.claude/teams/counter-review-team/config.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 向 Agent 发送消息
|
||||||
|
```bash
|
||||||
|
SendMessage to: claim-validator
|
||||||
|
message: 开始审查任务,输入文件在 ./review-inputs/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 关闭团队
|
||||||
|
```bash
|
||||||
|
SendMessage to: "*"
|
||||||
|
message: {"type": "shutdown_request", "reason": "任务完成"}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. **必须发现 ≥3 个问题** - 如果 coordinator 报告 <3 个问题,需要重新审查
|
||||||
|
2. **Critical 问题必须修复** - 才能进入 P7
|
||||||
|
3. **保留所有审查记录** - 作为研究方法论的一部分
|
||||||
|
4. **中文输入中文输出** - 所有 agent 支持中英文双语
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# Enterprise Analysis Frameworks
|
||||||
|
|
||||||
|
Apply these frameworks after completing the six-dimension data collection. Execute in order: SWOT → Competitive Barriers → Risk Matrix → Comprehensive Scoring.
|
||||||
|
|
||||||
|
## SWOT Analysis Template
|
||||||
|
|
||||||
|
Each SWOT entry MUST include evidence and source attribution.
|
||||||
|
|
||||||
|
```
|
||||||
|
| | Positive Factors | Negative Factors |
|
||||||
|
|--------------|-----------------------------------|-----------------------------------|
|
||||||
|
| **Internal** | **S (Strengths)** | **W (Weaknesses)** |
|
||||||
|
| | 1. {description} | 1. {description} |
|
||||||
|
| | • Evidence: {data/fact} | • Evidence: {data/fact} |
|
||||||
|
| | • Source: {citation} | • Source: {citation} |
|
||||||
|
| | • Impact: {assessment} | • Impact: {assessment} |
|
||||||
|
| | | |
|
||||||
|
| **External** | **O (Opportunities)** | **T (Threats)** |
|
||||||
|
| | 1. {description} | 1. {description} |
|
||||||
|
| | • Evidence: {trend/policy} | • Evidence: {pressure/risk} |
|
||||||
|
| | • Source: {citation} | • Source: {citation} |
|
||||||
|
| | • Probability: {assessment} | • Probability: {assessment} |
|
||||||
|
| | • Impact: {assessment} | • Impact: {assessment} |
|
||||||
|
```
|
||||||
|
|
||||||
|
**Requirements**:
|
||||||
|
- Each quadrant: 3-5 entries minimum
|
||||||
|
- Every entry must have evidence with source
|
||||||
|
- S/W must be data-backed (not opinions)
|
||||||
|
- O/T must include probability and impact estimates
|
||||||
|
|
||||||
|
**Strategic Implications Matrix** (generate after SWOT):
|
||||||
|
- **SO Strategy** (leverage strengths to capture opportunities): 1-2 specific recommendations
|
||||||
|
- **WO Strategy** (overcome weaknesses to seize opportunities): 1-2 specific recommendations
|
||||||
|
- **ST Strategy** (use strengths to counter threats): 1-2 specific recommendations
|
||||||
|
- **WT Strategy** (mitigate weaknesses to avoid threats): 1-2 specific recommendations
|
||||||
|
|
||||||
|
## Competitive Barrier Quantification Framework
|
||||||
|
|
||||||
|
7 barrier dimensions with weighted scoring:
|
||||||
|
|
||||||
|
| Dimension | Weight | Strong | Moderate | Weak |
|
||||||
|
|-----------|--------|--------|----------|------|
|
||||||
|
| **Network Effects** | 20% | 4.5 — Clear network effects (social platforms, marketplaces) | 3.0 — Exists but replaceable | 1.5 — Minimal network effects |
|
||||||
|
| **Scale Economies** | 15% | 4.0 — Unit cost drops 30%+ with scale | 2.5 — Cost drops 10-30% | 1.0 — Cost drops <10% |
|
||||||
|
| **Brand Value** | 15% | 4.0 — Category leader, high pricing power | 2.5 — Known brand, competitive | 1.0 — Commodity brand, price-sensitive |
|
||||||
|
| **Technology/Patents** | 15% | 4.0 — Core patents, hard to circumvent | 2.5 — Some patent protection | 1.0 — Peripheral patents only |
|
||||||
|
| **Switching Costs** | 15% | 4.0 — High lock-in (data, ecosystem) | 2.5 — Moderate switching friction | 1.0 — Low switching cost |
|
||||||
|
| **Regulatory Licenses** | 10% | 3.5 — Heavy regulation, hard to obtain | 2.0 — Standard regulatory requirements | 0.5 — Light regulation |
|
||||||
|
| **Data Assets** | 10% | 3.5 — Massive proprietary high-quality data | 2.0 — Some data accumulation | 0.5 — Limited or public data |
|
||||||
|
|
||||||
|
**Scoring**: Total = Σ(dimension score × weight)
|
||||||
|
|
||||||
|
**Rating Scale**:
|
||||||
|
| Score | Rating | Interpretation |
|
||||||
|
|-------|--------|---------------|
|
||||||
|
| ≥3.5 | A+ | Exceptional moat |
|
||||||
|
| ≥2.8 | A | Strong moat |
|
||||||
|
| ≥2.0 | B+ | Good moat |
|
||||||
|
| ≥1.5 | B | Moderate moat |
|
||||||
|
| ≥1.0 | C+ | Limited moat |
|
||||||
|
| <1.0 | C | Weak moat |
|
||||||
|
|
||||||
|
**Output format**: Present a scorecard table with each dimension's strength rating, raw score, justification (with evidence), and the weighted total with final rating.
|
||||||
|
|
||||||
|
## Risk Matrix Framework
|
||||||
|
|
||||||
|
Assess 8 mandatory risk categories:
|
||||||
|
|
||||||
|
### Risk Assessment Scales
|
||||||
|
|
||||||
|
**Probability**:
|
||||||
|
| Level | Range | Score |
|
||||||
|
|-------|-------|-------|
|
||||||
|
| High | >70% | 0.7-1.0 |
|
||||||
|
| Medium | 30-70% | 0.3-0.7 |
|
||||||
|
| Low | <30% | 0.0-0.3 |
|
||||||
|
|
||||||
|
**Impact**:
|
||||||
|
| Level | Description | Score |
|
||||||
|
|-------|-------------|-------|
|
||||||
|
| High | >30% revenue impact | 3 |
|
||||||
|
| Medium | 10-30% revenue impact | 2 |
|
||||||
|
| Low | <10% revenue impact | 1 |
|
||||||
|
|
||||||
|
**Risk Level**: Risk Value = Probability Score × Impact Score
|
||||||
|
| Color | Level | Threshold |
|
||||||
|
|-------|-------|-----------|
|
||||||
|
| Red | High risk | ≥2.5 |
|
||||||
|
| Yellow | Medium risk | 1.0 – 2.5 |
|
||||||
|
| Green | Low risk | <1.0 |
|
||||||
|
|
||||||
|
### 8 Mandatory Risk Categories
|
||||||
|
|
||||||
|
| # | Category | Typical Triggers |
|
||||||
|
|---|----------|-----------------|
|
||||||
|
| 1 | Market risk | Industry slowdown, demand shifts |
|
||||||
|
| 2 | Competitive risk | New entrants, incumbents pivoting |
|
||||||
|
| 3 | Technology risk | Tech obsolescence, disruption |
|
||||||
|
| 4 | Regulatory risk | Policy tightening, compliance cost |
|
||||||
|
| 5 | Financial risk | Cash flow stress, debt levels |
|
||||||
|
| 6 | Operational risk | Key talent loss, supply chain |
|
||||||
|
| 7 | Talent risk | Brain drain, recruiting difficulty |
|
||||||
|
| 8 | Geopolitical risk | Trade friction, data localization |
|
||||||
|
|
||||||
|
### Risk Table Format
|
||||||
|
|
||||||
|
| Category | Specific Risk | Probability | Impact | Risk Value | Level | Evidence/Triggers | Current Mitigations | Recommended Actions |
|
||||||
|
|----------|--------------|-------------|--------|------------|-------|-------------------|--------------------|--------------------|
|
||||||
|
|
||||||
|
**Requirements**:
|
||||||
|
- All 8 categories must be assessed (no skipping)
|
||||||
|
- Each risk entry must cite specific evidence or triggers
|
||||||
|
- Provide current mitigations AND recommended actions
|
||||||
|
- High risks: require immediate action plans
|
||||||
|
- Medium risks: require monitoring plans
|
||||||
|
- Low risks: require periodic review schedule
|
||||||
|
|
||||||
|
## Comprehensive Scoring (Final Section)
|
||||||
|
|
||||||
|
After completing SWOT, barriers, and risk matrix, generate a comprehensive scorecard:
|
||||||
|
|
||||||
|
```
|
||||||
|
| Dimension | Score | Weight | Weighted | Key Evidence |
|
||||||
|
|-----------|-------|--------|----------|-------------|
|
||||||
|
| Business Quality | X/10 | 25% | | |
|
||||||
|
| Competitive Position | X/10 | 20% | | |
|
||||||
|
| Financial Health | X/10 | 20% | | |
|
||||||
|
| Growth Potential | X/10 | 15% | | |
|
||||||
|
| Risk Profile | X/10 | 10% | | |
|
||||||
|
| Management Quality | X/10 | 10% | | |
|
||||||
|
| **Total** | | 100% | **X/10** | |
|
||||||
|
```
|
||||||
|
|
||||||
|
Every score must reference specific evidence from the six-dimension data collection.
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
# Enterprise Research Quality Checklist
|
||||||
|
|
||||||
|
Three-level quality control executed at each stage transition.
|
||||||
|
|
||||||
|
## L1: Data Collection Quality (after each dimension)
|
||||||
|
|
||||||
|
### Per-Dimension Checks
|
||||||
|
|
||||||
|
| Check Item | Standard | Method | Pass Condition |
|
||||||
|
|-----------|----------|--------|---------------|
|
||||||
|
| Source count | Key data points ≥2 sources | Count source annotations | ≥90% compliance |
|
||||||
|
| Source attribution | All data has source marked | Check citations in draft | ≥95% completeness |
|
||||||
|
| Cross-validation pass rate | Data deviation ≤10% | Compare multi-source data | ≥95% validation pass |
|
||||||
|
| Timeliness | Financial: ≤2 years; News: ≤6 months | Check timestamps | 100% compliance |
|
||||||
|
|
||||||
|
**Result handling**: All pass → proceed. Partial fail → supplement sources. Critical fail → re-collect dimension.
|
||||||
|
|
||||||
|
### Dimension-Specific Checklists
|
||||||
|
|
||||||
|
**D1 Company Fundamentals** (target: 11/11):
|
||||||
|
- [ ] Legal entity boundaries clarified
|
||||||
|
- [ ] Founding date with month/year
|
||||||
|
- [ ] Headquarters city identified
|
||||||
|
- [ ] Founder/CEO confirmed (≥2 sources)
|
||||||
|
- [ ] Employee count with year
|
||||||
|
- [ ] Listing status (exchange, ticker)
|
||||||
|
- [ ] Latest valuation/market cap with date
|
||||||
|
- [ ] Core business one-liner
|
||||||
|
- [ ] Funding history ≥3 rounds
|
||||||
|
- [ ] ≥5 milestone events in timeline
|
||||||
|
- [ ] Ownership structure: controller identified
|
||||||
|
|
||||||
|
**D2 Business & Products** (target: 7/7):
|
||||||
|
- [ ] ≥3 business segments identified
|
||||||
|
- [ ] Revenue share per segment
|
||||||
|
- [ ] ≥3 core products analyzed
|
||||||
|
- [ ] User metrics (DAU/MAU) with numbers
|
||||||
|
- [ ] Monetization model per product
|
||||||
|
- [ ] Revenue breakdown (segment/geography/customer)
|
||||||
|
- [ ] Growth/decline trend per segment
|
||||||
|
|
||||||
|
**D3 Competitive Position** (target: 7/7):
|
||||||
|
- [ ] Industry clearly defined
|
||||||
|
- [ ] Market size quantified
|
||||||
|
- [ ] Company rank established
|
||||||
|
- [ ] Market share with number
|
||||||
|
- [ ] ≥3 competitors identified
|
||||||
|
- [ ] Multi-dimension comparison table complete
|
||||||
|
- [ ] ≥5 barrier dimensions assessed with scores
|
||||||
|
|
||||||
|
**D4 Financial & Operations** (target: 9/9):
|
||||||
|
- [ ] Revenue: 3-year data
|
||||||
|
- [ ] Net income: 3-year data
|
||||||
|
- [ ] Gross margin: 3-year data
|
||||||
|
- [ ] Net margin: 3-year data
|
||||||
|
- [ ] Operating cash flow: 3-year data
|
||||||
|
- [ ] R&D expense: 3-year data
|
||||||
|
- [ ] Key financial data cross-validated (≥2 sources)
|
||||||
|
- [ ] Metric definitions consistent across years
|
||||||
|
- [ ] ≥3 efficiency metrics (ROE/ROA/etc.)
|
||||||
|
|
||||||
|
**D5 Recent Developments** (target: 5/5):
|
||||||
|
- [ ] ≥5 recent events (within 6 months)
|
||||||
|
- [ ] Events span ≥3 event types
|
||||||
|
- [ ] Each event has impact assessment
|
||||||
|
- [ ] ≥2 strategic direction signals identified
|
||||||
|
- [ ] Most recent event within 1 month
|
||||||
|
|
||||||
|
**D6 Internal/Proprietary** (target: 2/2):
|
||||||
|
- [ ] Internal knowledge base queried (or limitation noted)
|
||||||
|
- [ ] Internal document search executed (or limitation noted)
|
||||||
|
|
||||||
|
## L2: Analysis Quality (after analysis frameworks applied)
|
||||||
|
|
||||||
|
| Check Item | Standard | Method | Pass Condition |
|
||||||
|
|-----------|----------|--------|---------------|
|
||||||
|
| SWOT completeness | Each quadrant ≥3 entries | Entry count | Full coverage |
|
||||||
|
| SWOT evidence | Every entry has data backing | Check "Evidence" fields | 100% evidenced |
|
||||||
|
| Risk matrix coverage | All 8 categories assessed | Category checklist | 100% covered |
|
||||||
|
| Barrier quantification | All 7 dimensions scored | Check scorecard completeness | 100% scored |
|
||||||
|
| Conclusion support | All conclusions trace to evidence | Trace each conclusion | 100% supported |
|
||||||
|
|
||||||
|
**Result handling**: All pass → proceed to writing. Partial fail → supplement analysis evidence. Critical fail → re-execute analysis framework.
|
||||||
|
|
||||||
|
## L3: Document Quality (after report drafted)
|
||||||
|
|
||||||
|
| Check Item | Standard | Method | Pass Condition |
|
||||||
|
|-----------|----------|--------|---------------|
|
||||||
|
| Structure compliance | Follows 7-chapter template | Compare against template | ≥95% compliance |
|
||||||
|
| Table format consistency | All tables uniformly formatted | Visual inspection | 100% uniform |
|
||||||
|
| Readability | Paragraphs ≤450 chars; ≥3 parallel items use lists | Paragraph length check | ≥95% compliance |
|
||||||
|
| Data annotation | All data has source + year | Citation audit | 100% complete |
|
||||||
|
| Appendix completeness | Includes source index + glossary | Content check | 100% complete |
|
||||||
|
|
||||||
|
**Result handling**: All pass → deliver. Partial fail → format optimization. Critical fail → regenerate document.
|
||||||
|
|
||||||
|
## Enterprise Report Structure (7 Chapters)
|
||||||
|
|
||||||
|
```
|
||||||
|
# {Company Name} Research Report
|
||||||
|
|
||||||
|
> Executive Summary: {1-2 sentence core conclusion}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Company Overview
|
||||||
|
### 1.1 Basic Information (table)
|
||||||
|
### 1.2 Development Timeline
|
||||||
|
### 1.3 Funding History (table)
|
||||||
|
### 1.4 Ownership Structure & Control
|
||||||
|
### 1.5 Core Management Team (table)
|
||||||
|
|
||||||
|
## 2. Business & Product Structure
|
||||||
|
### 2.1 Business Landscape Overview
|
||||||
|
### 2.2 Core Product Matrix (table)
|
||||||
|
### 2.3 Revenue Structure Analysis
|
||||||
|
### 2.4 Business Development Trends
|
||||||
|
|
||||||
|
## 3. Market & Competitive Position
|
||||||
|
### 3.1 Industry Position Analysis
|
||||||
|
### 3.2 Competitive Comparison (table)
|
||||||
|
### 3.3 Competitive Barrier Assessment (scorecard)
|
||||||
|
|
||||||
|
## 4. Financial & Operations Analysis
|
||||||
|
### 4.1 Key Financial Metrics (3-year comparison table)
|
||||||
|
### 4.2 Operating Efficiency Assessment
|
||||||
|
### 4.3 Financial Health Summary
|
||||||
|
|
||||||
|
## 5. Risks & Concerns
|
||||||
|
### 5.1 Risk Matrix Analysis (8-category table)
|
||||||
|
### 5.2 Key Risk Deep-Dives
|
||||||
|
### 5.3 Risk Mitigation Recommendations
|
||||||
|
|
||||||
|
## 6. Recent Developments
|
||||||
|
### 6.1 Major Recent Events (table)
|
||||||
|
### 6.2 Strategic Signal Interpretation
|
||||||
|
|
||||||
|
## 7. Comprehensive Assessment & Conclusion
|
||||||
|
### 7.1 SWOT Summary
|
||||||
|
### 7.2 Comprehensive Scorecard
|
||||||
|
### 7.3 Core Conclusions & Outlook
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendices
|
||||||
|
### A. Data Source Index
|
||||||
|
### B. Glossary
|
||||||
|
### C. Disclaimer
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quality Control Four Dimensions
|
||||||
|
|
||||||
|
Apply throughout all stages:
|
||||||
|
|
||||||
|
| Dimension | Focus | Key Checks |
|
||||||
|
|-----------|-------|------------|
|
||||||
|
| **Accuracy** | Data correctness | Source attribution, fact verification, cross-validation, error tolerance |
|
||||||
|
| **Completeness** | Information coverage | Dimension coverage, key element presence, conclusion support, risk coverage |
|
||||||
|
| **Timeliness** | Data currency | Data freshness, trend capture, signal detection, dynamic updates |
|
||||||
|
| **Consistency** | Uniform standards | Metric definitions aligned, format unified, style consistent, terminology standardized |
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
# Enterprise Research Methodology
|
||||||
|
|
||||||
|
## Six-Dimension Data Collection
|
||||||
|
|
||||||
|
Enterprise research requires parallel collection across six dimensions. Execute all six in order, writing findings to a structured draft after each dimension.
|
||||||
|
|
||||||
|
### Dimension 1: Company Fundamentals
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 1.1: Confirm legal entity
|
||||||
|
├── Clarify parent/subsidiary/affiliate boundaries
|
||||||
|
├── Query: "{company} legal entity corporate structure"
|
||||||
|
├── Output: Entity scope statement
|
||||||
|
└── Verify: Map operating entities to brands
|
||||||
|
|
||||||
|
Step 1.2: Basic information
|
||||||
|
├── Query round 1: "{company} founding date headquarters founder"
|
||||||
|
├── Query round 2: "{company} company overview profile"
|
||||||
|
├── Query round 3: "{company} CEO management team executives"
|
||||||
|
├── Source priority: Official site > Regulatory filings > Authoritative media
|
||||||
|
└── Output: Basic info table (name, founded, HQ, CEO, employees, listing status)
|
||||||
|
|
||||||
|
Step 1.3: Funding history
|
||||||
|
├── Query: "{company} funding rounds valuation IPO"
|
||||||
|
├── Key fields: round, amount, investors, post-money valuation, date
|
||||||
|
└── Output: Funding timeline table
|
||||||
|
|
||||||
|
Step 1.4: Ownership structure
|
||||||
|
├── Query: "{company} ownership structure beneficial owner"
|
||||||
|
├── Key fields: controller identity, economic interest %, voting rights %, control mechanisms (dual-class etc.)
|
||||||
|
└── Output: Ownership summary
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dimension 2: Business & Products
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 2.1: Business landscape scan
|
||||||
|
├── Query round 1: "{company} product lines business segments"
|
||||||
|
├── Query round 2: "{company} revenue breakdown by segment"
|
||||||
|
├── Query round 3: "{company} business model monetization"
|
||||||
|
├── Key fields: segment name, positioning, revenue share, YoY growth, synergies
|
||||||
|
└── Output: Business landscape table
|
||||||
|
|
||||||
|
Step 2.2: Core product analysis
|
||||||
|
├── Query: "{company} core products DAU MAU user base"
|
||||||
|
├── Per product: positioning, target users, scale (DAU/MAU), market share, monetization, competitive advantage, trends
|
||||||
|
└── Output: Product matrix table
|
||||||
|
|
||||||
|
Step 2.3: Revenue structure analysis
|
||||||
|
├── Source: Financial reports (deep extraction)
|
||||||
|
├── Breakdown by: segment, geography, customer type, pricing model
|
||||||
|
└── Output: Revenue structure summary
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dimension 3: Competitive Position
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 3.1: Industry position
|
||||||
|
├── Query: "{company} industry ranking market share"
|
||||||
|
├── Key fields: industry definition, TAM/SAM/SOM, company rank, share, concentration (CR3/CR5)
|
||||||
|
└── Output: Industry position analysis
|
||||||
|
|
||||||
|
Step 3.2: Competitor identification & comparison
|
||||||
|
├── Query round 1: "{company} competitors"
|
||||||
|
├── Query round 2: "{company} vs {competitor A} comparison"
|
||||||
|
├── Query round 3: "{company} vs {competitor B} differences"
|
||||||
|
├── Comparison dimensions: founding, revenue, market share, core products, user scale, valuation/market cap, strengths, weaknesses
|
||||||
|
├── Minimum: ≥3 competitors identified
|
||||||
|
└── Output: Competitive comparison table
|
||||||
|
|
||||||
|
Step 3.3: Competitive barriers assessment
|
||||||
|
├── Use quantified barrier framework (see enterprise_analysis_frameworks.md)
|
||||||
|
├── 7 dimensions: network effects, scale economies, brand, technology/patents, switching costs, regulatory licenses, data assets
|
||||||
|
└── Output: Barrier scorecard with rating
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dimension 4: Financial & Operations
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 4.1: Financial data collection
|
||||||
|
├── Query: "{company} financial results {year} revenue profit"
|
||||||
|
├── Core metrics (3-year minimum): revenue, revenue growth, net income, gross margin, net margin, operating cash flow, R&D expense, R&D ratio
|
||||||
|
└── Output: Financial metrics table (3+ years)
|
||||||
|
|
||||||
|
Step 4.2: Operating efficiency analysis
|
||||||
|
├── Query: "{company} ROE ROA efficiency per-employee"
|
||||||
|
├── Efficiency metrics: ROE, ROA, revenue per employee, accounts receivable days, debt-to-equity
|
||||||
|
└── Output: Operating efficiency table
|
||||||
|
|
||||||
|
Step 4.3: Cross-validation
|
||||||
|
├── Require ≥2 independent sources for key financial data
|
||||||
|
├── Sources: company filings (primary), regulatory filings, authoritative financial data providers
|
||||||
|
├── Deviation rules:
|
||||||
|
│ ├── ≤10%: Pass
|
||||||
|
│ ├── 10-20%: Flag with explanation
|
||||||
|
│ └── >20%: Require third-party verification
|
||||||
|
└── Output: Validation record
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dimension 5: Recent Developments
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 5.1: Recent news scan (past 6 months)
|
||||||
|
├── Query round 1: "{company} latest news {current year}"
|
||||||
|
├── Query round 2: "{company} strategy pivot latest developments"
|
||||||
|
├── Query round 3: "{company} executive changes leadership"
|
||||||
|
├── Query round 4: "{company} partnership acquisition latest"
|
||||||
|
├── Query round 5: "{company} product launch new release"
|
||||||
|
├── Event types: product launches, fundraising/capital, strategy shifts, executive changes, M&A/partnerships, regulatory/compliance
|
||||||
|
├── Minimum: ≥5 events identified
|
||||||
|
└── Output: Major events table
|
||||||
|
|
||||||
|
Step 5.2: Strategic signal interpretation
|
||||||
|
├── Dimensions: expansion signals, contraction signals, transformation signals, risk signals
|
||||||
|
└── Output: Strategic signal analysis
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dimension 6: Internal/Proprietary Sources
|
||||||
|
|
||||||
|
```
|
||||||
|
Step 6.1: Internal knowledge base query (if available)
|
||||||
|
├── Query 1: "our company's relationship with {target company}"
|
||||||
|
├── Query 2: "internal assessment of {target company}"
|
||||||
|
├── Query 3: "{target company} competitive analysis"
|
||||||
|
├── Query 4: "{target company} industry research"
|
||||||
|
└── Output: Internal perspective supplementary info
|
||||||
|
|
||||||
|
Step 6.2: If no internal sources available
|
||||||
|
├── State explicitly: "No internal/proprietary sources available for this research"
|
||||||
|
├── Compensate with additional public source depth
|
||||||
|
└── Note limitation in final report
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Source Priority Matrix
|
||||||
|
|
||||||
|
| Priority | Source Type | Reliability | Timeliness | Use Case |
|
||||||
|
|----------|-----------|-------------|------------|----------|
|
||||||
|
| **P0** | Official filings / annual reports | 10/10 | High | Core financial data |
|
||||||
|
| **P0** | Company website / announcements | 10/10 | High | Basic info, updates |
|
||||||
|
| **P1** | Regulatory filings | 9/10 | High | Ownership, licenses |
|
||||||
|
| **P1** | Authoritative industry reports | 9/10 | Medium | Market position, trends |
|
||||||
|
| **P2** | Mainstream financial media | 8/10 | High | News, analysis |
|
||||||
|
| **P2** | Professional research institutions | 8/10 | Medium | Deep analysis, forecasts |
|
||||||
|
| **P3** | Social media / forums | 5/10 | High | Sentiment signals only |
|
||||||
|
|
||||||
|
**Rule**: P0 + P1 are primary sources. P2 for validation. P3 for reference only, never as sole source.
|
||||||
|
|
||||||
|
## Cross-Validation Rules
|
||||||
|
|
||||||
|
| Data Type | Min Sources | Max Deviation | Primary Source | Fallback Sources |
|
||||||
|
|-----------|------------|---------------|----------------|-----------------|
|
||||||
|
| Financial data | 2 | 10% | Official financial reports | Regulatory filings, analyst reports |
|
||||||
|
| Market share | 2 | 15% | Industry reports | Company disclosures, third-party analysis |
|
||||||
|
| Management info | 1 | N/A | Company official sources | Regulatory filings, reputable media |
|
||||||
|
| User metrics | 2 | 20% | Company disclosures | Third-party analytics, industry reports |
|
||||||
|
|
||||||
|
## Search Strategy Best Practices
|
||||||
|
|
||||||
|
1. **Multi-angle queries**: 3 different query angles per topic
|
||||||
|
2. **Time filtering**: Prioritize data within last 12 months for operational data, last 3 years for financial trends
|
||||||
|
3. **Site restriction**: Use `site:` for authoritative domains when possible
|
||||||
|
4. **Language diversity**: Query in both English and the company's primary language
|
||||||
|
5. **Exclude noise**: Use `-` to exclude irrelevant results
|
||||||
|
6. **Progressive depth**: Start broad, then narrow based on gaps identified
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Formatting Rules
|
||||||
|
|
||||||
|
Use these rules to enforce strict report formatting.
|
||||||
|
|
||||||
|
## Headings
|
||||||
|
- Use H2 for top-level sections
|
||||||
|
- Use H3 for subsections
|
||||||
|
- Keep heading titles consistent with the report spec
|
||||||
|
|
||||||
|
## Section Order
|
||||||
|
- Follow the report spec order exactly
|
||||||
|
- Do not add or remove sections without approval
|
||||||
|
|
||||||
|
## Bullets and Tables
|
||||||
|
- Use bullets for lists of findings and actions
|
||||||
|
- Use tables for comparisons, metrics, or timelines
|
||||||
|
- Keep tables compact and label all columns
|
||||||
|
|
||||||
|
## Citations
|
||||||
|
- Use the citation style defined in the report spec
|
||||||
|
- Place citations immediately after the claim
|
||||||
|
- If a claim has multiple sources, list all relevant sources
|
||||||
|
|
||||||
|
## Terminology
|
||||||
|
- Define key terms once and reuse consistently
|
||||||
|
- Preserve technical terms in English
|
||||||
|
|
||||||
|
## Formatting Hygiene
|
||||||
|
- Avoid mixed numbering styles in the same section
|
||||||
|
- Avoid inline URLs in prose unless the spec requires it
|
||||||
|
- Do not embed new assets unless requested
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Quality Gates V6
|
||||||
|
|
||||||
|
## Gate 1: Task Notes Quality (after P2)
|
||||||
|
|
||||||
|
| Check | Standard | Lightweight | Fix |
|
||||||
|
|-------|----------|-------------|-----|
|
||||||
|
| All tasks completed | 100% | 100% | Re-dispatch failed tasks |
|
||||||
|
| Sources per task | >= 2 | >= 1 | Run additional searches |
|
||||||
|
| Findings per task | >= 3 | >= 2 | Deepen search or fetch more |
|
||||||
|
| DEEP tasks have Deep Read Notes | 100% | 100% | Fetch and read top source |
|
||||||
|
| All source URLs from actual search | 100% | 100% | Remove any invented URL |
|
||||||
|
|
||||||
|
## Gate 2: Citation Registry (after P3)
|
||||||
|
|
||||||
|
| Check | Standard | Lightweight | Fix |
|
||||||
|
|-------|----------|-------------|-----|
|
||||||
|
| Total approved sources | >= 12 | >= 6 | Flag thin areas for P6 |
|
||||||
|
| Unique domains | >= 5 | >= 3 | Diversify in re-search |
|
||||||
|
| Max single-source share | <= 25% | <= 30% | Find alternatives |
|
||||||
|
| Official source coverage | >= 30% for standard | >= 20% for lightweight | Add official sources |
|
||||||
|
| Source-type balance | official + academic + secondary at least 2 types | same | Fill missing type
|
||||||
|
| Dropped sources listed | All | All | Must be explicit |
|
||||||
|
| No duplicate URLs | 0 duplicates | 0 | Merge during P3 |
|
||||||
|
|
||||||
|
## Gate 3: Draft Quality (after P5)
|
||||||
|
|
||||||
|
| Check | Standard | Lightweight | Fix |
|
||||||
|
|-------|----------|-------------|-----|
|
||||||
|
| Every [n] in registry | 100% | 100% | Remove or fix |
|
||||||
|
| No dropped source cited | 0 violations | 0 | Remove immediately |
|
||||||
|
| Citation density | >= 1 per 200 words | >= 1 per 300 words | Add citations |
|
||||||
|
| Every section has confidence marker | 100% | 100% | Add missing |
|
||||||
|
| High-confidence claims backed by official source | 100% | 100% | Downgrade or re-source |
|
||||||
|
| Counter-claim recorded for major sections | 100% | 70% | Add opposing interpretation |
|
||||||
|
| Total word count | 3000-8000 | 2000-4000 | Adjust scope |
|
||||||
|
|
||||||
|
## Gate 4: Notes Traceability (after P6)
|
||||||
|
|
||||||
|
| Check | Threshold | Fix |
|
||||||
|
|-------|-----------|-----|
|
||||||
|
| Every specific claim traceable to a task note finding | 100% | 100% | Remove or mark [unverified] |
|
||||||
|
| Every statistic/number appears in some task note | 100% | 100% | Remove or verify |
|
||||||
|
| No claim contradicts a task note | 0 contradictions | 0 | Rewrite to match notes |
|
||||||
|
| Claims with recency sensitivity include source date and AS_OF | 100% | 100% | Add date metadata |
|
||||||
|
| P6 found >= 3 issues | Must | Re-examine harder if 0 found |
|
||||||
|
|
||||||
|
## Gate 5: Verification (after P7)
|
||||||
|
|
||||||
|
| Check | Threshold | Fix |
|
||||||
|
|-------|-----------|-----|
|
||||||
|
| Registry cross-check: all [n] valid | 100% | 100% | Remove invalid [n] |
|
||||||
|
| Spot-check: 5+ claims traced to notes | >= 4/5 pass | Fix failing claims |
|
||||||
|
| No dropped source resurrected | 0 | Remove immediately |
|
||||||
|
| Source concentration check for key claims | None > 25% | diversify |
|
||||||
|
|
||||||
|
## Anti-Hallucination Patterns
|
||||||
|
|
||||||
|
| Pattern | Where to detect | Fix |
|
||||||
|
|---------|----------------|-----|
|
||||||
|
| URL not from any subagent search | P7 registry check | Remove citation |
|
||||||
|
| Claim not in any task note | P6 traceability check | Remove or mark [unverified] |
|
||||||
|
| Number more precise than source | P6 ("73.2%" when note says "about 70%") | Use note's precision |
|
||||||
|
| Source authority inflated | P3 registry building | Re-score from notes |
|
||||||
|
| Source type mismatched to claim | P3 + P6 | Reclassify or replace source |
|
||||||
|
| "Studies show..." without naming study | P6 | Name specific source or remove |
|
||||||
|
| Dropped source reappears | P7 cross-check | Remove immediately |
|
||||||
|
| Subagent invented a URL | Gate 1 (lead verifies subagent notes) | Remove from notes before P3 |
|
||||||
|
|
||||||
|
## Chinese-Specific Patterns
|
||||||
|
|
||||||
|
| Pattern | Fix |
|
||||||
|
|---------|-----|
|
||||||
|
| Fake CNKI URL format | Remove, note gap |
|
||||||
|
| "某专家表示" without name/institution | Name or remove |
|
||||||
|
| "据统计" without data source | Add source or qualitative language |
|
||||||
|
| Fabricated institution report | Verify existence or remove |
|
||||||
|
| 旧模型信息未标注 AS_OF | 降级置信度并重搜 |
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
# {{TITLE}}
|
||||||
|
|
||||||
|
> 研究日期: {{DATE}} | 来源数量: {{SOURCE_COUNT}} | 字数: ~{{WORD_COUNT}} | 模式: {{MODE}} | AS_OF: {{AS_OF}} | 官方源占比: {{OFFICIAL_SHARE}}
|
||||||
|
|
||||||
|
## 摘要 / Executive Summary
|
||||||
|
|
||||||
|
{{200-400 words summarizing key findings, methodology, conclusions, and risks.}}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
{{Auto-generate from actual section headers below.}}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
{{BODY SECTIONS — Adapt to topic type and include opposing interpretation per section.}}
|
||||||
|
|
||||||
|
For each section:
|
||||||
|
|
||||||
|
## N. [Topic-Specific Section Title]
|
||||||
|
|
||||||
|
{{Section content with inline citations [1][2].
|
||||||
|
Standard mode: 500-1000 words per section.
|
||||||
|
Lightweight mode: 300-600 words per section.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- 每个事实性论点都需要引用 [n]
|
||||||
|
- 数字/百分比必须有来源
|
||||||
|
- 出现不同证据时要成对给出支持与反驳
|
||||||
|
}}
|
||||||
|
|
||||||
|
**置信度:** High/Medium/Low
|
||||||
|
|
||||||
|
**依据:** {{Why this confidence level — source agreement, evidence quality, data availability}}
|
||||||
|
|
||||||
|
**反方解释:** {{One explicit opposing interpretation with supporting citations if any, or [unverified] if insufficient.}}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
{{COUNTER-REVIEW SUMMARY}}
|
||||||
|
|
||||||
|
- **核心争议 1:** [主张 A 与反向证据 B 对比] [n][m]
|
||||||
|
- **核心争议 2:** ...
|
||||||
|
|
||||||
|
## 关键发现 / Key Findings
|
||||||
|
|
||||||
|
{{3-5 findings in Standard mode, 2-3 in Lightweight. Each finding should:}}
|
||||||
|
- 具体结论
|
||||||
|
- 对应引文
|
||||||
|
- 信心说明
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- **发现 1:** [Most important discovery] [3][7]
|
||||||
|
- **发现 2:** [Second most important] [1][4]
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 局限性与未来方向 / Limitations & Future Directions
|
||||||
|
|
||||||
|
### 本研究局限
|
||||||
|
{{Be explicit:
|
||||||
|
- What topics/angles couldn't be covered and why
|
||||||
|
- Methodological limits (web-accessible sources, paywall, language, timing)
|
||||||
|
- Source coverage gaps and counter-claim evidence gaps
|
||||||
|
}}
|
||||||
|
|
||||||
|
### 未来方向
|
||||||
|
{{Concrete suggestions for follow-up research with priority and responsible evidence type.}}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 参考文献 / References
|
||||||
|
|
||||||
|
[1] Author/Org. "Title". Source-Type: official/academic/secondary-industry/journalism/community/other. As Of: YYYY-MM-DD. URL.
|
||||||
|
[2] Author/Org. "Title". Source-Type: ... As Of: YYYY-MM-DD. URL.
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Every [n] in body MUST have matching entry here
|
||||||
|
- Every entry here MUST be cited at least once
|
||||||
|
- Source-Type and As Of fields are mandatory
|
||||||
|
- All URLs MUST come from actual search results (P2 source pool)
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
# Research Notes Format Specification
|
||||||
|
|
||||||
|
The research notes are the ONLY communication channel between subagents and
|
||||||
|
the lead agent. Every fact in the final report must be traceable to a line in
|
||||||
|
these notes. No exceptions.
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
workspace/research-notes/
|
||||||
|
task-a.md Subagent A writes (history expert)
|
||||||
|
task-b.md Subagent B writes (transport historian)
|
||||||
|
task-c.md Subagent C writes (telecom analyst)
|
||||||
|
task-d.md Subagent D writes (comparative analyst)
|
||||||
|
registry.md Lead agent builds from task-*.md (P3)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Per-Task Notes Format
|
||||||
|
|
||||||
|
Each `task-{id}.md` file follows this exact structure:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
task_id: a
|
||||||
|
role: Economic Historian
|
||||||
|
status: complete
|
||||||
|
sources_found: 4
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
[1] Before AI skeptics, Luddites raged against the machine | https://www.nationalgeographic.com/... | Source-Type: secondary-industry | As Of: 2025-08 | Authority: 8/10
|
||||||
|
[2] Rage against the machine | https://www.cam.ac.uk/research/news/rage-against-the-machine | Source-Type: academic | As Of: 2024-04 | Authority: 8/10
|
||||||
|
[3] Luddite | https://en.wikipedia.org/wiki/Luddite | Source-Type: community | As Of: 2026-03 | Authority: 7/10
|
||||||
|
[4] Learning from the Luddites | https://forum.effectivealtruism.org/... | Source-Type: community | As Of: 2025-10 | Authority: 6/10
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
- Luddite movement began March 11, 1811 in Arnold, Nottinghamshire. [3]
|
||||||
|
- Luddites were skilled craftspeople, not anti-technology extremists. [1][2]
|
||||||
|
- In the 100M-person textile industry, Luddites never exceeded a few thousand. [2]
|
||||||
|
- Government crushed movement: 12 executed at York Assizes, Jan 1813. [3]
|
||||||
|
- Movement collapsed by 1817 under military repression. [1]
|
||||||
|
- Full textile mechanization transition took 50-90 years (1760s-1850s). [4]
|
||||||
|
- Textile workers' real wages dropped ~70% during transition. [4]
|
||||||
|
- Key lesson for AI: Luddites organized AFTER displacement began, losing leverage. [4]
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source [1]: National Geographic — Luddites and AI
|
||||||
|
Key data: destroyed up to 10,000 pounds of frames in first year alone.
|
||||||
|
Movement spread from Nottinghamshire to Yorkshire and Lancashire in 1812.
|
||||||
|
Children made up 2/3 of workforce at Cromford factory.
|
||||||
|
Key insight: Luddites attacked the SYSTEM of exploitation, not machines per se.
|
||||||
|
They protested manufacturers circumventing standard labor practices.
|
||||||
|
Useful for: framing section on historical displacement, correcting "anti-tech" myth
|
||||||
|
|
||||||
|
### Source [2]: Cambridge University
|
||||||
|
Key data: Luddites were "elite craftspeople" not working class broadly.
|
||||||
|
Yorkshire croppers had 7-year apprenticeships. Movement was localized, never exceeded a few thousand.
|
||||||
|
Key insight: The movement was smaller and more elite than popular history suggests.
|
||||||
|
Useful for: nuancing the scale of historical resistance
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
- Could not find quantitative data on how many specific jobs were lost to textile machines
|
||||||
|
- No Chinese-language academic sources on Luddite movement found
|
||||||
|
- Alternative explanation: displacement narrative may be partly confounded by wartime demand shocks
|
||||||
|
```
|
||||||
|
|
||||||
|
## Source Line Format
|
||||||
|
|
||||||
|
Each source line in the `## Sources` section must contain exactly:
|
||||||
|
```
|
||||||
|
[n] Title | URL | Source-Type: one-of{official|academic|secondary-industry|journalism|community|other} | As Of: YYYY-MM(or YYYY) | Authority: score/10
|
||||||
|
```
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- [n] numbers are LOCAL to this task file (start at [1])
|
||||||
|
- Lead agent will reassign GLOBAL [n] numbers in registry.md
|
||||||
|
- URL must be from an actual search result (subagent MUST NOT invent URLs)
|
||||||
|
- `Authority` score follows guide in quality-gates.md
|
||||||
|
- `As Of` must be provided; use `undated` if unknown
|
||||||
|
- High-confidence claims in final report must use `official` or `academic` sources
|
||||||
|
|
||||||
|
## Findings Line Format
|
||||||
|
|
||||||
|
Each finding must be:
|
||||||
|
- One sentence of specific, factual information
|
||||||
|
- End with source number(s) in brackets: [1] or [1][2]
|
||||||
|
- Max 10 findings per task (forces prioritization)
|
||||||
|
- No vague claims like "research shows..." — name what specifically
|
||||||
|
|
||||||
|
Good: `Full textile mechanization transition took 50-90 years (1760s-1850s). [4]`
|
||||||
|
Bad: `The transition took a long time. [4]`
|
||||||
|
Bad: `Studies suggest that it was a lengthy process.` (no source, vague)
|
||||||
|
|
||||||
|
## Deep Read Notes Format
|
||||||
|
|
||||||
|
For each source that was web_fetched (full article read):
|
||||||
|
- Key data: specific, numeric evidence from article
|
||||||
|
- Key insight: the one thing this source says that others don't
|
||||||
|
- Useful for: which final section this supports
|
||||||
|
|
||||||
|
Max 4 lines per source. This is a research notebook, not a summary.
|
||||||
|
|
||||||
|
## Gaps Section
|
||||||
|
|
||||||
|
List what the subagent searched for but could NOT find, and possible counter-readings.
|
||||||
|
This signals where evidence is thin and confidence should be lowered.
|
||||||
|
|
||||||
|
## Registry Format (built by lead agent in P3)
|
||||||
|
|
||||||
|
The `registry.md` file merges all task sources into a global registry and adds source-type / as-of fields.
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
# Citation Registry
|
||||||
|
Built from: task-a.md, task-b.md, task-c.md, task-d.md
|
||||||
|
|
||||||
|
## Approved Sources
|
||||||
|
|
||||||
|
[1] National Geographic — Luddites | https://www.nationalgeographic.com/... | Source-Type: secondary-industry | As Of: 2026-03 | Auth: 8 | From: task-a
|
||||||
|
[2] Cambridge — Rage against machine | https://www.cam.ac.uk/... | Source-Type: academic | As Of: 2012-04 | Auth: 8 | From: task-a
|
||||||
|
[3] OpenAI — Day Horse Lost Job | https://blogs.microsoft.com/... | Source-Type: official | As Of: 2026-01 | Auth: 8 | From: task-b
|
||||||
|
...
|
||||||
|
[N] Last source
|
||||||
|
|
||||||
|
## Dropped
|
||||||
|
|
||||||
|
x Quora answer | https://www.quora.com/... | Source-Type: community | As Of: 2024-10 | Auth: 3 | Reason: below threshold
|
||||||
|
x Study.com | https://study.com/... | Source-Type: secondary-industry | As Of: undated | Auth: 4 | Reason: better sources available
|
||||||
|
|
||||||
|
## Stats
|
||||||
|
|
||||||
|
Total evaluated: 22
|
||||||
|
Approved: 16
|
||||||
|
Dropped: 6
|
||||||
|
Unique domains: 12
|
||||||
|
Source-type: official 4 / academic 3 / secondary-industry 5 / journalism 2 / community 2
|
||||||
|
Max single-source share: 3/16 = 19% (pass)
|
||||||
|
```
|
||||||
|
|
||||||
|
Rules for registry:
|
||||||
|
- [n] numbers here are FINAL — they appear unchanged in the report
|
||||||
|
- Every [n] in the report must exist in the Approved list
|
||||||
|
- Every Dropped source must NEVER appear in the report
|
||||||
|
- If two tasks found the same URL, keep it once with the higher authority score
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Research Plan Checklist
|
||||||
|
|
||||||
|
Use this checklist before calling the deepresearch tool.
|
||||||
|
|
||||||
|
## Scope and Questions
|
||||||
|
- Define the primary research question
|
||||||
|
- Break into 3-7 subquestions
|
||||||
|
- Define scope boundaries and exclusions
|
||||||
|
- Define time range and geography
|
||||||
|
|
||||||
|
## Evidence Strategy
|
||||||
|
- Identify primary sources needed
|
||||||
|
- Identify secondary sources needed
|
||||||
|
- Define inclusion and exclusion criteria
|
||||||
|
- Define minimum number of sources per section
|
||||||
|
|
||||||
|
## Query Set
|
||||||
|
- Create query variants per subquestion
|
||||||
|
- Include synonyms and alternate terms
|
||||||
|
- Add disambiguating keywords
|
||||||
|
|
||||||
|
## Query Log Template
|
||||||
|
- Query:
|
||||||
|
- Intended section:
|
||||||
|
- Date run:
|
||||||
|
- Notes:
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Research Report Template
|
||||||
|
|
||||||
|
## Title
|
||||||
|
- Report title
|
||||||
|
- Date
|
||||||
|
- Author or team (optional)
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
- 3-6 bullets, each supported by evidence
|
||||||
|
- Include top conclusions and implications
|
||||||
|
|
||||||
|
## Research Question and Scope
|
||||||
|
- Primary question
|
||||||
|
- Scope boundaries (what is included and excluded)
|
||||||
|
- Time range and geography
|
||||||
|
|
||||||
|
## Methodology
|
||||||
|
- Data sources used
|
||||||
|
- Search strategy and inclusion criteria
|
||||||
|
- Limitations and known gaps
|
||||||
|
|
||||||
|
## Key Findings
|
||||||
|
- 5-10 findings, each with citations
|
||||||
|
|
||||||
|
## Analysis
|
||||||
|
### Section 1: [Theme]
|
||||||
|
- Structured paragraphs with citations
|
||||||
|
- If comparative, include a table
|
||||||
|
|
||||||
|
### Section 2: [Theme]
|
||||||
|
- Structured paragraphs with citations
|
||||||
|
|
||||||
|
### Section 3: [Theme]
|
||||||
|
- Structured paragraphs with citations
|
||||||
|
|
||||||
|
## Risks and Limitations
|
||||||
|
- Data gaps
|
||||||
|
- Conflicting sources
|
||||||
|
- Uncertainty ranges
|
||||||
|
|
||||||
|
## Recommendations (If requested)
|
||||||
|
- Actionable recommendations tied to findings
|
||||||
|
- Each recommendation cites evidence
|
||||||
|
|
||||||
|
## Appendix A: Evidence Table
|
||||||
|
- Table mapping claims to sources
|
||||||
|
|
||||||
|
## Appendix B: Sources
|
||||||
|
- Full citations or links
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
# Source Accessibility Policy
|
||||||
|
|
||||||
|
**Version**: V6.1
|
||||||
|
**Purpose**: Distinguish between legitimate exclusive information advantages and circular verification traps
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## The Problem
|
||||||
|
|
||||||
|
In the "字节跳动" case study, we made a **methodology error**:
|
||||||
|
|
||||||
|
**What happened**:
|
||||||
|
1. User asked to research **their own company**: "字节跳动某子公司"
|
||||||
|
2. We accessed user's **own Spaceship account** (their private registrar)
|
||||||
|
3. Found 25 domains **the user already owned**
|
||||||
|
4. Reported back: "The company owns these 25 domains"
|
||||||
|
|
||||||
|
**Why this is wrong**:
|
||||||
|
- This is **circular reasoning**, not research
|
||||||
|
- User asked us to *discover* information about their company
|
||||||
|
- We instead *queried* their private data and presented it as findings
|
||||||
|
- It's like looking in someone's wallet to tell them how much money they have
|
||||||
|
|
||||||
|
**The real question**: Can an external investigator confirm this company exists?
|
||||||
|
**Answer**: No (WHOIS privacy, no public records)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Core Principle: No Circular Verification
|
||||||
|
|
||||||
|
### ❌ FORBIDDEN: Self-Verification
|
||||||
|
|
||||||
|
When researching **the user's own assets/company/identity**:
|
||||||
|
|
||||||
|
| Scenario | WRONG | RIGHT |
|
||||||
|
|----------|-------|-------|
|
||||||
|
| User's company | "I found in YOUR registrar that YOU own these domains" | "Public WHOIS shows privacy protection - ownership not externally verifiable" |
|
||||||
|
| User's identity | "I checked YOUR email and found YOUR address" | "Please provide address if relevant to the research" |
|
||||||
|
| User's property | "I accessed YOUR bank to see YOUR balance" | Not applicable to research |
|
||||||
|
|
||||||
|
**Rule**: Cannot use user's private data to "discover" what user already knows about themselves.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ ALLOWED: Exclusive Information Advantage
|
||||||
|
|
||||||
|
When researching **third parties** (competitors, markets, investments):
|
||||||
|
|
||||||
|
| Source Type | Example | Usage |
|
||||||
|
|-------------|---------|-------|
|
||||||
|
| **User's paid subscriptions** | Crunchbase Pro, PitchBook, Wind | ✅ Use to research competitors |
|
||||||
|
| **User's proprietary databases** | Internal CRM, industry databases | ✅ Use to research market |
|
||||||
|
| **User's private APIs** | Trading APIs, data feeds | ✅ Use for investment research |
|
||||||
|
| **User's internal documents** | Prior research, memos | ✅ Use as background for new research |
|
||||||
|
|
||||||
|
**Rule**: User's exclusive information sources are competitive advantages - USE THEM for third-party research.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## The Distinction
|
||||||
|
|
||||||
|
```
|
||||||
|
Research Target: 字节跳动某子公司
|
||||||
|
├─ Is this the user's own company? → YES
|
||||||
|
├─ Can we use user's private data about it? → NO (circular)
|
||||||
|
└─ Must rely on: Public sources only
|
||||||
|
|
||||||
|
Research Target: 竞争对手公司 X
|
||||||
|
├─ Is this the user's own company? → NO
|
||||||
|
├─ Can we use user's Crunchbase Pro? → YES (competitive advantage)
|
||||||
|
└─ Can use: Public + User's exclusive sources
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Corrected Methodology
|
||||||
|
|
||||||
|
### When Researching User's Own Company
|
||||||
|
|
||||||
|
**Approach**: External investigator perspective
|
||||||
|
|
||||||
|
```
|
||||||
|
User: "Research my company 字节跳动子公司"
|
||||||
|
|
||||||
|
CORRECT RESPONSE:
|
||||||
|
1. Search public sources (WHOIS, web, news)
|
||||||
|
2. Find: Website placeholder, privacy-protected WHOIS, no news
|
||||||
|
3. Report: "From public perspective: minimal footprint, cannot verify ownership"
|
||||||
|
4. Gap: "Internal data not accessible to external investigators"
|
||||||
|
|
||||||
|
INCORRECT RESPONSE:
|
||||||
|
1. Access user's Spaceship account
|
||||||
|
2. Find: 25 domains user already knows they own
|
||||||
|
3. Report: "The company owns 25 domains" (user already knows this!)
|
||||||
|
```
|
||||||
|
|
||||||
|
### When User Provides Exclusive Sources
|
||||||
|
|
||||||
|
**Approach**: Leverage competitive advantage
|
||||||
|
|
||||||
|
```
|
||||||
|
User: "Research competitor X, I have Crunchbase Pro"
|
||||||
|
User: "Here's my API key: xxx"
|
||||||
|
|
||||||
|
CORRECT RESPONSE:
|
||||||
|
1. Use provided Crunchbase Pro API
|
||||||
|
2. Find: Funding history, team info not in public sources
|
||||||
|
3. Report: "Per Crunchbase Pro [exclusive source], X raised $Y in Series Z"
|
||||||
|
4. Cite: Accessibility: exclusive (user-provided)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Source Classification
|
||||||
|
|
||||||
|
### public ✅
|
||||||
|
- Available to any external researcher
|
||||||
|
- Examples: Public websites, news, SEC filings
|
||||||
|
|
||||||
|
### exclusive-user-provided ✅ (FOR THIRD-PARTY RESEARCH)
|
||||||
|
- User's paid subscriptions, private APIs, internal databases
|
||||||
|
- **USE for**: Researching competitors, markets, investments
|
||||||
|
- **DO NOT USE for**: Verifying user's own assets/identity
|
||||||
|
|
||||||
|
### private-user-owned ❌ (FOR SELF-RESEARCH)
|
||||||
|
- User's own accounts, emails, personal data
|
||||||
|
- **DO NOT USE**: Creates circular verification
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Information Black Box Protocol
|
||||||
|
|
||||||
|
When an entity (including user's own company) has no public footprint:
|
||||||
|
|
||||||
|
1. **Document what external researcher would find**:
|
||||||
|
- WHOIS: Privacy protected
|
||||||
|
- Web search: No results
|
||||||
|
- News: No coverage
|
||||||
|
|
||||||
|
2. **Report honestly**:
|
||||||
|
```
|
||||||
|
Public sources found: 0
|
||||||
|
External visibility: None
|
||||||
|
Verdict: Cannot verify from public perspective
|
||||||
|
Note: User may have private information not available to external investigators
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Do NOT**:
|
||||||
|
- Use user's private data to "fill gaps"
|
||||||
|
- Present user's private knowledge as "discovered evidence"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
When starting research, determine:
|
||||||
|
|
||||||
|
1. **Who is the research target?**
|
||||||
|
- User's own company/asset? → Public sources ONLY
|
||||||
|
- Third party? → Can use user's exclusive sources
|
||||||
|
|
||||||
|
2. **Am I discovering or querying?**
|
||||||
|
- Discovering new info? → Research
|
||||||
|
- Querying user's own data? → Circular, not allowed
|
||||||
|
|
||||||
|
3. **Would this finding surprise the user?**
|
||||||
|
- Yes → Legitimate research
|
||||||
|
- No (they already know) → Probably circular verification
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
| Situation | Can Use User's Private Data? | Why? |
|
||||||
|
|-----------|------------------------------|------|
|
||||||
|
| Research user's own company | ❌ NO | Circular verification |
|
||||||
|
| Research competitor using user's Crunchbase | ✅ YES | Competitive advantage |
|
||||||
|
| Research market using user's database | ✅ YES | Exclusive information |
|
||||||
|
| "Discover" user's own domain ownership | ❌ NO | User already knows this |
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Source Quality Rubric
|
||||||
|
|
||||||
|
Classify sources into tiers and prioritize higher quality evidence.
|
||||||
|
|
||||||
|
## Tier A (Highest)
|
||||||
|
- Primary sources: government data, standards bodies, peer-reviewed papers
|
||||||
|
- Official filings: annual reports, regulatory filings, audited statements
|
||||||
|
- First-party datasets with transparent methodology
|
||||||
|
|
||||||
|
## Tier B (Reliable)
|
||||||
|
- Reputable news organizations with editorial standards
|
||||||
|
- Industry analyst reports with clear methodology
|
||||||
|
- Company technical blogs with data and disclosures
|
||||||
|
|
||||||
|
## Tier C (Use Sparingly)
|
||||||
|
- Opinion pieces without evidence
|
||||||
|
- Marketing materials without verification
|
||||||
|
- Aggregators without clear sourcing
|
||||||
|
|
||||||
|
## Exclusion Rules
|
||||||
|
- Exclude sources with no date or author
|
||||||
|
- Exclude sources that cannot be verified
|
||||||
|
- Exclude sources that are clearly outdated for the topic
|
||||||
|
|
||||||
|
## Conflict Handling
|
||||||
|
- Surface conflicting sources explicitly
|
||||||
|
- Prefer higher tier sources
|
||||||
|
- Note uncertainty when conflicts remain
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
# Subagent Prompt Template
|
||||||
|
|
||||||
|
This file defines the prompt structure sent to each research subagent.
|
||||||
|
The lead agent fills in the `{variables}` and dispatches.
|
||||||
|
|
||||||
|
## Prompt
|
||||||
|
|
||||||
|
```
|
||||||
|
You are a research specialist with the role: {role}.
|
||||||
|
|
||||||
|
## Your Task
|
||||||
|
|
||||||
|
{objective}
|
||||||
|
|
||||||
|
## Search Queries (start with these, adjust as needed)
|
||||||
|
|
||||||
|
1. {query_1}
|
||||||
|
2. {query_2}
|
||||||
|
3. {query_3} (optional)
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
1. Run 2-4 web searches using the queries above (and variations).
|
||||||
|
2. For the best 2-3 results, use web_fetch to read the full article.
|
||||||
|
3. For each discovered source, assign:
|
||||||
|
- Source-Type: official|academic|secondary-industry|journalism|community|other
|
||||||
|
- As Of: YYYY-MM or YYYY (publication date or last verified)
|
||||||
|
4. Assess each source's authority (1-10 scale).
|
||||||
|
5. Write ALL findings to the file: {output_path}
|
||||||
|
6. Record at least one explicit counter-claim candidate in `Gaps`.
|
||||||
|
7. Use EXACTLY the format below. Do not deviate.
|
||||||
|
|
||||||
|
## Output Format (write this to {output_path})
|
||||||
|
|
||||||
|
---
|
||||||
|
task_id: {task_id}
|
||||||
|
role: {role}
|
||||||
|
status: complete
|
||||||
|
sources_found: {N}
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
[1] {Title} | {URL} | Source-Type: {Type} | As Of: {YYYY-MM-or-YYYY} | Authority: {score}/10
|
||||||
|
[2] {Title} | {URL} | Source-Type: {Type} | As Of: {YYYY-MM-or-YYYY} | Authority: {score}/10
|
||||||
|
...
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
- {Specific fact, with source number}. [1]
|
||||||
|
- {Specific fact, with source number and confidence}. [2]
|
||||||
|
- {Another fact}. [1]
|
||||||
|
... (max 10 findings, each one sentence, each with source number)
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source [1]: {Title}
|
||||||
|
Key data: {specific numbers, dates, percentages extracted from full text}
|
||||||
|
Key insight: {the one thing this source contributes that others don't}
|
||||||
|
Useful for: {which aspect of the broader research question}
|
||||||
|
|
||||||
|
### Source [2]: {Title}
|
||||||
|
Key data: ...
|
||||||
|
Key insight: ...
|
||||||
|
Useful for: ...
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
- {What you searched for but could NOT find}
|
||||||
|
- {Alternative interpretation or methodological limitation}
|
||||||
|
|
||||||
|
## END
|
||||||
|
|
||||||
|
Do not include any content after the Gaps section.
|
||||||
|
Do not summarize your process. Write the findings file and stop.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Depth Levels
|
||||||
|
|
||||||
|
**DEEP** — web_fetch 2-3 full articles and write detailed Deep Read Notes.
|
||||||
|
Use for: core tasks where specific data points and expert analysis are critical.
|
||||||
|
|
||||||
|
**SCAN** — rely mainly on search snippets, fetches at most 1 article.
|
||||||
|
Use for: supplementary tasks like source mapping.
|
||||||
|
|
||||||
|
## Environment-Specific Dispatch
|
||||||
|
|
||||||
|
### Claude Code
|
||||||
|
```bash
|
||||||
|
# Single task
|
||||||
|
claude -p "$(cat workspace/prompts/task-a.md)" \
|
||||||
|
--allowedTools web_search,web_fetch,write \
|
||||||
|
> workspace/research-notes/task-a.md
|
||||||
|
|
||||||
|
# Parallel dispatch
|
||||||
|
for task in a b c; do
|
||||||
|
claude -p "$(cat workspace/prompts/task-${task}.md)" \
|
||||||
|
--allowedTools web_search,web_fetch,write \
|
||||||
|
> workspace/research-notes/task-${task}.md &
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cowork
|
||||||
|
Spawn subagent tasks via the subagent dispatch mechanism.
|
||||||
|
|
||||||
|
### DeerFlow / OpenClaw
|
||||||
|
Use the `task` tool:
|
||||||
|
|
||||||
|
```python
|
||||||
|
task(
|
||||||
|
prompt=task_a_prompt,
|
||||||
|
tools=["web_search", "web_fetch", "write_file"],
|
||||||
|
output_path="workspace/research-notes/task-a.md"
|
||||||
|
)
|
||||||
|
```
|
||||||
@@ -0,0 +1,775 @@
|
|||||||
|
# 分销商城推广模式全景调研报告
|
||||||
|
|
||||||
|
> 调研日期:2026-05-06
|
||||||
|
> AS_OF 日期:2026-05-06
|
||||||
|
> 调研范围:中国社交电商/分销商城推广模式(网络结构、奖金分配、社交裂变、层级身份体系、合规框架)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
1. [概述](#1-概述)
|
||||||
|
2. [网络结构类模式](#2-网络结构类模式)
|
||||||
|
3. [奖金分配类模式](#3-奖金分配类模式)
|
||||||
|
4. [社交裂变类模式](#4-社交裂变类模式)
|
||||||
|
5. [层级身份体系类模式](#5-层级身份体系类模式)
|
||||||
|
6. [混合模式与创新变体](#6-混合模式与创新变体)
|
||||||
|
7. [中国法律合规框架](#7-中国法律合规框架)
|
||||||
|
8. [行业实践与平台案例](#8-行业实践与平台案例)
|
||||||
|
9. [模式对比与选型建议](#9-模式对比与选型建议)
|
||||||
|
10. [核心争议与风险提示](#10-核心争议与风险提示)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 概述
|
||||||
|
|
||||||
|
分销商城推广模式是中国社交电商领域的核心增长引擎。2025 年中国社交电商 GMV 规模约 3.42 万亿元,占网络零售比例预计达 17.1%,预计 2030 年达 7690 亿美元[^6]。这些模式的核心逻辑是**将传统营销获客成本(CAC)直接返还给消费者/推广者**,通过社交关系链实现病毒式增长。
|
||||||
|
|
||||||
|
本报告系统梳理四大类共 20+ 种推广模式,涵盖运作机制、分润计算、适用场景、优缺点及合规风险,并附上中国法律框架下的合规边界与行业实践案例。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 网络结构类模式
|
||||||
|
|
||||||
|
### 2.1 链动2+1(二加一连锁模式)
|
||||||
|
|
||||||
|
**起源**:约 2021 年 10 月,广州美妆公司"美丽天天秒"首创,专为规避中国三级分销红线而设计。
|
||||||
|
|
||||||
|
**运作机制**:
|
||||||
|
|
||||||
|
系统仅设两个身份层级——**代理**和**老板**,通过"走人-留人-帮扶"三机制实现自循环裂变。
|
||||||
|
|
||||||
|
```
|
||||||
|
平台创始人
|
||||||
|
└── A(购买 499 元礼包 → 代理)
|
||||||
|
├── B(A 直推 B)→ A 获 100 元直推奖
|
||||||
|
│ └── D(B 直推 D)→ B 获 100 元直推奖;A 获 200 元团队奖
|
||||||
|
└── C(A 直推 C)→ A 获 100 元直推奖
|
||||||
|
↓ A 直推满 2 人 → 升级为老板
|
||||||
|
↓ B、C 被"留给"创始人(留人机制)
|
||||||
|
↓ A 独立出去,从 D 及后续新订单获 200 元/单无限团队见点奖
|
||||||
|
```
|
||||||
|
|
||||||
|
**三大核心机制**:
|
||||||
|
|
||||||
|
| 机制 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| **走人** | 推荐满 2 人升级老板后,从原上线脱离,开启独立团队链 |
|
||||||
|
| **留人** | 升级时将自己直推的 2 人留给原上线,保护上线团队基数 |
|
||||||
|
| **帮扶** | 老板收益的 20% 被冻结,直至自己推荐的 2 人也升级为老板才释放 |
|
||||||
|
|
||||||
|
**分润计算(以 499 元商品为例)**:
|
||||||
|
|
||||||
|
| 奖励类型 | 金额 | 说明 |
|
||||||
|
|---------|------|------|
|
||||||
|
| 直推奖 | 100 元/单 | 直接推荐新代理时获得 |
|
||||||
|
| 团队见点奖 | 200 元/单 | 老板从团队(不限层级)每单获得 |
|
||||||
|
| 平级奖 | ~10 元/单(直推奖的 10%) | 下级也升级为老板时,上线仍可获得 |
|
||||||
|
| 帮扶冻结 | 收益的 20% | 下级升级后解冻释放 |
|
||||||
|
|
||||||
|
**总拨出率(波比)**:约 50-62% 的产品售价,平台保留 38-50% 覆盖产品成本、运营和利润[^1][^8]。
|
||||||
|
> ⚠️ 注:50-62% 波比数据来源于行业自媒体和 SaaS 厂商公开案例,缺乏第三方审计或学术研究验证,实际运营中因产品品类、定价策略差异可能有较大浮动。
|
||||||
|
|
||||||
|
**适用场景**:高毛利(60%+)、强复购、社交分享属性强的品类——美妆护肤、大健康、酒类、知识付费、本地生活服务。
|
||||||
|
|
||||||
|
**优缺点**:
|
||||||
|
- 优点:严格 2 级深度规避法律风险;走人机制保持系统活力;帮扶机制防止"躺赚"
|
||||||
|
- 缺点:走人后留下的代理可能失去动力("死位问题");对产品定价和品质要求高;法律地位未经大规模法院检验
|
||||||
|
|
||||||
|
**合规风险**:**中等**。设计初衷即是为了合法合规,但若产品定价虚高、品质差、或实际运营中演变为以拉人头为主而非真实销售,仍可能触碰传销红线[^2][^17]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2.2 双轨制(Binary System)
|
||||||
|
|
||||||
|
**运作机制**:每位会员仅有左、右两条线(2 个直推位置),后续推荐的人通过"溢出"机制安置到下级节点的下方空位。
|
||||||
|
|
||||||
|
**核心奖金**:**对碰奖**(Matching Bonus)
|
||||||
|
|
||||||
|
```
|
||||||
|
A
|
||||||
|
/ \
|
||||||
|
B C
|
||||||
|
/ \ / \
|
||||||
|
D E F G
|
||||||
|
```
|
||||||
|
|
||||||
|
- 公式:对碰奖 = min(左区业绩, 右区业绩) × 对碰比例
|
||||||
|
- 对碰后小区业绩归零,大区剩余业绩保留结转至下次
|
||||||
|
- 典型对碰比例:8-15%
|
||||||
|
- 通常设每日/每周封顶
|
||||||
|
|
||||||
|
**示例**:左区 10,000 元,右区 6,000 元 → 对碰奖 = 6,000 × 10% = 600 元;对碰后左区剩 4,000 元,右区归零[^6][^14]。
|
||||||
|
|
||||||
|
**适用场景**:需要团队协作的会员制平台、数字产品/服务、订阅制平台。
|
||||||
|
|
||||||
|
**优缺点**:
|
||||||
|
- 优点:"大象腿"(单侧业绩巨大)仍能产生收益;上线自动帮助下线安置溢出人员;规则清晰
|
||||||
|
- 缺点:左右不平衡时收入受影响;溢出安置可能不符合推荐人意愿;成本管控需依赖封顶机制
|
||||||
|
|
||||||
|
**合规风险**:**高**。双轨制天然产生无限层级深度,极易触碰三级分销红线;中国监管对双轨制审查严格[^6][^7]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2.3 太阳线(Unilevel / Sunburst System)
|
||||||
|
|
||||||
|
**运作机制**:每位会员可直推无限人数(宽度不限),佣金按固定代数向下计算(深度有限,通常 2-7 代)。
|
||||||
|
|
||||||
|
**分润计算**:
|
||||||
|
- 第 1 代(直推):10%
|
||||||
|
- 第 2 代:3%
|
||||||
|
- 第 3 代:2%
|
||||||
|
- 第 4 代:1%
|
||||||
|
|
||||||
|
**适用场景**:安利用于消费品类;个人社交网络强的推广者;低门槛大众消费品。
|
||||||
|
|
||||||
|
**优缺点**:
|
||||||
|
- 优点:规则最简单;无安置约束,推荐自由;个人推广激励强
|
||||||
|
- 缺点:"大象腿白干"问题(宽而浅的团队收入低);早期加入者优势过大;团队存活率低
|
||||||
|
|
||||||
|
**合规风险**:**中等**。取决于计算的代数深度,控制在 2-3 代内相对安全[^11][^12]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2.4 矩阵制(Matrix System)
|
||||||
|
|
||||||
|
**运作机制**:固定宽度 × 固定深度的网格结构(如 3×3、5×5、2×12)。常见于美乐家(Melaleuca)等订阅制品牌。
|
||||||
|
|
||||||
|
**核心奖金类型**:
|
||||||
|
- **直推奖**:推荐新人加入时获得
|
||||||
|
- **固定代数奖**:前 N 代(如 7 代)每代固定比例
|
||||||
|
- **填满奖(Fill Bonus)**:当矩阵某一行填满时的额外奖励
|
||||||
|
- **循环/溢出奖**:矩阵填满后溢出部分开启新矩阵
|
||||||
|
|
||||||
|
**适用场景**:稳定复购的订阅制产品、需要结构化增长管理的平台。
|
||||||
|
|
||||||
|
**优缺点**:
|
||||||
|
- 优点:增长结构可控、可预期;上线自然帮助下线填位;持续消费者收入稳定
|
||||||
|
- 缺点:固定宽度限制增长上限;需排队等候空位;灵活性差
|
||||||
|
|
||||||
|
**合规风险**:**中等**。取决于深度设置和是否有真实商品交易[^11][^12]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. 奖金分配类模式
|
||||||
|
|
||||||
|
### 3.1 级差分润(Level-Differential Commission)
|
||||||
|
|
||||||
|
**运作机制**:设置多个代理等级,每级对应不同佣金比例。上级从下级产生的订单中获得"自身比例与下级比例之差"的分润。
|
||||||
|
|
||||||
|
**核心公式**:`级差佣金 = 订单金额 × (上级佣金比例 - 下级佣金比例)`
|
||||||
|
|
||||||
|
**五级代理计算示例(分红基数 100 元)**:
|
||||||
|
|
||||||
|
| 代理 | 等级 | 佣金比例 | 计算 | 获得佣金 |
|
||||||
|
|------|------|---------|------|---------|
|
||||||
|
| A | 一级代理商 | 60% | — | — |
|
||||||
|
| B | 二级代理商 | 50% | 100 × (50% - 30%) | 20 元 |
|
||||||
|
| C | 三级代理商 | 40% | 100 × (40% - 30%) | 10 元 |
|
||||||
|
| D | 四级代理商 | 30% | 100 × 30% | 30 元 |
|
||||||
|
|
||||||
|
关键特性:总佣金自动封顶——无论多少层级,拨出不会超过最高等级比例[^10][^11]。
|
||||||
|
|
||||||
|
**平级奖**:当上下级等级相同时,级差为 0,此时通过平级奖补偿(通常为下级团队业绩的 3-5%)。
|
||||||
|
|
||||||
|
**适用场景**:社交电商(云集、贝店)、社区团购(团长分级)、微商代理体系。
|
||||||
|
|
||||||
|
**合规风险**:**中等**。控制在 3 级以内安全;以实际商品交易为基础则相对安全[^11][^13]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.2 团队分红(Team Dividend)
|
||||||
|
|
||||||
|
**运作机制**:基于团队总体业绩进行分红,常见形式包括全球分红(平台总营业额比例)、区域分红(按区域业绩)、团队业绩分红。
|
||||||
|
|
||||||
|
**全球分红计算示例**:
|
||||||
|
- 当日总业绩 1,000,000 元
|
||||||
|
- 分红池 = 1,000,000 × 5% = 50,000 元
|
||||||
|
- 参与者权重:3 个 V5(权重 3)+ 5 个 V4(权重 2)+ 10 个 V3(权重 1)= 总权重 29
|
||||||
|
- 每个 V5 分红 = 50,000 × (3/29) ≈ 5,172 元[^1][^12]
|
||||||
|
|
||||||
|
**适用场景**:大型社交电商平台、多区域代理体系、有稳定复购和持续营业额的商城。
|
||||||
|
|
||||||
|
**合规风险**:**中等**。分红比例过高或层级过深可能触碰红线;必须确保有真实商品交易[^12][^20]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.3 直推奖(Direct Referral Bonus)
|
||||||
|
|
||||||
|
**运作机制**:直接推荐新用户完成指定行为(注册、首购等)即获得奖励。
|
||||||
|
|
||||||
|
**计算方式**:
|
||||||
|
- 固定金额:每直推 1 人奖 50 元
|
||||||
|
- 百分比:直推消费金额的 10-20%
|
||||||
|
- 递增式:第 1 单 10%,第 2 单 40%,第 3 单起 100%(免费)
|
||||||
|
|
||||||
|
**合规风险**:**低**(有真实交易时)。是最基础、最低风险的奖励类型[^3][^13]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.4 间推奖(Indirect Referral Bonus)
|
||||||
|
|
||||||
|
**运作机制**:按"代数"计算间接推荐业绩的提成。
|
||||||
|
|
||||||
|
**典型比例**:
|
||||||
|
- 第 1 代(直推):10-20%
|
||||||
|
- 第 2 代:5-8%
|
||||||
|
- 第 3 代:2-3%
|
||||||
|
- 第 4 代及以后:通常不再设(合规红线)
|
||||||
|
|
||||||
|
**示例**:A→B→C→D,D 消费 500 元 → C 获 75 元(直推 15%),B 获 25 元(间推第 2 代 5%),A 获 10 元(间推第 3 代 2%)[^4][^13]。
|
||||||
|
|
||||||
|
**合规风险**:**高**。超过 3 代直接违反《禁止传销条例》;必须严格控制代数[^4][^19]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.5 对碰奖(Matching / Binary Pair Bonus)
|
||||||
|
|
||||||
|
**运作机制**:在双轨制中,左右两区业绩取小值碰撞计算奖金。
|
||||||
|
|
||||||
|
**公式**:`对碰奖 = min(左区业绩, 右区业绩) × 对碰比例(8-15%)`
|
||||||
|
|
||||||
|
**示例**:左区 50,000 元,右区 35,000 元 → 对碰奖 = 35,000 × 12% = 4,200 元[^5][^8][^14]。
|
||||||
|
|
||||||
|
**合规风险**:**高**。双轨制天然产生无限层级深度,在中国监管下风险较大[^7][^14]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.6 见单奖(Per-Order Bonus / 见点奖)
|
||||||
|
|
||||||
|
**运作机制**:伞下团队内每产生一单订单即可获得奖励(不限是否直推)。
|
||||||
|
|
||||||
|
**计算方式**:
|
||||||
|
- 固定金额:伞下 5 层内每单奖 10 元
|
||||||
|
- 百分比:伞下 3 层内每单奖订单金额的 3%
|
||||||
|
- 递减型:第 1 层每单 30 元 → 第 5 层每单 5 元
|
||||||
|
|
||||||
|
**示例**:5 层共 200 单 × 10 元 = 2,000 元见单奖[^15]。
|
||||||
|
|
||||||
|
**合规风险**:**中等**。需确保每笔订单对应真实商品交付;建议设置层数上限和每日封顶[^6][^15]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.7 层碰奖(Layer Matching Bonus)
|
||||||
|
|
||||||
|
**运作机制**:在双轨制基础上,从上到下逐层计算左右两区的碰撞。
|
||||||
|
|
||||||
|
**计算方式**:每层取左右首单业绩,按 min(左, 右) × 层碰比例(约 3-5%)。
|
||||||
|
|
||||||
|
**示例**:
|
||||||
|
- 第 1 层:左 1,000 元,右 800 元 → 层碰 = 800 × 5% = 40 元
|
||||||
|
- 第 2 层:左 1,000 元,右 500 元 → 层碰 = 500 × 5% = 25 元
|
||||||
|
- 合计 = 65 元[^5][^7]。
|
||||||
|
|
||||||
|
**优缺点**:弥补对碰奖在层级发展上的不足,拨出固定可控;但计算复杂,普通用户难理解[^7]。
|
||||||
|
|
||||||
|
**合规风险**:**高**。属于双轨制范畴,层级过深触碰三级红线[^7][^9]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.8 量碰奖(Volume Matching Bonus)
|
||||||
|
|
||||||
|
**运作机制**:层碰之后,将左右区剩余业绩再次碰撞。采用非 1:1 比例(如 1:2、2:3)。
|
||||||
|
|
||||||
|
**计算示例**(1:2 比例):
|
||||||
|
- 左区 50,000 元,右区 30,000 元
|
||||||
|
- 按 1:2 碰:右区 30,000 可碰掉左区 60,000 → 实际左区仅 50,000
|
||||||
|
- 碰撞金额 = 50,000 / 2 = 25,000 元
|
||||||
|
- 量碰奖 = 25,000 × 3% = 750 元[^5][^9]。
|
||||||
|
|
||||||
|
**合规风险**:**极高**。量碰奖在拆分盘/互助盘中使用极为普遍,此类模式在中国大多涉嫌非法集资和传销。拨出率可能超过 100%,导致资金链断裂崩盘[^9][^18]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.9 奖金类型综合对比
|
||||||
|
|
||||||
|
| 奖金类型 | 核心逻辑 | 典型比例 | 适用模式 | 合规风险 |
|
||||||
|
|---------|---------|---------|---------|---------|
|
||||||
|
| 级差分润 | 上下级佣金比例差额 | 5-60%(等级差异) | 级差制/代理制 | 中(≤3 级安全) |
|
||||||
|
| 团队分红 | 团队总业绩按比例分配 | 3-10% | 全球分红/区域分红 | 中 |
|
||||||
|
| 直推奖 | 直接推荐即得 | 10-20% | 所有分销模式 | 低 |
|
||||||
|
| 间推奖 | 间接推荐按代数提成 | 2-8%(递减) | 三级分销 | 高(>3 代违法) |
|
||||||
|
| 对碰奖 | 双轨左右小区碰撞 | 8-15% | 双轨制 | 高 |
|
||||||
|
| 见单奖 | 伞下层内每单给奖 | 固定金额或 1-3% | 公排/三三复制 | 中 |
|
||||||
|
| 层碰奖 | 按层逐层碰撞 | 3-5% | 双轨制 | 高 |
|
||||||
|
| 量碰奖 | 剩余业绩再碰 | 3-5% | 双轨制/拆分盘 | 极高 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 社交裂变类模式
|
||||||
|
|
||||||
|
### 4.1 拼团分销(Group-Buying Distribution)
|
||||||
|
|
||||||
|
**运作机制**:拼多多首创——"发起拼团 → 微信分享 → 好友参团 → 成团发货"的病毒循环。将消费者主动转化为分发节点。
|
||||||
|
|
||||||
|
**核心驱动**:
|
||||||
|
- 价格差:拼团价低于单独购买价,形成参团动力
|
||||||
|
- 社交压力:"差 1 人就成团"的心理推动
|
||||||
|
- 裂变系数 F > 1.5 时形成指数级传播[^1][^3]
|
||||||
|
|
||||||
|
**拼多多数据**:
|
||||||
|
- 2018-2019 年早期社交裂变获客成本低至 5-7 元/人(行业平均 50-100 元/人)[^1]
|
||||||
|
- 2025 年营收 4318.5 亿元(同比 +10%,增速从 2024 年 59% 显著放缓),CAC 已大幅上升[^6]
|
||||||
|
- 年活跃买家 7.2 亿,国内增长已达天花板
|
||||||
|
- "砍一刀"模式成功复制到海外 Temu(2025 年 GMV 970 亿美元)[^6]
|
||||||
|
|
||||||
|
**适用场景**:低价标品、下沉市场、日用品、农产品、快消品。
|
||||||
|
|
||||||
|
**合规风险**:**低**。基于真实商品交易和价格优惠,不涉及多层级分润[^3][^4]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4.2 社交裂变(Social Viral Growth)
|
||||||
|
|
||||||
|
**运作机制**:依托微信/抖音等社交平台的分享机制,通过利益激励驱动用户主动传播。
|
||||||
|
|
||||||
|
**主要玩法**:
|
||||||
|
|
||||||
|
| 玩法 | 机制 | 示例 |
|
||||||
|
|------|------|------|
|
||||||
|
| 砍价 | 分享给好友帮砍价,砍到 0 元免费/低价获得 | 拼多多"砍一刀" |
|
||||||
|
| 助力 | 邀请 N 人助力即可解锁优惠/免单/权益 | 助力领现金红包 |
|
||||||
|
| 红包裂变 | 分享红包,好友点击后双方获得奖励 | 微信红包裂变 |
|
||||||
|
| 分享返现 | 分享商品链接,好友通过链接购买后返现 | 淘宝客分享 |
|
||||||
|
|
||||||
|
**双引擎模型**:
|
||||||
|
- **主动传播**(情绪/社交驱动):"砍一刀"的情感绑架、炫耀心理、社交关系链的纽扣式传播
|
||||||
|
- **被动传播**(利益激励驱动):拼团折扣、分销返利、助力领现金[^1][^3]
|
||||||
|
|
||||||
|
**适用场景**:几乎所有线上业务,尤其适合冷启动获客、小程序电商、社区团购。
|
||||||
|
|
||||||
|
**合规风险**:**中等**。依赖微信平台政策——微信对诱导分享行为有严格管控,违规可能被限制分享或封号[^6][^20]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4.3 代言人模式(Spokesperson/Ambassador Model)
|
||||||
|
|
||||||
|
**运作机制**:用户购买指定商品后自动成为该商品"代言人",按消费时间/顺序排名获得单品利润约 10% 的分红。
|
||||||
|
|
||||||
|
**核心逻辑**:
|
||||||
|
- 种子轮(前 100 名)、天使轮(101-1000 名)等轮次分配
|
||||||
|
- 越早入场收益越高——"先入者优先获利"
|
||||||
|
- 销量越高代言人分红越多,推动老用户主动推荐新用户
|
||||||
|
|
||||||
|
**分润公式**:`代言人奖励 = 单品总利润 × 10% ÷ 对应轮次人数`
|
||||||
|
|
||||||
|
**升级版——合伙人模式**:
|
||||||
|
- 代言人满足条件后升级为合伙人,享受全平台销售利润约 20% 的分红
|
||||||
|
- `合伙人奖励 = 全平台销售利润 × 20% × 轮次比例 ÷ 轮次人数`
|
||||||
|
- 身份可叠加(代言人 + 合伙人 + 高级合伙人),获取多重收益[^8][^9][^24]。
|
||||||
|
|
||||||
|
**适用场景**:私域电商、美妆、大健康等高毛利单品,需强用户信任的品类。
|
||||||
|
|
||||||
|
**合规风险**:**高**。本质是"排队免单"的包装版本——用后续消费者的钱为早期用户返利。当新用户增长放缓时,整个分红体系面临崩溃风险。部分 SaaS 平台(微三云)将其包装为合规方案,但核心机制仍存在庞氏特征[^8][^10][^18]。
|
||||||
|
> ⚠️ 注:代言人模式的法律定性在司法实践中**存在分歧**,不同法院对"消费排名分红"是否构成传销的认定标准不统一。目前缺乏针对该模式的专项司法判例或监管通报,以下结论基于模式特征的类比分析,非确定性法律意见。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4.4 消费返利(Consumption Rebate/Cashback)
|
||||||
|
|
||||||
|
**运作机制**:消费者购买商品后,平台按一定规则返还部分或全部消费金额。
|
||||||
|
|
||||||
|
**主要变体**:
|
||||||
|
|
||||||
|
| 变体 | 机制 | 合规性 |
|
||||||
|
|------|------|--------|
|
||||||
|
| 信用卡式返利 | 固定比例小额返利(0.5-5%),从平台利润中拨付 | 合法 |
|
||||||
|
| Fun 模式 | 固定比例小额返利,资金来源透明 | 合法 |
|
||||||
|
| 盲返模式 | 随机小额返利 | 合法 |
|
||||||
|
| 积分增值模式 | 消费获积分,积分在奖金池增值后每日按比例释放 | 灰色地带 |
|
||||||
|
| **消费全返** | 承诺 100% 返还消费金额 | **刑事犯罪** |
|
||||||
|
|
||||||
|
**权威定性(最高检)**:
|
||||||
|
"消费全返"三大刑事风险——违规设立资金池、变相吸纳公众资金(借新还旧/拆东补西,庞氏特征)、涉嫌传销或非法集资。三类适用罪名:非法吸收公众存款罪、集资诈骗罪、组织领导传销活动罪[^12][^15][^16][^17]。
|
||||||
|
|
||||||
|
**合规推三返一模式**:邀请 3 人完成消费后返还自身消费额——融合裂变+返利,但控制在合法范围内[^21]。
|
||||||
|
|
||||||
|
**适用场景**:平台启动期快速获客(需谨慎合规设计)。
|
||||||
|
|
||||||
|
**合规风险**:**极高**(全返模式)/ **低**(小额返利模式)。关键区分在于返利上限、资金来源和层级深度[^12][^14][^15]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4.5 消费免单(Free-Order Model / 排队免单)
|
||||||
|
|
||||||
|
**运作机制**:消费后按 FIFO(先进先出)进入虚拟队列,平台将每笔订单利润的 10-30% 注入免单池,队列前方用户逐步获得免单。
|
||||||
|
|
||||||
|
**核心算法变体**:
|
||||||
|
|
||||||
|
| 变体 | 机制 | 示例 |
|
||||||
|
|------|------|------|
|
||||||
|
| 进 5 出 5 | 每新增 5 笔同金额订单,队列前 5 名各获返利 | 5 人同时免单 |
|
||||||
|
| 进 3 出 1 | 每 3 单利润完成 1 人免单 | 100 元商品利润 70 元,约 33 元入池 |
|
||||||
|
| 贡献值排序 | 贡献值 = 消费金额×1 + 邀请人数×100 + 复购次数×50,每日按排名释放约 5% 免单名额 | 综合贡献排名优先 |
|
||||||
|
|
||||||
|
**典型案例——城市酷选**:
|
||||||
|
- 2026 年 4 月港股 GEM 上市(08050.HK),估值超 10 亿元
|
||||||
|
- 宣称覆盖 80 万+商户、9000 万+用户,年交易规模超百亿元
|
||||||
|
- 2025H1 营收约 2194 万港元,净利 1115 万港元(主要依赖一次性收入 1611 万港元)
|
||||||
|
- 核心争议:排队免单本质是用新增用户资金为老用户返利,高度依赖持续增长,存在庞氏特征风险[^22][^23][^24]。
|
||||||
|
|
||||||
|
**适用场景**:高频刚需、实体店引流(餐饮、零售、美业、异业联盟)。
|
||||||
|
|
||||||
|
**合规风险**:**高**。缺乏权威司法判例明确判定"排队免单"是否构成传销,但永倍达崩盘案例(见第 10 节)已给出强烈警示信号[^10][^18][^25][^29]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 层级身份体系类模式
|
||||||
|
|
||||||
|
### 5.1 区域代理(Regional Agent Model)
|
||||||
|
|
||||||
|
**运作机制**:按行政区域(省/市/区/县)划分代理权,代理商获得地理区域内的排他性权益。所有配送到该区域的订单均产生区域分红。
|
||||||
|
|
||||||
|
**分润计算**:
|
||||||
|
- 从商品利润中切出佣金池(通常 10-30% 的产品利润)
|
||||||
|
- 常见分配:100 元商品 20 元利润 → 区域代理获 30% × 20 元 = 6 元区域分红
|
||||||
|
- 按配送地址匹配自动归属
|
||||||
|
- 业绩奖励:区域月 GMV 达标,比例增加 1-3 个百分点
|
||||||
|
|
||||||
|
**收入结构**:区域 GMV 分红(2-15%)+ 个人推广佣金双重收入[^1][^3]。
|
||||||
|
|
||||||
|
**适用场景**:有线下服务需求的品牌、需要本地化运营的区域性业务、连锁加盟体系。
|
||||||
|
|
||||||
|
**合规风险**:**低**。分红基于地理区域而非推荐链条,不触发传销三要素[^12][^20]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5.2 股东分红(Shareholder Dividend Model)
|
||||||
|
|
||||||
|
**运作机制**:顶级分销商被指定为"虚拟股东"(无实际股权),参与平台级别的利润分红。
|
||||||
|
|
||||||
|
**循环购模型(具体实现)**:
|
||||||
|
- 平台将每笔销售额的 20% 注入分红池
|
||||||
|
- 分为 10 份,每份 2%
|
||||||
|
- 各层级股东参与对应层级的分红
|
||||||
|
- 高级别股东可同时参与所有低级别分红(叠加效应)
|
||||||
|
- 例如:钻石股东获得 5 层 × 2% = 10% 的综合分红率[^8]。
|
||||||
|
|
||||||
|
**分红池比例**:通常为平台收入的 5-20%。中伦律所建议上限为净利润的 20%[^12][^20]。
|
||||||
|
|
||||||
|
**适用场景**:已有一定用户基础和稳定流水的成熟平台。
|
||||||
|
|
||||||
|
**合规风险**:**极高**。在传销三要素(拉人头、入门费、团队计酬)审查中最易触发:
|
||||||
|
- "股东"称谓暗示不存在的股权,构成误导披露
|
||||||
|
- 分红池由新成员入场费资助 → 入门费
|
||||||
|
- 分红基于下线体量而非个人销售 → 团队计酬
|
||||||
|
- 严格需有实际商品交易支撑、控制分红比例、避免拉人头关联[^12][^20]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5.3 福利区(Welfare/Benefit Zone)
|
||||||
|
|
||||||
|
> 📌 说明:"福利区"作为独立模式的概念在公开资料中缺乏权威定义,各平台使用方式不一。本节基于行业通用实践归纳,可能在不同语境下含义有所不同。
|
||||||
|
|
||||||
|
**运作机制**:作为分销层级的附加权益层,达到特定等级的用户获得专属福利:
|
||||||
|
- 更高佣金比例
|
||||||
|
- 专属低价商品
|
||||||
|
- 免运费、优先客服
|
||||||
|
- 积分倍率加成
|
||||||
|
- 积分商城准入
|
||||||
|
|
||||||
|
**本质**:留存激励——让高等级用户感受到实质性差异。福利由平台营销预算资助,不直接与额外收入挂钩[^4][^7]。
|
||||||
|
|
||||||
|
**合规风险**:**低**。属于常规营销手段,不涉及多层级分润[^7]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5.4 任务奖励(Task-Based Rewards)
|
||||||
|
|
||||||
|
**运作机制**:完成特定行为/里程碑后获得一次性或周期性奖励。
|
||||||
|
|
||||||
|
| 任务类型 | 示例 | 奖励 |
|
||||||
|
|---------|------|------|
|
||||||
|
| 新手任务 | 首次推荐 | 5 元现金 |
|
||||||
|
| 阶梯任务 | 邀请 10 人 / 50 人 | 50 元 / 200 元 + 等级升级 |
|
||||||
|
| 签到任务 | 每日签到 / 7 天连签 | 10 积分/天 / 额外 50 积分 |
|
||||||
|
| 消费任务 | 累计消费 99/299/599 元 | 解锁更高价值任务 |
|
||||||
|
| 复购任务 | 30 天内复购 | 额外返利/积分 |
|
||||||
|
|
||||||
|
**计算方式**:从固定营销预算中拨付,按固定金额或积分倍率计算。
|
||||||
|
|
||||||
|
**适用场景**:所有分销平台的新手引导和日常活跃。
|
||||||
|
|
||||||
|
**合规风险**:**低**。奖励绑定具体行为而非推荐链条,最安全的模式之一[^7][^13]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5.5 阶梯返利(Tiered Rebate)
|
||||||
|
|
||||||
|
**运作机制**:返利比例随累计销量递增。两种实现方式:
|
||||||
|
|
||||||
|
| 类型 | 说明 | 示例 |
|
||||||
|
|------|------|------|
|
||||||
|
| 阶梯奖励(非累计) | 达到更高级别后替换低级别比例 | 月销 10 万以下 5%,10-50 万 8%,50 万以上 12% |
|
||||||
|
| 循环奖励(累计) | 奖励可重复获得,达到门槛即重置 | 每满 1 万元返利一次,循环触发 |
|
||||||
|
|
||||||
|
**经销商模型示例**:基础返利 3%,季度销售超 1000 万 → 额外 2% 目标奖 + 2 万元固定奖金[^9][^13]。
|
||||||
|
|
||||||
|
**适用场景**:经销商/代理商体系、有明确销量目标的渠道管理。
|
||||||
|
|
||||||
|
**合规风险**:**低-中**。返利基于实际销量而非推荐人数,通常安全[^13]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. 混合模式与创新变体
|
||||||
|
|
||||||
|
### 6.1 链动 2+1 + 级差 + 区域代理(混合模式)
|
||||||
|
|
||||||
|
许多平台将多种模式组合使用:
|
||||||
|
- 底层:链动 2+1 实现快速裂变
|
||||||
|
- 中层:级差分润维持代理升级动力
|
||||||
|
- 顶层:区域代理/股东分红锁定核心分销商
|
||||||
|
|
||||||
|
### 6.2 盲返模式
|
||||||
|
|
||||||
|
随机小额返利,消费者无法预期返利金额。通过不可预期性降低庞氏风险,同时保持用户参与感[^22]。
|
||||||
|
|
||||||
|
### 6.3 推三返一
|
||||||
|
|
||||||
|
融合社交裂变 + 消费返利——邀请 3 人完成消费后返还自身消费额。控制在合法范围内(仅 1 层间接推荐)[^21]。
|
||||||
|
|
||||||
|
### 6.4 异业联盟 + 排队免单
|
||||||
|
|
||||||
|
城市酷选采用的模式——不同行业商户联盟,消费者在 A 店消费后可在 B 店获得排队免单资格,跨行业互相引流[^22][^23][^24]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. 中国法律合规框架
|
||||||
|
|
||||||
|
### 7.1 核心法规
|
||||||
|
|
||||||
|
| 法规 | 关键内容 |
|
||||||
|
|------|---------|
|
||||||
|
| 《禁止传销条例》(2005)第 7 条 | 定义传销三类型:入门费、拉人头、团队计酬 |
|
||||||
|
| 《刑法》第 224 条之一 | 组织、领导传销活动罪 |
|
||||||
|
| "两高一部"公通字〔2013〕37 号 | 刑事立案标准:30 人以上且三级以上层级 |
|
||||||
|
| 《直销管理条例》(2005) | 佣金总额不得超过销售额的 30% |
|
||||||
|
| 法答网精选答问(2024) | 最新传销罪司法认定指导 |
|
||||||
|
|
||||||
|
### 7.2 传销三要素
|
||||||
|
|
||||||
|
| 要素 | 定义 | 触发场景 |
|
||||||
|
|------|------|---------|
|
||||||
|
| **入门费** | 交纳费用或认购商品变相交费取得加入资格 | 高价礼包强制购买 |
|
||||||
|
| **拉人头** | 以发展人员数量作为计酬或返利依据 | 推荐人数直接决定收入 |
|
||||||
|
| **团队计酬** | 以直接或间接发展人员业绩为依据计算报酬 | 多级下线业绩提成 |
|
||||||
|
|
||||||
|
**法律认定**:
|
||||||
|
|
||||||
|
- "入门费"+"拉人头"→ 构成传销,可追究刑事责任(《刑法》第 224 条之一)
|
||||||
|
- 仅"团队计酬"→ 以实际销售商品为目的、以销售业绩为计酬依据的,**不作为犯罪处理**;但若以团队计酬为名、实际骗取财物的,仍按组织、领导传销活动罪定罪(2013 年"两高一部"司法解释)
|
||||||
|
- 行政处罚(《禁止传销条例》)对三类型均有覆盖,无刑事立案的 30 人/3 级门槛限制
|
||||||
|
|
||||||
|
> ⚠️ 注意:实务中三要素往往交织出现,但"团队计酬"在刑法与行政法规中的定性存在差异——刑事上以销售为目的的团队计酬不构成犯罪,行政上仍可能被认定为传销并处罚。
|
||||||
|
|
||||||
|
### 7.3 合法分销 vs 传销对照
|
||||||
|
|
||||||
|
| 维度 | 合法分销 | 传销 |
|
||||||
|
|------|---------|------|
|
||||||
|
| 计酬依据 | 实际销售业绩 | 发展人员数量 |
|
||||||
|
| 入门门槛 | 免费注册或低门槛 | 高额费用/高价商品 |
|
||||||
|
| 商品定价 | 市场合理价格 | 严重背离价值 |
|
||||||
|
| 层级关系 | 有限(2-3 级) | 无限层级金字塔 |
|
||||||
|
| 退货机制 | 完善退换货 | 无或设置障碍 |
|
||||||
|
| 收入来源 | 商品销售利润 | 新成员入会费 |
|
||||||
|
|
||||||
|
### 7.4 合规安全设计清单
|
||||||
|
|
||||||
|
> ⚠️ 重要法律提示:"2 级以内" 并非法律明文豁免条款,而是行业实务中的**审慎做法**。根据 2013 年"两高一部"司法解释,"30 人以上且三级以上"仅为**刑事立案标准**,不代表低于此标准即合法。即使仅 2 级,若存在高价入门费、拉人头计酬、无真实交易等情形,仍可能被行政处罚(《禁止传销条例》第 7 条无层级门槛)。合规的核心在于**以真实商品交易为基础、不以发展人员数量为主要计酬依据**。
|
||||||
|
2. 总佣金拨出率控制在营业额的 **20-30%** 以内
|
||||||
|
3. 所有奖励必须基于**实际商品交易**
|
||||||
|
4. 商品定价合理,**不以高价低质商品为道具**
|
||||||
|
5. 用户**自由选择**是否成为分销员,无强制
|
||||||
|
6. 设置每日/每周/每月**奖金封顶**
|
||||||
|
7. 完善**退换货**机制
|
||||||
|
8. 通过**灵活用工平台**处理分销员收入税务
|
||||||
|
9. 用语合规:避免"上下线""拉人头""提成"等敏感词
|
||||||
|
10. 不强制代理商**囤货压库存**
|
||||||
|
11. 关注《禁止传销条例》修订动态(2025 年立法计划中)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. 行业实践与平台案例
|
||||||
|
|
||||||
|
### 8.1 拼多多——拼团裂变标杆
|
||||||
|
|
||||||
|
- **模式**:拼团 + 砍价 + 社交分享
|
||||||
|
- **数据**:2025 年营收 4318.5 亿元(+10%),年活买家 7.2 亿
|
||||||
|
- **演进**:国内增长见顶 → Temu 海外承接增长(GMV 970 亿美元)
|
||||||
|
- **战略转向**:"千亿扶持"计划(3 年 1000 亿元),从"低价掠夺"到"生态共建"[^6]。
|
||||||
|
|
||||||
|
### 8.2 云集——从传销到退市的衰退弧
|
||||||
|
|
||||||
|
- 2017 年因三级分销涉传销被罚 958 万元
|
||||||
|
- 历经多轮"合规转型":三级→两级→会员制→私域→平台化
|
||||||
|
- 纳斯达克上市 4 年后市值缩水 99%,2024 年被退市警示
|
||||||
|
- 核心教训:每"整改"一次就失去一层增长动力[^6][^7]。
|
||||||
|
|
||||||
|
### 8.3 花生日记——天价罚单后存活
|
||||||
|
|
||||||
|
- 2019 年因 51 级传销链被罚 7456 万元(社交电商最大罚单)
|
||||||
|
- 2021 年行政复议改罚 904 万元
|
||||||
|
- 持续运营至今,宣称用户超 1 亿,但行业热度大幅下降[^6]。
|
||||||
|
|
||||||
|
### 8.4 永倍达崩盘——千亿资金盘覆灭
|
||||||
|
|
||||||
|
- 天津铸源旗下,"消费返利+社交电商"模式
|
||||||
|
- 三年运营,约 1100 万用户无法提现
|
||||||
|
- 全国 20 余省市联合定性传销+非法集资
|
||||||
|
- 平台层级多达 15 层(远超 3 层刑事标准)
|
||||||
|
- 2025 年 7 月安徽中院终审裁定构成传销[^25][^26][^27][^28][^29]
|
||||||
|
> ⚠️ 数据来源说明:本节数据主要来源于行业自媒体综合报道(知乎专栏等),截至本报告完成时,尚无法通过中国裁判文书网获取该案完整判决书原文。核心事实(层级数、用户规模)在多源报道中交叉一致,但精确金额数据可能存在偏差。
|
||||||
|
|
||||||
|
### 8.5 城市酷选——排队免单模式港股上市
|
||||||
|
|
||||||
|
- 2026 年 4 月港股 GEM 上市(08050.HK),估值超 10 亿元
|
||||||
|
- 宣称覆盖 80 万+商户、9000 万+用户、年交易规模超百亿
|
||||||
|
- 招股书将平台定位为"SaaS 软件服务商"以规避监管风险
|
||||||
|
- 核心争议:排队免单资金池透明度不足,高度依赖持续增长[^22][^23][^24]。
|
||||||
|
|
||||||
|
### 8.6 SaaS 平台分销功能
|
||||||
|
|
||||||
|
| 平台 | 模式 | 分销能力 |
|
||||||
|
|------|------|---------|
|
||||||
|
| 有赞 | SaaS 年费制 | 无限级代理、多级分销、自动化结算 |
|
||||||
|
| 微三云 | 源码买断 | 100+ 种分销模式(链动2+1、排队补贴等) |
|
||||||
|
| HiShop | 老牌系统商 | 推客分销、微信小店适配、按效果付费 |
|
||||||
|
|
||||||
|
### 8.7 获客成本对比(CAC)
|
||||||
|
|
||||||
|
| 平台 | CAC(元/人) | 说明 |
|
||||||
|
|------|-------------|------|
|
||||||
|
| 拼多多(2018-2019 早期) | 5-7 | 社交裂变极致优化,当前已大幅上升 |
|
||||||
|
| 抖音广告(2024-2025) | ~2.0(CPE) | 内容驱动 |
|
||||||
|
| 小红书地推(2024) | ~32 | 线下拉新 |
|
||||||
|
| 行业平均(2024) | 50-100+ | 全行业同比上涨 23% |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. 模式对比与选型建议
|
||||||
|
|
||||||
|
### 9.1 模式选型矩阵
|
||||||
|
|
||||||
|
| 业务特征 | 推荐模式 | 备选模式 | 风险等级 |
|
||||||
|
|---------|---------|---------|---------|
|
||||||
|
| 高毛利单品(美妆/大健康) | 链动2+1 | 代言人+级差 | 中 |
|
||||||
|
| 低价标品(日用品/农产品) | 拼团分销 | 社交裂变 | 低 |
|
||||||
|
| 订阅制产品 | 矩阵制 | 太阳线 | 中 |
|
||||||
|
| 区域化业务 | 区域代理+级差 | 区域代理+团队分红 | 低 |
|
||||||
|
| 冷启动获客 | 直推奖+任务奖励 | 社交裂变+拼团 | 低 |
|
||||||
|
| 成熟平台留存 | 福利区+阶梯返利 | 团队分红 | 低 |
|
||||||
|
| 会员制数字产品 | 双轨制+对碰奖 | 太阳线+级差 | 高 |
|
||||||
|
|
||||||
|
### 9.2 拨出率安全线
|
||||||
|
|
||||||
|
| 模式 | 安全拨出率 | 危险拨出率 |
|
||||||
|
|------|-----------|-----------|
|
||||||
|
| 级差分润 | ≤30% | >40% |
|
||||||
|
| 链动2+1 | 50-62%(因产品定价已含溢价) | >70% |
|
||||||
|
| 双轨制(对碰+层碰) | ≤15% | >20% |
|
||||||
|
| 团队分红 | ≤10% | >15% |
|
||||||
|
| 消费返利 | ≤5% | >30% |
|
||||||
|
|
||||||
|
### 9.3 模式组合安全示例
|
||||||
|
|
||||||
|
**低风险组合(推荐)**:
|
||||||
|
- 直推奖(10%)+ 级差分润(2 级,20%)+ 区域代理(3%)= 总拨出 33%
|
||||||
|
- 链动2+1(60%)+ 任务奖励(固定预算)= 总拨出 62-65%
|
||||||
|
|
||||||
|
**高风险组合(避免)**:
|
||||||
|
- 对碰奖(10%)+ 层碰奖(5%)+ 量碰奖(3%)+ 间推奖(3 代)→ 拨出率不可控,层级超限
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. 核心争议与风险提示
|
||||||
|
|
||||||
|
### 10.1 法律灰色地带
|
||||||
|
|
||||||
|
1. **"三级"界限的误解**:法律并无"三级以下合法、三级以上非法"的明确数字界定。"30 人以上且三级以上"仅是刑事立案标准(2013 年"两高一部"司法解释),不代表低于此标准即合法。行政处罚(《禁止传销条例》第 7 条)无层级门槛——即使仅 2 级,若存在高价入门费、拉人头计酬、无真实交易,仍可被行政处罚。合规的核心在于以真实商品交易为基础、不以发展人员数量为主要计酬依据[^3][^17][^19]。
|
||||||
|
|
||||||
|
2. **链动 2+1 的法律地位**:虽设计初衷为合规,但至今未经大规模法院检验。若产品定价虚高或运营偏离真实销售,仍可能被认定为传销[^2][^3]。
|
||||||
|
|
||||||
|
3. **排队免单的定性**:缺乏权威司法判例明确判定。城市酷选的"SAAS 软件服务商"定位能否经得起法律检验尚无结论[^10][^24]。
|
||||||
|
|
||||||
|
4. **《禁止传销条例》修订中**:2025 年立法计划包含修订,预计将细化社交电商边界[^7][^16]。
|
||||||
|
|
||||||
|
### 10.2 庞氏风险警示
|
||||||
|
|
||||||
|
**永倍达案例**(2024 年崩盘)是最强烈的警示信号:
|
||||||
|
- 15 层传销结构、约 1100 万用户、近千亿流水规模
|
||||||
|
- 即便持有直销牌照也无法规避定性
|
||||||
|
- 实控人被指转移约 12 亿元资金,受害者维权困难[^25][^26][^27][^28][^29]
|
||||||
|
- 2025 年 7 月安徽中院终审裁定构成传销[^29]
|
||||||
|
- 任何依赖"后续资金填补前期承诺"的模式(消费全返、排队免单、代言人轮次分红)均具有内在庞氏特征,无论是否持有直销牌照[^25][^26]。
|
||||||
|
|
||||||
|
> ⚠️ 数据来源说明:永倍达案的具体司法文书(判决书全文)截至 2026-05-06 尚无法通过中国裁判文书网公开获取。本节数据基于多家行业自媒体的交叉报道,核心事实(层级数、用户规模、定性结果)在多源中一致,但精确金额可能存在偏差。
|
||||||
|
|
||||||
|
### 10.3 可持续性数学
|
||||||
|
|
||||||
|
所有裂变/分润模式的可持续性取决于:
|
||||||
|
- **产品真实价值**:毛利能否覆盖拨出成本
|
||||||
|
- **复购率**:能否形成持续消费而非一次性拉新
|
||||||
|
- **裂变系数 F**:必须 F > 1 才能增长,但 F 过高加速触顶
|
||||||
|
- **CAC/LTV 比**:获客成本 vs 用户生命周期价值
|
||||||
|
- **资金池透明度**:是否有独立第三方审计[^3][^6]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 附录:术语表
|
||||||
|
|
||||||
|
| 术语 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| 波比 | 总拨出率/ payout ratio,佣金占售价的比例 |
|
||||||
|
| 直推 | 直接推荐的下级成员 |
|
||||||
|
| 间推 | 间接推荐(下级的下级) |
|
||||||
|
| 大象腿 | 双轨制中一侧业绩远大于另一侧 |
|
||||||
|
| 走人 | 2+1 模式中升级后脱离原上线 |
|
||||||
|
| 留人 | 走人时将自己直推的成员留给原上线 |
|
||||||
|
| 帮扶 | 冻结部分收益直至下级也升级才释放 |
|
||||||
|
| 对碰 | 双轨制中左右两区业绩取小值碰撞 |
|
||||||
|
| 层碰 | 按层级逐层计算左右碰撞 |
|
||||||
|
| 量碰 | 剩余业绩再次按比例碰撞 |
|
||||||
|
| 平级奖 | 上下级等级相同时的补充奖励 |
|
||||||
|
| 级差 | 上下级佣金比例的差额 |
|
||||||
|
| 裂变系数 F | 每个用户平均带来的新用户数 |
|
||||||
|
| CAC | Customer Acquisition Cost,获客成本 |
|
||||||
|
| LTV | Lifetime Value,用户生命周期价值 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 免责声明
|
||||||
|
|
||||||
|
本报告为行业调研分析,不构成法律建议。具体分销模式的设计与运营应咨询专业法律顾问,确保符合当地法律法规。所有案例数据和平台信息来源于公开报道,可能存在时效性限制(AS_OF: 2026-05-06)。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 参考资料索引
|
||||||
|
|
||||||
|
[^1]: Zhihu — 链动2+1模式深度解析 (zhuanlan.zhihu.com/p/679418297) | secondary-industry | 2023 | Auth: 6
|
||||||
|
[^2]: Zhihu — 链动2+1违法传销深度分析 (zhuanlan.zhihu.com/p/572293043) | community | 2023 | Auth: 6
|
||||||
|
[^3]: Zhihu — 链动2+1合规Q&A (zhuanlan.zhihu.com/p/691665089) | community | 2023 | Auth: 6
|
||||||
|
[^4]: Zhihu — 直销奖金制度深度解析 (zhuanlan.zhihu.com/p/679093752) | community | 2023 | Auth: 7
|
||||||
|
[^5]: 脉脉 — 对碰/层碰/量碰奖金解析 | community | 2023 | Auth: 6
|
||||||
|
[^6]: 雪球/亿邦/创业邦等 — 拼多多/云集/社交电商行业分析 | journalism | 2024-2026 | Auth: 7-9
|
||||||
|
[^7]: 分润宝 — 分销模式及玩法 (fenrunbao.cn) | secondary-industry | 2024 | Auth: 6
|
||||||
|
[^8]: 腾讯云 — 代言人/合伙人模式微三云解析 | secondary-industry | 2023 | Auth: 6
|
||||||
|
[^9]: Finnciti — 量碰层碰拆分盘解析 | community | N/A | Auth: 5
|
||||||
|
[^10]: Zhihu — 排队免单消费变投资 (zhuanlan.zhihu.com/p/1969786292100370904) | community | 2024 | Auth: 6
|
||||||
|
[^11]: 分润宝 — 分销佣金级差模式 (fenrunbao.cn/xueyuan/fenrun_16185.html) | secondary-industry | 2024 | Auth: 7
|
||||||
|
[^12]: 中伦律师事务所 — 社交电商避免传销陷阱 (zhonglun.com) | secondary-industry | 2024 | Auth: 9
|
||||||
|
[^13]: 乔拓云 — 2026年分销体系佣金架构实战指南 | secondary-industry | 2026 | Auth: 8
|
||||||
|
[^14]: MBA智库百科 — 双轨制度 (wiki.mbalib.com) | academic | ongoing | Auth: 8
|
||||||
|
[^15]: Zhihu — 复购见单奖金制度 (zhuanlan.zhihu.com/p/1888562430512185859) | community | 2025 | Auth: 6
|
||||||
|
[^16]: 正信法学 — 禁止传销条例修订分析 | secondary-industry | 2025 | Auth: 7
|
||||||
|
[^17]: 阿里云开发者 — 链动2+1弊端解决方案 (developer.aliyun.com/article/1633401) | secondary-industry | 2024 | Auth: 7
|
||||||
|
[^18]: 最高人民检察院 — "消费全返"刑事风险 (spp.gov.cn) | official | 2019 | Auth: 10
|
||||||
|
[^19]: 最高检/最高法/公安部 — 传销刑事案件司法解释 (spp.gov.cn) | official | 2013 | Auth: 10
|
||||||
|
[^20]: Lexology — 社交电商合规深水区 (lexology.com) | secondary-industry | 2024 | Auth: 8
|
||||||
|
[^21]: Zhihu — 推三返一模式 (zhuanlan.zhihu.com/p/1889004163456806973) | community | 2024 | Auth: 5
|
||||||
|
[^22]: 城市酷选HKEX招股书 (hkexnews.hk) | official | 2025 | Auth: 9
|
||||||
|
[^23]: 艾瑞 — 城市酷选冲刺港股估值超10亿 (iresearch.cn) | secondary-industry | 2025 | Auth: 8
|
||||||
|
[^24]: 中华网 — 城市酷选商业模式合规深度解密 | journalism | 2026 | Auth: 6
|
||||||
|
[^25]-[^29]: Zhihu系列 — 永倍达崩盘/庭审/终审裁定报道 | journalism | 2024-2025 | Auth: 7-8
|
||||||
|
[^30]: 搜狐 — 排队免单模式深度剖析 | journalism | 2024 | Auth: 6
|
||||||
|
[^31]: 搜狐 — 消费返利商业模式蓝海分析 | secondary-industry | 2024 | Auth: 6
|
||||||
|
[^32]: 360万分销 — 排队免单模式解析 | secondary-industry | 2024 | Auth: 6
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
# 中国社交电商病毒式分销模式深度研究报告
|
||||||
|
|
||||||
|
**研究日期:** 2026-05-06
|
||||||
|
**模式覆盖:** 拼团分销 | 社交裂变 | 代言人模式 | 消费返利 | 消费免单
|
||||||
|
**资料来源:** 24篇(官方4篇、学术1篇、行业分析11篇、新闻报道3篇、社区5篇)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一、拼团分销(Group-Buying Distribution)
|
||||||
|
|
||||||
|
### 1.1 运作机制
|
||||||
|
|
||||||
|
拼团分销是拼多多首创的"社交+电商"核心模式。其运作流程如下 [1][3][19][20]:
|
||||||
|
|
||||||
|
1. **发起拼团**: 用户在平台上选择商品,看到两个价格——"单独购买价"(较高)和"拼团价"(较低,通常便宜30-70%)。
|
||||||
|
2. **社交分享**: 选择拼团价后,用户必须将拼团链接分享至微信等社交渠道。
|
||||||
|
3. **邀请参团**: 在规定时间(通常24小时)内,需凑齐指定人数(通常2-5人),拼团才能成功。
|
||||||
|
4. **成团/失败**: 成团则所有参与者以拼团价获得商品;若超时未凑齐人数则拼团失败,订单取消。
|
||||||
|
5. **裂变循环**: 每个被邀请参与的用户又可能发起新的拼团,形成裂变循环。
|
||||||
|
|
||||||
|
**底层逻辑**: 以低价为核心激励,以社交关系链为传播载体。拼多多通过"起量"——聚合分散需求,实现规模效应降低供货成本,从而支撑低价策略 [1][3][20]。
|
||||||
|
|
||||||
|
### 1.2 分润计算方式
|
||||||
|
|
||||||
|
- **价格差驱动**: 拼团价通常比单独购买价低30-70%,差价由平台补贴和商家让利共同承担。
|
||||||
|
- **获客成本**: 拼多多通过拼团获客成本低至约 **0.5元/人**,远低于传统电商50-100元/人的获客成本 [1][4]。
|
||||||
|
- **商家端**: 商家通过"以量换价"——牺牲单品利润换取订单量,通过规模效应降低成本。
|
||||||
|
- **平台端**: 拼多多早期通过百亿补贴承担差价,后期通过广告变现和商家佣金实现盈利。
|
||||||
|
|
||||||
|
### 1.3 适用场景
|
||||||
|
|
||||||
|
| 适合的商品类型 | 原因 |
|
||||||
|
|---------------|------|
|
||||||
|
| 生鲜农产品 | 高频刚需、低单价、易拼团 |
|
||||||
|
| 日用品/快消品 | 复购率高,用户不介意分享 |
|
||||||
|
| 白牌/无品牌商品 | 价格敏感型消费者为主 |
|
||||||
|
| 季节性/清仓商品 | 需要快速起量消化库存 |
|
||||||
|
|
||||||
|
**不适合**: 高单价商品(手机、家电)、奢侈品、私密性商品——用户不愿为小额折扣在社交圈分享。
|
||||||
|
|
||||||
|
### 1.4 优缺点
|
||||||
|
|
||||||
|
**优势:**
|
||||||
|
- 获客成本极低(0.5元/人 vs 行业50-100元)[1][4]
|
||||||
|
- 用户自传播,平台无需大量广告投放
|
||||||
|
- 通过"以量换价"优化供应链效率
|
||||||
|
- 天然适合下沉市场(三四线城市及以下)
|
||||||
|
|
||||||
|
**劣势:**
|
||||||
|
- 利润空间被持续压缩 [1]
|
||||||
|
- 过度分享可能导致社交关系透支,用户疲劳 [1]
|
||||||
|
- 营销补贴成本持续上升
|
||||||
|
- 低价策略可能损害品牌形象
|
||||||
|
|
||||||
|
### 1.5 合规风险
|
||||||
|
|
||||||
|
**风险等级: 低-中**
|
||||||
|
|
||||||
|
拼团分销本身是合法的商业促销模式。风险点在于:
|
||||||
|
- 若拼团机制设计为"拉人头获利"而非真实交易,可能触及传销红线
|
||||||
|
- 虚假拼团(平台操纵拼团人数)涉嫌虚假宣传
|
||||||
|
- 价格欺诈(先提价再打折)违反《价格法》
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二、社交裂变(Social Viral Growth)
|
||||||
|
|
||||||
|
### 2.1 运作机制
|
||||||
|
|
||||||
|
社交裂变是拼团模式的进化版,涵盖更广泛的病毒式增长玩法 [2][4][5][7]:
|
||||||
|
|
||||||
|
**核心公式: 裂变系数 F = 每个用户平均带来的新用户数**
|
||||||
|
- 当 **F > 1.5** 时即可形成指数级传播效应 [1]
|
||||||
|
|
||||||
|
**主要玩法:**
|
||||||
|
|
||||||
|
| 玩法 | 机制 | 典型场景 |
|
||||||
|
|------|------|---------|
|
||||||
|
| **砍价免费拿** | 用户分享商品链接,好友点击帮忙"砍价",砍到0元即可免费获得 | 拼多多"天天领现金" |
|
||||||
|
| **分享得红包/优惠券** | 分享链接后获得红包,好友注册双方均得奖励 | 瑞幸咖啡"送Ta咖啡" |
|
||||||
|
| **邀请解锁/助力** | 需要N位好友助力才能解锁优惠或权益 | 拼多多"助力免单" |
|
||||||
|
| **抽奖转盘** | 分享获得抽奖机会,奖励随机 | 各类小程序活动 |
|
||||||
|
|
||||||
|
**算法优化**: 平台通过算法建模精细化识别高传播意愿用户(活跃度高、社交关系广、历史参与率高),定向推送高激励任务 [1]。
|
||||||
|
|
||||||
|
### 2.2 分润计算方式
|
||||||
|
|
||||||
|
- **双向激励**: 邀请者和被邀请者均获得奖励(红包、优惠券、折扣),形成互利循环。
|
||||||
|
- **阶梯式奖励**: 邀请人数越多,奖励越丰厚(如邀请3人得5元,邀请5人得10元,邀请10人得30元)。
|
||||||
|
- **动态定价**: 平台根据用户价值模型动态调整激励金额,高价值用户获得更多激励。
|
||||||
|
- **预算控制**: 平台设定总预算池,根据ROI动态调整单个用户激励上限。
|
||||||
|
|
||||||
|
### 2.3 适用场景
|
||||||
|
|
||||||
|
| 场景 | 代表案例 |
|
||||||
|
|------|---------|
|
||||||
|
| 新用户拉新 | 拼多多、瑞幸咖啡、美团 |
|
||||||
|
| 日活提升 | 拼多多"天天领现金" |
|
||||||
|
| 节日促销 | 双十一、618期间的社交分享活动 |
|
||||||
|
| 私域流量运营 | 微信小程序商城的社群裂变 |
|
||||||
|
|
||||||
|
### 2.4 优缺点
|
||||||
|
|
||||||
|
**优势:**
|
||||||
|
- 极低成本获客,ROI远超传统广告
|
||||||
|
- 用户主动传播,信任背书强(来自朋友推荐)
|
||||||
|
- 可精准触达目标人群(通过社交关系链)
|
||||||
|
|
||||||
|
**劣势:**
|
||||||
|
- 过度依赖微信生态,受平台政策影响大(微信曾多次封杀拼多多链接)
|
||||||
|
- 用户对频繁分享请求产生疲劳感
|
||||||
|
- "薅羊毛"用户多,留存率低
|
||||||
|
- 需要持续投入补贴,停补即停增长
|
||||||
|
|
||||||
|
### 2.5 合规风险
|
||||||
|
|
||||||
|
**风险等级: 中**
|
||||||
|
|
||||||
|
- **《禁止传销条例》**: 若裂变机制涉及三级以上分销获利(发展下线并从中获利),涉嫌传销
|
||||||
|
- **《反不正当竞争法》**: 虚假宣传(如"100%中奖"实际极低概率)、诱导分享可能违法
|
||||||
|
- **微信生态风险**: 微信对诱导分享行为持续打击,链接可能被封杀
|
||||||
|
- **个人信息保护**: 收集用户社交关系链数据需符合《个人信息保护法》
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 三、代言人模式(Spokesperson/Ambassador Model)
|
||||||
|
|
||||||
|
### 3.1 运作机制
|
||||||
|
|
||||||
|
代言人模式是一种**以消费顺序排名为基础**的消费返利奖励机制,通常与合伙人模式结合使用 [8][9][24]:
|
||||||
|
|
||||||
|
**核心流程:**
|
||||||
|
|
||||||
|
1. **消费成为代言人**: 用户购买指定商品或完成消费,自动进入"代言人"排队序列。
|
||||||
|
2. **按消费时间排序**: 先消费的用户排在前面,后消费的排在后面。
|
||||||
|
3. **利润分成**: 平台从后续订单中抽取一定比例利润,分配给排在队列前面的代言人。
|
||||||
|
4. **免单出局**: 当某代言人累计获得的返利金额等于其消费金额时,该代言人"免单出局"。
|
||||||
|
5. **循环流转**: 出局后,队列中下一位自动成为首位,继续接收返利。
|
||||||
|
|
||||||
|
**双重身份叠加:**
|
||||||
|
|
||||||
|
| 身份 | 排名机制 | 特点 |
|
||||||
|
|------|----------|------|
|
||||||
|
| **代言人** | 以消费顺序排名 | 先下单者优先获返利 |
|
||||||
|
| **合伙人** | 以成为合伙人的时间顺序排名 | 需额外条件(如消费达到一定金额) |
|
||||||
|
| **高级合伙人** | 更高阶身份 | 享受更多奖励层级 |
|
||||||
|
|
||||||
|
代言人身份可与合伙人身份叠加,用户可同时获得两重奖励 [8][24]。
|
||||||
|
|
||||||
|
### 3.2 分润计算方式
|
||||||
|
|
||||||
|
典型的分润比例设定(以微三云等SaaS平台方案为例)[8][9][24]:
|
||||||
|
|
||||||
|
- **免单池比例**: 平台从每笔后续订单中抽取 **约40%** 注入免单奖金池
|
||||||
|
- **分配规则**: 排在队列首位的用户优先获得返利,直至其返利累计等于消费额
|
||||||
|
- **合伙人分红**: 合伙人额外享受平台总利润的一定比例(如5-15%)分红
|
||||||
|
- **高级合伙人**: 在合伙人基础上,额外享受区域或品类利润分成
|
||||||
|
|
||||||
|
### 3.3 适用场景
|
||||||
|
|
||||||
|
| 适合的业态 | 原因 |
|
||||||
|
|-----------|------|
|
||||||
|
| 大健康产品 | 高频复购、用户粘性强、适合排队返利机制 [10] |
|
||||||
|
| 美妆/护肤品 | 高毛利空间、复购率高 |
|
||||||
|
| 生活服务/到店消费 | 如"城市酷选"平台(年交易额破百亿)[23] |
|
||||||
|
| 社区团购 | 天然具备社交传播属性 |
|
||||||
|
|
||||||
|
### 3.4 优缺点
|
||||||
|
|
||||||
|
**优势:**
|
||||||
|
- 强烈刺激用户争先下单(排位机制制造紧迫感)
|
||||||
|
- 提升复购率和用户粘性
|
||||||
|
- 快速引流,用户主动分享推荐
|
||||||
|
- 商家增加销量,消费者获得返利——双赢效果 [10][11]
|
||||||
|
|
||||||
|
**劣势:**
|
||||||
|
- **高度依赖新订单持续流入**——一旦订单增速放缓,返利速度大幅下降
|
||||||
|
- 排队等待时间过长导致用户体验下降
|
||||||
|
- 需要平台具备足够的利润空间支撑返利
|
||||||
|
- 身份叠加增加系统复杂度,用户理解成本高
|
||||||
|
|
||||||
|
### 3.5 合规风险
|
||||||
|
|
||||||
|
**风险等级: 高**
|
||||||
|
|
||||||
|
代言人模式是当前监管重点关注的灰色地带:
|
||||||
|
|
||||||
|
- **涉嫌传销**: 若代言人/合伙人从"发展下线"中获利(而非从真实商品交易利润中分成),符合《禁止传销条例》对传销的定义
|
||||||
|
- **非法集资**: 排队免单本质上可能构成变相吸纳公众资金,当平台设立资金池时风险尤其高 [12][15]
|
||||||
|
- **法律定性模糊**: 代言人模式在不同地区司法实践中定性不一致——部分地区认定为合法促销,部分地区认定为变相传销
|
||||||
|
- **关键判断标准**:
|
||||||
|
- 是否有真实商品交易?(纯资金流转 = 非法)
|
||||||
|
- 返利来源是经营利润还是后来者资金?(后者 = 庞氏)
|
||||||
|
- 分销层级是否超过两级?(超过 = 涉嫌传销)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 四、消费返利(Consumption Rebate/Cashback)
|
||||||
|
|
||||||
|
### 4.1 运作机制
|
||||||
|
|
||||||
|
消费返利是指消费者在平台完成消费后,获得一定比例的现金或积分返还 [12][13][14][15][16][17][22]:
|
||||||
|
|
||||||
|
**合规模式:**
|
||||||
|
- **购物返积分**: 消费者获得积分,积分可用于下次消费抵扣(如天猫积分、京东京豆)
|
||||||
|
- **购物返现**: 消费后按固定比例返现至钱包(如淘宝返利、信用卡返现)
|
||||||
|
- **推三返一**: 用户邀请3人完成消费后返还自身消费额 [21]
|
||||||
|
|
||||||
|
**高风险模式:**
|
||||||
|
- **消费全返**: 承诺消费金额100%返还——实质是庞氏骗局 [12][15][16]
|
||||||
|
- **高额返利**: 返利比例超过合理商业利润范围(如消费100元返150元)
|
||||||
|
|
||||||
|
### 4.2 分润计算方式
|
||||||
|
|
||||||
|
| 模式 | 返利比例 | 资金来源 | 合规性 |
|
||||||
|
|------|---------|---------|--------|
|
||||||
|
| 购物返积分 | 1-5% | 商家营销预算 | 合规 |
|
||||||
|
| 信用卡返现 | 0.5-5% | 银行营销费用 | 合规 |
|
||||||
|
| 推三返一 | 33%(约) | 新增用户消费利润 | 灰色 |
|
||||||
|
| 消费全返 | 100% | 后来者资金 | **违法** |
|
||||||
|
|
||||||
|
**合规边界** [12][14][17]:
|
||||||
|
- 返利金额需设定合理上限(通常不超过消费额的30%)
|
||||||
|
- 商品定价需合理、正常纳税
|
||||||
|
- 严禁设立资金池
|
||||||
|
- 分销层级不超过两级
|
||||||
|
|
||||||
|
### 4.3 适用场景
|
||||||
|
|
||||||
|
| 模式 | 适合业态 |
|
||||||
|
|------|---------|
|
||||||
|
| 积分返利 | 电商、航司、酒店、餐饮连锁 |
|
||||||
|
| 现金返利 | 信用卡、比价购物平台 |
|
||||||
|
| 推三返一 | 社交电商、社区团购 |
|
||||||
|
|
||||||
|
### 4.4 优缺点
|
||||||
|
|
||||||
|
**优势:**
|
||||||
|
- 提升用户复购率和留存率
|
||||||
|
- 积分/返利可锁定用户后续消费
|
||||||
|
- 合规的积分模式风险低
|
||||||
|
|
||||||
|
**劣势:**
|
||||||
|
- 高额返利模式必然导致资金链断裂
|
||||||
|
- 用户可能只为返利消费,而非真实需求
|
||||||
|
- 平台需承担返利成本和税务处理复杂性
|
||||||
|
|
||||||
|
### 4.5 合规风险
|
||||||
|
|
||||||
|
**风险等级: 极高(对高额返利/全返模式)**
|
||||||
|
|
||||||
|
**最高人民检察院明确分析** [12]: "消费全返"模式存在三大刑事风险:
|
||||||
|
1. 违规设立资金池,规避互联网金融和第三方支付监管
|
||||||
|
2. 变相吸纳公众资金
|
||||||
|
3. 庞氏骗局特征——用后来者的钱支付早期参与者的返利
|
||||||
|
|
||||||
|
**涉嫌罪名** [12][15][16][18]:
|
||||||
|
- **非法吸收公众存款罪**: 未经许可,通过消费返利模式变相吸收公众资金
|
||||||
|
- **集资诈骗罪**: 以非法占有为目的,使用诈骗方法非法集资
|
||||||
|
- **组织、领导传销活动罪**: 以发展人员数量作为计酬依据
|
||||||
|
|
||||||
|
**公安部预警** [16]: 多家以"消费返利""购物返本"为模式的网站已被立案调查,属国家级监管重点。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 五、消费免单(Free-Order / Consumption-to-Earn-Free)
|
||||||
|
|
||||||
|
### 5.1 运作机制
|
||||||
|
|
||||||
|
消费免单(又称"排队免单")是代言人模式的具象化实现 [10][11][23]:
|
||||||
|
|
||||||
|
**排队免单完整流程:**
|
||||||
|
|
||||||
|
```
|
||||||
|
用户A消费100元 → 进入排队序列(第1位)
|
||||||
|
用户B消费100元 → 进入排队序列(第2位)
|
||||||
|
用户C消费100元 → 进入排队序列(第3位)
|
||||||
|
↓
|
||||||
|
平台从B的100元中抽取40元 → 注入免单池 → 分配给A
|
||||||
|
平台从C的100元中抽取40元 → 注入免单池 → 分配给A
|
||||||
|
↓
|
||||||
|
A累计获得80元返利(还需20元即可免单)
|
||||||
|
用户D消费100元 → 抽取40元 → A获得20元(已免单出局)+ 平台留存20元
|
||||||
|
↓
|
||||||
|
A出局后,B自动成为队列第1位,继续接收后续返利
|
||||||
|
```
|
||||||
|
|
||||||
|
**关键参数** [10][11][23]:
|
||||||
|
- 免单池抽取比例: 通常30-40%
|
||||||
|
- 免单条件: 累计返利 = 消费金额
|
||||||
|
- 出局机制: 免单后退出队列,下一位自动递补
|
||||||
|
|
||||||
|
**城市酷选案例**: 该模式在线上线下消费场景落地,据称年交易额突破百亿元 [11][23]。
|
||||||
|
|
||||||
|
### 5.2 分润计算方式
|
||||||
|
|
||||||
|
- **商家**: 每笔订单获得60-70%收入(扣除免单池30-40%+平台服务费)
|
||||||
|
- **消费者**: 通过排队获得全额免单(但等待时间不确定)
|
||||||
|
- **平台**: 获得免单池剩余部分 + 服务费
|
||||||
|
- **推荐关系**: 若A推荐B消费,A可能额外获得B消费额的一定比例(如5-10%)
|
||||||
|
|
||||||
|
### 5.3 适用场景
|
||||||
|
|
||||||
|
| 场景 | 代表案例 |
|
||||||
|
|------|---------|
|
||||||
|
| 到店消费 | 城市酷选(餐饮、娱乐、生活服务)[23] |
|
||||||
|
| 线上商城 | 各类社交电商平台 |
|
||||||
|
| 大健康 | 高频复购的健康产品 [10] |
|
||||||
|
| 社区服务 | 社区团购、本地生活 |
|
||||||
|
|
||||||
|
### 5.4 优缺点
|
||||||
|
|
||||||
|
**优势:**
|
||||||
|
- "免费消费"的心理冲击力强,引流效果显著
|
||||||
|
- 排序机制制造紧迫感,刺激用户争先下单
|
||||||
|
- 提升复购率和用户粘性
|
||||||
|
- 商家虽然让利但增加了客流
|
||||||
|
|
||||||
|
**劣势:**
|
||||||
|
- 免单等待时间不可控(取决于后续订单量)
|
||||||
|
- 高度依赖持续的新订单流入
|
||||||
|
- 平台利润被免单池严重压缩
|
||||||
|
- 用户若长期排队未出局会产生信任危机
|
||||||
|
|
||||||
|
### 5.5 合规风险
|
||||||
|
|
||||||
|
**风险等级: 高**
|
||||||
|
|
||||||
|
排队免单模式面临的法律挑战 [10][12][15][16]:
|
||||||
|
- **资金池风险**: 免单池本质上是平台控制的资金池,若缺乏监管可能演变为非法集资
|
||||||
|
- **庞氏结构**: 用后来消费者的钱支付先消费者的返利——当新用户增速放缓时资金链断裂
|
||||||
|
- **传销风险**: 若免单机制中包含"拉人头获利"的层级返利,可能构成传销
|
||||||
|
- **消费者权益**: 免单承诺无法兑现时的消费者权益保护问题
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 六、模式对比总结
|
||||||
|
|
||||||
|
| 维度 | 拼团分销 | 社交裂变 | 代言人模式 | 消费返利 | 消费免单 |
|
||||||
|
|------|---------|---------|-----------|---------|---------|
|
||||||
|
| **核心驱动** | 价格差 | 病毒式分享 | 排队排序 | 现金返还 | 免费消费 |
|
||||||
|
| **获客成本** | 极低(0.5元) | 低 | 中 | 中-高 | 中 |
|
||||||
|
| **用户激励** | 省钱 | 奖励/红包 | 免单排队 | 返现/积分 | 全额免单 |
|
||||||
|
| **合规风险** | 低 | 中 | 高 | 极高 | 高 |
|
||||||
|
| **可持续性** | 高 | 中(依赖补贴) | 中(依赖新订单) | 低(高返利必崩) | 中(依赖订单量) |
|
||||||
|
| **适合阶段** | 全阶段 | 拉新/促活 | 增长期 | 不建议 | 增长期 |
|
||||||
|
| **代表平台** | 拼多多 | 拼多多/瑞幸 | 微三云方案 | Fun返利 | 城市酷选 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 核心争议 / Key Controversies
|
||||||
|
|
||||||
|
- **争议 1: 代言人/排队免单模式的法律定性** — 支持方认为该模式基于真实商品交易、返利来自经营利润,属合法促销 [8][24];反对方(最高检、公安部)指出该模式本质是"以新偿旧"的庞氏结构,涉嫌非法吸收公众存款和传销 [12][15][16][18]。
|
||||||
|
|
||||||
|
- **争议 2: 社交裂变的可持续性** — 拼多多模式在早期实现了极低获客成本,但随着用户增长见顶,补贴成本持续上升,社交疲劳导致裂变系数F下降至1以下 [1][3][4]。
|
||||||
|
|
||||||
|
- **争议 3: 消费返利 vs 消费全返的定量边界** — 监管未明确规定返利比例上限,"合理"与"非法"之间的灰色地带仍存 [12][14][17]。实践中,返利超过30%通常被视为高风险。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 关键发现摘要
|
||||||
|
|
||||||
|
1. 拼团分销和社交裂变是**低风险、高效率**的获客手段,已被拼多多验证为成功模式,获客成本可比传统电商低100倍 [1][4][19][20]。
|
||||||
|
2. 代言人模式和排队免单模式**处于合规灰色地带**——虽有真实交易基础,但资金池和"以新偿旧"机制使其接近非法集资结构 [8][12][15]。
|
||||||
|
3. "消费全返"已被**最高人民检察院、公安部明确定性为违法**,涉嫌非法吸收公众存款、集资诈骗和组织传销三项罪名 [12][15][16][18]。
|
||||||
|
4. 合规消费返利的关键红线:**不超过两级分销、返利来自真实经营利润、不设立资金池、不承诺100%返还** [12][14][17]。
|
||||||
|
5. 社交电商的未来趋势是**从"纯补贴驱动"向"价值驱动"转型**——通过产品差异化、供应链优化而非无底线的价格战实现增长 [3][19]。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 参考资料索引
|
||||||
|
|
||||||
|
详见 `/home/zdh/projects/.claude/skills/deep-research/research-notes/registry-c.md`
|
||||||
|
|
||||||
|
**官方来源 (4篇):** 最高人民检察院 [12]、公安部 [16]、北京市委金融办 [15]、最高人民法院 [18]
|
||||||
|
**学术来源 (1篇):** 汉斯出版社 [3]
|
||||||
|
**行业分析 (11篇):** [1][4][7][8][14][17][19][20][22][24] 等
|
||||||
|
**新闻报道 (3篇):** [6][11][13]
|
||||||
|
**社区来源 (5篇):** [2][5][9][10][21][23]
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*报告基于公开搜索结果摘要编写。由于网络环境限制,WebFetch未能成功抓取任何页面全文,所有信息均来自搜索引擎摘要。建议在决策前进一步核实关键数据和法律定性。*
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# CITATION REGISTRY
|
||||||
|
|
||||||
|
Built from: task-c.md
|
||||||
|
|
||||||
|
## Approved Sources
|
||||||
|
|
||||||
|
[1] 拼多多社交电商商业模式深度解析: 拼团裂变、下沉市场与算法推荐机制 — Sina财经 | https://cj.sina.cn/articles/view/7879848900/1d5acf3c401902we8s | Source-Type: secondary-industry | As Of: 2024-06 | Auth: 6 | From: task-c
|
||||||
|
[2] 实战: 解析互联网拼团裂变模式 — 知乎专栏 | https://zhuanlan.zhihu.com/p/258546036 | Source-Type: community | As Of: 2020-09 | Auth: 6 | From: task-c
|
||||||
|
[3] "社交+电商"模式的裂变与挑战——以拼多多为例 — 汉斯出版社(学术) | https://www.hanspub.org/journal/paperinformation?paperID=130599 | Source-Type: academic | As Of: 2024 | Auth: 7 | From: task-c
|
||||||
|
[4] 拼多多屡试不爽的裂变,你为什么玩不好? — 顶象 | https://www.dingxiang-inc.com/blog/post/297 | Source-Type: secondary-industry | As Of: 2023 | Auth: 7 | From: task-c
|
||||||
|
[5] 拼团、砍价、分销|用户要增长,裂变和转化才是关键 — 人人都是产品经理 | https://www.woshipm.com/operate/2295477.html | Source-Type: community | As Of: 2023 | Auth: 6 | From: task-c
|
||||||
|
[6] 社交裂变玩法中拼团与分销功能设计的优秀案例分享 — 搜狐 | https://www.sohu.com/a/902973212_100150288 | Source-Type: journalism | As Of: 2025-04 | Auth: 5 | From: task-c
|
||||||
|
[7] 拼多多在用户裂变增长模式上的独特方式方法及案例分析 — 商派 | https://www.shopex.cn/news/archives/17226.html | Source-Type: secondary-industry | As Of: 2023 | Auth: 6 | From: task-c
|
||||||
|
[8] 什么是代言人与合伙人模式?微三云深度解析 — 腾讯云 | https://cloud.tencent.com/developer/news/1014119 | Source-Type: secondary-industry | As Of: 2023-04 | Auth: 6 | From: task-c
|
||||||
|
[9] 2023新消费模式商城"代言人"+"合伙人"模式 — 知乎 | https://zhuanlan.zhihu.com/p/610766506 | Source-Type: community | As Of: 2023-03 | Auth: 5 | From: task-c
|
||||||
|
[10] 揭秘"排队免单":消费变投资 — 知乎 | https://zhuanlan.zhihu.com/p/1969786292100370904 | Source-Type: community | As Of: 2024 | Auth: 6 | From: task-c
|
||||||
|
[11] 排队免单模式全产业适配解析与真实案例复盘 — 搜狐 | https://www.sohu.com/a/1013343290_122699958 | Source-Type: journalism | As Of: 2025 | Auth: 5 | From: task-c
|
||||||
|
[12] "消费全返"为何存在刑事风险 — 最高人民检察院 | https://www.spp.gov.cn/spp/llyj/201907/t20190717_443375.shtml | Source-Type: official | As Of: 2019-07 | Auth: 9 | From: task-c
|
||||||
|
[13] 电商微商、消费返利?小心!有可能是新型传销 — 北京科技报 | https://www.bbtnews.com.cn/2021/1220/423361.shtml | Source-Type: journalism | As Of: 2021-12 | Auth: 7 | From: task-c
|
||||||
|
[14] 国家关于消费返利违法的认定与合规方案 — 启博 | https://www.qibo.com/article/44198.html | Source-Type: secondary-industry | As Of: 2024 | Auth: 6 | From: task-c
|
||||||
|
[15] 警惕"消费返利"非法集资陷阱 — 北京市委金融委员会办公室 | https://jrj.beijing.gov.cn/jrxcjy/jraq/ffffjzxkt/202405/t20240527_3695341.html | Source-Type: official | As Of: 2024-05 | Auth: 9 | From: task-c
|
||||||
|
[16] 关于"高额消费返利"类网站涉嫌违法犯罪预警 — 公安部 | https://www.mps.gov.cn:8090/n2253534/n2253535/c4143338/content.html | Source-Type: official | As Of: 2022 | Auth: 10 | From: task-c
|
||||||
|
[17] 销售模式介绍及法律风险探讨 — 中伦律师事务所 | https://www.zhonglun.com/research/articles/9588.html | Source-Type: secondary-industry | As Of: 2024 | Auth: 8 | From: task-c
|
||||||
|
[18] 人民法院依法惩治金融犯罪典型案例 — 最高人民法院 | https://www.court.gov.cn/zixun/xiangqing/372731.html | Source-Type: official | As Of: 2023 | Auth: 9 | From: task-c
|
||||||
|
[19] What's behind the success of China's social commerce app Pinduoduo — Econsultancy | https://econsultancy.com/what-s-behind-the-success-of-china-s-social-commerce-app-pinduoduo/ | Source-Type: secondary-industry | As Of: 2020-05 | Auth: 7 | From: task-c
|
||||||
|
[20] Pinduoduo and the rise of social e-commerce — YC Startup Library | https://www.ycombinator.com/library/2z-pinduoduo-and-the-rise-of-social-e-commerce | Source-Type: secondary-industry | As Of: 2020 | Auth: 7 | From: task-c
|
||||||
|
[21] 推三返一模式详细剖析 — 知乎 | https://zhuanlan.zhihu.com/p/1889004163456806973 | Source-Type: community | As Of: 2024 | Auth: 5 | From: task-c
|
||||||
|
[22] Fun消费返利模式:误区解析与实战策略 — 启博 | https://www.qibo.com/article/44239.html | Source-Type: secondary-industry | As Of: 2024 | Auth: 6 | From: task-c
|
||||||
|
[23] 城市酷选排队免单 — 知乎 | https://zhuanlan.zhihu.com/p/13117000993 | Source-Type: community | As Of: 2024 | Auth: 5 | From: task-c
|
||||||
|
[24] 教你读懂代言人+合伙人模式 — 腾讯云 | https://cloud.tencent.com/developer/news/1073579 | Source-Type: secondary-industry | As Of: 2023 | Auth: 6 | From: task-c
|
||||||
|
|
||||||
|
## Dropped
|
||||||
|
|
||||||
|
No sources dropped. All 24 sources meet lightweight threshold (Auth >= 5, diverse domains).
|
||||||
|
|
||||||
|
## Stats
|
||||||
|
|
||||||
|
Total evaluated: 24
|
||||||
|
Approved: 24
|
||||||
|
Dropped: 0
|
||||||
|
Unique domains: 13
|
||||||
|
Source-type: official 4 / academic 1 / secondary-industry 11 / journalism 3 / community 5
|
||||||
|
Max single-source share: 5/24 = 21% (pass - under 30% lightweight limit)
|
||||||
|
Official share: 4/24 = 17% — slightly below 20% lightweight target but acceptable given the topic (regulatory/legal content from government sources is well-represented)
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
# Research Notes: Chinese Social Commerce Distribution Models — Network Structure Analysis
|
||||||
|
|
||||||
|
**Date:** 2026-05-06
|
||||||
|
**Task:** Research 二加一连锁模式, 双轨制, 太阳线, 矩阵制 — mechanics, profit-sharing, use cases, pros/cons, compliance risks
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| # | URL | Source-Type | Accessibility | Date | Authority (1-10) |
|
||||||
|
|---|-----|-------------|---------------|------|-------------------|
|
||||||
|
| 1 | https://zhuanlan.zhihu.com/p/679418297 | Zhihu article (industry analysis) | Open | 2023 | 6 |
|
||||||
|
| 2 | https://zhuanlan.zhihu.com/p/572293043 | Zhihu article (legal analysis) | Open | 2023 | 6 |
|
||||||
|
| 3 | https://zhuanlan.zhihu.com/p/691665089 | Zhihu article (compliance Q&A) | Open | 2023 | 6 |
|
||||||
|
| 4 | https://www.weifenxiao.com/info/display/1954.html | Vendor site (Qibo/Weifenxiao) | Open | 2023-2024 | 5 |
|
||||||
|
| 5 | https://www.sohu.com/a/609318392_121606784 | Sohu article (legal analysis) | Open | 2023 | 5 |
|
||||||
|
| 6 | https://www.jubaozan.com/CaseDismantling/info.aspx?itemid=1065 | Vendor analysis page | Open | 2023 | 5 |
|
||||||
|
| 7 | https://developer.aliyun.com/article/1633401 | Aliyun developer article | Open | 2024-2025 | 6 |
|
||||||
|
| 8 | https://www.crmeb.com/ask/thread/40153 | CRMEB forum thread | Open | 2023 | 5 |
|
||||||
|
| 9 | https://cloud.tencent.com/developer/article/2577487 | Tencent Cloud developer article | Open | 2024-2025 | 6 |
|
||||||
|
| 10 | https://www.qibo.com/article/44931.html | Qibo vendor encyclopedia | Open | 2024 | 5 |
|
||||||
|
| 11 | https://www.sohu.com/a/277371611_100299982 | Sohu article (all MLM plans) | Open | 2018 | 5 |
|
||||||
|
| 12 | https://www.163.com/dy/article/G9GDCGLJ05428T8W.html | NetEase article (all plans) | Open | 2023 | 5 |
|
||||||
|
| 13 | https://wiki.mbalib.com/zh-tw/%E5%8F%8C%E8%BD%A8%E5%88%B6%E5%BA%A6 | MBA智库百科 (encyclopedia) | Open | Ongoing | 7 |
|
||||||
|
| 14 | https://zhuanlan.zhihu.com/p/554789751 | Zhihu article (微三云 analysis) | Open | 2022 | 5 |
|
||||||
|
| 15 | https://blog.csdn.net/lrj20030206/article/details/130014508 | CSDN technical blog | Open | 2023 | 5 |
|
||||||
|
| 16 | https://xueqiu.com/9448294601/238654967 | Xueqiu (financial analysis) | Open | 2023 | 6 |
|
||||||
|
| 17 | https://www.100ec.cn/detail--6638350.html | 网经社 legal analysis | Open | 2020 | 7 |
|
||||||
|
| 18 | https://www.lexology.com/library/detail.aspx?g=6f2dfc03-c164-47d8-8571-3876489b583c | Lexology (law firm) | Open | 2024 | 8 |
|
||||||
|
| 19 | https://www.dehenglaw.com/CN/tansiaocontent/0008/030694/7.aspx | DeHeng law firm analysis | Open | 2020 | 8 |
|
||||||
|
| 20 | https://maimai.cn/article/detail?fid=1853704803 | MaiMai (professional network) | Open | 2023 | 4 |
|
||||||
|
| 21 | https://m.92hi.com/news/7577.html | 商城网站建设 (vendor blog) | Open | 2024 | 4 |
|
||||||
|
| 22 | https://m.92hi.com/news/7578.html | 商城网站建设 (vendor blog) | Open | 2024 | 4 |
|
||||||
|
| 23 | https://zhuanlan.zhihu.com/p/561439553 | Zhihu (health supplement case) | Open | 2022 | 5 |
|
||||||
|
| 24 | https://jingdaily.com/posts/taking-advantage-of-multi-level-marketing-mlm-in-china | JingDaily (media) | Open | 2020s | 7 |
|
||||||
|
| 25 | https://insideretail.asia/2015/07/26/chinas-multi-level-marketing-ban/ | Inside Retail Asia | Open | 2015 | 6 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
### Key Fact 1: 链动2+1 (二加一连锁模式) is a two-level distribution model designed specifically to stay within China's legal boundaries
|
||||||
|
|
||||||
|
The model uses exactly two identity tiers — 代理 (agent) and 老板 (boss) — and limits commission payout depth to avoid the "three-tier" threshold that triggers pyramid scheme classification under Chinese law. It originated around October 2021, reportedly pioneered by Guangzhou beauty company "美丽天天秒" (Sources: 1, 6, 14).
|
||||||
|
|
||||||
|
### Key Fact 2: The "2+1" core mechanic: recommend 2 people, upgrade, then detach
|
||||||
|
|
||||||
|
A user buys a product package (commonly priced at 399-999 CNY, with 499 CNY being a standard example) to become an 代理. After directly recommending 2 new agents, the user upgrades to 老板 status. Upon upgrade, the "走人" (walk-away) mechanism activates: the newly upgraded boss detaches from their original sponsor and starts an independent team chain. The two agents they recruited are "left behind" (留人) with the original sponsor, preserving the upline's team base (Sources: 1, 6, 8, 14).
|
||||||
|
|
||||||
|
### Key Fact 3: Three core mechanisms define the 2+1 model
|
||||||
|
|
||||||
|
1. **走人机制 (Walk-away)**: After recruiting 2 and upgrading to boss, the user detaches and starts a new chain. This prevents infinite team accumulation and keeps the system dynamic.
|
||||||
|
2. **留人机制 (Retention)**: The 2 agents recruited by the upgrading boss stay with the original upline sponsor. This protects the upline's commission base.
|
||||||
|
3. **帮扶机制 (Support/Freeze)**: Typically 20% of a boss's earnings are frozen. The frozen amount is released only after the boss's own 2 recommended agents also upgrade to boss. This creates mutual incentive — upper levels actively help lower levels succeed (Sources: 1, 6, 8, 14).
|
||||||
|
|
||||||
|
### Key Fact 4: Standard profit distribution formula (499 CNY product example)
|
||||||
|
|
||||||
|
| Reward Type | Who Gets It | Amount | Description |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 直推奖 (Direct referral) | The person who directly recruited | 100 CNY | For every direct recruit who buys the package |
|
||||||
|
| 团队见点奖 (Team per-order) | The boss above the recruiter | 200 CNY | For every order from the team (not direct recruits) |
|
||||||
|
| 平级奖 (Peer-level) | Boss whose recruit also becomes boss | ~10 CNY (10% of direct referral) | Ensures upline still earns when downline reaches same level |
|
||||||
|
| 帮扶冻结 (Support freeze) | Platform holds | 20% of boss earnings | Released when boss's 2 recruits upgrade |
|
||||||
|
|
||||||
|
Total payout ratio (波比): approximately 50-62% of product price. Platform retains roughly 38-50% covering product cost, operations, and profit (Sources: 1, 8, 10, 14, 16).
|
||||||
|
|
||||||
|
### Key Fact 5: Concrete example flow
|
||||||
|
|
||||||
|
```
|
||||||
|
Platform Owner (founder)
|
||||||
|
└── A (buys 499, becomes 代理)
|
||||||
|
├── B (A recruits B, B buys 499) → A gets 100 直推奖
|
||||||
|
│ └── D (B recruits D) → B gets 100 直推奖; A gets 200 团队奖
|
||||||
|
└── C (A recruits C, C buys 499) → A gets 100 直推奖; A now upgrades to 老板
|
||||||
|
└── E (C recruits E) → C gets 100 直推奖; A gets 200 团队奖
|
||||||
|
|
||||||
|
A升级老板后: B和C被"留给"平台Owner (留人机制), A独立出去
|
||||||
|
A继续从D、E及后续新订单获得 200元/单 的无限团队见点奖
|
||||||
|
```
|
||||||
|
|
||||||
|
The 20% freeze means if A earned 400 CNY in team rewards, 80 CNY is frozen until B and C both upgrade to boss (Sources: 1, 6, 8).
|
||||||
|
|
||||||
|
### Key Fact 6: 双轨制 (Binary Tree) — each member has exactly 2 legs
|
||||||
|
|
||||||
|
Structure: Each distributor can only have 2 direct downlines (left leg and right leg). Additional recruits are "spilled over" and placed deeper in the tree. The key commission is the **对碰奖** (matching bonus): commission = min(left_leg_volume, right_leg_volume) × rate (typically 5-10%). Weekly/monthly caps apply. Advantages: strong teamwork (upline helps place recruits), "elephant leg" (single-side growth) still generates income. Disadvantages: leg imbalance hurts earnings, complex spillover placement, capping limits high earners (Sources: 11, 12, 13).
|
||||||
|
|
||||||
|
### Key Fact 7: 太阳线 (Sunburst/Unilevel) — unlimited width, limited depth
|
||||||
|
|
||||||
|
Structure: A distributor can recruit unlimited direct downlines (unlimited width). Commissions are paid on a fixed number of generations deep (typically 2-7 generations). Example: Gen 1 = 10% direct referral, Gen 2 = 3%, Gen 3 = 2%, Gen 4 = 1%. Advantages: simple rules, no placement constraints, strong personal recruitment incentive. Used by Amway (安利). Disadvantages: "elephant leg gets nothing" problem (wide but shallow teams earn little), early adopters have disproportionate advantage, team survival rate is low (Sources: 11, 12, 13).
|
||||||
|
|
||||||
|
### Key Fact 8: 矩阵制 (Matrix) — fixed width × fixed depth
|
||||||
|
|
||||||
|
Structure: Limited front-row positions and fixed depth (e.g., 3×3, 5×5, 2×12). Commission types include direct referral bonus, fixed-generation bonus (e.g., 7 generations like Melaleuca/美乐家), fill bonus (bonus when a row fills), and cycle/spillover bonus (when matrix fills, overflow starts new matrix). Advantages: structured growth, upline naturally helps downline fill positions, stable income for consistent consumers. Disadvantages: limited width constrains growth, requires queuing/waiting for positions (Sources: 11, 12, 13).
|
||||||
|
|
||||||
|
### Key Fact 9: Legal compliance framework in China
|
||||||
|
|
||||||
|
Under the 2005 《禁止传销条例》 (Anti-Pyramid Selling Regulations), three criteria define illegal pyramid selling: (1) 入门费 — entry fees disguised as product purchases, (2) 拉人头 — recruiting downlines as the primary activity, (3) 团队计酬 — compensation based on team size/recruitment rather than actual product sales. Criminal prosecution threshold: 30+ people AND 3+ tiers of hierarchy (《刑法》第224条之一). The 链动2+1 model stays compliant by: limiting to 2 identity tiers, basing commissions on actual product sales, keeping total payout ratio (波比) under ~62%, and ensuring product pricing is reasonable (Sources: 3, 4, 5, 17, 18, 19).
|
||||||
|
|
||||||
|
### Key Fact 10: Best-fit industries and success conditions
|
||||||
|
|
||||||
|
The 2+1 model works best for products with: **high gross margin** (60%+), **strong repurchase rate**, and **social sharing attributes**. Proven industries: beauty/skincare, health supplements, liquor/wine, knowledge products (online courses), local life services. Documented case: one health supplement brand grew to 5,000 members and 8 million CNY monthly revenue in 3 months using a variant. Critical success factor: the product must have genuine value — the model amplifies distribution but cannot compensate for a weak product. Failure modes include: trust barriers, product quality issues, "dead position" problem in the walk-away mechanism, and regulatory scrutiny (Sources: 6, 14, 21, 22, 23).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source 1: Zhihu — "一文解析链动2+1模式的具体方案讲解" (zhuanlan.zhihu.com/p/679418297)
|
||||||
|
|
||||||
|
**Key Insights:**
|
||||||
|
- This is one of the most detailed technical breakdowns of the 2+1 model available publicly.
|
||||||
|
- Defines the model as having exactly 2 identity levels (代理 → 老板), with a clear upgrade path requiring exactly 2 direct recruits.
|
||||||
|
- Provides specific numerical examples using 499 CNY product pricing, with 100 CNY direct referral, 200 CNY team per-order, and ~10 CNY peer-level bonuses.
|
||||||
|
- Explains the "波比" (payout ratio) concept: the industry-standard target is ~50%, meaning roughly half the product price goes to distributor commissions.
|
||||||
|
- The 帮扶机制 (support freeze) is critical — typically 20% of boss earnings are frozen until the boss's own 2 recruits upgrade, creating strong mutual assistance incentives.
|
||||||
|
- Notes that the model was designed specifically to stay within the legal 2-tier distribution framework, avoiding the 3-tier pyramid scheme threshold.
|
||||||
|
|
||||||
|
### Source 3: Zhihu — "深度分析链动2+1模式是不是违法传销" (zhuanlan.zhihu.com/p/572293043)
|
||||||
|
|
||||||
|
**Key Insights:**
|
||||||
|
- Provides a legal analysis specifically comparing the 2+1 model against the three criteria for pyramid selling under the 2005 regulations.
|
||||||
|
- Key distinction: the 2+1 model commissions are tied to actual product sales, not headcount. The product has real value and reasonable pricing (not inflated to fund commissions).
|
||||||
|
- The "2-tier only" structure is the model's main legal defense — it never creates a 3+ level compensation chain.
|
||||||
|
- The article emphasizes that legality depends on execution: if the product is overpriced, of poor quality, or if recruitment becomes the primary focus over sales, the model crosses into illegal territory.
|
||||||
|
- Recommends compliance measures: work with flexible employment platforms for tax compliance, ensure product quality certification, maintain transparent reward rules, and strictly limit to 2-tier structure.
|
||||||
|
|
||||||
|
### Source 6: Jubaozan — "链动2+1模式:概念、原理与商业逻辑的深度解析" (jubaozan.com)
|
||||||
|
|
||||||
|
**Key Insights:**
|
||||||
|
- Provides the commercial logic perspective: the 2+1 model is fundamentally a customer acquisition cost optimization strategy. Traditional e-commerce customer acquisition costs (CAC) can be 100-300+ CNY per user. The 2+1 model essentially pays this CAC directly to users as referral commissions, turning customers into distributors.
|
||||||
|
- Explains the evolution from traditional multi-level MLM: the 2+1 model strips away infinite depth and replaces it with the walk-away/retention mechanism, which both limits legal risk and creates a self-renewing growth loop.
|
||||||
|
- Documents the 2021 origin story with 美丽天天秒, a Guangzhou beauty company that pioneered the model to solve high CAC in the beauty industry.
|
||||||
|
- Identifies the "dead position" problem: when a boss walks away, the two agents they leave behind may lose motivation since their immediate upline is gone. This has led to evolved variants like "链动1+1" and "链动2+1 5.0" that address this issue with additional mechanisms.
|
||||||
|
- The platform's margin analysis: at 499 CNY product price with ~310 CNY total commission payout, the platform needs product cost to be under ~100 CNY to maintain profitability, making this viable primarily for high-margin goods.
|
||||||
|
|
||||||
|
### Source 17: 网经社 — "什么是三级分销?三级分销是传销吗?" (100ec.cn)
|
||||||
|
|
||||||
|
**Key Insights:**
|
||||||
|
- Legal analysis from China's leading e-commerce research organization.
|
||||||
|
- Clarifies that the "3-tier" threshold is often misunderstood: the law does not say "3 tiers is legal, 4 tiers is illegal." Rather, pyramid selling is defined by the three behavioral criteria (entry fees, headcount recruitment, team-based compensation), not purely by tier count.
|
||||||
|
- The "30 people AND 3+ tiers" standard is for criminal prosecution, not for determining whether something is pyramid selling at all. Administrative penalties can apply at any tier level.
|
||||||
|
- Two-level distribution (二级分销) is widely considered the safe zone, which is precisely why the 2+1 model limits itself to 2 identity tiers.
|
||||||
|
- Social commerce platforms must also navigate tax compliance (distributor income is technically personal service income), consumer protection, and advertising regulations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
1. **Official regulatory stance on 链动2+1**: No government regulatory body has published an explicit ruling or guidance specifically on the 2+1 model. All analysis comes from vendors, lawyers, and industry observers. The model's legal status remains untested at scale in court.
|
||||||
|
|
||||||
|
2. **Exact failure case details**: Multiple sources mention the model can fail, but specific documented failure cases with company names, timelines, and root causes are scarce. Vendor-published content tends to be promotional rather than critical.
|
||||||
|
|
||||||
|
3. **Tax compliance specifics**: While sources mention the need for tax compliance through flexible employment platforms (灵活用工平台), the exact mechanisms, rates, and legal structures for handling distributor income tax are not detailed in publicly available sources.
|
||||||
|
|
||||||
|
4. **Quantitative performance data**: Claims like "3 months, 5000 members, 8 million CNY monthly revenue" are cited but lack independent verification. No academic or government-published performance studies exist.
|
||||||
|
|
||||||
|
5. **Comparison data between models**: Direct comparative performance metrics (e.g., CAC, retention rate, LTV) across binary, sunburst, matrix, and 2+1 models are not available in public sources. Most analysis is qualitative.
|
||||||
|
|
||||||
|
6. **International perspective**: No English-language academic or regulatory analysis of the 链动2+1 model exists. The model appears to be uniquely Chinese and has not been documented in international MLM literature.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix: Quick Comparison Table
|
||||||
|
|
||||||
|
| Dimension | 二加一连锁 (2+1 Chain) | 双轨制 (Binary) | 太阳线 (Unilevel) | 矩阵制 (Matrix) |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| Width limit | Unlimited (until upgrade) | Exactly 2 | Unlimited | Fixed (3 or 5 typical) |
|
||||||
|
| Depth limit | 2 tiers only | Unlimited | Fixed generations (2-7) | Fixed layers (3-12) |
|
||||||
|
| Core commission | Direct + team per-order | Matching (对碰) bonus | Generation percentage | Fill + cycle bonus |
|
||||||
|
| Payout ratio | ~50-62% | ~5-10% per match | ~2-10% per generation | Varies by matrix size |
|
||||||
|
| Team dynamics | Walk-away + retention | Forced bilateral | Independent lines | Structured filling |
|
||||||
|
| Best for | High-margin, fast CAC | Team-oriented brands | Personal network sellers | Stable subscription products |
|
||||||
|
| Legal risk (China) | Moderate (designed for compliance) | High (often exceeds 3 tiers) | Moderate (depends on depth) | Moderate (depends on depth) |
|
||||||
|
| Typical products | Beauty, supplements, liquor | Various | Consumer goods (Amway model) | Subscription (Melaleuca model) |
|
||||||
|
| Complexity | Medium | High | Low | Medium |
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
# Task B: 分润机制深度研究 — 级差分润、团队分红、直推奖、间推奖、对碰奖、见单奖、层碰奖、量碰奖
|
||||||
|
|
||||||
|
> 研究日期: 2026-05-06
|
||||||
|
> 研究员: 分润机制分析师
|
||||||
|
> 主题: 中国社会电商/分销平台中的佣金分配模型
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| # | URL | Source-Type | Accessibility | Date | Authority (1-10) |
|
||||||
|
|---|-----|-------------|---------------|------|------------------|
|
||||||
|
| 1 | [分销商城团队分红商城小程序开发](https://blog.csdn.net/weixin_35728089/article/details/140703485) | 技术博客 | 公开 | 2024-07 | 6 |
|
||||||
|
| 2 | [分销模式模式合集详解-店长模式/团队管理奖](https://zhuanlan.zhihu.com/p/576810811) | 知乎专栏 | 公开 | 2022 | 7 |
|
||||||
|
| 3 | [直销系统奖金制度](https://zhuanlan.zhihu.com/p/100653716) | 知乎专栏 | 公开 | 2020 | 7 |
|
||||||
|
| 4 | [直销制度:规则与奖金分配方式的深度解析](https://zhuanlan.zhihu.com/p/679093752) | 知乎专栏 | 公开 | 2023 | 7 |
|
||||||
|
| 5 | [直销奖金大揭秘:对碰、层碰、量碰](https://maimai.cn/article/detail?fid=1827568385) | 脉脉文章 | 公开 | 2023 | 6 |
|
||||||
|
| 6 | [公排模式与双轨制直销:机制特点与奖金制度解析](https://cloud.tencent.com/developer/news/1231006) | 腾讯云开发者 | 公开 | 2023 | 7 |
|
||||||
|
| 7 | [深度分析双轨制直销模式(3):制度与规则](https://cloud.tencent.com/developer/news/1045867) | 腾讯云开发者 | 公开 | 2022 | 7 |
|
||||||
|
| 8 | [关于对碰奖的解析](https://www.cnblogs.com/w10234/p/6636215.html) | 博客园 | 公开 | 2017 | 6 |
|
||||||
|
| 9 | [量碰和层碰:拆分盘团队复制的精髓](https://www.finnciti.cc/9656.html) | 行业博客 | 公开 | N/A | 5 |
|
||||||
|
| 10 | [如何制定代理商分润模式](https://www.qibo.com/article/44775.html) | 启博科技 | 公开 | 2024 | 7 |
|
||||||
|
| 11 | [什么是分销佣金级差模式](https://www.fenrunbao.cn/xueyuan/fenrun_16185.html) | 分润宝 | 公开 | 2024 | 7 |
|
||||||
|
| 12 | [分销商城分润系统:互联网时代的创新分销模式](https://www.fenrunbao.cn/helpshow.aspx?bh=17990) | 分润宝 | 公开 | 2024 | 7 |
|
||||||
|
| 13 | [2026年分销体系佣金架构与代理激励深度实战指南](https://qiaotuoyun.com/h-nd-90849.html) | 乔拓云 | 公开 | 2026 | 8 |
|
||||||
|
| 14 | [双轨制度](https://wiki.mbalib.com/zh-tw/%E5%8F%8C%E8%BD%A8%E5%88%B6%E5%BA%A6) | MBA智库百科 | 公开 | 2023 | 8 |
|
||||||
|
| 15 | [复购见单奖金制度的深度解读](https://zhuanlan.zhihu.com/p/1888562430512185859) | 知乎专栏 | 公开 | 2025 | 6 |
|
||||||
|
| 16 | [平级返佣和差级返佣](https://blog.51cto.com/u_15968310/6061663) | 51CTO | 公开 | 2023 | 6 |
|
||||||
|
| 17 | [链动2+1商业模式:弊端、解决方案、合法性与玩法](https://developer.aliyun.com/article/1633401) | 阿里云开发者 | 公开 | 2024 | 7 |
|
||||||
|
| 18 | [办案指引:消费模式创新还是新型网络传销](https://www.spp.gov.cn/spp/llyj/202107/t20210710_523438.shtml) | 最高人民检察院 | 公开 | 2021-07 | 10 |
|
||||||
|
| 19 | [两高一部关于办理组织领导传销活动刑事案件适用法律若干问题的意见](https://www.spp.gov.cn/spp/flfg/gfwj/201311/t20131122_64638.shtml) | 最高检/最高法/公安部 | 公开 | 2013-11 | 10 |
|
||||||
|
| 20 | [实操建议:社交电商业务模式避免落入传销陷阱](https://www.zhonglun.com/research/articles/9005.html) | 中伦律师事务所 | 公开 | 2024 | 9 |
|
||||||
|
| 21 | [社交电商步入合规深水区:应对传销与税务风险的实战攻略](https://www.lexology.com/library/detail.aspx?g=6f2dfc03-c164-47d8-8571-3876489b583c) | Lexology | 公开 | 2024 | 8 |
|
||||||
|
| 22 | [法答网精选答问(第十二批)—组织、领导传销活动罪专题](https://www.court.gov.cn/zixun/xiangqing/448831.html) | 最高人民法院 | 公开 | 2024 | 10 |
|
||||||
|
| 23 | [穿透性审查:论组织、领导传销活动罪的司法认定](https://shanghai.dacheng.com/Party_2/1063.html) | 大成律师事务所 | 公开 | 2023 | 8 |
|
||||||
|
| 24 | [什么是"三级分销"?"三级分销"是传销吗?](https://www.100ec.cn/detail--6638350.html) | 网经社 | 公开 | 2023 | 7 |
|
||||||
|
| 25 | [真实交易:区分传销与社交营销的本质界限](https://www.allbrightlaw.com/CN/10475/5373d6b4c4b692bc.aspx) | 锦天城律师事务所 | 公开 | 2023 | 9 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
**Fact 1.** 级差分润的自动封顶机制:无论团队多少层级,总佣金支出永远不超过最高等级设定的佣金比例上限(如 20%-60%)。公式为:级差佣金 = 订单金额 ×(上级佣金比例 - 下级佣金比例),差额为负时取 0。
|
||||||
|
|
||||||
|
**Fact 2.** 团队分红有三种主要变体:(a) 团队业绩分红 = 团队总业绩 × 个人等级比例;(b) 全球加权分红 = 总业绩 ×(个人权重 / 所有参与者权重之和);(c) 区域分红 = 区域内订单 × 区域内代理等级比例。全球分红池通常设为总营业额的 3%-5%。
|
||||||
|
|
||||||
|
**Fact 3.** 直推奖是最基础的分销激励,比例通常在 10%-20% 之间,部分递增机制可达"第 1 单 10%,第 2 单 40%,第 3 单起 100%"(即推三返本模式)。
|
||||||
|
|
||||||
|
**Fact 4.** 间推奖按"代数"递减:第 1 代(直推)10%-20%,第 2 代 5%-8%,第 3 代 2%-3%,第 4 代起通常为零。中国刑事立案标准为"30 人以上且层级三级以上",实务中平台多控制在 2 代以内。
|
||||||
|
|
||||||
|
**Fact 5.** 对碰奖(双轨制)核心公式:对碰奖 = min(左区业绩, 右区业绩) × 对碰比例(8%-15%)。碰撞后小区归零,大区剩余额保留结转。通常设有每日/每周对碰封顶。
|
||||||
|
|
||||||
|
**Fact 6.** 见单奖按"伞下 N 层内每产生一单即给奖",有两种形式:固定金额型(如每单 10-30 元)和百分比型(订单金额 1%-3%)。常设置层数上限(3-5 层)以控制成本。
|
||||||
|
|
||||||
|
**Fact 7.** 层碰奖按层级逐层碰撞(每层仅碰一次),其核心优势是**拨出固定可控**——每个点位的层碰奖只能被一人领取,不论网体多大,最高拨出率永远在可控范围内(通常 96% 以内)。层碰比例通常为 3%-5%。
|
||||||
|
|
||||||
|
**Fact 8.** 量碰奖是层碰后的剩余业绩再碰撞,拨出率可能**超过 100%**。典型案例:14 个上级每人从 1 个新人的 1,000 元中各拿 8% 量碰奖,总拨出 1,120 元 > 1,000 元投入。量碰在拆分盘/互助盘中极为常见,此类模式在中国大多涉嫌非法集资。
|
||||||
|
|
||||||
|
**Fact 9.** 中国法律对"三级分销"的界定核心在于实质而非数字:判断标准是是否有真实商品交易、是否收取入门费、是否以拉人头为主要获利方式、商品定价是否合理。单纯以销售业绩为计酬依据的"团队计酬"不作为刑事犯罪处理,但可行政处罚。
|
||||||
|
|
||||||
|
**Fact 10.** 合规安全模式推荐:级差制 + 直推奖(最安全)、级差制 + 团队分红(适合实体电商)、二级分销 + 平级奖(最保守)。强烈建议避免:量碰奖在拆分盘中使用、超过 3 级的间推奖、无商品支撑的纯资金盘模式。总佣金池建议控制在营业额的 20%-30% 以内。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 中国法律合规要点
|
||||||
|
|
||||||
|
### 核心法规框架
|
||||||
|
|
||||||
|
1. **《禁止传销条例》(2005年国务院令第444号)** — 第 7 条明确定义传销三种类型:
|
||||||
|
- **入门费**:要求被发展人员交纳费用或认购商品变相交纳费用,取得加入资格
|
||||||
|
- **拉人头**:以发展人员的数量作为计酬或返利依据
|
||||||
|
- **团队计酬**:以直接或间接发展人员的销售业绩为依据计算报酬,形成上下线层级关系
|
||||||
|
|
||||||
|
2. **《刑法》第 224 条之一(2009年刑法修正案七)** — 组织、领导传销活动罪
|
||||||
|
|
||||||
|
3. **"两高一部"《关于办理组织领导传销活动刑事案件适用法律若干问题的意见》(公通字〔2013〕37号)** — 关键司法解释:
|
||||||
|
- **刑事犯罪**仅涵盖"拉人头"和"入门费"两种类型
|
||||||
|
- **"团队计酬"式传销**不作为刑事犯罪处理,但可按《禁止传销条例》行政处罚
|
||||||
|
- 以销售商品为目的、以销售业绩为计酬依据的单纯"团队计酬"式活动,**不作为犯罪处理**
|
||||||
|
- 刑事立案标准:组织、领导传销活动人员在**30人以上且层级在三级以上**
|
||||||
|
|
||||||
|
4. **《直销管理条例》(2005年)** — 直销企业佣金总额不得超过销售额的 **30%**
|
||||||
|
|
||||||
|
5. **最高人民法院法答网精选答问(第十二批,2024)** — 对传销活动罪的司法认定提供了最新指导
|
||||||
|
|
||||||
|
### 合规红线
|
||||||
|
|
||||||
|
- **三级限制**:刑事追责标准为"30人以上且三级以上"层级关系。实务中多数平台将分佣控制在**两级以内**以降低风险
|
||||||
|
- **30% 佣金上限**:直销企业所有佣金/奖金总和不得超过商品销售额的 30%
|
||||||
|
- **真实交易基础**:必须有实际商品或服务交易。商品定价需合理,不能以高价低质商品为"道具"
|
||||||
|
- **无入门费**:用户可自由选择是否成为分销员,不得以缴纳费用作为加入条件
|
||||||
|
- **非拉人头计酬**:不得以发展下线人数作为主要计酬依据
|
||||||
|
|
||||||
|
### 关键区别:合法分销 vs 传销
|
||||||
|
|
||||||
|
| 维度 | 合法分销 | 传销 |
|
||||||
|
|------|---------|------|
|
||||||
|
| 计酬依据 | 实际销售业绩 | 发展人员数量 |
|
||||||
|
| 入门门槛 | 免费注册或低门槛 | 缴纳高额费用/购买高价商品 |
|
||||||
|
| 商品定价 | 市场合理价格 | 严重背离价值 |
|
||||||
|
| 层级关系 | 有限(2-3级) | 无限层级金字塔 |
|
||||||
|
| 退货机制 | 有完善退换货 | 无或设置障碍 |
|
||||||
|
| 收入来源 | 商品销售利润 | 新成员入会费 |
|
||||||
|
|
||||||
|
### 安全设计建议
|
||||||
|
|
||||||
|
1. 级差分润控制在 3 级以内,推荐 2 级
|
||||||
|
2. 间推奖仅设 2 代(直推 + 间推 1 代)
|
||||||
|
3. 对碰奖/层碰奖/量碰奖必须有真实商品支撑,建议用于电商而非金融产品
|
||||||
|
4. 设置每日/每周/每月奖金封顶
|
||||||
|
5. 总佣金池控制在营业额的 20%-30% 以内
|
||||||
|
6. 避免使用"拆分盘""互助盘"等资金盘模式的量碰机制
|
||||||
|
7. 用语合规:避免使用"上下线""拉人头""提成"等传销敏感词汇
|
||||||
|
8. 不强制囤货:避免代理商积压库存
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Deep Read 1: 级差制系统设计逻辑(综合分润宝、启博科技、CSDN 来源)
|
||||||
|
|
||||||
|
级差制的核心设计思想是**"等级越高,分润越多,但通过差额自动分配"**。其本质是一种自动化的利益分配机制:
|
||||||
|
|
||||||
|
- 每个代理等级对应一个"拿货价"或"佣金比例"
|
||||||
|
- 上级赚的是自己和下级之间的差额
|
||||||
|
- 经典案例(微分销供应商版 PDF):
|
||||||
|
- 零售价 100 元,A 顶级代理拿货价 40 元,B 二级代理 50 元,C 三级代理 60 元
|
||||||
|
- 当 C 卖出 100 元商品时:C 赚 40 元,B 赚 50-40=10 元差价,A 赚 60-50=10 元差价
|
||||||
|
- **总拨出 = 60 元(即最高代理的拿货价对应利润)**,不会超过预设上限
|
||||||
|
- 平级时:若二级代理推荐了另一个二级代理,则上级无法赚取级差,此时需要"平级奖"
|
||||||
|
- 平级奖通常为下级团队总业绩的 3%-5%,或按收益百分比计算
|
||||||
|
|
||||||
|
**关键设计要素:**
|
||||||
|
1. 等级数量:通常 4-7 级,太少激励不够,太多计算复杂
|
||||||
|
2. 级差间距:相邻等级间的比例差建议 5%-10%(如初级 10%、中级 15%、高级 20%)
|
||||||
|
3. 升级条件:需设置合理的业绩门槛或直推人数门槛
|
||||||
|
4. 平级奖:同级时必须有补充激励,否则代理不愿推荐同级或更高级的人
|
||||||
|
5. **总成本自动封顶**:无论多少层级,总佣金不会超过最高等级比例
|
||||||
|
|
||||||
|
### Deep Read 2: 双轨制奖金体系(对碰奖 + 层碰奖 + 量碰奖)
|
||||||
|
|
||||||
|
双轨制是最复杂的奖金制度之一,三种"碰"的组合使用(基于博客园、腾讯云、脉脉来源):
|
||||||
|
|
||||||
|
**工作流程:**
|
||||||
|
1. 每位会员只有左右两个位置,不断向下延伸
|
||||||
|
2. **对碰奖(点碰)**:左右两区总业绩取小区碰撞(1:1),碰撞后小区归零,大区剩余额保留
|
||||||
|
- 公式:min(左区, 右区) × 比例(8%-15%)
|
||||||
|
3. **层碰奖**:在对碰基础上,按层级逐层计算碰撞,每层仅碰一次
|
||||||
|
- 核心优势:**拨出固定可控**,不论网体多大,最高拨出率在可控范围内
|
||||||
|
- 层碰过的业绩不再参与对碰,每个点位的层碰奖只能被一个人领取
|
||||||
|
4. **量碰奖**:层碰后剩余业绩再次按比例碰撞
|
||||||
|
- 拨出率可能**超过 100%**(如 14 个上级每人从 1 个新人的 1000 元中拿 8%,总拨出 1120 元)
|
||||||
|
- **量碰不可持续**,是拆分盘崩盘的常见原因
|
||||||
|
|
||||||
|
**拨出率对比:**
|
||||||
|
| 对比项 | 对碰奖 | 层碰奖 | 量碰奖 |
|
||||||
|
|--------|--------|--------|--------|
|
||||||
|
| 计算方式 | 单点左右碰 | 按层左右碰 | 累计往上碰 |
|
||||||
|
| 每层碰撞 | 不限 | 每层 1 次 | 不限 |
|
||||||
|
| 拨出率 | 可控(有封顶) | **固定可控**(~96%以内) | **不可控**(可达 100%+) |
|
||||||
|
| 可持续性 | 较好 | **最优** | **最差**(易崩盘) |
|
||||||
|
| 奖金大小 | 中等 | 较低 | 最高 |
|
||||||
|
|
||||||
|
**成本叠加分析:**
|
||||||
|
- 假设月总业绩 1,000,000 元
|
||||||
|
- 对碰奖(10%):≈ 50,000 元(假设左右基本平衡)
|
||||||
|
- 层碰奖(5%):≈ 20,000 元
|
||||||
|
- 直推奖(15%):≈ 30,000 元
|
||||||
|
- **总奖金池:100,000 元(占业绩 10%)**
|
||||||
|
- 若再叠加团队分红等,总支出可能达到 15%-25%
|
||||||
|
|
||||||
|
### Deep Read 3: 合规框架下的模式选择(综合最高检、中伦律所、锦天城律所)
|
||||||
|
|
||||||
|
在中国市场运营社交电商分销,合规是首要考量:
|
||||||
|
|
||||||
|
**法律界定关键(最高检办案指引):**
|
||||||
|
- 判断核心在于**实质**而非层级数量
|
||||||
|
- 是否以**真实商品交易**为基础
|
||||||
|
- 是否收取**入门费**
|
||||||
|
- 是否以**拉人头**为主要获利方式
|
||||||
|
- 商品定价是否**明显不合理**
|
||||||
|
- **法律上并无明确的"三级"数字界定** — 我国法律没有明确"三级以下合法、三级以上非法"
|
||||||
|
- 刑事立案标准:组织、领导传销活动人员在**30 人以上且层级在三级以上**
|
||||||
|
|
||||||
|
**安全模式推荐:**
|
||||||
|
1. **级差制 + 直推奖**:最安全,层级清晰,佣金比例可控
|
||||||
|
2. **级差制 + 团队分红**:适合有实体商品和稳定复购的电商
|
||||||
|
3. **二级分销 + 平级奖**:最保守但最合规的方案
|
||||||
|
|
||||||
|
**谨慎使用:**
|
||||||
|
1. **对碰奖**:需要双轨制支撑,容易触碰三级红线
|
||||||
|
2. **见单奖**:成本低但需注意层数上限
|
||||||
|
|
||||||
|
**强烈建议避免:**
|
||||||
|
1. **量碰奖在拆分盘/互助盘中使用**:中国已查处大量此类非法集资案例
|
||||||
|
2. **超过 3 级的间推奖**:直接违反《禁止传销条例》
|
||||||
|
3. **无商品支撑的纯资金盘模式**:构成刑事犯罪(组织、领导传销活动罪)
|
||||||
|
|
||||||
|
**典型案例参考:**
|
||||||
|
- **贝店(2021年)**:因具备"拉人头""团队计酬""入门费"特征被查处
|
||||||
|
- 多家社交电商平台因传销嫌疑被行政处罚或冻结资金
|
||||||
|
- 某乳业大厂线上营销被查:微商分销模式涉及多级代理层级计酬问题
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
1. **最新监管动态细节**:2025-2026 年市场监管总局关于电商平台佣金的具体新规细则未完全获取,需持续关注执法实践
|
||||||
|
2. **平台实际数据**:各大平台(云集、贝店、有赞、微盟等)具体的佣金比例和分润数据为商业机密,难以获取精确数字
|
||||||
|
3. **税务处理**:分润收入的税务处理(个人所得税代扣代缴、增值税、灵活用工平台结算等)在本次研究中未深入涉及
|
||||||
|
4. **技术实现细节**:级差分润在数据库层面的具体实现(如递归查询、树形结构存储、并发结算)需要另外研究
|
||||||
|
5. **跨境合规**:中国社交电商平台出海时的佣金模式合规要求(东南亚/非洲/拉美市场)未覆盖
|
||||||
|
6. **对碰奖/量碰奖的实际封盘案例**:虽然知道这些模式风险高,但缺乏具体被查处的案例数据和法律判决书分析
|
||||||
|
7. **社区团购团长佣金模型**:不同平台(兴盛优选、美团优选、多多买菜)的团长佣金差异和计算方式未深入研究
|
||||||
|
8. **链动 2+1 / 推三返一等新型模式的深度计算分析**:这些模式在实践中广泛使用,但本文未覆盖其详细佣金算法
|
||||||
|
9. **WebFetch 限制**:多数中国域名(知乎、CSDN、腾讯云等)无法通过 WebFetch 直接读取,本报告主要依赖搜索摘要和已有知识构建,缺少原文逐字引用验证
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
---
|
||||||
|
task_id: c
|
||||||
|
role: Social Commerce & Viral Growth Analyst (Chinese E-commerce)
|
||||||
|
status: complete
|
||||||
|
sources_found: 33
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| # | URL | Source-Type | Accessibility | Date | Authority |
|
||||||
|
|---|-----|-------------|---------------|------|-----------|
|
||||||
|
| 1 | [拼多多社交电商商业模式深度解析](https://cj.sina.cn/articles/view/7879848900/1d5acf3c401902we8s) | secondary-industry | Search summary | ~2025 | 7 |
|
||||||
|
| 2 | [实战:解析互联网拼团裂变模式](https://zhuanlan.zhihu.com/p/258546036) | community | Blocked | ~2020 | 6 |
|
||||||
|
| 3 | ["社交+电商"模式的裂变与挑战——以拼多多为例](https://www.hanspub.org/journal/paperinformation?paperID=130599) | academic | Blocked | 2024 | 7 |
|
||||||
|
| 4 | [拼多多屡试不爽的裂变,你为什么玩不好?](https://www.dingxiang-inc.com/blog/post/297) | secondary-industry | Blocked | ~2023 | 7 |
|
||||||
|
| 5 | [拼团、砍价、分销|用户要增长,裂变和转化才是关键](https://www.woshipm.com/operate/2295477.html) | community | Search summary | ~2023 | 6 |
|
||||||
|
| 6 | [社交裂变玩法中拼团与分销案例分享](https://www.sohu.com/a/902973212_100150288) | journalism | Search summary | 2025-07 | 7 |
|
||||||
|
| 7 | [拼多多在用户裂变增长模式上的独特方式](https://www.shopex.cn/news/archives/17226.html) | secondary-industry | Blocked | ~2023 | 6 |
|
||||||
|
| 8 | [什么是代言人与合伙人模式?微三云深度解析](https://cloud.tencent.com/developer/news/1014119) | secondary-industry | Blocked | 2023-04 | 6 |
|
||||||
|
| 9 | [2023新消费模式"代言人"+"合伙人"](https://zhuanlan.zhihu.com/p/610766506) | community | Blocked | 2023-03 | 5 |
|
||||||
|
| 10 | [揭秘"排队免单":消费变投资](https://zhuanlan.zhihu.com/p/1969786292100370904) | community | Blocked | ~2024 | 6 |
|
||||||
|
| 11 | [排队免单模式全产业适配解析](https://www.sohu.com/a/1013343290_122699958) | journalism | Search summary | 2025 | 5 |
|
||||||
|
| 12 | ["消费全返"为何存在刑事风险](https://www.spp.gov.cn/spp/llyj/201907/t20190717_443375.shtml) | official | Blocked | 2019-07 | 10 |
|
||||||
|
| 13 | [电商微商、消费返利?小心!新型传销](https://www.bbtnews.com.cn/2021/1220/423361.shtml) | journalism | Search summary | 2021-12 | 7 |
|
||||||
|
| 14 | [国家关于消费返利违法的认定与合规方案](https://www.qibo.com/article/44198.html) | secondary-industry | Blocked | ~2024 | 6 |
|
||||||
|
| 15 | [警惕"消费返利"非法集资陷阱](https://jrj.beijing.gov.cn/jrxcjy/jraq/ffffjzxkt/202405/t20240527_3695341.html) | official | Blocked | 2024-05 | 9 |
|
||||||
|
| 16 | [公安部:高额消费返利预警](https://www.mps.gov.cn:8090/n2253534/n2253535/c4143338/content.html) | official | Blocked | ~2022 | 10 |
|
||||||
|
| 17 | [中伦律师事务所:快消行业合规体系解析](https://www.zhonglun.com/research/articles/9588.html) | secondary-industry | Blocked | ~2024 | 8 |
|
||||||
|
| 18 | [人民法院金融犯罪典型案例](https://www.court.gov.cn/zixun/xiangqing/372731.html) | official | Search summary | 2023 | 9 |
|
||||||
|
| 19 | [Econsultancy: Pinduoduo Social Commerce](https://econsultancy.com/what-s-behind-the-success-of-china-s-social-commerce-app-pinduoduo/) | secondary-industry | Blocked | ~2020 | 7 |
|
||||||
|
| 20 | [YC: Pinduoduo and Social E-commerce](https://www.ycombinator.com/library/2z-pinduoduo-and-the-rise-of-social-e-commerce) | secondary-industry | Blocked | 2020 | 7 |
|
||||||
|
| 21 | [推三返一模式详细剖析](https://zhuanlan.zhihu.com/p/1889004163456806973) | community | Search summary | ~2024 | 5 |
|
||||||
|
| 22 | [Fun消费返利模式:误区解析](https://www.qibo.com/article/44239.html) | secondary-industry | Blocked | ~2024 | 6 |
|
||||||
|
| 23 | [城市酷选排队免单](https://zhuanlan.zhihu.com/p/13117000993) | community | Blocked | ~2024 | 5 |
|
||||||
|
| 24 | [教你读懂代言人+合伙人模式](https://cloud.tencent.com/developer/news/1073579) | secondary-industry | Blocked | ~2023 | 6 |
|
||||||
|
| 25 | [永倍达三年圈钱近千亿崩盘](https://zhuanlan.zhihu.com/p/685635069) | journalism | Search summary | 2024-03 | 8 |
|
||||||
|
| 26 | [永倍达9月一审庭审披露关键细节](https://zhuanlan.zhihu.com/p/1954502779520390706) | journalism | Search summary | 2025-09 | 8 |
|
||||||
|
| 27 | [永倍达崩盘:天津铸源](https://zhuanlan.zhihu.com/p/687725253) | journalism | Search summary | 2024 | 8 |
|
||||||
|
| 28 | [永倍达三年千亿流水崩盘后发文](https://zhuanlan.zhihu.com/p/689201922) | journalism | Search summary | 2024 | 7 |
|
||||||
|
| 29 | [安徽中院终审裁定永倍达构成传销](https://zhuanlan.zhihu.com/p/2002803821760512098) | journalism | Search summary | 2025-07 | 8 |
|
||||||
|
| 30 | [排队免单模式深度剖析](https://www.sohu.com/a/883926811_121880640) | journalism | Search summary | ~2024 | 6 |
|
||||||
|
| 31 | [消费返利商业模式:被低估的蓝海模式](https://www.sohu.com/a/790637964_121880203) | secondary-industry | Blocked | ~2024 | 6 |
|
||||||
|
| 32 | [排队免单模式解析购物免单0元购](https://www.360wdfx.com/article-detail/BAwyDz2W) | secondary-industry | Search summary | ~2024 | 6 |
|
||||||
|
| 33 | [中国社交购物市场分析](https://www.china-experience.com/china-experience-insights/what-can-we-learn-from-social-shopping-in-china) | secondary-industry | Blocked | ~2023 | 7 |
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
1. **拼团分销核心闭环**:拼多多以"发起拼团-微信分享-好友参团-成团发货"为病毒循环,将消费者转化为主动分发节点。裂变系数 F > 1.5 时形成指数传播,获客成本低至 0.5 元/人。系统通过动态定价算法(社交价值高的用户砍价幅度更大)和虚拟成团策略(算法自动填充缺额)优化转化率。[1][4][6][7]
|
||||||
|
|
||||||
|
2. **社交裂变双引擎**:主动传播(情绪/社交驱动,如"砍一刀"的情感绑架和炫耀心理)和被动传播(利益激励驱动,如拼团折扣、分销返利、助力领现金)。拼多多依托微信关系链实现纽扣式社会关系传播,5年内用户增长至 7 亿+。[1][3][4][19]
|
||||||
|
|
||||||
|
3. **代言人模式运作**:用户购买指定商品后自动成为该商品代言人,按消费时间/顺序排名获得单品利润约 10% 的分红。核心逻辑是"越早入场、收益越高"——种子轮(前100名)、天使轮(101-1000名)等轮次分配。销量越高代言人分红越多,推动老用户主动推荐新用户。[8][9][24]
|
||||||
|
|
||||||
|
4. **合伙人模式升级路径**:代言人满足条件后升级为合伙人,享受全平台销售利润约 20% 的分红,按加入时间轮次分配。公式:合伙人奖励 = 全平台销售利润 × 20% × 轮次比例 ÷ 轮次人数。高级合伙人享受更高比例。身份可叠加(代言人+合伙人+高级合伙人),获取多重收益。[8][9][24]
|
||||||
|
|
||||||
|
5. **排队免单核心算法**:消费后按 FIFO 进入虚拟队列,平台将每笔订单利润的 10%-30% 注入免单池。典型模式包括:(a) "进5出5"——每新增5笔同金额订单,队列前5名各获返利;(b) "进3出1"——每3单利润完成1人免单,如100元商品成本30元,利润70元,平台将约33元投入排队池;(c) 贡献值排序——贡献值 = 消费金额×1 + 邀请人数×100 + 复购次数×50,每日按排名释放约5%免单名额。[10][11][23][30][32]
|
||||||
|
|
||||||
|
6. **消费返利合规红线(权威定性)**:最高检明确"消费全返"三大刑事风险:违规设立资金池、变相吸纳公众资金(借新还旧/拆东补西,庞氏特征)、涉嫌传销或非法集资。三类罪名:非法吸收公众存款罪、集资诈骗罪、组织领导传销活动罪。合法边界:返利有合理上限、基于实际消费、层级不超两级、商品定价正常、避免资金池、返利需开红字发票并通过银行转账。[12][14][15][16][17]
|
||||||
|
|
||||||
|
7. **永倍达崩盘案例(最新详情)**:天津铸源旗下永倍达以"消费返利+社交电商"模式三年圈钱近千亿,1100万用户无法提现,2024年3月正式暴雷。全国20余省市联合定性其涉嫌传销+非法集资双重违法。南通警方查实层级多达15层(远超3层红线)。2025年9月一审庭审披露实控人转移12亿元资金。2025年7月安徽中院终审裁定构成传销。即便铸源持有直销牌照也无法掩盖违法本质。[25][26][27][28][29]
|
||||||
|
|
||||||
|
8. **消费返利合法变体**:合规方案包括 Fun模式(固定比例小额返利)、盲返模式(随机小额返利)、积分增值模式(消费获积分,积分在奖金池增值后每日按比例释放)、推三返一模式(邀请3人完成消费返还自身消费额,融合裂变+返利)。这些模式通过控制返利上限和资金来源来规避刑事风险。[14][21][22]
|
||||||
|
|
||||||
|
9. **适用场景匹配**:拼团分销适合低价标品/下沉市场(日用品、农产品、快消品);代言人模式适合私域电商/美妆/大健康(高毛利单品,需强用户信任);排队免单适合高频刚需/实体店引流(餐饮、零售、美业、异业联盟);消费返利适合平台启动期快速获客但需谨慎合规设计。[6][8][10][11][30]
|
||||||
|
|
||||||
|
10. **监管持续收紧趋势**:公安部、北京市委金融委等多部门持续发布消费返利风险预警。法院判例显示确山县消费返利案(1-1.5年有期徒刑)、西安"消费积分"集资诈骗案、广州白云区非法吸收公众存款案(4-8年)、北京西城案("购物返本"获刑4年6个月)。关键合规要点:分销层级严格两级以内、返利来源透明可追溯、禁止"拉人头"作为返利条件。[13][15][16][18]
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source [12]: 最高人民检察院 — "消费全返"为何存在刑事风险 (Authority: 10/10)
|
||||||
|
|
||||||
|
**Key data**:最高检从刑事法律角度详细剖析"消费全返"模式的违法结构。核心风险点:(1) 违规设立资金池——沉淀大量用户资金,规避互联网金融和第三方支付监管;(2) 变相吸纳公众资金——以"消费"名义行"集资"之实;(3) "拆东墙补西墙"运作——用后来消费者的钱支付早期参与者返利,具有典型庞氏骗局特征。
|
||||||
|
|
||||||
|
**Key insight**:最高检明确界定三类适用罪名——非法吸收公众存款罪(未经批准吸收公众资金,承诺还本付息)、集资诈骗罪(以非法占有为目的,使用诈骗方法非法集资)、组织领导传销活动罪(以推销商品为名,要求参加者缴纳费用获得加入资格,形成层级关系,以发展人员数量作为返利依据)。这三类罪名的界定为行业合规提供了最权威的红线标准。
|
||||||
|
|
||||||
|
**Useful for**:消费返利合规风险章节的最高级别法律依据,是任何消费返利模式设计的必读参考。
|
||||||
|
|
||||||
|
### Source [25]-[29]: 永倍达崩盘系列报道 (Authority: 8/10)
|
||||||
|
|
||||||
|
**Key data**:永倍达(天津铸源健康科技集团旗下)是"排队免单+消费返利"模式最典型的崩盘案例。三年运营,圈钱近千亿人民币,约1100万用户无法提现。2024年3月正式暴雷停止报单和提现。全国20余省市监管部门联合定性其涉嫌传销与非法集资双重违法犯罪。南通警方查实平台构建层级多达15层。2025年9月一审庭审披露:实控人王继伟已将12亿元资金转移。2025年7月安徽某中级人民法院终审裁定永倍达构成传销。
|
||||||
|
|
||||||
|
**Key insight**:永倍达案例揭示了排队免单/消费返利模式最极端的风险后果——即使平台持有直销牌照(铸源集团有直销资质),也无法掩盖其非法集资和传销本质。15层级的传销结构远超法律认定的3层红线。实控人转移12亿资金表明此类模式存在严重的资金安全风险。该案例是当前监管环境下消费返利模式最有力的警示教材。
|
||||||
|
|
||||||
|
**Useful for**:合规风险章节的核心案例,证明"排队免单"模式在规模扩张后极易触碰法律红线。
|
||||||
|
|
||||||
|
### Source [8]: 腾讯云 — 什么是代言人与合伙人模式?微三云深度解析 (Authority: 6/10)
|
||||||
|
|
||||||
|
**Key data**:代言人模式以消费顺序排名为基础,先消费的用户排在前面优先享受奖励。三种身份各有独立排名队列:代言人(按消费顺序排队分红)、合伙人(按加入时间顺序排队分红)、高级合伙人(更高比例全平台分红)。身份可叠加获取多重收益。代言人奖励 = 单品总利润 × 10% ÷ 对应轮次人数。合伙人奖励 = 全平台销售利润 × 对应比例 ÷ 对应轮次人数。
|
||||||
|
|
||||||
|
**Key insight**:代言人模式本质上是"排队免单"的包装版本——利用"先入者优先获利"的心理预期,鼓励用户争先下单。身份叠加机制(代言人+合伙人)既增加了用户的收益想象空间,也放大了平台的资金池风险。这种模式的核心驱动力是:代言人会主动推荐新用户,因为用户越多→销量越高→分红池越大→个人收益越高。但这也意味着当新用户增长放缓时,整个分红体系面临崩溃风险。
|
||||||
|
|
||||||
|
**Useful for**:代言人模式机制和分润计算的核心参考,虽然来源权威性一般(技术社区而非法律/监管机构),但对模式运作的描述与多个独立来源交叉验证一致。
|
||||||
|
|
||||||
|
### Source [3]: 汉斯出版社 — "社交+电商"模式的裂变与挑战 (Authority: 7/10)
|
||||||
|
|
||||||
|
**Key data**:学术论文从理论框架分析拼多多"社交+电商"模式,指出核心驱动力是"低价+社交关系链+算法推荐"三位一体。拼团、砍价、社交分享等机制实现用户规模快速裂变。论文同时指出该模式面临的挑战:营销成本上升、利润空间压缩、用户体验疲劳("砍一刀"引发反感)、下沉市场饱和后的增长瓶颈。
|
||||||
|
|
||||||
|
**Key insight**:学术视角确认了社交电商飞轮效应的完整逻辑:低价吸引用户→用户社交分享→新用户涌入→订单规模扩大→供应链成本降低→进一步降价。但论文警告这一飞轮存在反向循环风险:当用户增长放缓时,分享激励效果递减→新用户减少→规模效应减弱→成本上升→需要更高价格→用户流失。
|
||||||
|
|
||||||
|
**Useful for**:拼团分销和社交裂变的学术理论支撑,提供了超越行业自媒体的独立分析视角。
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
- 未能通过 WebFetch 访问任何外部网站(网络限制),所有信息基于搜索摘要,缺乏全文深度验证
|
||||||
|
- 拼多多最新2025-2026年运营数据(当前CAC、LTV、活跃用户增长率)缺失,大部分量化数据为2020-2023年区间
|
||||||
|
- "城市酷选"等新兴排队免单平台的详细交易数据和运营指标不足,仅有"年交易额破百亿"的笼统说法
|
||||||
|
- 代言人模式的法律定性在司法实践中仍存分歧,不同法院对"消费排名分红"是否构成传销的认定标准不统一
|
||||||
|
- 消费返利模式的合规灰色地带——不同地区执法尺度差异、"消费全返"与合理返利的定量边界(具体返利比例上限)尚无统一国家标准
|
||||||
|
- 缺少英文独立学术文献对中国社交电商模式的分析(仅依赖中文来源,可能存在信息偏差)
|
||||||
|
- 拼多多/社交电商平台技术实现细节(推荐算法如何优化裂变系数、动态定价算法的具体参数)未在公开资料中披露
|
||||||
|
- 永倍达案2025年9月一审后的最终判决结果和受害者赔偿方案尚未在搜索结果中明确
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Research Notes: Hierarchical Identity & Tier-Based Distribution Models in Chinese Social Commerce
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| # | URL | Source-Type | Accessibility | Date | Authority (1-10) |
|
||||||
|
|---|-----|-------------|---------------|------|-------------------|
|
||||||
|
| 1 | https://www.fenrunbao.cn/helpshow.aspx?bh=19785 | 行业平台文章 (分润宝) | Open | ~2024 | 6 |
|
||||||
|
| 2 | https://zhuanlan.zhihu.com/p/576803357 | 知乎专栏 | Open | ~2022 | 6 |
|
||||||
|
| 3 | https://www.qibo.com/article/7714.html | 启博软件官网 | Open | ~2024 | 6 |
|
||||||
|
| 4 | https://www.woshipm.com/pd/6238299.html | 人人都是产品经理 | Open | ~2024 | 7 |
|
||||||
|
| 5 | https://www.jiandaoyun.com/blog/article/1781137/ | 简道云博客 | Open | ~2024 | 6 |
|
||||||
|
| 6 | https://help.youzan.com/displaylist/detail_5_5-1-64881 | 有赞帮助中心 | Open | ~2024 | 7 |
|
||||||
|
| 7 | https://zhuanlan.zhihu.com/p/660754693 | 知乎专栏 | Open | ~2024 | 5 |
|
||||||
|
| 8 | https://zhuanlan.zhihu.com/p/651671348 | 知乎专栏 (循环购模式) | Open | ~2023 | 6 |
|
||||||
|
| 9 | https://www.fenrunbao.cn/xueyuan/fenrunmoshi_17463.html | 分润宝 | Open | ~2024 | 6 |
|
||||||
|
| 10 | https://www.lexology.com/library/detail.aspx?g=6f2dfc03-c164-47d8-8571-3876489b583c | Lexology (法律分析) | Open | 2024-2025 | 9 |
|
||||||
|
| 11 | https://www.chinalawinsight.com/2020/08/articles/intellectual-property/社交电商v-s-互联网传销/ | China Law Insight (金杜) | Open | 2020 | 9 |
|
||||||
|
| 12 | https://www.zhonglun.com/research/articles/9005.html | 中伦律师事务所 | Open | ~2024 | 9 |
|
||||||
|
| 13 | https://www.netcnnet.net/study/marketing_news/1632.html | 网晨网络 | Open | ~2023 | 5 |
|
||||||
|
| 14 | https://www.sohu.com/a/1010188218_122699958 | 搜狐 (链动2+1) | Open | ~2025 | 5 |
|
||||||
|
| 15 | https://m.gmw.cn/toutiao/2025-03/21/content_1303997418.htm | 光明网 (监管新闻) | Open | 2025-03 | 8 |
|
||||||
|
| 16 | https://www.zxfull.com/2025/04/11/105739/ | 正信法学 (条例修订) | Open | 2025-04 | 7 |
|
||||||
|
| 17 | https://www.mdpi.com/2071-1050/13/1/422 | MDPI 学术论文 | Open | 2021 | 8 |
|
||||||
|
| 18 | https://vffranchiseconsulting.com/chinas-multi-level-marketing-ban-workaround/ | 行业咨询 | Open | ~2024 | 7 |
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
1. **区域代理 (Regional Agent Model)**: Divides territory by administrative divisions (省/市/区/县). Agents gain exclusivity over a geographic zone; all orders shipped to that zone generate a dividend for the zone agent (typically 2-5% of GMV). Acquisition requires meeting thresholds (e.g., purchase minimum, referral quota, or application + review). The model maps onto China's city-tier hierarchy (Tier 1-5), with higher-tier zones commanding higher entry costs but also larger GMV potential. Core chain: Brand/Platform -> Regional Agent -> Distributor -> Consumer.
|
||||||
|
|
||||||
|
2. **区域代理分润计算**: Commission pool is carved from product margin (typically 10-30% of sale price). A common split: from a 100 CNY product with 20 CNY margin, 30% (6 CNY) goes to the regional agent for that zone, while the rest flows to the direct salesperson's multi-tier commission. Regional agent dividends are usually calculated per-order by matching delivery address to the agent's territory. Some platforms add a performance bonus: if a zone agent's territory exceeds a monthly GMV target, their rate increases by 1-3 percentage points.
|
||||||
|
|
||||||
|
3. **股东分红 (Shareholder Dividend Model)**: Not actual equity shareholders. Instead, top-performing distributors are designated as "shareholders" (虚拟股东/共享股东) and receive a slice of platform-level profit sharing. A typical mechanism: the platform allocates a fixed percentage of daily/weekly revenue (e.g., 5-20%) into a dividend pool, which is then distributed proportionally among qualified shareholders based on their weight (determined by personal sales volume, team volume, or level). The "循环购" (circular purchase) model divides the pool into tiers (e.g., 10 portions of 2% each), where higher-tier shareholders can also participate in lower-tier dividends.
|
||||||
|
|
||||||
|
4. **股东分红合规风险 -- highest risk model**: Using the term "股东" (shareholder) for non-equity profit-sharing is a legal red flag. Under China's Company Law, real shareholder dividends require formal equity registration, proper accounting, and tax compliance. If a platform calls users "shareholders" but grants no legal equity, it risks being deemed misleading. More critically, if the dividend is tied to recruiting new members rather than actual product sales, it crosses into pyramid selling (传销) territory. The three statutory criteria for 传销 are: (a) 拉人头 (headcount-based compensation), (b) 入门费 (entry fee disguised as product purchase), (c) 团队计酬 (multi-level team-based commission). Shareholder dividend models frequently trigger (a) and (c) scrutiny.
|
||||||
|
|
||||||
|
5. **福利区 (Welfare/Benefit Zone)**: A perks layer attached to the distribution hierarchy. Users who reach certain levels gain access to exclusive benefits: higher commission rates, exclusive products at below-market prices, free shipping, priority customer service, bonus points multipliers, or access to a "points mall" (积分商城). The welfare zone is essentially a retention mechanic -- it makes higher tiers feel materially different. Benefits are often funded from the platform's marketing budget and are not directly tied to additional revenue generation, making them lower compliance risk compared to dividend models.
|
||||||
|
|
||||||
|
6. **任务奖励 (Task-Based Rewards)**: Milestone-driven bonuses for completing specific actions. Common tasks include: (a) 新手任务 -- first referral earns 5 CNY cash, lowering barrier to entry; (b) 阶梯任务 -- invite 10 people for 50 CNY bonus, 50 people for 200 CNY + level upgrade; (c) 签到任务 -- daily check-in for points (10 points/day), 7-day streak bonus of 50 extra points; (d) 消费任务 -- spend 99/299/599 CNY to unlock progressively higher-value tasks. Rewards are one-time or periodic payouts from a fixed marketing budget, calculated as flat amounts or point multipliers.
|
||||||
|
|
||||||
|
7. **阶梯返利 (Tiered Rebate)**: Rebate rates that scale with cumulative volume. Two implementation variants exist: (a) **阶梯奖励 (non-cumulative tiers)** -- reaching a higher tier replaces the lower tier rate (max 5 tiers per platform); (b) **循环奖励 (cumulative/looping)** -- rewards reset and can be earned repeatedly. Example: monthly sales < 10K CNY at 5% commission; 10K-50K at 8%; 50K-100K at 12%; >100K at 15%. For dealer/distributor models, a base rebate of 3% might scale to 5% once quarterly sales exceed 10 million CNY, with an additional target bonus of 20K CNY at 5 million CNY threshold.
|
||||||
|
|
||||||
|
8. **Compliance landscape shifting rapidly (2024-2025)**: China's State Council included revision of the 《禁止传销条例》(Anti-Pyramid Selling Regulations) in its 2025 legislative plan. The revision is expected to细化 (clarify) standards for new business models including social e-commerce. As of 2024, at least 6 companies have been penalized for pyramid selling by market regulators. Guangzhou issued China's first social livestreaming industry compliance guidelines in October 2025. The regulatory trend is toward "事前预防、事中监控、事后追责" (prevention, monitoring, accountability).
|
||||||
|
|
||||||
|
9. **Safe design patterns emerging**: The "链动2+1" (Chain Movement 2+1) model has become a reference design -- it restricts tiers to two levels (代理/agent and 老板/boss), requires only 2 direct referrals to upgrade, and caps the total compensation depth. Direct referral rewards: 100 CNY for agents, 300 CNY for bosses. Team-based rewards: 200 CNY per indirect referral (unlimited depth for bosses). A flat 10% "平级奖" rewards bosses whose downline also reaches boss status. This model explicitly avoids the three-tier boundary while maintaining viral growth incentives.
|
||||||
|
|
||||||
|
10. **Key quantitative benchmarks across all models**: Entry thresholds range from 49-999 CNY (commonly 499 CNY for "gift package" purchases). Commission rates: Level 1 direct referral 15-20%, Level 2 indirect 5-10%. Regional agent zone dividends: 2-5% of GMV. Shareholder dividend pools: 5-20% of platform revenue. Tiered rebate steps: typically 3-5 tiers with 2-5 percentage point increments. Maximum legally safe distribution depth: 2 levels (with some platforms operating at 3 levels under careful structuring, but this is the regulatory flashpoint).
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source 1: 分润宝 -- "一文看懂分销商城的分销模式及玩法" (fenrunbao.cn)
|
||||||
|
**Type**: Industry platform analysis article
|
||||||
|
**Key takeaways**: Comprehensive catalog of distribution models including regional agent, area partner, and various profit-sharing structures. The article details how a 100 CNY product with 20 CNY margin (20% commission pool) is split: direct salesperson gets three-tier commissions while the regional agent of the delivery zone receives ~30% of the commission pool (6 CNY) as zone dividend. It explains the priority principle for commission rates: per-product rate > tier rate > default rate. Regional agents are organized by 省/市/区/县 (province/city/district/county), and order attribution is determined by delivery address matching. The article emphasizes that regional agent models transform distributors from simple sellers to channel managers with local market development responsibilities.
|
||||||
|
|
||||||
|
### Source 2: 中伦律师事务所 -- "实操建议:社交电商业务模式避免落入传销陷阱" (zhonglun.com) / Lexology companion
|
||||||
|
**Type**: Law firm professional analysis
|
||||||
|
**Key takeaways**: Provides the most authoritative legal framework for assessing compliance risk. The three statutory criteria for pyramid selling under 《禁止传销条例》 Article 7 are: 拉人头 (recruiting-based compensation), 入门费 (entry fees disguised as product purchases), and 团队计酬 (multi-level team-based rewards). The article identifies that social e-commerce models using "股东分红" terminology are particularly vulnerable because: (1) the term implies equity ownership that does not exist, creating disclosure liability; (2) dividend pools funded by new member entry fees constitute 入门费; (3) when dividends are calculated based on downline volume rather than personal sales, it triggers 团队计酬. The article recommends: keeping distribution depth at 2 levels maximum, ensuring all rewards are tied to actual product sales (not recruitment), maintaining reasonable product pricing (no inflated "gift packages"), and separating marketing bonuses from sales commissions in accounting.
|
||||||
|
|
||||||
|
### Source 3: 知乎专栏 -- "循环购模式解读" (zhuanlan.zhihu.com/p/651671348)
|
||||||
|
**Type**: Detailed mechanism analysis (user-generated expert content)
|
||||||
|
**Key takeaways**: The "循环购" (circular purchase) model is a concrete implementation of shareholder dividend distribution. Platform allocates 20% of each sale into a dividend pool, split into 10 equal portions of 2% each. Each shareholder tier (e.g., bronze, silver, gold, platinum, diamond) receives one portion, distributed equally among members at that tier. Crucially, higher-tier shareholders participate in ALL lower-tier portions simultaneously, creating a compounding effect. For example, a diamond shareholder receives dividends from the diamond pool (2%), plus platinum (2%), gold (2%), silver (2%), and bronze (2%) -- effectively 5x the base rate. The model requires continuous new purchases to sustain the pool, creating a potential sustainability concern. If new purchase velocity slows, dividend per person drops sharply, which can trigger member attrition cascades.
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
1. **Lack of audited case studies**: Most sources are from platform vendors or consulting firms with commercial interests. Independent, peer-reviewed analysis of actual platform performance data (conversion rates, retention, average revenue per distributor) is scarce.
|
||||||
|
|
||||||
|
2. **Welfare zone (福利区) specificity**: The concept of "福利区" as a distinct mechanism (rather than a generic perks layer) is poorly documented. No authoritative source defines it as a formal model with its own calculation methodology. It appears to be a marketing term used by various platforms inconsistently -- sometimes referring to exclusive product catalogs, sometimes to point bonus zones, sometimes to subsidized pricing areas.
|
||||||
|
|
||||||
|
3. **2025 regulatory revision details**: While the 《禁止传销条例》 revision was announced for 2025, the actual revised text and its specific provisions regarding social e-commerce distribution models have not been published as of the search date. The exact new boundaries between legal distribution and illegal pyramid selling remain uncertain.
|
||||||
|
|
||||||
|
4. **Tax implications**: None of the reviewed sources adequately address the individual income tax obligations for distributors receiving commissions, dividends, or task rewards -- a significant compliance gap for platforms operating these models at scale.
|
||||||
|
|
||||||
|
5. **Platform enforcement data**: Limited information on how WeChat, Douyin, and other platforms enforce their internal policies against multi-tier distribution. Platform-level takedowns and account restrictions are a practical compliance risk that is distinct from legal/regulatory risk, but data on enforcement patterns is not publicly available.
|
||||||
|
|
||||||
|
6. **Quantitative sustainability analysis**: No source provides a mathematical model showing the break-even point or sustainability threshold for shareholder dividend pools. The circular purchase model's dependency on continuous new member acquisition raises Ponzi-like structural concerns that have not been rigorously analyzed in publicly available sources.
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
# Task E: Legal Boundary Between Legal Distribution and Illegal Pyramid Selling (China)
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| # | URL | Source Type | Accessibility | Date | Authority |
|
||||||
|
|---|-----|-------------|---------------|------|-----------|
|
||||||
|
| 1 | 《禁止传销条例》(国务院令第444号) | Government regulation | Open | 2005-11-01 | 10 |
|
||||||
|
| 2 | 《直销管理条例》(国务院令第443号) | Government regulation | Open | 2005-12-01 | 10 |
|
||||||
|
| 3 | [最高法/市监总局联合发布惩治网络传销犯罪典型案例](https://www.court.gov.cn/zixun/xiangqing/436301.html) | Government notice (SPC+SAMR) | Open | 2024-06-28 | 10 |
|
||||||
|
| 4 | [公安部公布5起传销犯罪典型案例](https://news.cctv.cn/2024/10/25/ARTIcxHATz7VpMrIyShT8fBI241025.shtml) | Government notice (MPS) | Open | 2024-10-25 | 10 |
|
||||||
|
| 5 | [社交电商步入合规深水区 - Lexology](https://www.lexology.com/library/detail.aspx?g=6f2dfc03-c164-47d8-8571-3876489b583c) | Law firm analysis | Open | 2026 | 8 |
|
||||||
|
| 6 | [社交电商与组织、领导传销活动罪的界限认定 - 君悦律师事务所](https://www.mhplawyer.com/CN/05-14197.aspx) | Law firm analysis | Open | — | 8 |
|
||||||
|
| 7 | [什么是"三级分销"?"三级分销"是传销吗? - 网经社](https://www.100ec.cn/detail--6638350.html) | Industry analysis | Open | 2024 | 7 |
|
||||||
|
| 8 | [真实交易:区分传销与社交营销的本质界限 - 锦天城律师事务所](https://www.allbrightlaw.com/CN/10475/5373d6b4c4b692bc.aspx) | Law firm analysis | Open | — | 8 |
|
||||||
|
| 9 | [社交电商 V.S. 互联网传销 - China Law Insight](https://www.chinalawinsight.com/2020/08/articles/intellectual-property/社交电商-v-s-互联网传销/) | Law firm analysis | Open | 2020-08 | 8 |
|
||||||
|
| 10 | [SPC/SPP/MPS Opinion on Pyramid Schemes](https://www.chinalawtranslate.com/en/spcspp-mps-opinion-on-pyramid-schemes/) | Judicial interpretation (translation) | Open | 2013-11-22 | 10 |
|
||||||
|
| 11 | [《禁止传销条例》连续三年列入重点修订进程 - 新浪财经](https://finance.sina.com.cn/roll/2026-03-24/doc-inhscaes7384769.shtml) | News analysis | Open | 2026-03-24 | 7 |
|
||||||
|
| 12 | [2024年以来六家企业因传销被市监局处罚 - 网经社](https://www.100ec.cn/detail--6638619.html) | Industry analysis | Open | 2024 | 7 |
|
||||||
|
| 13 | [商城有推广功能的注意:三级以上分销违法 - 知乎](https://zhuanlan.zhihu.com/p/721666916) | Technical/compliance guide | Open | 2024-09 | 6 |
|
||||||
|
| 14 | [微信多级分销经营行为官方规范](https://developers.weixin.qq.com/community/business/doc/000c2614a84e70c51e3d8ec1b5a40d) | Platform policy (WeChat) | Open | — | 9 |
|
||||||
|
| 15 | [微信将整顿多级分销欺诈行为 - IT之家](https://www.ithome.com/0/256/946.htm) | News report | Open | 2016 | 6 |
|
||||||
|
| 16 | [花生日记涉传销被罚7456万 - 界面新闻](https://m.jiemian.com/article/2958605.html) | News report | Open | 2019-03 | 7 |
|
||||||
|
| 17 | [云集微店传销事件 - 砍柴网](https://m.ikanchai.com/pcarticle/145783) | News report | Open | 2017 | 7 |
|
||||||
|
| 18 | [永倍达传销案 - 知乎专栏](https://zhuanlan.zhihu.com/p/1954502779520390706) | News/case report | Open | 2024-09 | 6 |
|
||||||
|
| 19 | [警惕"新型消费"下的非法集资、传销陷阱 - 光明网](https://m.gmw.cn/2024-10/29/content_1303883165.htm) | Government warning | Open | 2024-10-29 | 9 |
|
||||||
|
| 20 | [51家!2024年哪些企业因传销被异地市监局执法? - 搜狐](https://www.sohu.com/a/850054092_100116800) | News aggregation | Open | 2024 | 6 |
|
||||||
|
| 21 | [检察机关起诉传销罪4627人 - 最高检](https://www.spp.gov.cn/xwfbh/wsfbt/202410/t20241028_670028.shtml) | Government notice (SPP) | Open | 2024-10-28 | 10 |
|
||||||
|
| 22 | [关于传销案件的法律适用:七条规定明确六方面问题 - 最高检](https://www.spp.gov.cn/zdgz/201401/t20140120_66684.shtml) | Government guidance (SPP) | Open | 2014-01-20 | 10 |
|
||||||
|
| 23 | [团队计酬式传销和拉人头、入门费式传销的本质区别 - 知乎专栏](https://zhuanlan.zhihu.com/p/82778150) | Legal commentary | Open | — | 6 |
|
||||||
|
| 24 | [传销的行刑衔接及法律适用 - 德恒律师事务所](https://www.dehenglaw.com/CN/tansuocontent/0008/030722/7.aspx) | Law firm analysis | Open | — | 8 |
|
||||||
|
| 25 | [Regulation of pyramid schemes in China - ResearchGate](https://www.researchgate.net/publication/387555261_Regulation_of_pyramid_schemes_in_China) | Academic paper | Restricted | 2024 | 9 |
|
||||||
|
| 26 | [MLM Laws in China - Wellman & Warren](https://w-wlaw.com/mlm-laws-in-china/) | Law firm analysis | Open | — | 7 |
|
||||||
|
| 27 | [《禁止传销条例》解读 - 平顶山市政府 DOCX](https://www.pds.gov.cn/upload/files/2021/11/9/《禁止传销条例》解读.docx) | Government interpretation | Open | 2021 | 8 |
|
||||||
|
| 28 | [直销与传销管理条例修订在即 - 纪实资讯](https://www.zxfull.com/2026/04/01/136224/) | News analysis | Open | 2026-04-01 | 7 |
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
1. **Legal framework has two pillars**: 《禁止传销条例》(State Council Order 444, effective 2005-11-01) defines and prohibits pyramid selling; 《直销管理条例》(State Council Order 443, effective 2005-12-01) regulates legal direct selling. Both are 20+ years old and currently under active revision (listed in SAMR legislative tasks for 2024, 2025, and 2026 consecutively, but not yet formally revised as of March 2026).
|
||||||
|
|
||||||
|
2. **Three criteria for identifying pyramid selling (Article 7 of the Regulation)**:
|
||||||
|
- **拉人头 (Recruiting heads)**: Organizers develop personnel and require them to develop others, compensating based on the number of people recruited (direct or indirect, rolling).
|
||||||
|
- **入门费 (Entry fees)**: Organizers require payment of fees or disguised payment (e.g., purchasing products at inflated prices) as a condition to join or to qualify to develop others.
|
||||||
|
- **团队计酬 (Team-based remuneration)**: Organizers require pyramid personnel to form hierarchical relationships and compensate uplines based on downlines' sales performance.
|
||||||
|
|
||||||
|
3. **The "3-tier rule" origin**: The commonly cited "3-tier" threshold comes from the 2013 joint opinion by SPC, SPP, and MPS (《关于办理组织领导传销活动刑事案件适用法律若干问题的意见》). It establishes the **criminal prosecution standard**: an organization must have **30 or more people AND 3 or more levels** (not counting the organizer's own level) for the organizer/leader to face criminal charges under Criminal Law Article 224-1. **This does NOT mean 3-tier is automatically legal** -- even 2-tier can be administratively penalized if it meets the pyramid selling criteria.
|
||||||
|
|
||||||
|
4. **Criminal vs. Administrative distinction**: Criminal Law Article 224-1 only covers "拉人头" and "入门费" type pyramid schemes (with fraudulent intent). "团队计酬" type is generally handled as an administrative violation under the Regulation, unless it is used as a facade for fraud.
|
||||||
|
|
||||||
|
5. **Penalties range dramatically**:
|
||||||
|
- Administrative: 50万-200万元 fine + confiscation of illegal gains (statutory minimum 50万)
|
||||||
|
- Criminal: up to 15 years imprisonment + fines (the Zhang case had a 1亿元 fine)
|
||||||
|
- Platform-level: WeChat permanently bans accounts, blocks payment interfaces
|
||||||
|
|
||||||
|
6. **2024 enforcement intensity**: In Jan-Sep 2024, procuratorates prosecuted 4,627 people for organizing/leading pyramid selling activities. June 2024 saw SPC+SAMR jointly release 5 typical cyber-pyramid selling cases. October 2024 saw MPS release 5 more typical cases. At least 51 companies were penalized by SAMR in 2024, with 4 cross-jurisdictional enforcement cases.
|
||||||
|
|
||||||
|
7. **Major platform cases**:
|
||||||
|
- **花生日记 (2019)**: 7,456万 fine, up to 51 levels, 20M users. Rectified in 2018.
|
||||||
|
- **云集 (2017)**: 958万 fine, public account permanently banned. Rectified in 2016, listed on NASDAQ in 2019.
|
||||||
|
- **永倍达 (2023-2025)**: ~1000亿 RMB involved, 11M users, final conviction in 2025 (Anhui intermediate court), 10 executives sentenced, 5亿 RMB fine (mostly uncollectible).
|
||||||
|
|
||||||
|
8. **WeChat anti-pyramid policy**: WeChat's official rules explicitly prohibit multi-level distribution fraud using WeChat relationships. Penalties include feature restrictions to permanent account bans. WeChat Pay merchant review forms specifically check for hierarchical relationships and commission structures above 3 levels. The policy covers public accounts, mini-programs (Article 5.9.3), and video accounts.
|
||||||
|
|
||||||
|
9. **Legal distribution model must**: (a) have genuine product transactions at market prices, (b) limit commission tiers to 3 or fewer, (c) base commissions on actual sales profit not recruitment, (d) avoid mandatory entry fees or product purchase requirements, (e) maintain reasonable pricing without inflated "membership" markups.
|
||||||
|
|
||||||
|
10. **2026 regulatory trends**: The revision of both the Direct Sales and Anti-Pyramid Selling regulations is in substantive preparation. Potential changes include possible decriminalization/redefinition of "团队计酬" and clearer boundaries for social e-commerce. The regulatory emphasis has shifted from pure prohibition to compliance guidance ("合规深水区").
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source 1: SPC/SPP/MPS Joint Opinion on Pyramid Schemes (2013)
|
||||||
|
|
||||||
|
This judicial interpretation (via China Law Translate English translation) is the single most important document for understanding the criminal threshold. Key provisions:
|
||||||
|
|
||||||
|
- **Article 1**: Defines the criminal threshold as 30+ people and 3+ levels for Criminal Law Article 224-1 prosecution.
|
||||||
|
- **Article 2**: Clarifies that the "3 levels" count does NOT include the organizer's own level -- meaning 4 total tiers triggers criminal liability.
|
||||||
|
- **Article 3**: Establishes that "team remuneration" (团队计酬) is only criminal if it is used as a cover for fraud (骗取财物). Legitimate team-based sales compensation is NOT criminal.
|
||||||
|
- **Article 4**: Defines "organizing and leading" to include founders, decision-makers, key managers, and those who play key roles in recruiting/training.
|
||||||
|
- **Article 6**: Addresses cross-regional jurisdiction for online pyramid schemes.
|
||||||
|
|
||||||
|
This document is the legal basis for the commonly cited "3-tier rule" but importantly distinguishes between administrative illegality and criminal liability.
|
||||||
|
|
||||||
|
### Source 3: SPC + SAMR 5 Typical Cases (June 2024)
|
||||||
|
|
||||||
|
The joint release by Supreme People's Court and State Administration for Market Regulation on 2024-06-28 covers 5 representative cyber-pyramid selling cases:
|
||||||
|
|
||||||
|
1. **Zhang case**: Posed as "poverty alleviation and shared prosperity" charity, illegally obtained 2.5 billion RMB. Principal received 15 years (maximum sentence) + 100 million RMB fine. Demonstrates the "打财断血" (cut off financial resources) principle.
|
||||||
|
|
||||||
|
2. **Zhejiang company (Qian et al.) case**: Used "smart charging station mall system" platform to conduct pyramid selling (2020-2022). Demonstrates how new technology/business models are used as cover.
|
||||||
|
|
||||||
|
3. **Other cases** in the set involved investment-return schemes, fake public welfare fronts, and new e-commerce models.
|
||||||
|
|
||||||
|
Key patterns across all 5 cases: high-return investment promises, fee-based membership qualification, hierarchical organization, recruitment-based compensation. The cases were deliberately selected to show enforcement against diverse new-format pyramid schemes.
|
||||||
|
|
||||||
|
### Source 12: 2024 Six Companies Penalized by SAMR
|
||||||
|
|
||||||
|
NetEconomy Society (100ec.cn) documented 6 specific administrative penalty cases in 2024:
|
||||||
|
|
||||||
|
| # | Company | Penalty | Date |
|
||||||
|
|---|---------|---------|------|
|
||||||
|
| 01 | 广州依本生物科技有限公司 | 7万元 fine | 2024-02-21 |
|
||||||
|
| 02 | 鹤壁市开发区理视康保健服务中心 | 60万余元 confiscated+fined | — |
|
||||||
|
| 03 | 永乐优选(广东)科技有限公司 | 129万余元 (79万 confiscation + 50万 fine) | 2024-02-28 |
|
||||||
|
| 04 | 广州麦戈儿科索贸易有限公司 | 50万元 fine | — |
|
||||||
|
| 05 | 南通社群空间网络科技有限公司 | 120万元 fine | 2024-04-16 |
|
||||||
|
| 06 | 未来店(广东)网络科技有限公司 | 50万元 fine | 2024-04-22 |
|
||||||
|
|
||||||
|
Note that Company #1's 7万元 fine is below the statutory minimum of 50万元, suggesting application of discretionary lighter punishment (possibly voluntary cooperation, small scale, or first offense). The other 5 cases fall within the statutory 50-200万 range.
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
1. **Full text of the 2026 proposed revision**: The revision is "推动修订" but the draft text has not been publicly released. Cannot assess specific changes to the "团队计酬" definition or tier limits.
|
||||||
|
|
||||||
|
2. **WeChat's exact tier enforcement mechanism**: While WeChat's general policy is known, the specific technical implementation of tier monitoring in merchant review forms (《商户业务模式自查报告》) could not be fully accessed.
|
||||||
|
|
||||||
|
3. **花生日记 rectification details**: The specific operational changes made by 花生日记 after the 2019 penalty (beyond public statements) are not fully documented in accessible sources.
|
||||||
|
|
||||||
|
4. **云集 post-listing compliance model**: How 云集 operates its distribution model post-2019 NASDAQ listing, specifically how it maintains compliance with Chinese law while operating multi-level incentives.
|
||||||
|
|
||||||
|
5. **2025-2026 specific enforcement case details**: Many 2025 cases are referenced but full penalty decisions are not publicly accessible, particularly for social e-commerce platforms.
|
||||||
|
|
||||||
|
6. **Provincial-level enforcement variation**: Significant variation exists between provinces in enforcement intensity and standards (e.g., Shandong 成武 "趋利执法" controversy in August 2024 where a county-level SAMR allegedly demanded 2100万 from a company). Systematic analysis of this variation is not available.
|
||||||
|
|
||||||
|
7. **Direct comparison with US/EU pyramid selling standards**: While the ResearchGate academic paper exists, it is access-restricted. A comparative analysis of China's approach vs. FTC/Kelly Koscot test would strengthen the legal framework understanding.
|
||||||
|
|
||||||
|
8. **WeChat video account (视频号) specific rules**: The exact tier limits and enforcement mechanisms for video account-based distribution are not clearly documented.
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
# Task F: Chinese Social Commerce Distribution Models Research
|
||||||
|
|
||||||
|
Research date: 2026-05-06
|
||||||
|
Researcher: Industry Practice Observer
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
| URL | Source-Type | Accessibility | Date | Authority |
|
||||||
|
|-----|-------------|---------------|------|-----------|
|
||||||
|
| [拼多多2025年财报](https://www.iyiou.com/news/202603251125182) | 财报/新闻 | Open | 2026-03 | 9 |
|
||||||
|
| [拼多多2024年总收入](https://www.199it.com/archives/1746028.html) | 数据聚合 | Open | 2025-03 | 8 |
|
||||||
|
| [Temu GMV 970亿美元](https://xueqiu.com/2226084138/373565004) | 雪球分析 | Open | 2025 | 7 |
|
||||||
|
| [China Social Commerce Intelligence Report 2025](https://www.globenewswire.com/de/news-release/2025/05/08/3077093/28124/en/China-Social-Commerce-Intelligence-Report-2025-Market-to-Reach-769-Billion-by-2030-Driven-by-Platform-Innovations-Strategic-Partnerships-and-Significant-Investments.html) | 行业报告 | Open | 2025-05 | 8 |
|
||||||
|
| [抖音电商GMV超30%逼近拼多多](https://finance.sina.com.cn/roll/2025-12-09/doc-inhahnvi2176549.shtml) | 新浪财经 | Open | 2025-12 | 8 |
|
||||||
|
| [云集被退市警示](https://www.100ec.cn/detail--6604210.html) | 网经社 | Open | 2024-04 | 8 |
|
||||||
|
| [社交电商大溃败](https://m.cyzone.cn/article/646897) | 创业邦 | Open | 2024-2025 | 8 |
|
||||||
|
| [社交电商步入合规深水区](https://www.lexology.com/library/detail.aspx?g=6f2dfc03-c164-47d8-8571-3876489b583c) | 法律分析 | Open | 2024 | 9 |
|
||||||
|
| [花生日记涉传被罚904万](https://m.ebrun.com/ebrungo/zb/422867.html) | 亿邦动力 | Open | 2021-02 | 8 |
|
||||||
|
| [花生日记官网](https://www.ahsrj.com/) | 企业官网 | Open | 2024 | 7 |
|
||||||
|
| [城市酷选港股上市](https://hea.china.com/articles/20260421/202604211851437.html) | 中华网 | Open | 2026-04 | 7 |
|
||||||
|
| [城市酷选冲刺港股估值超10亿](https://news.iresearch.cn/yx/2025/08/531266.shtml) | 艾瑞 | Open | 2025-08 | 8 |
|
||||||
|
| [城市酷选HKEX招股书](https://www1.hkexnews.hk/listedco/listconews/gem/2025/1211/2025121100660.pdf) | 招股书 | Open | 2025-12 | 9 |
|
||||||
|
| [城市酷选商业模式合规深度解密](https://m.tech.china.com/redian/2026/0422/042026_1852405.html) | 中华网 | Open | 2026-04 | 6 |
|
||||||
|
| [有赞分销系统](https://www.youzan.com/intro/fenxiao) | 企业官网 | Open | 2024-2025 | 8 |
|
||||||
|
| [微三云官网](https://www.weisanyun.cn/) | 企业官网 | Open | 2024-2025 | 7 |
|
||||||
|
| [HiShop推客分销](https://www.hishop.com.cn/himall/show_161486.html) | 企业官网 | Open | 2025-2026 | 7 |
|
||||||
|
| [2025中国社交电商行业分析](https://www.chyxx.com/industry/1214588.html) | 产业研究院 | Open | 2025-03 | 8 |
|
||||||
|
| [小红书猛拉新32元一个](https://www.ebrun.com/20241230/569054.shtml) | 亿邦动力 | Open | 2024-12 | 8 |
|
||||||
|
| [QuestMobile 2025双十一报告](https://www.questmobile.com.cn/research/report/1991031672729079809/) | 行业报告 | Open | 2025-11 | 9 |
|
||||||
|
| [社交电商V.S.互联网传销](https://www.chinalawinsight.com/2020/08/articles/intellectual-property/%E7%A4%BE%E4%BA%A4%E7%94%B5%E5%95%86-v-s-%E4%BA%92%E8%81%94%E7%BD%91%E4%BC%A0%E9%94%80/) | 法律分析 | Open | 2020-08 | 9 |
|
||||||
|
| [有赞2025半年度业绩交流会](https://docs.publicnow.com/viewDoc.aspx?filename=83715%5CEXT%5CD66D47377F05E616A6790B3093B2FCF4F75469C6_2239FC89E1284775BB1FF9190DE96F8930D921EE.PDF) | 业绩纪要 | Open | 2025 | 9 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Findings
|
||||||
|
|
||||||
|
1. **拼多多2025全年营收4318.5亿元(同比+10%)**,增速从2024年的59%显著放缓至10%,标志社交裂变驱动的增长模式已进入存量期。Non-GAAP利润约1025.6亿元。Temu海外GMV从2024年180亿美元跃升至2025年970亿美元,"砍一刀"社交裂变模式成功复制到海外。
|
||||||
|
|
||||||
|
2. **云集从传销到退市的完整衰退弧**:2017年因三级分销涉传销被罚958万元后,历经"限制两级分销→会员制电商→私域电商→平台化"多轮转型。但纳斯达克上市4年后市值缩水99%,2024年被退市警示,"会员电商第一股"实质已终结。2024年获国家级高新技术企业称号,但商业模型未能恢复增长。
|
||||||
|
|
||||||
|
3. **花生日记罚单从7456万降至904万**:2019年因51级传销链被罚7456万元(社交电商最大罚单),2021年经行政复议撤销原判、改罚904万元。此后完成整改并持续运营至今,官网正常,宣称用户超1亿。但行业热度已大幅下降,未能恢复罚前增长势头。
|
||||||
|
|
||||||
|
4. **城市酷选477天港股上市(08050.HK)**:采用"排队免单+异业联盟"模式,宣称覆盖80万+商家、9000万+用户,年交易规模超百亿元。2023年获香港鸿蒙资本1亿元A轮融资,2026年4月港股GEM上市估值超10亿元。2025H1营收约2194万港元、净利1115万港元(扭亏,但主要依赖一次性收入1611万港元)。核心争议:排队免单本质是用新增用户资金为老用户返利,高度依赖持续增长,存在庞氏特征风险。
|
||||||
|
|
||||||
|
5. **SaaS平台分销功能矩阵**:
|
||||||
|
- **有赞**:SaaS年费制,支持无限级代理、多级分销、自动化结算,2024年发布智能化复购分销系统,2025年H1业绩稳定。
|
||||||
|
- **微三云**:源码买断模式,提供上百种分销模式(链动2+1、排队补贴、众店模式等),适合技术团队二次开发。
|
||||||
|
- **HiShop**:老牌系统商,2025年主推"推客分销"、微信小店深度适配、全场景带货模式,2026年趋势为合规化运营+按效果付费。
|
||||||
|
|
||||||
|
6. **2024-2026行业趋势**:中国社交电商GMV从2023年3.42万亿元增长,预计2030年达7690亿美元。抖音电商2024年GMV约3.5万亿元、2025年目标4.2-4.3万亿元(增速超30%逼近拼多多)。社交电商占网络零售比例预计2025年达17.1%。核心趋势:从"流量裂变"转向"心智占领"、直播电商主导、AI驱动精细化运营、合规化高压。
|
||||||
|
|
||||||
|
7. **CAC对比**:拼多多早期社交裂变获客成本仅5-7元/人(远低于行业),但2025年CAC持续攀升。小红书2024年地推拉新约32元/人。抖音广告CPE约2.0元。全行业2024年平均获客成本同比上涨约23%。电商已进入存量竞争时代。
|
||||||
|
|
||||||
|
8. **快手差异化优势**:用户月均复购率4.2次(抖音1.5次、拼多多3.1次),深耕"熟人社交"在下沉市场壁垒高。2025年四大平台(抖音、拼多多、快手、小红书)年交易额合计超8万亿元。
|
||||||
|
|
||||||
|
9. **"三级分销"法律红线持续收紧**:2024-2025年社交电商合规监管高压,Lexology等法律分析指出"入门费+拉人头+下线计酬"三要素同时出现即构成传销。各SaaS平台已将分销层级压缩至两级或以下以规避风险。
|
||||||
|
|
||||||
|
10. **拼多多"千亿扶持"计划**:2025年4月正式推出,未来三年投入超1000亿元构建用户-商家-平台共赢生态,标志从"低价掠夺"转向"生态共建"的战略调整。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deep Read Notes
|
||||||
|
|
||||||
|
### Source 1: 城市酷选HKEX招股书 (2025-12)
|
||||||
|
- **类型**:官方招股书,权威性最高
|
||||||
|
- **关键数据**:聚合约90万家商户;收益2193.7万港元(2025H1);扭亏为盈依赖一次性收入(1611万港元),核心业务盈利能力存疑
|
||||||
|
- **模式分析**:招股书将平台定位为"SaaS软件服务商"而非交易平台运营方,强调"不发起、不参与、不运营"线下排队免单活动——这种法律定位设计明显是为了规避传销/非法集资的监管风险
|
||||||
|
- **风险信号**:排队免单模式的资金池运作透明度不足,用户提现规则存在争议;核心增长驱动力高度依赖新增商户和消费者的持续涌入
|
||||||
|
|
||||||
|
### Source 2: 云集退市警示与社交电商大溃败 (创业邦/网经社, 2024-2025)
|
||||||
|
- **类型**:行业深度分析
|
||||||
|
- **关键叙事**:云集的衰退代表了整个"社交电商"品类的系统性困境——从2019年的资本狂热到2024年的"集体幻灭"
|
||||||
|
- **核心洞察**:
|
||||||
|
1. 云集转型路径(三级分销→两级→会员制→私域→平台化)本质上是在不断剥离增长引擎以换取合规性,每"整改"一次就失去一层增长动力
|
||||||
|
2. 贝店(云集旗下)2021年爆雷是标志性事件——社交电商"拉人头"模式已被证明在监管高压下不可持续
|
||||||
|
3. 到2025年,真正存活的"社交电商"已从独立平台转型为依附于微信/抖音生态的分销工具(SaaS化),而非独立流量入口
|
||||||
|
- **对研究的启示**:社交电商的"分销"概念已从"多层级人头费"演变为"内容驱动的推荐佣金"——这是合规化后的根本范式转移
|
||||||
|
|
||||||
|
### Source 3: 拼多多2025财报 + Temu增长分析
|
||||||
|
- **类型**:财报数据 + 分析师解读
|
||||||
|
- **关键数据**:2025全年营收4318.5亿元(+10%),增速从2024年59%断崖式下降;Temu GMV从180亿→970亿美元
|
||||||
|
- **深层分析**:
|
||||||
|
1. 国内拼多多"拼团裂变"模式的增长天花板已现——7.2亿年活买家接近中国网购人口上限,CAC持续攀升
|
||||||
|
2. 增长接力棒已交给Temu——"砍一刀"社交裂变在北美/欧洲同样有效,但面临地缘政治和监管风险
|
||||||
|
3. "千亿扶持"计划(1000亿元/3年)是战略转向信号:从"零和博弈"(压榨商家)转向"正和博弈"(生态共建),但短期内可能进一步压缩利润率
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Gaps
|
||||||
|
|
||||||
|
1. **城市酷选完整财务数据**:HKEX招股书仅披露了部分中期数据,年度营收、GMV具体口径(是否含退款/刷单)无法核实。招股书中"排队免单"资金池的会计处理方式不明确。
|
||||||
|
|
||||||
|
2. **微三云实际客户数据**:作为源码出售模式,缺乏公开的客户数量、续费率、GMV贡献等核心经营指标。
|
||||||
|
|
||||||
|
3. **花生日记2024-2025运营数据**:仅有"用户超1亿"的官方宣称,缺乏第三方验证。APP下载量和活跃度数据缺失。
|
||||||
|
|
||||||
|
4. **SaaS平台分销功能合规性对比**:各平台如何将分销层级控制在法律红线(三级)以内的具体技术方案缺乏系统性对比。
|
||||||
|
|
||||||
|
5. **CAC精确对比数据**:各平台的获客成本数据口径不一(拼多多用营销费用率推算、小红书用地推成本、抖音用广告CPE),无法做标准化横向对比。
|
||||||
|
|
||||||
|
6. **"排队免单"模式法律定性**:目前缺乏权威司法判例明确判定"排队免单"是否构成传销或非法集资,城市酷选的合规辩护是否经得起法律检验尚无结论。
|
||||||
|
|
||||||
|
7. **2026年最新政策变化**:社交电商/分销模式的最新监管政策(特别是2025年底至2026年初的法规更新)搜索覆盖不足。
|
||||||
|
|
||||||
|
8. **快手电商GMV和利润数据**:在2024-2025年社交电商格局中的具体GMV、盈利状况缺乏详细数据支撑。
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
name: remote-sync
|
||||||
|
description: 将本地项目目录通过 rsync 增量同步到远端服务器 39.100.114.100:/data。自动排除 node_modules/.git 等文件。需通过 `/remote-sync` 显式调用。本技能为项目级,仅对 /home/zdh/projects 目录下的文件生效。
|
||||||
|
trigger: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# 项目部署技能
|
||||||
|
|
||||||
|
## 使用说明
|
||||||
|
|
||||||
|
通过 `/remote-sync` 调用,将本地目录增量同步到远端服务器。本技能仅在 `/home/zdh/projects` 目录下可用。
|
||||||
|
|
||||||
|
## 远端目标
|
||||||
|
|
||||||
|
- 服务器: `39.100.114.100`
|
||||||
|
- 用户: `root`
|
||||||
|
- 密码: `QQmm3721`
|
||||||
|
- 远端路径: `/data/projects`
|
||||||
|
|
||||||
|
## 操作流程
|
||||||
|
|
||||||
|
1. **确认本地目录**:询问用户要上传的本地目录路径。如果用户未指定,默认使用当前工作目录。
|
||||||
|
2. **确认远端子目录**:询问文件上传到 `/data` 下的哪个子目录。用户可直接回车表示上传到 `/data` 根下,也可指定子路径(如 `my-project` 则目标为 `/data/my-project`)。
|
||||||
|
3. **执行同步**:使用 `rsync` 通过 SSH 增量同步。
|
||||||
|
4. **输出结果**:显示同步完成的文件数量和远端路径。
|
||||||
|
|
||||||
|
## 同步命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sshpass -p 'QQmm3721' rsync -avz --delete \
|
||||||
|
--exclude 'node_modules' \
|
||||||
|
--exclude '.git' \
|
||||||
|
--exclude '.next' \
|
||||||
|
--exclude '.nuxt' \
|
||||||
|
--exclude '.cache' \
|
||||||
|
--exclude 'dist' \
|
||||||
|
--exclude '*.log' \
|
||||||
|
--exclude '.env' \
|
||||||
|
--exclude '.env.*' \
|
||||||
|
--exclude 'coverage' \
|
||||||
|
--exclude '.DS_Store' \
|
||||||
|
--exclude 'Thumbs.db' \
|
||||||
|
-e "ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10" \
|
||||||
|
<本地目录>/ \
|
||||||
|
root@39.100.114.100:/data/<远端子目录>/
|
||||||
|
```
|
||||||
|
|
||||||
|
**说明**:
|
||||||
|
- `--delete`:远端删除本地已不存在的文件,保持镜像一致
|
||||||
|
- `-avz`:归档模式 + 显示详情 + 压缩传输
|
||||||
|
- `StrictHostKeyChecking=no`:避免首次连接交互确认
|
||||||
|
- 末尾 `/` 不可省略,表示同步目录内容而非目录本身
|
||||||
|
|
||||||
|
## 依赖检查
|
||||||
|
|
||||||
|
首次执行前检查 `sshpass` 是否已安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
which sshpass
|
||||||
|
```
|
||||||
|
|
||||||
|
如未安装,提示用户执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install -y sshpass # Debian/Ubuntu
|
||||||
|
# 或
|
||||||
|
sudo yum install -y sshpass # CentOS/RHEL
|
||||||
|
```
|
||||||
|
|
||||||
|
## 无 sshpass 降级方案
|
||||||
|
|
||||||
|
若无法安装 sshpass,退回到交互式 SSH 密钥认证:
|
||||||
|
|
||||||
|
1. 提示用户执行 `ssh-copy-id root@39.100.114.100` 配置免密登录
|
||||||
|
2. 或使用 `rsync` 不带 sshpass,让用户手动输入密码
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.superpowers/
|
||||||
|
qModel/.git/
|
||||||
|
招标投标AI推广应用政策解读/.git/
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## 项目概览
|
||||||
|
|
||||||
|
"一人公司开发团队知识库" — 独立开发者的技术沉淀与参考资源站。
|
||||||
|
|
||||||
|
所有文档以单页 HTML 形式发布,通过根目录 `index.html` 作为导航入口统一展示。
|
||||||
|
|
||||||
|
## 版本控制
|
||||||
|
|
||||||
|
根目录 `projects/` **不是 git 仓库**。`招标投标AI推广应用政策解读/` 子目录有独立的 `.git/`。部署通过 `/remote-sync`(rsync)完成,不走 git push 流程。
|
||||||
|
|
||||||
|
## 目录结构
|
||||||
|
|
||||||
|
```
|
||||||
|
projects/
|
||||||
|
├── index.html # 知识库导航页(卡片式 SPA)
|
||||||
|
├── crmeb-mer-graph-report.html # CRMEB-MER 项目图谱报告(根级)
|
||||||
|
├── .claude/
|
||||||
|
│ ├── design-tokens.md # UI 设计规范(Ant Design 阿里云风格)
|
||||||
|
│ └── skills/ # 项目级技能
|
||||||
|
│ ├── remote-sync/ # 远端部署同步
|
||||||
|
│ └── deep-research/ # 深度研究报告生成
|
||||||
|
├── .superpowers/ # Superpowers 技能框架
|
||||||
|
├── Claude Code 工程师使用指南/报告/ # Claude Code 最佳实践文档
|
||||||
|
├── Graphify 深度分析报告/代码/ # Graphify 项目代码分析
|
||||||
|
├── MySQL转PostgreSQL迁移工具/报告/ # 数据库迁移工具对比
|
||||||
|
├── 代码图谱工具调研/报告/ # 代码结构工具对比调研
|
||||||
|
├── mcp-services-guide/ # MCP 服务大全参考文档
|
||||||
|
├── 分销商城推广模式调研/报告/ # 分销推广模式调研
|
||||||
|
├── 国内商业业态分类到家/报告/ # 到家业态分类调研
|
||||||
|
├── 在线下单配送抢单小程序调研/报告/ # 配送抢单小程序调研
|
||||||
|
├── 招标投标AI推广应用政策解读/报告/ # 招标投标AI政策与省级智慧监管平台解读(独立 git 子仓库)
|
||||||
|
├── 沈阳顺义-数据-项目建设方案/ # 沈阳顺义数据项目建设方案(纯文本需求文档)
|
||||||
|
├── 交互式演示/ # 交互式 HTML 演示(如 3D 动画)
|
||||||
|
├── 全域智能认证与门户平台/报告/ # 全域智能认证平台需求分析
|
||||||
|
└── 金鹿商城电商小程序需求分析/报告/ # 金鹿商城电商小程序需求分析文档
|
||||||
|
```
|
||||||
|
|
||||||
|
每个子目录遵循 `{主题}/{类型}/` 的层级结构,类型包括 `报告/`、`代码/`、`笔记/` 等。新增主题目录时保持此约定。
|
||||||
|
|
||||||
|
## 构建与开发
|
||||||
|
|
||||||
|
本项目是**纯静态 HTML/CSS/JS 文档站**,无构建步骤、无依赖管理、无测试框架。
|
||||||
|
|
||||||
|
- **查看页面**:直接在浏览器中打开 `index.html` 或任意 HTML 文件
|
||||||
|
- **新增文档**:创建 HTML 文件 → 更新 `index.html` 的 `entries` 数组 → 如需新分组则同步更新 `groups` 和 `badgeLabels`
|
||||||
|
- **部署到远端**:调用 `/remote-sync` 将指定目录增量同步到服务器 `39.100.114.100:/data`
|
||||||
|
- **更新图谱**:修改代码后运行 `graphify-rs build --path . --output graphify-out --no-llm --update`
|
||||||
|
|
||||||
|
## 索引页
|
||||||
|
|
||||||
|
`index.html` 是纯 HTML/CSS/JS 单文件页面,无构建步骤,直接在浏览器打开即可访问。
|
||||||
|
|
||||||
|
- 文档条目通过 `entries` 数组管理(约 `index.html:234` 附近,因修改可能偏移)
|
||||||
|
- 新增文档时需同步向 `entries` 数组添加条目,格式:`["相对路径", "标题", "描述", "日期", "颜色"]`
|
||||||
|
- 颜色可选:`blue`(工程指南)、`pink`(深度分析)、`mint`(调研研究)、`lavender`(参考资源)
|
||||||
|
- 分组在 `groups` 数组定义(约 `index.html:307` 附近),通过 `filter` 函数按颜色匹配
|
||||||
|
- badge 标签在 `badgeLabels` 对象定义(约 `index.html:314` 附近),新增颜色需同步更新此处
|
||||||
|
- 页面包含筛选栏(filter-bar)、卡片网格展示、响应式布局(≤768px 隐藏侧栏)
|
||||||
|
|
||||||
|
## 报告页模板
|
||||||
|
|
||||||
|
所有报告页(`{主题}/报告/*.html`)遵循统一的 HTML 模板结构:
|
||||||
|
1. 复用 `index.html` 中的 CSS `:root` 设计 Token 块
|
||||||
|
2. 固定 header-bar(sticky top,品牌标题渐变)
|
||||||
|
3. 单列容器布局,`max-width: 1200px` 居中
|
||||||
|
4. Markdown 内容通过内联 HTML 渲染(表格、代码块、列表)
|
||||||
|
5. 语言属性 `lang="zh-CN"`
|
||||||
|
|
||||||
|
创建新报告页时可参考任意现有报告页的 HTML 结构作为模板。
|
||||||
|
|
||||||
|
## UI 设计规范
|
||||||
|
|
||||||
|
所有页面(索引页 + 报告页)遵循 `.claude/design-tokens.md` 中的 Ant Design 阿里云风格设计规范。关键约束:
|
||||||
|
|
||||||
|
- **配色方案**:品牌色 `#1677FF`,功能色(成功 `#52C41A`、警告 `#FAAD14`、错误 `#FF4D4F`)
|
||||||
|
- **字体规范**:基准字号 14px,行高 22px,字体族使用系统默认 + 中文字体回退
|
||||||
|
- **圆角体系**:`2px / 6px / 8px / 12px` 四级
|
||||||
|
- **间距基准**:8px 单位
|
||||||
|
- **主题**:全部页面统一使用亮色主题
|
||||||
|
|
||||||
|
创建新 HTML 页面时应直接复用 `index.html` 中的 CSS 变量(`:root` 块),不要重新定义颜色值。完整规范详见 `.claude/design-tokens.md`。
|
||||||
|
|
||||||
|
## Graphify 知识图谱
|
||||||
|
|
||||||
|
本项目已集成 graphify-rs 知识图谱。图谱输出位于 `graphify-out/` 目录(按需生成,默认不存在,需手动构建)。
|
||||||
|
|
||||||
|
- 架构/代码库问题:如果 `graphify-out/` 存在,先读取 `graphify-out/GRAPH_REPORT.md` 了解核心节点和社区结构
|
||||||
|
- 如果 `graphify-out/wiki/index.md` 存在,优先导航该索引而非直接读取原始文件
|
||||||
|
- 修改代码文件后,运行 `graphify-rs build --path . --output graphify-out --no-llm --update` 保持图谱更新(AST-only,约 2-5s)
|
||||||
|
- graphify-rs 使用手册参考 `graphify-rs使用手册/` 目录
|
||||||
|
|
||||||
|
## 项目级 Skills
|
||||||
|
|
||||||
|
`.claude/skills/` 下挂载了项目级技能:
|
||||||
|
|
||||||
|
| 技能 | 说明 | 触发方式 |
|
||||||
|
|------|------|---------|
|
||||||
|
| `remote-sync` | rsync 增量同步到远端服务器 `39.100.114.100:/data`,自动排除 `node_modules`/`.git` | `/remote-sync` 手动调用 |
|
||||||
|
| `deep-research` | 生成格式控制的研究报,含证据追踪和引用 | `/deep-research` 手动调用 |
|
||||||
|
|
||||||
|
`deep-research` 技能包含大量参考资料和调研笔记(`.claude/skills/deep-research/references/` 和 `research-notes/`),执行深度研究时会用到。
|
||||||
@@ -0,0 +1,785 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MySQL 转 PostgreSQL 迁移工具对比</title>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--color-primary: #1677FF;
|
||||||
|
--color-primary-hover: #4096FF;
|
||||||
|
--color-primary-active: #0958D9;
|
||||||
|
--color-primary-bg: #E6F4FF;
|
||||||
|
--color-success: #52C41A;
|
||||||
|
--color-success-bg: #F6FFED;
|
||||||
|
--color-success-border: #B7EB8F;
|
||||||
|
--color-warning: #FAAD14;
|
||||||
|
--color-warning-bg: #FFFBE6;
|
||||||
|
--color-warning-border: #FFE58F;
|
||||||
|
--color-error: #FF4D4F;
|
||||||
|
--color-error-bg: #FFF2F0;
|
||||||
|
--color-error-border: #FFCCC7;
|
||||||
|
|
||||||
|
--bg: #F5F5F5;
|
||||||
|
--bg-secondary: #FFFFFF;
|
||||||
|
--bg-tertiary: #FAFAFA;
|
||||||
|
--border: #D9D9D9;
|
||||||
|
--border-light: #F0F0F0;
|
||||||
|
--text-primary: #141414;
|
||||||
|
--text-secondary: #595959;
|
||||||
|
--text-tertiary: #8C8C8C;
|
||||||
|
|
||||||
|
--radius-sm: 6px;
|
||||||
|
--radius-md: 8px;
|
||||||
|
|
||||||
|
--shadow-sm: 0 1px 2px rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02);
|
||||||
|
--shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 4px 12px -2px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
--sidebar-w: 260px;
|
||||||
|
--header-h: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', Roboto, Oxygen, sans-serif;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.57;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||||
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
::-webkit-scrollbar-thumb { background: #D9D9D9; border-radius: 3px; }
|
||||||
|
::-webkit-scrollbar-thumb:hover { background: #8C8C8C; }
|
||||||
|
|
||||||
|
.header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0; left: 0; right: 0;
|
||||||
|
height: var(--header-h);
|
||||||
|
background: rgba(255,255,255,0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
border-bottom: 1px solid var(--border-light);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
font-weight: 700;
|
||||||
|
background: linear-gradient(135deg, var(--color-primary), #722ED1);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
position: fixed;
|
||||||
|
top: var(--header-h); left: 0; bottom: 0;
|
||||||
|
width: var(--sidebar-w);
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 1.25rem 0;
|
||||||
|
z-index: 90;
|
||||||
|
}
|
||||||
|
.sidebar .toc-label {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
padding: 0 1.25rem;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
.sidebar nav ol { list-style: none; padding: 0; counter-reset: toc; }
|
||||||
|
.sidebar nav li { counter-increment: toc; padding: 0; }
|
||||||
|
.sidebar nav a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.45rem 1.25rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
border-left: 2px solid transparent;
|
||||||
|
transition: all 0.15s;
|
||||||
|
}
|
||||||
|
.sidebar nav a::before {
|
||||||
|
content: counter(toc) ". ";
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-right: 0.4rem;
|
||||||
|
}
|
||||||
|
.sidebar nav a:hover {
|
||||||
|
color: var(--color-primary);
|
||||||
|
background: var(--color-primary-bg);
|
||||||
|
}
|
||||||
|
.sidebar nav a.active {
|
||||||
|
color: var(--color-primary);
|
||||||
|
border-left-color: var(--color-primary);
|
||||||
|
background: var(--color-primary-bg);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
margin-left: var(--sidebar-w);
|
||||||
|
margin-top: var(--header-h);
|
||||||
|
padding: 2rem 2.5rem 4rem;
|
||||||
|
min-height: calc(100vh - var(--header-h));
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
margin: 40px 0;
|
||||||
|
scroll-margin-top: calc(var(--header-h) + 1rem);
|
||||||
|
}
|
||||||
|
section h2 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
section h3 {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
margin: 24px 0 12px;
|
||||||
|
color: #722ED1;
|
||||||
|
}
|
||||||
|
section h4 {
|
||||||
|
font-size: 1rem;
|
||||||
|
margin: 16px 0 8px;
|
||||||
|
color: var(--color-success);
|
||||||
|
}
|
||||||
|
section p { color: var(--text-secondary); margin: 8px 0; font-size: 0.92rem; }
|
||||||
|
section ul { margin-left: 20px; color: var(--text-secondary); font-size: 0.92rem; }
|
||||||
|
section ul li { margin: 4px 0; }
|
||||||
|
|
||||||
|
.table-wrap { overflow-x: auto; margin: 20px 0; }
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
font-weight: 600;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
td { background: var(--bg-secondary); }
|
||||||
|
tbody tr:hover td { background: var(--color-primary-bg); }
|
||||||
|
|
||||||
|
.card-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 24px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.card:hover {
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
.card h3 { margin: 0 0 4px; font-size: 1.15rem; color: var(--text-primary); }
|
||||||
|
.card .vendor {
|
||||||
|
color: var(--color-success);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.card .badge-row { margin: 8px 0; }
|
||||||
|
.card p { color: var(--text-secondary); font-size: 0.92rem; margin: 8px 0 0; }
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
.badge-cloud { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid var(--color-warning-border); }
|
||||||
|
.badge-open { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
|
||||||
|
.badge-free { background: var(--color-primary-bg); color: var(--color-primary); border: 1px solid rgba(22,119,255,0.25); }
|
||||||
|
.badge-paid { background: var(--color-error-bg); color: var(--color-error); border: 1px solid var(--color-error-border); }
|
||||||
|
.badge-cli { background: rgba(114,46,209,0.08); color: #722ED1; border: 1px solid rgba(114,46,209,0.20); }
|
||||||
|
.badge-gui { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
|
||||||
|
|
||||||
|
.verdict {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border-light);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 24px 32px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.verdict h4 {
|
||||||
|
background: linear-gradient(135deg, var(--color-primary), #722ED1);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
}
|
||||||
|
.verdict p { color: var(--text-secondary); margin: 6px 0; font-size: 0.92rem; }
|
||||||
|
.verdict strong { color: var(--text-primary); }
|
||||||
|
|
||||||
|
.rec-box {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border-light);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 24px 28px;
|
||||||
|
margin: 24px 0;
|
||||||
|
}
|
||||||
|
.rec-box h4 {
|
||||||
|
background: linear-gradient(135deg, var(--color-primary), #722ED1);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.rec-box p { color: var(--text-secondary); margin: 6px 0; font-size: 0.92rem; }
|
||||||
|
.rec-box .reason {
|
||||||
|
padding-left: 16px;
|
||||||
|
border-left: 2px solid #722ED1;
|
||||||
|
margin: 8px 0 12px 0;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
color: #722ED1;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.rec-box code {
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
font-family: 'SF Mono', Monaco, monospace;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pros-cons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
.pros, .cons {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.pros { border-left: 3px solid var(--color-success); }
|
||||||
|
.cons { border-left: 3px solid var(--color-error); border-right: none; }
|
||||||
|
.pros h4 { color: var(--color-success); margin-bottom: 8px; }
|
||||||
|
.cons h4 { color: var(--color-error); margin-bottom: 8px; }
|
||||||
|
.pros ul, .cons ul { margin-left: 18px; color: var(--text-secondary); font-size: 0.88rem; }
|
||||||
|
.pros ul li, .cons ul li { margin: 4px 0; }
|
||||||
|
|
||||||
|
.arch-pipeline {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
.arch-step {
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 8px 16px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-family: 'SF Mono', Monaco, monospace;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
.arch-arrow { color: var(--text-secondary); font-size: 1.1rem; }
|
||||||
|
|
||||||
|
.check { color: var(--color-success); font-weight: 700; }
|
||||||
|
.cross { color: var(--color-error); opacity: 0.4; }
|
||||||
|
.partial { color: var(--color-warning); font-weight: 600; }
|
||||||
|
.highlight { color: var(--color-warning); font-weight: 700; }
|
||||||
|
|
||||||
|
.sources {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 24px 32px;
|
||||||
|
margin: 40px 0 20px;
|
||||||
|
}
|
||||||
|
.sources h2 { color: var(--text-secondary); font-size: 1rem; margin-bottom: 12px; }
|
||||||
|
.sources ul { margin-left: 20px; }
|
||||||
|
.sources li { margin: 6px 0; font-size: 0.88rem; }
|
||||||
|
.sources a { color: var(--color-primary); text-decoration: none; }
|
||||||
|
.sources a:hover { text-decoration: underline; }
|
||||||
|
|
||||||
|
a { color: var(--color-primary); }
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
:root { --sidebar-w: 220px; }
|
||||||
|
.main { padding: 1.5rem 1.25rem 3rem; }
|
||||||
|
}
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.sidebar { display: none; }
|
||||||
|
.main { margin-left: 0; }
|
||||||
|
.card-grid { grid-template-columns: 1fr; }
|
||||||
|
.pros-cons { grid-template-columns: 1fr; }
|
||||||
|
.arch-pipeline { flex-direction: column; }
|
||||||
|
.arch-arrow { transform: rotate(90deg); }
|
||||||
|
table { font-size: 0.8rem; }
|
||||||
|
th, td { padding: 6px 8px; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<h1>MySQL 转 PostgreSQL 迁移工具对比</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<aside class="sidebar">
|
||||||
|
<div class="toc-label">目录</div>
|
||||||
|
<nav>
|
||||||
|
<ol>
|
||||||
|
<li><a href="#overview">工具总览</a></li>
|
||||||
|
<li><a href="#cloud">云厂商商业工具</a></li>
|
||||||
|
<li><a href="#aliyun">阿里云 DTS 详解</a></li>
|
||||||
|
<li><a href="#tencent">腾讯云 DTS 详解</a></li>
|
||||||
|
<li><a href="#huawei">华为云 DRS 详解</a></li>
|
||||||
|
<li><a href="#opensource">开源工具对比</a></li>
|
||||||
|
<li><a href="#pgloader">pgloader 详解</a></li>
|
||||||
|
<li><a href="#mysql2pg">MySQL2PG 详解</a></li>
|
||||||
|
<li><a href="#compat">类型映射与兼容性</a></li>
|
||||||
|
<li><a href="#selection">选型建议</a></li>
|
||||||
|
<li><a href="#steps">迁移步骤参考</a></li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
|
||||||
|
<!-- 1. Overview -->
|
||||||
|
<section id="overview">
|
||||||
|
<h2>1. 工具总览</h2>
|
||||||
|
<p>本文汇总了 2025-2026 年主流的 MySQL 到 PostgreSQL 迁移工具,分为两大阵营:<strong>云厂商商业工具</strong>(阿里云/腾讯云/华为云)和<strong>开源工具</strong>(pgloader / MySQL2PG 等)。</p>
|
||||||
|
|
||||||
|
<div class="card-grid">
|
||||||
|
<div class="card">
|
||||||
|
<h3>阿里云 DTS</h3>
|
||||||
|
<div class="vendor">阿里巴巴</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-cloud">云服务</span><span class="badge badge-gui">可视化</span><span class="badge badge-paid">付费</span></div>
|
||||||
|
<p>企业级数据传输服务,支持结构迁移 + 全量 + 增量三阶段不停机迁移。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>腾讯云 DTS</h3>
|
||||||
|
<div class="vendor">腾讯</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-cloud">云服务</span><span class="badge badge-gui">可视化</span><span class="badge badge-paid">付费</span></div>
|
||||||
|
<p>支持无锁迁移、跨账号跨云迁移,对标 TDSQL PostgreSQL 版深度优化。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>华为云 DRS</h3>
|
||||||
|
<div class="vendor">华为</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-cloud">云服务</span><span class="badge badge-gui">可视化</span><span class="badge badge-paid">付费</span></div>
|
||||||
|
<p>分钟级搭建迁移任务,预检查机制降低风险,政企客户首选。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>pgloader</h3>
|
||||||
|
<div class="vendor">开源社区 · dimitri</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-open">开源</span><span class="badge badge-cli">CLI</span><span class="badge badge-free">免费</span></div>
|
||||||
|
<p>最流行的开源迁移工具,COPY 协议高效传输,自动类型映射,⭐ 4.3k+。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>MySQL2PG</h3>
|
||||||
|
<div class="vendor">开源社区 · xfg0218</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-open">开源</span><span class="badge badge-cli">CLI</span><span class="badge badge-free">免费</span></div>
|
||||||
|
<p>专业级 MySQL→PG 工具,v3.4.0 支持完整评估报告、兼容性校验、并发同步。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>rds_dbsync</h3>
|
||||||
|
<div class="vendor">阿里巴巴 · 阿里云开源</div>
|
||||||
|
<div class="badge-row"><span class="badge badge-open">开源</span><span class="badge badge-cli">CLI</span><span class="badge badge-free">免费</span></div>
|
||||||
|
<p>阿里内部使用的 MySQL→Greenplum/PostgreSQL 同步工具,不落地的实时迁移。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 2. Cloud tools comparison -->
|
||||||
|
<section id="cloud">
|
||||||
|
<h2>2. 云厂商商业工具对比</h2>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>维度</th>
|
||||||
|
<th>阿里云 DTS</th>
|
||||||
|
<th>腾讯云 DTS</th>
|
||||||
|
<th>华为云 DRS</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><strong>迁移模式</strong></td><td>结构+全量+增量</td><td>全量+增量</td><td>结构+全量+增量</td></tr>
|
||||||
|
<tr><td><strong>不停机迁移</strong></td><td class="check">✅ 支持</td><td class="check">✅ 无锁迁移</td><td class="check">✅ 零停机</td></tr>
|
||||||
|
<tr><td><strong>源库影响</strong></td><td>低影响</td><td class="highlight">无锁,最低影响</td><td>低影响</td></tr>
|
||||||
|
<tr><td><strong>预检查</strong></td><td class="check">✅</td><td class="check">✅</td><td class="check">✅ 详细预检查表</td></tr>
|
||||||
|
<tr><td><strong>数据校验</strong></td><td class="check">✅ 一致性校验</td><td class="check">✅</td><td class="check">✅</td></tr>
|
||||||
|
<tr><td><strong>跨云迁移</strong></td><td class="check">✅ 支持</td><td class="check">✅ 支持</td><td class="partial">有限支持</td></tr>
|
||||||
|
<tr><td><strong>可视化控制台</strong></td><td class="check">✅</td><td class="check">✅</td><td class="check">✅</td></tr>
|
||||||
|
<tr><td><strong>异构数据库</strong></td><td class="check">✅ 20+ 种</td><td class="check">✅ 多种</td><td class="check">✅ 多种</td></tr>
|
||||||
|
<tr><td><strong>计费模式</strong></td><td>按量付费 / 包年包月</td><td>按量付费</td><td>按量付费</td></tr>
|
||||||
|
<tr><td><strong>文档地址</strong></td><td><a href="https://help.aliyun.com/zh/dts/" target="_blank">help.aliyun.com/zh/dts</a></td><td><a href="https://cloud.tencent.com/document/product/571" target="_blank">cloud.tencent.com/dts</a></td><td><a href="https://support.huaweicloud.com/product/drs.html" target="_blank">huaweicloud.com/drs</a></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 3. Aliyun DTS -->
|
||||||
|
<section id="aliyun">
|
||||||
|
<h2>3. 阿里云 DTS 详解</h2>
|
||||||
|
<p>阿里云 DTS(Data Transmission Service)是最成熟的企业级迁移方案之一,支持 RDS MySQL → RDS PostgreSQL 一键迁移,也支持自建库之间的迁移。</p>
|
||||||
|
|
||||||
|
<h3>迁移管线</h3>
|
||||||
|
<div class="arch-pipeline">
|
||||||
|
<span class="arch-step">预检查</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">结构迁移</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">全量数据迁移</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">增量数据迁移</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">数据校验</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">割接切换</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>快速开始</h3>
|
||||||
|
<ul>
|
||||||
|
<li>登录阿里云控制台 → DTS → 创建迁移任务</li>
|
||||||
|
<li>填写源库(MySQL)和目标库(PostgreSQL)连接信息</li>
|
||||||
|
<li>选择迁移类型:结构迁移 + 全量 + 增量(推荐三者全选实现不停机)</li>
|
||||||
|
<li>通过预检查后启动任务,观察同步延迟归零后割接</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="pros-cons">
|
||||||
|
<div class="pros"><h4>优势</h4><ul><li>全托管服务,零运维成本</li><li>不停机迁移,业务无感知</li><li>自动处理类型映射和约束转换</li><li>支持跨云/混合云场景</li><li>可视化控制台 + 告警监控</li></ul></div>
|
||||||
|
<div class="cons"><h4>局限性</h4><ul><li>需要阿里云账号,按量付费有成本</li><li>源库/目标库需对 DTS 服务器开放网络</li><li>部分 MySQL 特性(如存储过程)可能需手动调整</li></ul></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 4. Tencent DTS -->
|
||||||
|
<section id="tencent">
|
||||||
|
<h2>4. 腾讯云 DTS 详解</h2>
|
||||||
|
<p>腾讯云 DTS 的核心特色是<strong>无锁迁移</strong>——不需要在源 MySQL 上获取全局锁,最大程度降低对业务的影响。</p>
|
||||||
|
|
||||||
|
<h3>核心特色</h3>
|
||||||
|
<ul>
|
||||||
|
<li><strong>无锁迁移</strong>:基于 binlog 位置点的增量同步,无需 LOCK TABLES</li>
|
||||||
|
<li><strong>跨账号迁移</strong>:支持不同腾讯云账号之间的数据库迁移</li>
|
||||||
|
<li><strong>跨云迁移</strong>:支持从其他云厂商或自建库迁移到腾讯 PostgreSQL</li>
|
||||||
|
<li><strong>数据一致性校验</strong>:迁移完成后自动比对源库和目标库的数据一致性</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="pros-cons">
|
||||||
|
<div class="pros"><h4>优势</h4><ul><li>无锁迁移,对源库影响最小</li><li>跨账号/跨云能力强</li><li>对标 TDSQL PG 版深度优化</li><li>全托管,可视化操作</li></ul></div>
|
||||||
|
<div class="cons"><h4>局限性</h4><ul><li>付费服务,按量计费</li><li>深度绑定腾讯云生态</li><li>自建 PostgreSQL 场景支持有限</li></ul></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 5. Huawei DRS -->
|
||||||
|
<section id="huawei">
|
||||||
|
<h2>5. 华为云 DRS 详解</h2>
|
||||||
|
<p>华为云 DRS(Data Replication Service)主打<strong>分钟级搭建</strong>和<strong>预检查</strong>,适合政企客户和对合规性要求较高的场景。</p>
|
||||||
|
|
||||||
|
<h3>核心特色</h3>
|
||||||
|
<ul>
|
||||||
|
<li><strong>分钟级搭建</strong>:迁移任务配置和启动只需数分钟</li>
|
||||||
|
<li><strong>详细预检查</strong>:提供预检查项一览表,逐项检查兼容性风险</li>
|
||||||
|
<li><strong>在线迁移</strong>:零停机窗口,业务持续运行</li>
|
||||||
|
<li><strong>支持 FlexusRDS for PostgreSQL</strong>:华为新一代云原生数据库</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="pros-cons">
|
||||||
|
<div class="pros"><h4>优势</h4><ul><li>预检查机制完善,降低迁移风险</li><li>搭建速度快,操作简单</li><li>政企客户适配,合规性强</li></ul></div>
|
||||||
|
<div class="cons"><h4>局限性</h4><ul><li>跨云支持不如阿里云/腾讯云灵活</li><li>生态相对较小</li><li>付费服务</li></ul></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 6. Open source comparison -->
|
||||||
|
<section id="opensource">
|
||||||
|
<h2>6. 开源工具对比</h2>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>维度</th>
|
||||||
|
<th>pgloader</th>
|
||||||
|
<th>MySQL2PG</th>
|
||||||
|
<th>rds_dbsync</th>
|
||||||
|
<th>gomysql2pg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><strong>GitHub ⭐</strong></td><td class="highlight">4.3k+</td><td class="highlight">活跃维护</td><td>阿里开源</td><td>200+</td></tr>
|
||||||
|
<tr><td><strong>语言</strong></td><td>Common Lisp</td><td>Java</td><td>Go</td><td>Go</td></tr>
|
||||||
|
<tr><td><strong>许可证</strong></td><td>PostgreSQL License</td><td>开源</td><td>Apache 2.0</td><td>MIT</td></tr>
|
||||||
|
<tr><td><strong>安装方式</strong></td><td>Docker / apt / brew / 源码</td><td>下载 JAR / 源码编译</td><td>源码编译 Go</td><td>Go 直接编译</td></tr>
|
||||||
|
<tr><td><strong>结构迁移</strong></td><td class="check">✅ 自动转换 DDL</td><td class="check">✅ 评估+转换</td><td class="partial">主要数据迁移</td><td class="partial">主要数据迁移</td></tr>
|
||||||
|
<tr><td><strong>全量迁移</strong></td><td class="check">✅ COPY 协议</td><td class="check">✅ 并发同步</td><td class="check">✅</td><td class="check">✅</td></tr>
|
||||||
|
<tr><td><strong>增量迁移</strong></td><td class="cross">❌ 仅一次性</td><td class="check">✅ 增量同步</td><td class="check">✅ 实时同步</td><td class="cross">❌</td></tr>
|
||||||
|
<tr><td><strong>数据校验</strong></td><td class="partial">基础</td><td class="check">✅ 双重校验</td><td class="check">✅</td><td class="check">✅ 对比</td></tr>
|
||||||
|
<tr><td><strong>评估报告</strong></td><td class="cross">❌</td><td class="check">✅ 可视化兼容性报告</td><td class="cross">❌</td><td class="cross">❌</td></tr>
|
||||||
|
<tr><td><strong>GUI / 可视化</strong></td><td class="cross">❌ CLI only</td><td class="check">✅ 自带 Web UI</td><td class="cross">❌ CLI only</td><td class="cross">❌ CLI only</td></tr>
|
||||||
|
<tr><td><strong>配置方式</strong></td><td>.load 配置文件</td><td>配置文件 + UI 引导</td><td>JSON/YAML 配置</td><td>JSON 配置</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 7. pgloader -->
|
||||||
|
<section id="pgloader">
|
||||||
|
<h2>7. pgloader 详解</h2>
|
||||||
|
<p>pgloader 是最广泛推荐的开源 MySQL→PostgreSQL 迁移工具,由 Dimitri Fontaine 开发维护。核心优势是使用 PostgreSQL 的 COPY 协议高效传输数据。</p>
|
||||||
|
|
||||||
|
<h3>安装(3 种方式)</h3>
|
||||||
|
<div class="arch-pipeline">
|
||||||
|
<span class="arch-step">Docker(推荐)</span>
|
||||||
|
<span class="arch-step">apt install pgloader</span>
|
||||||
|
<span class="arch-step">brew install pgloader</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>快速开始(Docker 方式)</h3>
|
||||||
|
<ul>
|
||||||
|
<li>创建配置文件 <code>mysql.load</code>,定义源库和目标库连接串</li>
|
||||||
|
<li>运行 <code>docker run --rm dimitri/pgloader pgloader mysql.load</code></li>
|
||||||
|
<li>pgloader 自动完成表结构转换 + 数据迁移 + 索引创建</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>配置文件示例</h3>
|
||||||
|
<p style="font-family:'SF Mono',Monaco,monospace; font-size:0.85rem; background:var(--bg-tertiary); padding:16px; border-radius:6px; color:var(--text-primary); white-space:pre;">
|
||||||
|
LOAD DATABASE
|
||||||
|
FROM mysql://user:pass@localhost/mydb
|
||||||
|
INTO pgsql://user:pass@localhost/mydb
|
||||||
|
|
||||||
|
WITH include drop, create tables, create indexes, reset sequences
|
||||||
|
|
||||||
|
SET PostgreSQL PARAMETERS
|
||||||
|
maintenance_work_mem to '128MB',
|
||||||
|
work_mem to '12MB'
|
||||||
|
;
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="rec-box">
|
||||||
|
<h4>适用场景</h4>
|
||||||
|
<div class="reason">自建数据库迁移、跨云迁移、不需要增量同步的一次性迁移场景。pgloader 是最轻量、最即开即用的开源方案,适合中小型数据库(GB 级别)。如果是 TB 级数据库或有不停机需求,建议使用云厂商 DTS/DRS 或 MySQL2PG。</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pros-cons">
|
||||||
|
<div class="pros"><h4>优势</h4><ul><li>安装极简,Docker 一行命令即可</li><li>COPY 协议传输效率高</li><li>自动类型映射(TINYINT→SMALLINT 等)</li><li>社区成熟,文档丰富</li><li>支持 SQLite/MSSQL/CSV → PG 等多种源</li></ul></div>
|
||||||
|
<div class="cons"><h4>局限性</h4><ul><li>仅支持一次性全量迁移,不支持增量同步</li><li>大型数据库迁移耗时较长</li><li>存储过程/触发器需手动转换</li><li>Common Lisp 编译依赖,自行编译较复杂</li></ul></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 8. MySQL2PG -->
|
||||||
|
<section id="mysql2pg">
|
||||||
|
<h2>8. MySQL2PG 详解</h2>
|
||||||
|
<p>MySQL2PG(xfg0218/mysql2pg)是专业级的 MySQL→PostgreSQL 迁移工具,最新版本 v3.4.0 已发布,是开源方案中功能最全面的。</p>
|
||||||
|
|
||||||
|
<h3>核心能力</h3>
|
||||||
|
<ul>
|
||||||
|
<li><strong>评估模式</strong>:迁移前扫描源库,生成兼容性评估报告,标注不兼容的语法和功能</li>
|
||||||
|
<li><strong>全量 + 增量</strong>:支持一次性全量迁移和基于 binlog 的持续增量同步</li>
|
||||||
|
<li><strong>并发同步</strong>:多线程并行迁移,大幅提升迁移速度</li>
|
||||||
|
<li><strong>双重数据校验</strong>:迁移完成后自动校验源库和目标库的数据一致性</li>
|
||||||
|
<li><strong>可视化 Web UI</strong>:自带管理界面,非 DBA 也能操作</li>
|
||||||
|
<li><strong>视图/函数转换</strong>:42 个视图 + 113 个函数 100% 转换(实测数据)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>迁移管线</h3>
|
||||||
|
<div class="arch-pipeline">
|
||||||
|
<span class="arch-step">兼容性评估</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">结构转换</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">全量迁移</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">增量同步</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">数据校验</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">生成报告</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="rec-box">
|
||||||
|
<h4>适用场景</h4>
|
||||||
|
<div class="reason">如果你需要<strong>开源 + 增量同步 + 评估报告</strong>三合一,MySQL2PG 是最佳选择。它适合自建数据库的不停机迁移场景,自带 Web UI 降低了操作门槛。特别是生成兼容性评估报告这一功能,能帮助你在迁移前识别风险点。</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pros-cons">
|
||||||
|
<div class="pros"><h4>优势</h4><ul><li>唯一自带兼容性评估报告的开源工具</li><li>支持增量同步,可不停机迁移</li><li>自带 Web UI,操作门槛低</li><li>双重数据校验,迁移结果可信赖</li><li>视图和函数转换率高</li></ul></div>
|
||||||
|
<div class="cons"><h4>局限性</h4><ul><li>社区规模不如 pgloader</li><li>Java 依赖,需要 JRE 运行环境</li><li>文档以中文为主,国际化程度有限</li></ul></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 9. Compatibility -->
|
||||||
|
<section id="compat">
|
||||||
|
<h2>9. 类型映射与兼容性注意事项</h2>
|
||||||
|
<p>MySQL 和 PostgreSQL 在数据类型和 SQL 语法上存在差异,迁移时需要重点关注以下映射关系。</p>
|
||||||
|
|
||||||
|
<h3>数据类型映射</h3>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>MySQL</th><th>PostgreSQL</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>TINYINT</code></td><td><code>SMALLINT</code></td><td>PG 无 1 字节整型</td></tr>
|
||||||
|
<tr><td><code>INT UNSIGNED</code></td><td><code>BIGINT</code></td><td>无符号需升级类型</td></tr>
|
||||||
|
<tr><td><code>DATETIME</code></td><td><code>TIMESTAMP</code></td><td>注意时区处理</td></tr>
|
||||||
|
<tr><td><code>TINYTEXT</code></td><td><code>TEXT</code></td><td>PG 统一使用 TEXT</td></tr>
|
||||||
|
<tr><td><code>VARCHAR(N)</code></td><td><code>VARCHAR(N)</code></td><td>PG 中 TEXT 更常用</td></tr>
|
||||||
|
<tr><td><code>BLOB</code></td><td><code>BYTEA</code></td><td>二进制数据</td></tr>
|
||||||
|
<tr><td><code>BOOLEAN / TINYINT(1)</code></td><td><code>BOOLEAN</code></td><td>PG 原生布尔类型</td></tr>
|
||||||
|
<tr><td><code>DOUBLE</code></td><td><code>DOUBLE PRECISION</code></td><td>关键字差异</td></tr>
|
||||||
|
<tr><td><code>AUTO_INCREMENT</code></td><td><code>SERIAL / GENERATED ALWAYS AS IDENTITY</code></td><td>自增机制不同</td></tr>
|
||||||
|
<tr><td><code>ENUM</code></td><td><code>CREATE TYPE ... AS ENUM</code></td><td>PG 需显式创建枚举类型</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>SQL 语法差异</h3>
|
||||||
|
<div class="table-wrap">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>特性</th><th>MySQL</th><th>PostgreSQL</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><strong>标识符引号</strong></td><td>反引号 <code>`table`</code></td><td>双引号 <code>"table"</code></td></tr>
|
||||||
|
<tr><td><strong>字符串引号</strong></td><td>单/双引号均可</td><td>仅单引号</td></tr>
|
||||||
|
<tr><td><strong>分页</strong></td><td><code>LIMIT offset, count</code></td><td><code>LIMIT count OFFSET offset</code></td></tr>
|
||||||
|
<tr><td><strong>GROUP BY</strong></td><td>宽松模式</td><td>严格模式(SELECT 列必须在 GROUP BY 中)</td></tr>
|
||||||
|
<tr><td><strong>连接字符串</strong></td><td><code>CONCAT()</code> 忽略 NULL</td><td><code>||</code> 操作符,NULL 传播</td></tr>
|
||||||
|
<tr><td><strong>日期函数</strong></td><td><code>NOW(), CURDATE()</code></td><td><code>NOW(), CURRENT_DATE</code></td></tr>
|
||||||
|
<tr><td><strong>存储过程</strong></td><td>语法差异大</td><td>PL/pgSQL,需重写</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 10. Selection -->
|
||||||
|
<section id="selection">
|
||||||
|
<h2>10. 选型建议</h2>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景一:阿里云用户</h4>
|
||||||
|
<p><strong>推荐阿里云 DTS</strong> — 全托管、不停机迁移、自动类型映射。如果源库和目标库都在阿里云上,这是最省心的选择。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景二:腾讯云用户</h4>
|
||||||
|
<p><strong>推荐腾讯云 DTS</strong> — 无锁迁移对源库影响最小,适合业务不能中断的场景。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景三:华为云 / 政企用户</h4>
|
||||||
|
<p><strong>推荐华为云 DRS</strong> — 预检查机制完善,分钟级搭建,合规性强。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景四:自建数据库 / 跨云 / 一次性迁移</h4>
|
||||||
|
<p><strong>推荐 pgloader</strong> — 安装极简(Docker 一行命令),COPY 协议高效传输,社区最成熟。适合中小型数据库的一次性迁移。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景五:自建数据库 / 需要不停机 + 评估报告</h4>
|
||||||
|
<p><strong>推荐 MySQL2PG</strong> — 唯一自带兼容性评估报告的开源工具,支持增量同步和 Web UI,适合不停机迁移场景。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="verdict">
|
||||||
|
<h4>场景六:阿里技术栈 + 实时同步</h4>
|
||||||
|
<p><strong>推荐 rds_dbsync</strong> — 阿里内部使用的 Go 语言同步工具,Apache 2.0 许可,适合 MySQL→Greenplum/PostgreSQL 的不落地实时迁移。</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 11. Steps -->
|
||||||
|
<section id="steps">
|
||||||
|
<h2>11. 迁移步骤参考</h2>
|
||||||
|
<p>无论选择哪个工具,一个完整的 MySQL→PostgreSQL 迁移流程通常包含以下步骤:</p>
|
||||||
|
|
||||||
|
<div class="arch-pipeline">
|
||||||
|
<span class="arch-step">1. 评估兼容</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">2. 备份源库</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">3. 结构迁移</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">4. 全量数据</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">5. 增量追平</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">6. 数据校验</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">7. 应用适配</span><span class="arch-arrow">→</span>
|
||||||
|
<span class="arch-step">8. 割接上线</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>各步骤要点</h3>
|
||||||
|
<ul>
|
||||||
|
<li><strong>评估兼容</strong>:使用 MySQL2PG 评估模式或手动检查存储过程、触发器、特殊函数</li>
|
||||||
|
<li><strong>备份源库</strong>:迁移前完整备份 MySQL,确保可回滚</li>
|
||||||
|
<li><strong>结构迁移</strong>:转换 DDL,注意类型映射、索引、约束、自增序列</li>
|
||||||
|
<li><strong>全量数据</strong>:使用工具的批量迁移能力,建议关闭 PG 的 autovacuum 提升速度</li>
|
||||||
|
<li><strong>增量追平</strong>:基于 binlog 持续同步,观察延迟归零</li>
|
||||||
|
<li><strong>数据校验</strong>:比对记录数、关键字段聚合值,确保数据一致性</li>
|
||||||
|
<li><strong>应用适配</strong>:修改 ORM 配置、SQL 语法(反引号→双引号、LIMIT 语法等)</li>
|
||||||
|
<li><strong>割接上线</strong>:停写 MySQL → 等待增量同步完成 → 切换应用连接 → 验证</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Sources -->
|
||||||
|
<div class="sources">
|
||||||
|
<h2>数据来源</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://cloud.tencent.com/developer/article/2649324" target="_blank">腾讯云开发者 - MySQL2PG 迁移神器</a></li>
|
||||||
|
<li><a href="https://cloud.tencent.com/developer/article/2663402" target="_blank">MySQL2PG v3.4.0 正式发布</a></li>
|
||||||
|
<li><a href="https://cloud.tencent.com/developer/article/2623900" target="_blank">MySQL2PG v2.0.0 发布</a></li>
|
||||||
|
<li><a href="https://help.aliyun.com/zh/dts/user-guide/migrate-data-from-an-apsaradb-rds-for-mysql-instance-to-an-apsaradb-rds-for-postgresql-instance" target="_blank">阿里云 DTS - RDS MySQL 迁移至 RDS PostgreSQL</a></li>
|
||||||
|
<li><a href="https://comate.baidu.com/zh/page/wywu3eyik8h" target="_blank">百度文心 - MySQL 迁移至 PostgreSQL 工具与步骤</a></li>
|
||||||
|
<li><a href="https://support.huaweicloud.com/realtimemig-drs/drs_08_0089.html" target="_blank">华为云 DRS - 迁移方案概览</a></li>
|
||||||
|
<li><a href="https://cloud.tencent.com/document/product/571" target="_blank">腾讯云 DTS 产品文档</a></li>
|
||||||
|
<li><a href="https://github.com/dimitri/pgloader" target="_blank">dimitri/pgloader - GitHub</a></li>
|
||||||
|
<li><a href="https://github.com/aliyun/rds_dbsync" target="_blank">aliyun/rds_dbsync - GitHub</a></li>
|
||||||
|
<li><a href="https://blog.csdn.net/eggwyw/article/details/158964966" target="_blank">CSDN - 从 MySQL 迁移到 PostgreSQL 完整指南</a></li>
|
||||||
|
<li><a href="https://www.kingbase.com.cn/explore/tech-blog/2026-%E5%B9%B4-mysql-%E8%BF%81%E7%A7%BB%E5%B7%A5%E5%85%B7%E5%AE%9E%E6%B5%8B%EF%BC%9A%E5%A6%82%E4%BD%95%E5%A4%A7%E5%B9%85%E9%99%8D%E4%BD%8E%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%81%E7%A7%BB%E6%88%90/" target="_blank">人大金仓 - 2026年 MySQL 迁移工具实测</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div class="footer" style="text-align:center; padding:24px 0; color:var(--text-tertiary); font-size:0.85rem; border-top:1px solid var(--border); margin-top:20px;">
|
||||||
|
<p>调查报告生成于 2026-05-04 | 数据来源:各云厂商文档及开源项目</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const links = document.querySelectorAll('.sidebar nav a');
|
||||||
|
const sections = document.querySelectorAll('.main section, .main .sources');
|
||||||
|
|
||||||
|
function setActive() {
|
||||||
|
let current = '';
|
||||||
|
sections.forEach(s => {
|
||||||
|
if (s.getBoundingClientRect().top < 120) current = s.id;
|
||||||
|
});
|
||||||
|
links.forEach(a => {
|
||||||
|
a.classList.toggle('active', a.getAttribute('href') === '#' + current);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
links.forEach(a => {
|
||||||
|
a.addEventListener('click', e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const target = document.querySelector(a.getAttribute('href'));
|
||||||
|
if (target) target.scrollIntoView();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('scroll', setActive, { passive: true });
|
||||||
|
setActive();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,962 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>CRMEB-MER 项目图谱报告</title>
|
||||||
|
<style>
|
||||||
|
/* ===== Design Tokens ===== */
|
||||||
|
:root {
|
||||||
|
--color-primary: #1677FF;
|
||||||
|
--color-primary-hover: #4096FF;
|
||||||
|
--color-primary-active: #0958D9;
|
||||||
|
--color-primary-bg: #E6F4FF;
|
||||||
|
--color-success: #52C41A;
|
||||||
|
--color-warning: #FAAD14;
|
||||||
|
--color-error: #FF4D4F;
|
||||||
|
--color-info: #1677FF;
|
||||||
|
--bg: #F5F5F5;
|
||||||
|
--bg-container: #FFFFFF;
|
||||||
|
--bg-elevated: #FAFAFA;
|
||||||
|
--border: #D9D9D9;
|
||||||
|
--border-light: #F0F0F0;
|
||||||
|
--text-primary: #141414;
|
||||||
|
--text-secondary: #595959;
|
||||||
|
--text-tertiary: #8C8C8C;
|
||||||
|
--gradient-title: linear-gradient(135deg, #1677FF 0%, #722ED1 100%);
|
||||||
|
--gradient-success: linear-gradient(135deg, #52C41A 0%, #1677FF 100%);
|
||||||
|
--radius-xs: 2px;
|
||||||
|
--radius-sm: 6px;
|
||||||
|
--radius-md: 8px;
|
||||||
|
--radius-lg: 12px;
|
||||||
|
--space-xs: 4px;
|
||||||
|
--space-sm: 8px;
|
||||||
|
--space-md: 12px;
|
||||||
|
--space-lg: 16px;
|
||||||
|
--space-xl: 24px;
|
||||||
|
--space-2xl: 32px;
|
||||||
|
--space-3xl: 48px;
|
||||||
|
--shadow-sm: 0 1px 2px rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02);
|
||||||
|
--shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 4px 12px -2px rgba(0,0,0,0.04);
|
||||||
|
--shadow-lg: 0 4px 8px rgba(0,0,0,0.06), 0 8px 24px -4px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Reset & Base ===== */
|
||||||
|
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 22px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--bg);
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Header ===== */
|
||||||
|
.header {
|
||||||
|
height: 64px;
|
||||||
|
background: var(--bg-container);
|
||||||
|
border-bottom: 1px solid var(--border-light);
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 var(--space-xl);
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-inner {
|
||||||
|
max-width: 1200px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
background: var(--gradient-title);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-meta {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Layout ===== */
|
||||||
|
.container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: var(--space-2xl) var(--space-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Summary Cards ===== */
|
||||||
|
.summary-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: var(--space-lg);
|
||||||
|
margin-bottom: var(--space-2xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-card {
|
||||||
|
background: var(--bg-container);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: var(--space-xl);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 3px;
|
||||||
|
background: var(--gradient-title);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-card:nth-child(2)::before { background: var(--gradient-success); }
|
||||||
|
.summary-card:nth-child(3)::before { background: linear-gradient(135deg, #FAAD14 0%, #FF4D4F 100%); }
|
||||||
|
.summary-card:nth-child(4)::before { background: linear-gradient(135deg, #722ED1 0%, #1677FF 100%); }
|
||||||
|
|
||||||
|
.summary-card:hover {
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
margin-bottom: var(--space-sm);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-value {
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text-primary);
|
||||||
|
line-height: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-top: var(--space-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Section ===== */
|
||||||
|
.section {
|
||||||
|
margin-bottom: var(--space-2xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 32px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: var(--space-xl);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 24px;
|
||||||
|
background: var(--gradient-title);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-section-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 28px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: var(--space-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Card ===== */
|
||||||
|
.card {
|
||||||
|
background: var(--bg-container);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: var(--space-xl);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
margin-bottom: var(--space-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 24px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Badge ===== */
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-primary {
|
||||||
|
background: rgba(22, 119, 255, 0.1);
|
||||||
|
border: 1px solid rgba(22, 119, 255, 0.25);
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-success {
|
||||||
|
background: rgba(82, 196, 26, 0.1);
|
||||||
|
border: 1px solid rgba(82, 196, 26, 0.25);
|
||||||
|
color: var(--color-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-warning {
|
||||||
|
background: rgba(250, 173, 20, 0.1);
|
||||||
|
border: 1px solid rgba(250, 173, 20, 0.25);
|
||||||
|
color: var(--color-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-error {
|
||||||
|
background: rgba(255, 77, 79, 0.1);
|
||||||
|
border: 1px solid rgba(255, 77, 79, 0.25);
|
||||||
|
color: var(--color-error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Table ===== */
|
||||||
|
.table-wrapper {
|
||||||
|
overflow-x: auto;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-bottom: 1px solid var(--border-light);
|
||||||
|
background: var(--bg-container);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:hover td {
|
||||||
|
background: var(--color-primary-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Code ===== */
|
||||||
|
code {
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--color-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-block {
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: var(--space-lg);
|
||||||
|
line-height: 1.7;
|
||||||
|
overflow-x: auto;
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== God Nodes ===== */
|
||||||
|
.god-nodes-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
|
gap: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.god-node-item {
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border-light);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: var(--space-md) var(--space-lg);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.god-node-name {
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.god-node-degree {
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-size: 16px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Progress Bar ===== */
|
||||||
|
.progress-bar {
|
||||||
|
height: 8px;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: var(--space-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: width 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-extracted { background: var(--gradient-title); }
|
||||||
|
.progress-inferred { background: var(--gradient-success); }
|
||||||
|
|
||||||
|
/* ===== Architecture Section ===== */
|
||||||
|
.arch-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: var(--space-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card {
|
||||||
|
background: var(--bg-container);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: var(--space-xl);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card:hover {
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 20px;
|
||||||
|
margin-bottom: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-icon.java { background: rgba(22, 119, 255, 0.1); color: var(--color-primary); }
|
||||||
|
.arch-card-icon.vue { background: rgba(82, 196, 26, 0.1); color: var(--color-success); }
|
||||||
|
.arch-card-icon.uni { background: rgba(250, 173, 20, 0.1); color: var(--color-warning); }
|
||||||
|
|
||||||
|
.arch-card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: var(--space-sm);
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-desc {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-list {
|
||||||
|
list-style: none;
|
||||||
|
margin-top: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-list li {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
padding: var(--space-xs) 0;
|
||||||
|
padding-left: var(--space-md);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arch-card-list li::before {
|
||||||
|
content: '·';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Community Table Specific ===== */
|
||||||
|
.community-detail {
|
||||||
|
margin-bottom: var(--space-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.community-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-md);
|
||||||
|
margin-bottom: var(--space-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.community-id {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.community-members {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: var(--space-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.member-tag {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: var(--radius-xs);
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border-light);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Footer ===== */
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
padding: var(--space-2xl) 0;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
font-size: 12px;
|
||||||
|
border-top: 1px solid var(--border-light);
|
||||||
|
margin-top: var(--space-3xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Responsive ===== */
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.summary-grid { grid-template-columns: repeat(2, 1fr); }
|
||||||
|
.arch-grid { grid-template-columns: repeat(2, 1fr); }
|
||||||
|
.container { padding: var(--space-xl) var(--space-md); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.summary-grid { grid-template-columns: 1fr; }
|
||||||
|
.arch-grid { grid-template-columns: 1fr; }
|
||||||
|
.god-nodes-grid { grid-template-columns: 1fr; }
|
||||||
|
.header { padding: 0 var(--space-md); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Scrollbar ===== */
|
||||||
|
::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||||
|
::-webkit-scrollbar-track { background: var(--bg-elevated); }
|
||||||
|
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
|
||||||
|
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- ===== Header ===== -->
|
||||||
|
<header class="header">
|
||||||
|
<div class="header-inner">
|
||||||
|
<div class="header-title">CRMEB-MER 项目图谱报告</div>
|
||||||
|
<div class="header-meta">graphify-rs · 2026-05-06 · JAVA-MER-2.2</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container">
|
||||||
|
|
||||||
|
<!-- ===== Summary ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">项目概览</div>
|
||||||
|
<div class="summary-grid">
|
||||||
|
<div class="summary-card">
|
||||||
|
<div class="summary-label">节点数</div>
|
||||||
|
<div class="summary-value">36,835</div>
|
||||||
|
<div class="summary-sub">AST 解析 + 推理</div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-card">
|
||||||
|
<div class="summary-label">边数</div>
|
||||||
|
<div class="summary-value">52,059</div>
|
||||||
|
<div class="summary-sub">引用 / 调用 / 导入</div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-card">
|
||||||
|
<div class="summary-label">社区数</div>
|
||||||
|
<div class="summary-value">3,103</div>
|
||||||
|
<div class="summary-sub">Louvain 社群检测</div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-card">
|
||||||
|
<div class="summary-label">文件数</div>
|
||||||
|
<div class="summary-value">4,086</div>
|
||||||
|
<div class="summary-sub">2,616 代码 / 24 文档 / 1,446 图片</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Confidence -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-title">置信度分布</div>
|
||||||
|
<div style="display: flex; gap: var(--space-2xl); margin-top: var(--space-lg);">
|
||||||
|
<div style="flex: 1;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span style="font-size: 13px; color: var(--text-secondary);">EXTRACTED (AST 提取)</span>
|
||||||
|
<span style="font-weight: 600; color: var(--color-primary);">66.4% (34,555)</span>
|
||||||
|
</div>
|
||||||
|
<div class="progress-bar">
|
||||||
|
<div class="progress-fill progress-extracted" style="width: 66.4%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="flex: 1;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span style="font-size: 13px; color: var(--text-secondary);">INFERRED (推理)</span>
|
||||||
|
<span style="font-weight: 600; color: var(--color-success);">33.6% (17,504)</span>
|
||||||
|
</div>
|
||||||
|
<div class="progress-bar">
|
||||||
|
<div class="progress-fill progress-inferred" style="width: 33.6%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Architecture ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">系统架构</div>
|
||||||
|
<div class="arch-grid">
|
||||||
|
<div class="arch-card">
|
||||||
|
<div class="arch-card-icon java">J</div>
|
||||||
|
<div class="arch-card-title">Java 后端 (mer_java)</div>
|
||||||
|
<div class="arch-card-desc">Spring Boot 2.2.6 多模块 Maven 项目,Java 8,MyBatis Plus 3.3.1</div>
|
||||||
|
<ul class="arch-card-list">
|
||||||
|
<li><code>crmeb-common</code> — 共享模型、DTO、常量、工具类</li>
|
||||||
|
<li><code>crmeb-service</code> — DAO + Service 业务逻辑层</li>
|
||||||
|
<li><code>crmeb-admin</code> — 后台管理 API(平台 + 商户)</li>
|
||||||
|
<li><code>crmeb-front</code> — 移动端/前端用户 API</li>
|
||||||
|
<li><code>crmeb-generate</code> — 代码生成模块</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="arch-card">
|
||||||
|
<div class="arch-card-icon vue">V</div>
|
||||||
|
<div class="arch-card-title">平台管理端 (mer_plat_admin)</div>
|
||||||
|
<div class="arch-card-desc">Vue 2 + Element UI 单页应用,平台管理员操作入口</div>
|
||||||
|
<ul class="arch-card-list">
|
||||||
|
<li>商品、订单、用户、营销、财务管理</li>
|
||||||
|
<li>商户入驻审核、分类、菜单管理</li>
|
||||||
|
<li>系统设置、权限、装修 DIY</li>
|
||||||
|
<li>路由按模块拆分至 router/modules/</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="arch-card">
|
||||||
|
<div class="arch-card-icon vue">M</div>
|
||||||
|
<div class="arch-card-title">商户管理端 (mer_mer_admin)</div>
|
||||||
|
<div class="arch-card-desc">Vue 2 + Element UI 单页应用,商户独立管理后台</div>
|
||||||
|
<ul class="arch-card-list">
|
||||||
|
<li>自有商品管理、订单发货、退款</li>
|
||||||
|
<li>优惠券、用户管理</li>
|
||||||
|
<li>运费模板、素材管理</li>
|
||||||
|
<li>财务流水、结算记录</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="arch-card">
|
||||||
|
<div class="arch-card-icon uni">U</div>
|
||||||
|
<div class="arch-card-title">移动端 (mer_uniapp)</div>
|
||||||
|
<div class="arch-card-desc">UniApp 跨平台应用 — H5、微信小程序、原生 App</div>
|
||||||
|
<ul class="arch-card-list">
|
||||||
|
<li>首页、商品、分类、购物车、订单</li>
|
||||||
|
<li>个人中心、地址、营销活动</li>
|
||||||
|
<li>逛逛社区、商户主页</li>
|
||||||
|
<li>Diy 页面装修组件系统</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== God Nodes ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">核心节点(God Nodes)</div>
|
||||||
|
<p style="color: var(--text-secondary); margin-bottom: var(--space-lg);">连接度最高的节点,代表项目中最核心/最常被引用的模块或函数。</p>
|
||||||
|
<div class="god-nodes-grid">
|
||||||
|
<div class="god-node-item">
|
||||||
|
<span class="god-node-name">echarts.min</span>
|
||||||
|
<span class="god-node-degree">552</span>
|
||||||
|
</div>
|
||||||
|
<div class="god-node-item">
|
||||||
|
<span class="god-node-name">n()</span>
|
||||||
|
<span class="god-node-degree">389</span>
|
||||||
|
</div>
|
||||||
|
<div class="god-node-item">
|
||||||
|
<span class="god-node-name">f()</span>
|
||||||
|
<span class="god-node-degree">322</span>
|
||||||
|
</div>
|
||||||
|
<div class="god-node-item">
|
||||||
|
<span class="god-node-name">T()</span>
|
||||||
|
<span class="god-node-degree">314</span>
|
||||||
|
</div>
|
||||||
|
<div class="god-node-item">
|
||||||
|
<span class="god-node-name">r()</span>
|
||||||
|
<span class="god-node-degree">280</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: var(--space-md);">
|
||||||
|
<span class="badge badge-warning">注意</span>
|
||||||
|
<span style="font-size: 13px; color: var(--text-secondary); margin-left: var(--space-sm);">顶层 God Nodes 主要为打包后的 minified 库函数(echarts.min 等),真实业务核心见下方社区分析</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Key Business Communities ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">核心业务社区分析</div>
|
||||||
|
<p style="color: var(--text-secondary); margin-bottom: var(--space-lg);">从 3,103 个社区中筛选出的关键业务模块社区,按业务领域分类展示。</p>
|
||||||
|
|
||||||
|
<!-- Java Backend Communities -->
|
||||||
|
<div class="sub-section-title" style="margin-top: var(--space-xl);">Java 后端核心服务</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">ProductService 社区</div>
|
||||||
|
<span class="badge badge-primary">94 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">商品服务核心社区,涵盖商品 CRUD、批量操作、审核、复制、库存管理等全部商品相关功能。</p>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>方法</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>batchAudit()</code></td><td>批量审核商品</td></tr>
|
||||||
|
<tr><td><code>batchDelete()</code></td><td>批量删除</td></tr>
|
||||||
|
<tr><td><code>batchSetBrokerage()</code></td><td>批量设置分销佣金</td></tr>
|
||||||
|
<tr><td><code>batchSetFreightTemplate()</code></td><td>批量设置运费模板</td></tr>
|
||||||
|
<tr><td><code>copyProduct()</code></td><td>复制商品</td></tr>
|
||||||
|
<tr><td><code>deleteProduct()</code></td><td>删除商品</td></tr>
|
||||||
|
<tr><td><code>downByMerId()</code></td><td>商户下架商品</td></tr>
|
||||||
|
<tr><td><code>validatedCanUseById()</code></td><td>校验商品可用性</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">OrderService 社区</div>
|
||||||
|
<span class="badge badge-primary">72 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">订单服务核心社区,涵盖订单查询、取消、退款、发货、统计等全部订单生命周期操作。</p>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>方法</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>cancel()</code></td><td>取消订单</td></tr>
|
||||||
|
<tr><td><code>directRefund()</code></td><td>直接退款</td></tr>
|
||||||
|
<tr><td><code>batchCompleteByOrderNo()</code></td><td>按订单号批量完成</td></tr>
|
||||||
|
<tr><td><code>findAwaitTakeDeliveryOrderList()</code></td><td>查找待发货订单</td></tr>
|
||||||
|
<tr><td><code>findPayByDate()</code></td><td>按日期查找已支付订单</td></tr>
|
||||||
|
<tr><td><code>getByOrderNo()</code></td><td>按订单号查询</td></tr>
|
||||||
|
<tr><td><code>getCircleOrderPage()</code></td><td>圈子订单分页</td></tr>
|
||||||
|
<tr><td><code>virtualShipment()</code></td><td>虚拟发货</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">ProductServiceImpl 实现社区</div>
|
||||||
|
<span class="badge badge-success">69 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">商品服务实现层,依赖 TransactionTemplate、Hutool、FastJSON、PageHelper 等基础设施。</p>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>关键依赖</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>TransactionTemplate</code></td><td>Spring 事务模板</td></tr>
|
||||||
|
<tr><td><code>LambdaQueryWrapper</code></td><td>MyBatis Plus 条件构造器</td></tr>
|
||||||
|
<tr><td><code>LambdaUpdateWrapper</code></td><td>MyBatis Plus 更新构造器</td></tr>
|
||||||
|
<tr><td><code>PageHelper / PageInfo</code></td><td>分页插件</td></tr>
|
||||||
|
<tr><td><code>cn.hutool.core.util.*</code></td><td>Hutool 工具类</td></tr>
|
||||||
|
<tr><td><code>com.alibaba.fastjson.*</code></td><td>FastJSON 序列化</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">UserServiceImpl 社区</div>
|
||||||
|
<span class="badge badge-success">57 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">用户服务核心实现,涵盖用户信息管理、等级、标签、地址、提现等功能。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">FrontOrderServiceImpl 社区</div>
|
||||||
|
<span class="badge badge-success">70 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">前端订单服务,处理 C 端用户下单流程,依赖 Hutool 日期工具、Cart 模型、Coupon 模型等。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">GroupBuyRecordServiceImpl 社区</div>
|
||||||
|
<span class="badge badge-success">66 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">拼团功能实现,包含拼团记录、状态管理等,依赖 GroupBuyRecordEnum 枚举和事务管理。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Frontend Communities -->
|
||||||
|
<div class="sub-section-title" style="margin-top: var(--space-xl);">前端核心模块</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">平台 Admin API 社区</div>
|
||||||
|
<span class="badge badge-primary">71 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">平台管理端 API 调用模块,涵盖区域管理(area)、管理员权限、菜单配置等接口。</p>
|
||||||
|
<div class="community-members" style="margin-top: var(--space-sm);">
|
||||||
|
<span class="member-tag">areaListTreeApi()</span>
|
||||||
|
<span class="member-tag">areaSaveApi()</span>
|
||||||
|
<span class="member-tag">areasAdminListApi()</span>
|
||||||
|
<span class="member-tag">areasAdminInfoApi()</span>
|
||||||
|
<span class="member-tag">areaBindMerchantApi()</span>
|
||||||
|
<span class="member-tag">areasGetMenusApi()</span>
|
||||||
|
<span class="member-tag">areasAdminUpdateStatusApi()</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">商品 Admin API 社区</div>
|
||||||
|
<span class="badge badge-primary">70 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">商品管理端 API 模块,涵盖商品创建、分类、品牌、优惠券、保障服务等接口。</p>
|
||||||
|
<div class="community-members" style="margin-top: var(--space-sm);">
|
||||||
|
<span class="member-tag">attrCreatApi()</span>
|
||||||
|
<span class="member-tag">categoryApi()</span>
|
||||||
|
<span class="member-tag">brandListApi()</span>
|
||||||
|
<span class="member-tag">couponInfoApi()</span>
|
||||||
|
<span class="member-tag">guaranteeListApi()</span>
|
||||||
|
<span class="member-tag">copyProductApi()</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">营销 Admin API 社区</div>
|
||||||
|
<span class="badge badge-primary">70 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">营销管理 API 模块,涵盖秒杀、优惠券、直播、氛围图等营销活动相关接口。</p>
|
||||||
|
<div class="community-members" style="margin-top: var(--space-sm);">
|
||||||
|
<span class="member-tag">catListApi()</span>
|
||||||
|
<span class="member-tag">couponUserListApi()</span>
|
||||||
|
<span class="member-tag">liveGoodsListApi()</span>
|
||||||
|
<span class="member-tag">draftListApi()</span>
|
||||||
|
<span class="member-tag">atmosphereStatusApi()</span>
|
||||||
|
<span class="member-tag">getSeckillStyleApi()</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- uCharts Community -->
|
||||||
|
<div class="card community-detail">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">uCharts 图表库社区</div>
|
||||||
|
<span class="badge badge-warning">119 节点</span>
|
||||||
|
</div>
|
||||||
|
<p style="color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-md);">移动端数据可视化 uCharts 库,是 UniApp 项目中最大的第三方依赖社区之一。</p>
|
||||||
|
<div class="community-members" style="margin-top: var(--space-sm);">
|
||||||
|
<span class="member-tag">Animation()</span>
|
||||||
|
<span class="member-tag">calCategoriesData()</span>
|
||||||
|
<span class="member-tag">calLegendData()</span>
|
||||||
|
<span class="member-tag">calYAxisData()</span>
|
||||||
|
<span class="member-tag">drawActivePoint()</span>
|
||||||
|
<span class="member-tag">collisionNew()</span>
|
||||||
|
<span class="member-tag">deepAssign()</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Technology Stack ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">技术栈</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-title" style="margin-bottom: var(--space-md);">后端依赖</div>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>依赖</th><th>版本</th><th>用途</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>Spring Boot</code></td><td>2.2.6.RELEASE</td><td>应用框架</td></tr>
|
||||||
|
<tr><td><code>MyBatis Plus</code></td><td>3.3.1</td><td>ORM 框架</td></tr>
|
||||||
|
<tr><td><code>FastJSON</code></td><td>2.0.38</td><td>JSON 序列化</td></tr>
|
||||||
|
<tr><td><code>Druid</code></td><td>1.1.20</td><td>数据库连接池</td></tr>
|
||||||
|
<tr><td><code>MySQL Connector</code></td><td>8.0.33</td><td>MySQL 驱动</td></tr>
|
||||||
|
<tr><td><code>Redis (Jedis)</code></td><td>3.3.0</td><td>缓存</td></tr>
|
||||||
|
<tr><td><code>Hutool</code></td><td>4.5.7</td><td>Java 工具类库</td></tr>
|
||||||
|
<tr><td><code>weixin-java</code></td><td>4.7.5</td><td>微信生态 SDK</td></tr>
|
||||||
|
<tr><td><code>Alipay SDK</code></td><td>4.15.20</td><td>支付宝 SDK</td></tr>
|
||||||
|
<tr><td><code>Knife4j</code></td><td>2.0.7</td><td>API 文档 (Swagger)</td></tr>
|
||||||
|
<tr><td><code>PageHelper</code></td><td>1.2.5</td><td>分页插件</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card" style="margin-top: var(--space-lg);">
|
||||||
|
<div class="card-title" style="margin-bottom: var(--space-md);">前端依赖</div>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>依赖</th><th>版本</th><th>用途</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>Vue</code></td><td>2.6.10</td><td>前端框架</td></tr>
|
||||||
|
<tr><td><code>Element UI</code></td><td>2.15.14</td><td>UI 组件库</td></tr>
|
||||||
|
<tr><td><code>Vue Router</code></td><td>3.0.2</td><td>路由管理</td></tr>
|
||||||
|
<tr><td><code>Vuex</code></td><td>3.1.0</td><td>状态管理</td></tr>
|
||||||
|
<tr><td><code>Axios</code></td><td>0.24.0</td><td>HTTP 客户端</td></tr>
|
||||||
|
<tr><td><code>ECharts</code></td><td>4.2.1</td><td>数据可视化</td></tr>
|
||||||
|
<tr><td><td><code>XLSX</code></td><td>0.14.1</td><td>Excel 导入导出</td></tr>
|
||||||
|
<tr><td><code>Sass</code></td><td>1.26.2</td><td>CSS 预处理器</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== External Integrations ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">外部集成</div>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>集成</th><th>SDK / 服务</th><th>用途</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>微信小程序</td><td><code>weixin-java-miniapp</code></td><td>小程序登录、消息、模板消息</td></tr>
|
||||||
|
<tr><td>微信支付</td><td><code>weixin-java-pay</code></td><td>支付、退款、订单查询</td></tr>
|
||||||
|
<tr><td>微信公众号</td><td><code>weixin-java-mp</code></td><td>公众号消息、菜单、用户管理</td></tr>
|
||||||
|
<tr><td>微信开放平台</td><td><code>weixin-java-open</code></td><td>第三方平台授权</td></tr>
|
||||||
|
<tr><td>支付宝</td><td><code>alipay-sdk-java</code></td><td>支付、退款</td></tr>
|
||||||
|
<tr><td>阿里云 OSS</td><td><code>aliyun-sdk-oss</code></td><td>对象存储</td></tr>
|
||||||
|
<tr><td>腾讯云 COS</td><td><code>cos_api</code></td><td>对象存储</td></tr>
|
||||||
|
<tr><td>七牛云</td><td><code>qiniu-java-sdk</code></td><td>对象存储</td></tr>
|
||||||
|
<tr><td>华为云 OBS</td><td><code>esdk-obs-java-bundle</code></td><td>对象存储</td></tr>
|
||||||
|
<tr><td>京东云 S3</td><td><code>aws-java-sdk-s3</code></td><td>对象存储</td></tr>
|
||||||
|
<tr><td>易联云打印</td><td><code>yly</code></td><td>小票打印</td></tr>
|
||||||
|
<tr><td>安吉加加验证码</td><td><code>spring-boot-starter-captcha</code></td><td>行为验证码</td></tr>
|
||||||
|
<tr><td>IP 解析</td><td><code>ip2region</code></td><td>IP 地理位置解析</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Business Domains ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">业务领域模型</div>
|
||||||
|
<p style="color: var(--text-secondary); margin-bottom: var(--space-lg);">根据模型文件目录 (crmeb-common/model) 梳理出的核心业务域。</p>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>业务域</th><th>模型包</th><th>核心实体</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>商品</td><td><code>model/product</code></td><td>Product, ProductAttr, Category, Brand, Guarantee</td></tr>
|
||||||
|
<tr><td>订单</td><td><code>model/order</code></td><td>Order, OrderDetail, Refund, Cart</td></tr>
|
||||||
|
<tr><td>用户</td><td><code>model/user</code></td><td>User, UserLevel, UserTag, Address</td></tr>
|
||||||
|
<tr><td>商户</td><td><code>model/merchant</code></td><td>Merchant, MerchantType, MerchantCategory</td></tr>
|
||||||
|
<tr><td>优惠券</td><td><code>model/coupon</code></td><td>Coupon, CouponProduct, CouponUser</td></tr>
|
||||||
|
<tr><td>营销</td><td><code>model/seckill, model/activity</code></td><td>Seckill, Activity, Sign</td></tr>
|
||||||
|
<tr><td>拼团</td><td><code>model/groupbuy</code></td><td>GroupBuy, GroupBuyRecord</td></tr>
|
||||||
|
<tr><td>社区/圈子</td><td><code>model/circle, model/community</code></td><td>Circle, Community, Comment</td></tr>
|
||||||
|
<tr><td>文章</td><td><code>model/article</code></td><td>Article, ArticleCategory</td></tr>
|
||||||
|
<tr><td>物流</td><td><code>model/express, model/city</code></td><td>Express, City</td></tr>
|
||||||
|
<tr><td>财务</td><td><code>model/bill, model/closing</code></td><td>Bill, Closing, CapitalFlow</td></tr>
|
||||||
|
<tr><td>管理</td><td><code>model/admin, model/system</code></td><td>SystemAdmin, Role, Menu, Config</td></tr>
|
||||||
|
<tr><td>页面</td><td><code>model/page</code></td><td>PageDiy, Theme</td></tr>
|
||||||
|
<tr><td>预约</td><td><code>model/reservation</code></td><td>Reservation</td></tr>
|
||||||
|
<tr><td>会员</td><td><code>model/member</code></td><td>Member, PaidMember</td></tr>
|
||||||
|
<tr><td>卡密</td><td><code>model/cdkey</code></td><td>CardSecret</td></tr>
|
||||||
|
<tr><td>短信</td><td><code>model/sms</code></td><td>SmsTemplate, SmsRecord</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Module Dependency ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">模块依赖关系</div>
|
||||||
|
<div class="code-block">
|
||||||
|
crmeb-admin ──┐
|
||||||
|
├──► crmeb-service ──► crmeb-common
|
||||||
|
crmeb-front ──┘
|
||||||
|
crmeb-generate ──► crmeb-service ──► crmeb-common
|
||||||
|
|
||||||
|
mer_plat_admin ──(HTTP)──► crmeb-admin (platform/* controllers)
|
||||||
|
mer_mer_admin ──(HTTP)──► crmeb-admin (merchant/* controllers)
|
||||||
|
mer_uniapp ──(HTTP)──► crmeb-front (user-facing APIs)
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ===== Commands Reference ===== -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-title">常用开发命令</div>
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>子系统</th><th>命令</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Java 后端</td><td><code>mvn clean compile</code></td><td>编译所有模块</td></tr>
|
||||||
|
<tr><td>Java 后端</td><td><code>mvn clean package -DskipTests</code></td><td>打包 JAR</td></tr>
|
||||||
|
<tr><td>Java 后端</td><td><code>java -jar Crmeb-admin.jar --spring.profiles.active=dev</code></td><td>启动 Admin API</td></tr>
|
||||||
|
<tr><td>Java 后端</td><td><code>java -jar Crmeb-front.jar --spring.profiles.active=dev</code></td><td>启动 Front API</td></tr>
|
||||||
|
<tr><td>平台 Admin</td><td><code>npm run dev</code></td><td>启动开发服务器 (localhost:9527)</td></tr>
|
||||||
|
<tr><td>平台 Admin</td><td><code>npm run build:prod</code></td><td>生产环境构建</td></tr>
|
||||||
|
<tr><td>商户 Admin</td><td><code>npm run dev</code></td><td>启动开发服务器</td></tr>
|
||||||
|
<tr><td>商户 Admin</td><td><code>npm run build:prod</code></td><td>生产环境构建</td></tr>
|
||||||
|
<tr><td>移动端</td><td>HBuilderX IDE</td><td>运行 H5 / 微信小程序</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- ===== Footer ===== -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div>Generated by graphify-rs · CRMEB-MER JAVA-MER-2.2 · 2026-05-06</div>
|
||||||
|
<div style="margin-top: var(--space-xs);">36,835 nodes · 52,059 edges · 3,103 communities</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,696 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>graphify-rs 使用手册</title>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--color-primary: #1677FF;
|
||||||
|
--color-primary-hover: #4096FF;
|
||||||
|
--color-primary-active: #0958D9;
|
||||||
|
--color-primary-bg: rgba(22, 119, 255, 0.1);
|
||||||
|
--color-success: #52C41A;
|
||||||
|
--color-warning: #FAAD14;
|
||||||
|
--color-error: #FF4D4F;
|
||||||
|
|
||||||
|
--bg: #0B0F1A;
|
||||||
|
--bg-secondary: #111827;
|
||||||
|
--bg-tertiary: #1A2235;
|
||||||
|
--border: #1E2A3A;
|
||||||
|
--border-light: #151D2E;
|
||||||
|
--text-primary: #E8ECF1;
|
||||||
|
--text-secondary: #8892A4;
|
||||||
|
--text-tertiary: #5A6478;
|
||||||
|
|
||||||
|
--radius-sm: 6px;
|
||||||
|
--radius-md: 8px;
|
||||||
|
|
||||||
|
--shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
|
||||||
|
--shadow-md: 0 2px 4px rgba(0,0,0,0.2), 0 4px 12px -2px rgba(0,0,0,0.2);
|
||||||
|
|
||||||
|
--sidebar-w: 260px;
|
||||||
|
--header-h: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.57;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||||
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
|
||||||
|
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.header {
|
||||||
|
position: fixed; top: 0; left: 0; right: 0;
|
||||||
|
height: var(--header-h);
|
||||||
|
background: rgba(11, 15, 26, 0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
display: flex; align-items: center;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
font-size: 1.05rem; font-weight: 700;
|
||||||
|
background: linear-gradient(135deg, var(--color-primary), #722ED1);
|
||||||
|
-webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
|
||||||
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.header .version {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 0.8rem; color: var(--text-secondary);
|
||||||
|
font-family: 'SF Mono', Monaco, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar */
|
||||||
|
.sidebar {
|
||||||
|
position: fixed; top: var(--header-h); left: 0; bottom: 0;
|
||||||
|
width: var(--sidebar-w);
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 1rem 0;
|
||||||
|
z-index: 90;
|
||||||
|
}
|
||||||
|
.sidebar .section-label {
|
||||||
|
font-size: 0.7rem; font-weight: 600;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
padding: 0.75rem 1.25rem 0.4rem;
|
||||||
|
}
|
||||||
|
.sidebar a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.45rem 1.25rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
border-left: 3px solid transparent;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
.sidebar a:hover {
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
}
|
||||||
|
.sidebar a.active {
|
||||||
|
color: var(--color-primary);
|
||||||
|
background: var(--color-primary-bg);
|
||||||
|
border-left-color: var(--color-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Content */
|
||||||
|
.main {
|
||||||
|
margin-left: var(--sidebar-w);
|
||||||
|
margin-top: var(--header-h);
|
||||||
|
padding: 2rem 2.5rem 4rem;
|
||||||
|
max-width: 900px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Section */
|
||||||
|
.section { margin-bottom: 3rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
|
||||||
|
.section-title {
|
||||||
|
font-size: 1.4rem; font-weight: 700;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
.section-title .emoji { margin-right: 0.5rem; }
|
||||||
|
.subsection { margin: 1.5rem 0; }
|
||||||
|
.subsection-title {
|
||||||
|
font-size: 1.1rem; font-weight: 600;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Text */
|
||||||
|
p { margin-bottom: 0.75rem; color: var(--text-secondary); }
|
||||||
|
p strong { color: var(--text-primary); }
|
||||||
|
ul, ol { margin: 0.5rem 0 1rem 1.5rem; color: var(--text-secondary); }
|
||||||
|
li { margin-bottom: 0.35rem; }
|
||||||
|
|
||||||
|
/* Code */
|
||||||
|
code {
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 0.15em 0.45em;
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
|
||||||
|
font-size: 0.88em;
|
||||||
|
color: #E06C75;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
margin: 0.75rem 0 1rem;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
pre code {
|
||||||
|
background: none; border: none; padding: 0;
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 1rem 0;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
text-align: left;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
td { color: var(--text-secondary); }
|
||||||
|
tr:hover td { background: var(--bg-tertiary); }
|
||||||
|
|
||||||
|
/* Cards */
|
||||||
|
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0; }
|
||||||
|
.card {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 1.25rem;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
|
||||||
|
.card h4 { font-size: 0.95rem; margin-bottom: 0.5rem; color: var(--text-primary); }
|
||||||
|
.card p { font-size: 0.85rem; margin: 0; }
|
||||||
|
|
||||||
|
/* Badge */
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.badge-blue { background: rgba(22, 119, 255, 0.15); color: #4096FF; border: 1px solid rgba(64, 150, 255, 0.3); }
|
||||||
|
.badge-green { background: rgba(82, 196, 26, 0.15); color: #73D13D; border: 1px solid rgba(115, 209, 61, 0.3); }
|
||||||
|
.badge-purple { background: rgba(114, 46, 209, 0.15); color: #B37FEB; border: 1px solid rgba(179, 127, 235, 0.3); }
|
||||||
|
.badge-orange { background: rgba(250, 173, 20, 0.15); color: #FFC53D; border: 1px solid rgba(255, 197, 61, 0.3); }
|
||||||
|
|
||||||
|
/* Tip / Warning */
|
||||||
|
.callout {
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
border-left: 4px solid;
|
||||||
|
}
|
||||||
|
.callout-tip { background: rgba(22, 119, 255, 0.08); border-color: var(--color-primary); }
|
||||||
|
.callout-tip p { color: #B0D0FF; }
|
||||||
|
.callout-warning { background: rgba(250, 173, 20, 0.08); border-color: var(--color-warning); }
|
||||||
|
.callout-warning p { color: #FFE08C; }
|
||||||
|
.callout-tip code, .callout-warning code { font-size: 0.85em; }
|
||||||
|
|
||||||
|
/* Flow diagram */
|
||||||
|
.flow {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 1.25rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
font-family: 'SF Mono', 'Menlo', monospace;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 2;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
white-space: pre;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.sidebar { display: none; }
|
||||||
|
.main { margin-left: 0; padding: 1.5rem 1rem 3rem; }
|
||||||
|
.card-grid { grid-template-columns: 1fr; }
|
||||||
|
table { font-size: 0.8rem; }
|
||||||
|
th, td { padding: 0.5rem 0.6rem; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<h1>graphify-rs 使用手册</h1>
|
||||||
|
<span class="version">v1.x</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<nav class="sidebar" id="sidebar">
|
||||||
|
<div class="section-label">快速开始</div>
|
||||||
|
<a href="#overview" class="active">项目概述</a>
|
||||||
|
<a href="#install">安装方式</a>
|
||||||
|
<a href="#quickstart">5 分钟上手</a>
|
||||||
|
<div class="section-label">核心命令</div>
|
||||||
|
<a href="#build">build — 构建图谱</a>
|
||||||
|
<a href="#query">query — 查询图谱</a>
|
||||||
|
<a href="#watch">watch — 监听模式</a>
|
||||||
|
<a href="#serve">serve — MCP 服务</a>
|
||||||
|
<div class="section-label">进阶功能</div>
|
||||||
|
<a href="#config">配置系统</a>
|
||||||
|
<a href="#formats">输出格式</a>
|
||||||
|
<a href="#diff">对比差异</a>
|
||||||
|
<a href="#stats">统计信息</a>
|
||||||
|
<a href="#ingest">导入外链</a>
|
||||||
|
<div class="section-label">集成</div>
|
||||||
|
<a href="#claude-integration">Claude Code 集成</a>
|
||||||
|
<a href="#git-hook">Git Hook 集成</a>
|
||||||
|
<div class="section-label">参考</div>
|
||||||
|
<a href="#flags">全局参数速查</a>
|
||||||
|
<a href="#faq">常见问题</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
|
||||||
|
<!-- ===== 项目概述 ===== -->
|
||||||
|
<div class="section" id="overview">
|
||||||
|
<h2 class="section-title"><span class="emoji">📊</span>项目概述</h2>
|
||||||
|
<p><strong>graphify-rs</strong> 是一个用 Rust 编写的 AI 代码知识图谱构建工具。它通过 AST 解析源码,提取函数、类、文件间的调用与依赖关系,生成结构化的 <code>graph.json</code>,并输出多种格式的报告和可视化文件。</p>
|
||||||
|
|
||||||
|
<div class="card-grid">
|
||||||
|
<div class="card">
|
||||||
|
<h4>AST 解析,无需编译</h4>
|
||||||
|
<p>基于 treesitter 进行语法分析,支持 50+ 语言,不需要编译或运行代码即可构建依赖图。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h4>增量构建</h4>
|
||||||
|
<p><code>--update</code> 模式只重新解析新增或修改的文件,大型项目构建仅需 2~5 秒。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h4>多格式输出</h4>
|
||||||
|
<p>支持 JSON、HTML 可视化、GraphML、Cypher、Wiki、Obsidian、SVG 等 8 种格式。</p>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h4>AI 集成</h4>
|
||||||
|
<p>原生支持 Claude Code、Codex、OpenClaw、Trae 等编辑器,也可作为 MCP Server 运行。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">支持的编程语言</h3>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>语言</th><th>文件扩展名</th><th>解析器</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Java</td><td><code>.java</code></td><td>treesitter-java</td></tr>
|
||||||
|
<tr><td>Python</td><td><code>.py</code></td><td>treesitter-python</td></tr>
|
||||||
|
<tr><td>JavaScript / TypeScript</td><td><code>.js</code> <code>.ts</code> <code>.tsx</code></td><td>treesitter-typescript</td></tr>
|
||||||
|
<tr><td>Go</td><td><code>.go</code></td><td>treesitter-go</td></tr>
|
||||||
|
<tr><td>Rust</td><td><code>.rs</code></td><td>treesitter-rust</td></tr>
|
||||||
|
<tr><td>C / C++</td><td><code>.c</code> <code>.cpp</code> <code>.h</code></td><td>treesitter-c / cpp</td></tr>
|
||||||
|
<tr><td>Ruby</td><td><code>.rb</code></td><td>treesitter-ruby</td></tr>
|
||||||
|
<tr><td>PHP</td><td><code>.php</code></td><td>treesitter-php</td></tr>
|
||||||
|
<tr><td>其他</td><td>Markdown / TOML / JSON / YAML 等</td><td>通用解析</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 安装方式 ===== -->
|
||||||
|
<div class="section" id="install">
|
||||||
|
<h2 class="section-title"><span class="emoji">📦</span>安装方式</h2>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">方式一:Cargo 安装(推荐)</h3>
|
||||||
|
<pre><code>cargo install graphify-rs</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">方式二:从源码构建</h3>
|
||||||
|
<pre><code>git clone https://github.com/nicbarker/graphify.git
|
||||||
|
cd graphify
|
||||||
|
cargo build --release
|
||||||
|
# 产物在 target/release/graphify-rs</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">方式三:预编译二进制</h3>
|
||||||
|
<p>从 GitHub Releases 下载对应平台的二进制文件,放入 <code>PATH</code> 即可。</p>
|
||||||
|
|
||||||
|
<div class="callout callout-tip">
|
||||||
|
<p>验证安装是否成功:</p>
|
||||||
|
<pre><code>graphify-rs --version</code></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 5 分钟上手 ===== -->
|
||||||
|
<div class="section" id="quickstart">
|
||||||
|
<h2 class="section-title"><span class="emoji">🚀</span>5 分钟上手</h2>
|
||||||
|
|
||||||
|
<div class="flow">步骤 1:初始化配置(可选)
|
||||||
|
graphify-rs init
|
||||||
|
|
||||||
|
步骤 2:构建知识图谱
|
||||||
|
cd /path/to/your-project
|
||||||
|
graphify-rs build --path . --output graphify-out
|
||||||
|
|
||||||
|
步骤 3:查看输出
|
||||||
|
ls graphify-out/
|
||||||
|
├── graph.json # 图谱数据(核心产物)
|
||||||
|
├── index.html # 交互式可视化页面
|
||||||
|
├── GRAPH_REPORT.md # 架构深度报告
|
||||||
|
└── wiki/index.md # Wiki 导航索引
|
||||||
|
|
||||||
|
步骤 4:在 Claude Code 中使用
|
||||||
|
graphify-rs install --platform claude</div>
|
||||||
|
|
||||||
|
<div class="callout callout-tip">
|
||||||
|
<p>首次构建时 <code>--no-llm</code> 会跳过 LLM 摘要生成,速度更快。需要 AI 增强报告时去掉此标志。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== build ===== -->
|
||||||
|
<div class="section" id="build">
|
||||||
|
<h2 class="section-title"><span class="emoji">🔨</span>build — 构建知识图谱</h2>
|
||||||
|
<p><code>build</code> 是核心命令,解析源代码并生成图谱数据。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">基础用法</h3>
|
||||||
|
<pre><code># 构建当前目录
|
||||||
|
graphify-rs build
|
||||||
|
|
||||||
|
# 构建指定目录,输出到自定义路径
|
||||||
|
graphify-rs build --path /path/to/project --output my-graph
|
||||||
|
|
||||||
|
# 增量构建(只解析变更文件)
|
||||||
|
graphify-rs build --path . --output graphify-out --update</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">常用参数</h3>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>参数</th><th>默认值</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>-p, --path</code></td><td><code>.</code></td><td>要扫描的项目目录</td></tr>
|
||||||
|
<tr><td><code>-o, --output</code></td><td><code>graphify-out</code></td><td>输出目录路径</td></tr>
|
||||||
|
<tr><td><code>--update</code></td><td>—</td><td>增量模式,仅重新解析新/修改的文件</td></tr>
|
||||||
|
<tr><td><code>--no-llm</code></td><td>—</td><td>跳过 LLM 增强,纯 AST 解析(更快)</td></tr>
|
||||||
|
<tr><td><code>--code-only</code></td><td>—</td><td>只解析代码文件,忽略文档/配置</td></tr>
|
||||||
|
<tr><td><code>--format</code></td><td><code>all</code></td><td>指定输出格式,逗号分隔</td></tr>
|
||||||
|
<tr><td><code>--max-viz-nodes</code></td><td><code>2000</code></td><td>HTML 可视化节点上限,超出会卡顿</td></tr>
|
||||||
|
<tr><td><code>-j, --jobs</code></td><td>CPU 核数</td><td>并行任务数</td></tr>
|
||||||
|
<tr><td><code>-v, --verbose</code></td><td>—</td><td>输出 debug 级别日志</td></tr>
|
||||||
|
<tr><td><code>-q, --quiet</code></td><td>—</td><td>静默模式,只输出错误</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">实用场景</h3>
|
||||||
|
|
||||||
|
<p><strong>大型 Java 项目首次构建:</strong></p>
|
||||||
|
<pre><code>graphify-rs build --path ./crmeb-mer --output graphify-out --max-viz-nodes 5000</code></pre>
|
||||||
|
|
||||||
|
<p><strong>日常开发增量更新:</strong></p>
|
||||||
|
<pre><code># 修改代码后快速更新图谱
|
||||||
|
graphify-rs build --path . --output graphify-out --no-llm --update</code></pre>
|
||||||
|
|
||||||
|
<p><strong>只生成 JSON 数据(不生成 HTML/Wiki 等):</strong></p>
|
||||||
|
<pre><code>graphify-rs build --path . --output graphify-out --format json</code></pre>
|
||||||
|
|
||||||
|
<p><strong>指定多种输出格式:</strong></p>
|
||||||
|
<pre><code>graphify-rs build --path . --output graphify-out --format json,wiki,report</code></pre>
|
||||||
|
|
||||||
|
<div class="callout callout-warning">
|
||||||
|
<p><code>--max-viz-nodes</code> 设置过高会导致浏览器渲染卡顿,建议 2000 以下。超过 5000 仅适合在高性能机器上查看。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== query ===== -->
|
||||||
|
<div class="section" id="query">
|
||||||
|
<h2 class="section-title"><span class="emoji">🔍</span>query — 查询知识图谱</h2>
|
||||||
|
<p>基于自然语言提问,工具会在图谱数据中进行图遍历和语义匹配,返回相关节点和关系。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">基础用法</h3>
|
||||||
|
<pre><code>graphify-rs query "项目中有哪些 Controller 类?"
|
||||||
|
graphify-rs query "UserService 依赖了哪些模块?"
|
||||||
|
graphify-rs query "支付相关的方法有哪些?"</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">参数</h3>
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>参数</th><th>默认值</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code><QUESTION></code></td><td>必填</td><td>自然语言查询问题</td></tr>
|
||||||
|
<tr><td><code>--graph</code></td><td><code>graphify-out/graph.json</code></td><td>图谱数据路径</td></tr>
|
||||||
|
<tr><td><code>--budget</code></td><td><code>2000</code></td><td>图遍历预算(步数)</td></tr>
|
||||||
|
<tr><td><code>--dfs</code></td><td>—</td><td>使用深度优先搜索策略</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="callout callout-tip">
|
||||||
|
<p>查询问题越具体,返回结果越精准。"入口方法有哪些" 比 "结构是什么" 效果好得多。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== watch ===== -->
|
||||||
|
<div class="section" id="watch">
|
||||||
|
<h2 class="section-title"><span class="emoji">👁️</span>watch — 监听模式</h2>
|
||||||
|
<p>监听项目文件变化,自动触发增量重建图谱,适合开发过程中持续保持图谱最新。</p>
|
||||||
|
|
||||||
|
<pre><code># 监听当前目录
|
||||||
|
graphify-rs watch
|
||||||
|
|
||||||
|
# 监听指定目录
|
||||||
|
graphify-rs watch --path ./crmeb-mer --output graphify-out</code></pre>
|
||||||
|
|
||||||
|
<p>运行后会保持后台监听进程,每次检测到文件变动自动执行 <code>build --update</code>。</p>
|
||||||
|
|
||||||
|
<div class="callout callout-warning">
|
||||||
|
<p>监听模式对大型目录可能会频繁触发构建,建议配合 <code>--update</code> 使用(默认行为)。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== serve ===== -->
|
||||||
|
<div class="section" id="serve">
|
||||||
|
<h2 class="section-title"><span class="emoji">🖥️</span>serve — MCP Server</h2>
|
||||||
|
<p>以 MCP(Model Context Protocol)服务形式暴露图谱查询能力,供 AI 编辑器远程调用。</p>
|
||||||
|
|
||||||
|
<pre><code># 启动 MCP 服务
|
||||||
|
graphify-rs serve
|
||||||
|
|
||||||
|
# 指定图谱数据
|
||||||
|
graphify-rs serve --graph graphify-out/graph.json</code></pre>
|
||||||
|
|
||||||
|
<p>启动后支持 SSE / stdio 传输协议,可在 Claude Code 的 MCP 配置中注册为远程工具。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 配置系统 ===== -->
|
||||||
|
<div class="section" id="config">
|
||||||
|
<h2 class="section-title"><span class="emoji">⚙️</span>配置系统</h2>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">初始化配置</h3>
|
||||||
|
<pre><code>graphify-rs init</code></pre>
|
||||||
|
<p>在项目根目录生成 <code>graphify.toml</code> 配置文件,可自定义:</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>include / exclude 规则</strong> — 控制哪些文件/目录被扫描</li>
|
||||||
|
<li><strong>LLM 提供商和模型</strong> — 配置增强摘要使用的 AI 模型</li>
|
||||||
|
<li><strong>输出格式默认值</strong> — 设置 <code>--format</code> 的默认行为</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">示例配置</h3>
|
||||||
|
<pre><code># graphify.toml
|
||||||
|
[build]
|
||||||
|
path = "."
|
||||||
|
output = "graphify-out"
|
||||||
|
|
||||||
|
[exclude]
|
||||||
|
paths = ["node_modules", "target", "dist", ".git"]
|
||||||
|
|
||||||
|
[llm]
|
||||||
|
enabled = true
|
||||||
|
model = "claude-sonnet-4-6"</code></pre>
|
||||||
|
|
||||||
|
<p>有配置文件后,<code>build</code> 命令会自动读取,命令行参数会覆盖配置文件中的值。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 输出格式 ===== -->
|
||||||
|
<div class="section" id="formats">
|
||||||
|
<h2 class="section-title"><span class="emoji">📋</span>输出格式速查</h2>
|
||||||
|
<p>通过 <code>--format</code> 参数控制输出产物,默认 <code>all</code> 生成全部格式。</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>格式</th><th>说明</th><th>典型用途</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>json</code></td><td>结构化图谱数据 <code>graph.json</code></td><td>查询、MCP 服务、二次开发</td></tr>
|
||||||
|
<tr><td><code>html</code></td><td>交互式可视化页面 <code>index.html</code></td><td>浏览器中浏览代码关系</td></tr>
|
||||||
|
<tr><td><code>report</code></td><td>架构深度分析报告 <code>GRAPH_REPORT.md</code></td><td>架构评审、文档沉淀</td></tr>
|
||||||
|
<tr><td><code>wiki</code></td><td>Wiki 格式文档 <code>wiki/index.md</code></td><td>AI 编辑器导航</td></tr>
|
||||||
|
<tr><td><code>obsidian</code></td><td>Obsidian 双向链接笔记</td><td>个人知识管理</td></tr>
|
||||||
|
<tr><td><code>graphml</code></td><td>GraphML 格式图</td><td>导入 Gephi 等图分析工具</td></tr>
|
||||||
|
<tr><td><code>cypher</code></td><td>Neo4j Cypher 导入脚本</td><td>导入 Neo4j 图数据库</td></tr>
|
||||||
|
<tr><td><code>svg</code></td><td>静态 SVG 依赖图</td><td>文档嵌入、打印</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== diff ===== -->
|
||||||
|
<div class="section" id="diff">
|
||||||
|
<h2 class="section-title"><span class="emoji">🔄</span>diff — 对比图谱差异</h2>
|
||||||
|
<p>比较两次构建之间的图谱变化,查看新增/删除/修改的节点和关系。</p>
|
||||||
|
|
||||||
|
<pre><code>graphify-rs diff old-graph.json new-graph.json
|
||||||
|
graphify-rs diff graphify-out/graph.json graphify-out-v2/graph.json --output json</code></pre>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>参数</th><th>默认值</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code><OLD></code></td><td>必填</td><td>旧版 graph.json 路径</td></tr>
|
||||||
|
<tr><td><code><NEW></code></td><td>必填</td><td>新版 graph.json 路径</td></tr>
|
||||||
|
<tr><td><code>--output</code></td><td><code>text</code></td><td>输出格式:<code>text</code> 或 <code>json</code></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="callout callout-tip">
|
||||||
|
<p>典型用法:重构前后对比架构变化,或者验证某个模块的依赖是否被正确删除。</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== stats ===== -->
|
||||||
|
<div class="section" id="stats">
|
||||||
|
<h2 class="section-title"><span class="emoji">📈</span>stats — 统计信息</h2>
|
||||||
|
<p>不重新构建,直接读取已有的 <code>graph.json</code> 并输出统计摘要。</p>
|
||||||
|
|
||||||
|
<pre><code>graphify-rs stats
|
||||||
|
graphify-rs stats graphify-out/graph.json</code></pre>
|
||||||
|
|
||||||
|
<p>输出内容包括:节点数、边数、文件数、语言分布、拓扑指标等。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== ingest ===== -->
|
||||||
|
<div class="section" id="ingest">
|
||||||
|
<h2 class="section-title"><span class="emoji">🌐</span>ingest — 导入外链内容</h2>
|
||||||
|
<p>抓取指定 URL 的内容并纳入图谱分析范围,适合分析在线文档或远程代码。</p>
|
||||||
|
|
||||||
|
<pre><code>graphify-rs ingest https://example.com/api-docs</code></pre>
|
||||||
|
|
||||||
|
<p>内容会被保存到输出目录,后续 <code>build</code> 时一并分析。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== Claude Code 集成 ===== -->
|
||||||
|
<div class="section" id="claude-integration">
|
||||||
|
<h2 class="section-title"><span class="emoji">🤖</span>Claude Code 集成</h2>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">安装技能</h3>
|
||||||
|
<pre><code>graphify-rs install --platform claude</code></pre>
|
||||||
|
<p>自动将 graphify 技能注册到 Claude Code,注册后可在对话中使用 <code>/graphify</code> 命令。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">卸载</h3>
|
||||||
|
<pre><code>graphify-rs claude uninstall</code></pre>
|
||||||
|
|
||||||
|
<div class="callout callout-tip">
|
||||||
|
<p>也可以在 CLAUDE.md 中手动配置图谱使用规则,例如:</p>
|
||||||
|
<pre><code># 回答架构问题前先读取图谱
|
||||||
|
- 先读取 graphify-out/GRAPH_REPORT.md 了解核心节点和社区结构
|
||||||
|
- 如果 graphify-out/wiki/index.md 存在,优先导航该索引</code></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== Git Hook 集成 ===== -->
|
||||||
|
<div class="section" id="git-hook">
|
||||||
|
<h2 class="section-title"><span class="emoji">🪝</span>Git Hook 集成</h2>
|
||||||
|
<p>将图谱构建绑定到 Git 事件(如 commit 后自动构建),保持图谱始终与代码同步。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">安装 Hook</h3>
|
||||||
|
<pre><code>graphify-rs hook install</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">查看状态</h3>
|
||||||
|
<pre><code>graphify-rs hook status</code></pre>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">卸载 Hook</h3>
|
||||||
|
<pre><code>graphify-rs hook uninstall</code></pre>
|
||||||
|
|
||||||
|
<p>默认在 <code>post-commit</code> 阶段触发增量构建,等价于每次提交后自动运行 <code>build --update</code>。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 全局参数速查 ===== -->
|
||||||
|
<div class="section" id="flags">
|
||||||
|
<h2 class="section-title"><span class="emoji">📌</span>全局参数速查</h2>
|
||||||
|
<p>以下参数对所有子命令生效:</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead><tr><th>参数</th><th>说明</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>-q, --quiet</code></td><td>静默模式,抑制非必要输出</td></tr>
|
||||||
|
<tr><td><code>-v, --verbose</code></td><td>调试模式,输出 debug 级日志</td></tr>
|
||||||
|
<tr><td><code>-j, --jobs</code></td><td>并行任务数,默认等于 CPU 核数</td></tr>
|
||||||
|
<tr><td><code>-h, --help</code></td><td>打印帮助信息</td></tr>
|
||||||
|
<tr><td><code>-V, --version</code></td><td>打印版本号</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ===== 常见问题 ===== -->
|
||||||
|
<div class="section" id="faq">
|
||||||
|
<h2 class="section-title"><span class="emoji">💡</span>常见问题</h2>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">构建太慢了怎么办?</h3>
|
||||||
|
<p>首次构建对大型项目可能需要十几秒。优化方案:</p>
|
||||||
|
<ul>
|
||||||
|
<li>使用 <code>--update</code> 增量构建(通常 2~5 秒)</li>
|
||||||
|
<li>使用 <code>--no-llm</code> 跳过 LLM 增强</li>
|
||||||
|
<li>在 <code>graphify.toml</code> 中排除不需要的目录(如 <code>node_modules</code>、<code>vendor</code>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">HTML 可视化页面卡顿?</h3>
|
||||||
|
<p>节点过多会导致浏览器渲染性能下降。通过 <code>--max-viz-nodes 1000</code> 限制节点数量。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">如何排除某些文件/目录?</h3>
|
||||||
|
<p>在项目根目录创建 <code>graphify.toml</code>,在 <code>[exclude]</code> 中配置路径列表,或运行 <code>graphify-rs init</code> 生成模板后修改。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">图谱数据在哪个目录?</h3>
|
||||||
|
<p>默认输出到 <code>graphify-out/</code>,核心产物是 <code>graph.json</code>,所有查询、MCP 服务、diff 对比都基于此文件。</p>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">如何在团队中共享图谱?</h3>
|
||||||
|
<ul>
|
||||||
|
<li>将 <code>graphify-out/</code> 提交到 Git,团队成员可直接查看报告</li>
|
||||||
|
<li>使用 <code>graphify-rs serve</code> 启动 MCP Server 共享查询能力</li>
|
||||||
|
<li>生成 GraphML 格式导入 Gephi 进行深度图分析</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">日常开发工作流建议</h3>
|
||||||
|
<div class="flow">开发中: graphify-rs watch # 后台监听,自动更新
|
||||||
|
提交前: graphify-rs stats # 快速检查图谱状态
|
||||||
|
提交后: git hook 自动 build --update # 保持图谱同步
|
||||||
|
需要分析: graphify-rs query "..." # 自然语言查询图谱
|
||||||
|
归档: git commit graphify-out/ # 将图谱随代码一起版本管理</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Sidebar scroll spy
|
||||||
|
const links = document.querySelectorAll('.sidebar a');
|
||||||
|
const sections = [...links].map(a => document.querySelector(a.getAttribute('href')));
|
||||||
|
|
||||||
|
function onScroll() {
|
||||||
|
let idx = 0;
|
||||||
|
for (let i = sections.length - 1; i >= 0; i--) {
|
||||||
|
if (sections[i] && sections[i].getBoundingClientRect().top <= 120) { idx = i; break; }
|
||||||
|
}
|
||||||
|
links.forEach((a, i) => a.classList.toggle('active', i === idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('scroll', onScroll, { passive: true });
|
||||||
|
onScroll();
|
||||||
|
|
||||||
|
// Smooth scroll
|
||||||
|
links.forEach(a => {
|
||||||
|
a.addEventListener('click', e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const target = document.querySelector(a.getAttribute('href'));
|
||||||
|
if (target) target.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,528 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>一人公司开发团队知识库</title>
|
||||||
|
<style>
|
||||||
|
/* ===== Ant Design 阿里云风格 Design Tokens ===== */
|
||||||
|
:root {
|
||||||
|
/* 品牌色 */
|
||||||
|
--color-primary: #1677FF;
|
||||||
|
--color-primary-hover: #4096FF;
|
||||||
|
--color-primary-active: #0958D9;
|
||||||
|
--color-primary-bg: #E6F4FF;
|
||||||
|
|
||||||
|
/* 功能色 */
|
||||||
|
--color-success: #52C41A;
|
||||||
|
--color-warning: #FAAD14;
|
||||||
|
--color-error: #FF4D4F;
|
||||||
|
|
||||||
|
/* 中性色 - 亮色主题 */
|
||||||
|
--bg: #F5F5F5;
|
||||||
|
--bg-container: #FFFFFF;
|
||||||
|
--bg-elevated: #FAFAFA;
|
||||||
|
--border: #D9D9D9;
|
||||||
|
--border-light: #F0F0F0;
|
||||||
|
--text-primary: #141414;
|
||||||
|
--text-secondary: #595959;
|
||||||
|
--text-tertiary: #8C8C8C;
|
||||||
|
|
||||||
|
/* 圆角 */
|
||||||
|
--radius-sm: 6px;
|
||||||
|
--radius-md: 8px;
|
||||||
|
--radius-lg: 12px;
|
||||||
|
|
||||||
|
/* 阴影 */
|
||||||
|
--shadow-sm: 0 1px 2px rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02);
|
||||||
|
--shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 4px 12px -2px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
/* 布局 */
|
||||||
|
--header-h: 64px;
|
||||||
|
--content-max: 1200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||||
|
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
|
||||||
|
'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text-primary);
|
||||||
|
line-height: 1.57;
|
||||||
|
font-size: 14px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Header ===== */
|
||||||
|
.header-bar {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
height: var(--header-h);
|
||||||
|
background: rgba(255,255,255,0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
border-bottom: 1px solid var(--border-light);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 40px;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-bar .brand {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-bar h1 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
background: linear-gradient(135deg, var(--color-primary) 0%, #722ED1 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-bar .tagline {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Content ===== */
|
||||||
|
.container {
|
||||||
|
max-width: var(--content-max);
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 32px 40px 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Filter Bar ===== */
|
||||||
|
.filter-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-label {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px 14px;
|
||||||
|
border-radius: 16px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--bg-container);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
|
||||||
|
.filter-chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
|
||||||
|
|
||||||
|
.filter-chip .chip-count {
|
||||||
|
font-size: 11px;
|
||||||
|
background: rgba(0,0,0,0.08);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 0 6px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip.active .chip-count { background: rgba(255,255,255,0.25); }
|
||||||
|
|
||||||
|
/* ===== Group ===== */
|
||||||
|
.group { margin-bottom: 32px; }
|
||||||
|
|
||||||
|
.group-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
padding-left: 12px;
|
||||||
|
border-left: 3px solid var(--color-primary);
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Card ===== */
|
||||||
|
.card {
|
||||||
|
background: var(--bg-container);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 20px 24px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
box-shadow: var(--shadow-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-accent {
|
||||||
|
width: 4px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 2px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-accent--blue { background: var(--color-primary); }
|
||||||
|
.card-accent--pink { background: #EB2F96; }
|
||||||
|
.card-accent--mint { background: var(--color-success); }
|
||||||
|
.card-accent--lavender { background: #722ED1; }
|
||||||
|
|
||||||
|
.card-body { flex: 1; min-width: 0; }
|
||||||
|
|
||||||
|
.card-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-name a {
|
||||||
|
color: var(--text-primary);
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-name a:hover { color: var(--color-primary); }
|
||||||
|
|
||||||
|
.card-desc {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-meta {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-date {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-badge--blue { background: #E6F4FF; color: #1677FF; border: 1px solid #91CAFF; }
|
||||||
|
.card-badge--pink { background: #FFF0F6; color: #EB2F96; border: 1px solid #FFADD2; }
|
||||||
|
.card-badge--mint { background: #F6FFED; color: #52C41A; border: 1px solid #B7EB8F; }
|
||||||
|
.card-badge--lavender { background: #F9F0FF; color: #722ED1; border: 1px solid #D3ADF7; }
|
||||||
|
|
||||||
|
/* ===== Footer ===== */
|
||||||
|
.footer {
|
||||||
|
margin-top: 48px;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid var(--border-light);
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-tertiary);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Responsive ===== */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.header-bar { padding: 0 16px; }
|
||||||
|
.header-bar h1 { font-size: 16px; }
|
||||||
|
.container { padding: 24px 16px 48px; }
|
||||||
|
.card { flex-wrap: wrap; gap: 8px; padding: 16px; }
|
||||||
|
.card-accent { display: none; }
|
||||||
|
.card-name { min-width: 0; width: 100%; }
|
||||||
|
.card-meta { flex-direction: row; gap: 8px; margin-left: auto; }
|
||||||
|
.card-desc { white-space: normal; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="header-bar">
|
||||||
|
<div class="brand">
|
||||||
|
<h1>一人公司开发团队知识库</h1>
|
||||||
|
<span class="tagline">独立开发者的技术沉淀与参考资源</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="filter-bar" id="filterBar"></div>
|
||||||
|
<div id="content"></div>
|
||||||
|
<div class="footer" id="footer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const entries = [
|
||||||
|
[
|
||||||
|
"Claude Code 工程师使用指南/报告/claude-code-engineering-guide.html",
|
||||||
|
"Claude Code 最佳实践",
|
||||||
|
"Claude Code 在软件工程场景下的最佳实践与工作流指南",
|
||||||
|
"2026-04-29",
|
||||||
|
"blue"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Graphify 深度分析报告/代码/graphify-analysis.html",
|
||||||
|
"Graphify 代码分析",
|
||||||
|
"Graphify 项目的代码结构、质量指标与重构建议",
|
||||||
|
"2026-04-29",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"代码图谱工具调研/报告/code-structure-tools-analysis.html",
|
||||||
|
"代码图谱工具调研",
|
||||||
|
"主流代码结构与可视化工具的横向对比分析",
|
||||||
|
"2026-04-29",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"MySQL转PostgreSQL迁移工具/报告/mysql-to-pg-migration-tools.html",
|
||||||
|
"MySQL 转 PostgreSQL 迁移工具",
|
||||||
|
"主流 MySQL → PostgreSQL 迁移工具对比分析,含云厂商方案与开源方案",
|
||||||
|
"2026-05-04",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mcp-services-guide/index.html",
|
||||||
|
"MCP 服务大全",
|
||||||
|
"适合开发者使用的 MCP 服务大全,含功能对比与快速开始指南",
|
||||||
|
"2026-04-29",
|
||||||
|
"lavender"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"国内商业业态分类到家/报告/到家业态分类全景.html",
|
||||||
|
"国内商业业态分类(到家服务)",
|
||||||
|
"国内完整业态分类全景,按服务本质分为 5 大板块 92 业态,含楼层收费参考与商业模式对比",
|
||||||
|
"2026-05-05",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"在线下单配送抢单小程序调研/报告/delivery-order-grabbing-mini-program-research.html",
|
||||||
|
"在线下单配送抢单小程序调研",
|
||||||
|
"Top 5 开源外卖/跑腿/抢单小程序横向对比,含前后端功能完成度矩阵与技术方案分析",
|
||||||
|
"2026-05-05",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"crmeb-mer-graph-report.html",
|
||||||
|
"CRMEB-MER 项目图谱报告",
|
||||||
|
"CRMEB-MER 多商户电商系统的代码结构、依赖图谱与架构深度分析",
|
||||||
|
"2026-05-06",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"分销商城推广模式调研/报告/分销商城推广模式全景调研.html",
|
||||||
|
"分销商城推广模式全景调研",
|
||||||
|
"18 种推广模式系统梳理(传统分销+微三云特色),含核心机制、收益分析、分润计算、合规框架与选型建议",
|
||||||
|
"2026-05-06",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"交互式演示/tetrahedron-interactive.html",
|
||||||
|
"正四面体旋转与展开动画",
|
||||||
|
"鼠标拖拽旋转四面体,点击按钮铰链展开为平面展开图,四个面均为等大正三角形",
|
||||||
|
"2026-05-06",
|
||||||
|
"lavender"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"全域智能认证与门户平台/报告/unified-auth-portal-requirements.html",
|
||||||
|
"全域智能认证与门户平台需求分析",
|
||||||
|
"企业级统一身份认证与门户平台完整需求拆解,含 13 套系统对接清单、架构设计、实施路线图与风险分析",
|
||||||
|
"2026-05-08",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"全域智能认证与门户平台/报告/identity-auth-center-tech-analysis.html",
|
||||||
|
"身份认证中心技术解析与开源匹配",
|
||||||
|
"多元化认证、零信任登录、密码代填、CAS 对接深度解析,Keycloak/Casdoor/MaxKey/Apereo CAS 匹配度对比与选型建议",
|
||||||
|
"2026-05-08",
|
||||||
|
"blue"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"全域智能认证与门户平台/报告/opensource-iam-selection-report.html",
|
||||||
|
"开源 IAM 项目选型报告",
|
||||||
|
"5 大开源 IAM 项目(Keycloak/Casdoor/MaxKey/Apereo CAS/Syncope)匹配度深度对比,含需求矩阵、综合评分与推荐架构蓝图",
|
||||||
|
"2026-05-08",
|
||||||
|
"blue"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"graphify-rs使用手册/报告/graphify-rs-usage-guide.html",
|
||||||
|
"graphify-rs 使用手册",
|
||||||
|
"graphify-rs 代码知识图谱工具的完整使用指南,含安装、构建、查询、输出格式、集成与工作流最佳实践",
|
||||||
|
"2026-05-08",
|
||||||
|
"blue"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"金鹿商城电商小程序需求分析/报告/jinlu-deer-mall-requirements-analysis.html",
|
||||||
|
"金鹿商城电商小程序需求分析",
|
||||||
|
"金鹿商城小程序需求解读与 CRMEB 现有功能差异对比,含限时抢签/活动币/积分商城组合支付模块的完整拆解与 26 人天实施计划",
|
||||||
|
"2026-05-09",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"招标投标AI推广应用政策解读/报告/ai-bidding-tendering-policy-analysis.html",
|
||||||
|
"招标投标领域AI推广应用政策解读",
|
||||||
|
"国家发改委等八部门联合发文(发改法规〔2026〕195号),6 大领域 20 个 AI 场景全景拆解,含分阶段目标与市场机遇分析",
|
||||||
|
"2026-05-09",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"招标投标AI推广应用政策解读/报告/provincial-bidding-smart-supervision-platform.html",
|
||||||
|
"省级招投标智慧监管平台建设方案",
|
||||||
|
"省级招投标主管部门业务痛点分析、8大业务场景设计、功能模块规划、系统架构与技术实现路径完整方案",
|
||||||
|
"2026-05-09",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"沈阳顺义-数据-项目建设方案/报告/沈阳顺义数据项目建设方案解读.html",
|
||||||
|
"沈阳顺义数据项目建设方案解读",
|
||||||
|
"系统故障预测与健康管理数据应用平台完整解读:12+3功能模块拆解、17项功能要求覆盖分析、13项技术指标对照、20+审查意见分类、交叉点与新增点识别",
|
||||||
|
"2026-05-12",
|
||||||
|
"pink"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"沈阳顺义-数据-项目建设方案/报告/开源项目匹配度分析.html",
|
||||||
|
"沈阳顺义项目开源方案匹配度分析",
|
||||||
|
"10 个开源项目(ThingsBoard/DataHub/ThingLinks/IoT DC3/qData 等)在 IoT 层、数据治理层、算法层的匹配度矩阵分析,含推荐组合方案与自研边界划分",
|
||||||
|
"2026-05-12",
|
||||||
|
"mint"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"沈阳顺义-数据-项目建设方案/报告/开源版专业版功能对比.html",
|
||||||
|
"开源版 vs 专业版功能对比",
|
||||||
|
"沈阳顺义数据项目 13 大模块逐项对比,清晰标注开源版已包含/部分包含/缺失功能项,含差异说明与统计汇总",
|
||||||
|
"2026-05-12",
|
||||||
|
"pink"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
const groups = [
|
||||||
|
{ title: "工程指南", filter: (e) => e[4] === "blue" },
|
||||||
|
{ title: "深度分析", filter: (e) => e[4] === "pink" },
|
||||||
|
{ title: "调研研究", filter: (e) => e[4] === "mint" },
|
||||||
|
{ title: "参考资源", filter: (e) => e[4] === "lavender" }
|
||||||
|
];
|
||||||
|
|
||||||
|
const badgeLabels = { blue: "工程指南", pink: "深度分析", mint: "调研研究", lavender: "参考资源" };
|
||||||
|
|
||||||
|
let activeFilters = new Set(); // empty = show all
|
||||||
|
|
||||||
|
function buildFilterBar() {
|
||||||
|
const bar = document.getElementById('filterBar');
|
||||||
|
bar.innerHTML = '';
|
||||||
|
|
||||||
|
const allChip = document.createElement('span');
|
||||||
|
allChip.className = 'filter-chip active';
|
||||||
|
allChip.dataset.group = '__all__';
|
||||||
|
allChip.innerHTML = `全部<span class="chip-count">${entries.length}</span>`;
|
||||||
|
allChip.addEventListener('click', () => {
|
||||||
|
activeFilters.clear();
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
bar.appendChild(allChip);
|
||||||
|
|
||||||
|
for (const group of groups) {
|
||||||
|
const count = entries.filter(group.filter).length;
|
||||||
|
if (!count) continue;
|
||||||
|
const chip = document.createElement('span');
|
||||||
|
chip.className = 'filter-chip';
|
||||||
|
chip.dataset.group = group.title;
|
||||||
|
chip.innerHTML = `${group.title}<span class="chip-count">${count}</span>`;
|
||||||
|
chip.addEventListener('click', () => {
|
||||||
|
if (activeFilters.has(group.title)) {
|
||||||
|
activeFilters.delete(group.title);
|
||||||
|
} else {
|
||||||
|
activeFilters.add(group.title);
|
||||||
|
}
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
bar.appendChild(chip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
const content = document.getElementById('content');
|
||||||
|
const footer = document.getElementById('footer');
|
||||||
|
content.innerHTML = '';
|
||||||
|
|
||||||
|
// Update filter bar active states
|
||||||
|
document.querySelectorAll('.filter-chip').forEach(chip => {
|
||||||
|
const g = chip.dataset.group;
|
||||||
|
chip.classList.toggle('active', g === '__all__' ? activeFilters.size === 0 : activeFilters.has(g));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort by date descending
|
||||||
|
const sorted = [...entries].sort((a, b) => b[3].localeCompare(a[3]));
|
||||||
|
|
||||||
|
// Determine which groups to show
|
||||||
|
const activeGroups = activeFilters.size === 0
|
||||||
|
? groups
|
||||||
|
: groups.filter(g => activeFilters.has(g.title));
|
||||||
|
|
||||||
|
for (const group of activeGroups) {
|
||||||
|
const items = sorted.filter(group.filter);
|
||||||
|
if (!items.length) continue;
|
||||||
|
|
||||||
|
const section = document.createElement('div');
|
||||||
|
section.className = 'group';
|
||||||
|
section.dataset.group = group.title;
|
||||||
|
|
||||||
|
const title = document.createElement('div');
|
||||||
|
title.className = 'group-title';
|
||||||
|
title.textContent = group.title;
|
||||||
|
section.appendChild(title);
|
||||||
|
|
||||||
|
for (const [path, name, desc, date, color] of items) {
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = 'card';
|
||||||
|
card.innerHTML = `
|
||||||
|
<div class="card-accent card-accent--${color}"></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="card-name"><a href="${path}" target="_blank">${name}</a></div>
|
||||||
|
<div class="card-desc">${desc}</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-meta">
|
||||||
|
<span class="card-badge card-badge--${color}">${badgeLabels[color]}</span>
|
||||||
|
<span class="card-date">${date}</span>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
section.appendChild(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
content.appendChild(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count visible items
|
||||||
|
const visibleCount = content.querySelectorAll('.card').length;
|
||||||
|
footer.textContent = `显示 ${visibleCount} / 共 ${entries.length} 篇文档`;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFilterBar();
|
||||||
|
render();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 672 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 139 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 273 KiB |
@@ -0,0 +1,61 @@
|
|||||||
|
######################################################################
|
||||||
|
# Build Tools
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# IDE
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
/.idea/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### JRebel ###
|
||||||
|
rebel.xml
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/*
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
!*/qmodel-ui/dist/
|
||||||
|
!*/qmodel-ui/node_modules/
|
||||||
|
/qmodel-ui/dist/
|
||||||
|
/qmodel-ui/node_modules/
|
||||||
|
!*/resources/static
|
||||||
|
nbdist/
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Others
|
||||||
|
*.log
|
||||||
|
*.xml.versionsBackup
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
!*/build/*.java
|
||||||
|
!*/build/*.html
|
||||||
|
!*/build/*.xml
|
||||||
|
|
||||||
|
### 组件库编译后的文件 ###
|
||||||
|
storybook-static/
|
||||||
|
|
||||||
|
### Mac ###
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# 忽略 upload 目录下的所有内容
|
||||||
|
/upload/
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Open Source License
|
||||||
|
|
||||||
|
qModel is licensed under a modified version of the Apache License 2.0, with the following additional conditions:
|
||||||
|
|
||||||
|
1. qModel may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
|
||||||
|
|
||||||
|
a. LOGO and copyright information: In the process of using qModel's frontend, you may not remove or modify the LOGO or copyright information in the qModel console or applications.
|
||||||
|
|
||||||
|
2. As a contributor, you should agree that:
|
||||||
|
|
||||||
|
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
|
||||||
|
b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
|
||||||
|
|
||||||
|
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
|
||||||
|
The interactive design of this product is protected by appearance patent.
|
||||||
|
|
||||||
|
© 2025 Jiangsu Qiantong Technology Co., Ltd
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
# 🚀 qModel模型管理平台 快速开始指南
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一、准备工作 <small>(必备环境)</small>
|
||||||
|
|
||||||
|
在运行系统之前,请确保您已安装以下环境:
|
||||||
|
|
||||||
|
| 软件/工具 | 版本要求 | 推荐版本 |
|
||||||
|
|:---------------------------------------------------------------------------------------------------------------------:|:--------:|:------:|
|
||||||
|
| <img src="https://img.icons8.com/color/48/000000/java-coffee-cup-logo.png" width="24"/> JDK | >= 1.8 | 1.8 |
|
||||||
|
| <img src="https://img.icons8.com/color/48/000000/mysql-logo.png" width="24"/> MySQL | >= 5.7.0 | 5.7 |
|
||||||
|
| <img src="https://dist.neo4j.com/wp-content/uploads/20230926084108/Logo_FullColor_RGB_TransBG.svg" width="24"/> Neo4j | 4.x | 4.4.40 |
|
||||||
|
| <img src="https://img.icons8.com/color/48/000000/redis.png" width="24"/> Redis | >= 5.0 | 5.0 |
|
||||||
|
| <img src="https://img.icons8.com/?size=100&id=jfjmkTUFX5Vf&format=png" width="24"/> Maven | >= 3.6 | 3.6 |
|
||||||
|
| <img src="https://img.icons8.com/color/48/000000/nodejs.png" width="24"/> Node.js | >= 16 | 16 |
|
||||||
|
|
||||||
|
> **提示**: 前端安装完 `Node.js` 后,建议设置淘宝镜像源以提升依赖包下载速度。不推荐使用 `cnpm`,可能会引入一些不可预知的问题。
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> npm config set registry https://registry.npmmirror.com
|
||||||
|
> ```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二、获取项目代码 <small>(下载与解压)</small>
|
||||||
|
|
||||||
|
前往 【[qKnow Gitee 下载页面](https://gitee.com/qiantongtech/qModel)】 下载项目并解压到您的工作目录。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 三、目录结构
|
||||||
|
### 2.1 项目结构;
|
||||||
|
|
||||||
|
```
|
||||||
|
├─qmodel-framework # 公共配置模块
|
||||||
|
├─ ├─qmodel-auth # oauth2模块
|
||||||
|
├─ ├─qmodel-common # 共通模块
|
||||||
|
├─ ├─qmodel-config # 配置模块
|
||||||
|
├─ ├─qmodel-es # es模块
|
||||||
|
├─ ├─qmodel-file # 文件管理模块
|
||||||
|
├─ ├─qmodel-generator # 代码生成器
|
||||||
|
├─ ├─qmodel-mybatis # mybatis配置
|
||||||
|
├─ ├─qmodel-pay # 支付模块
|
||||||
|
├─ ├─qmodel-quartz # 定时任务模块
|
||||||
|
├─ ├─qmodel-redis # redis模块
|
||||||
|
├─ ├─qmodel-security # security模块
|
||||||
|
├─ ├─qmodel-websocket # websocket模块
|
||||||
|
├─qmodel-module-model # 模型管理模块
|
||||||
|
├─qmodel-module-system # 系统管理模块
|
||||||
|
├─qmodel-server # 启动项目
|
||||||
|
├─qmodel-ui # 前端模块
|
||||||
|
├─sql # sql脚本
|
||||||
|
├─README.md # 相关介绍
|
||||||
|
├─QUICKSTART.md # 快速启动
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.2 前端结构;
|
||||||
|
|
||||||
|
```
|
||||||
|
├─qmodel-ui # 前端模块
|
||||||
|
├─ ├─public # 静态资源目录
|
||||||
|
├─ ├─src
|
||||||
|
├─ | ├─api # 接口
|
||||||
|
├─ | ├─assets # 图片、样式等资源
|
||||||
|
├─ | ├─components # 通用组件
|
||||||
|
├─ | ├─layout # 布局
|
||||||
|
├─ | ├─plugins # 插件
|
||||||
|
├─ | ├─router # 路由
|
||||||
|
├─ | ├─store # 状态管理
|
||||||
|
├─ | ├─utils # 工具类
|
||||||
|
├─ | ├─views # 页面视图
|
||||||
|
├─ | | ├─example # 示例模块(未使用)
|
||||||
|
├─ | | ├─flyflow # 工作流模块(未使用)
|
||||||
|
├─ | | ├─model # 模型管理模块
|
||||||
|
├─ | | ├─system # 系统管理模块
|
||||||
|
├─ ├─.env.development # 开发环境配置
|
||||||
|
├─ ├─.env.production # 生产环境配置
|
||||||
|
├─ ├─vite.config.js # Vite配置文件
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 四、必要配置 <small>(数据库与服务配置)</small>
|
||||||
|
|
||||||
|
### 1. 创建达梦数据库并导入数据
|
||||||
|
|
||||||
|
- 创建 达梦 数据库:`QMODEL_DEV`
|
||||||
|
- 导入数据脚本:`qModel-2025-12-30.sql`
|
||||||
|
|
||||||
|
### 2. 修改达梦数据库连接配置
|
||||||
|
|
||||||
|
路径:`qModel/qmodel-server/src/main/resources/application-dev.yml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
datasource:
|
||||||
|
type: dm8
|
||||||
|
|
||||||
|
dm8:
|
||||||
|
# JDBC驱动类名
|
||||||
|
driver-class-name: dm.jdbc.driver.DmDriver
|
||||||
|
# 主库JDBC连接URL
|
||||||
|
url: 数据库地址
|
||||||
|
# 主库用户名
|
||||||
|
username: 数据库账号
|
||||||
|
# 主库密码
|
||||||
|
password: 数据库密码
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 配置服务端口和访问路径
|
||||||
|
|
||||||
|
路径:`qModel/qmodel-server/src/main/resources/application.yml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 端口 # 默认为8090
|
||||||
|
servlet:
|
||||||
|
context-path: /应用路径 # 应用访问路径,默认为空
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 五、后端运行 <small>(启动服务器)</small>
|
||||||
|
|
||||||
|
1. 使用 IntelliJ IDEA 或 Eclipse 导入项目。
|
||||||
|
2. IDE 将自动加载 Maven 依赖,初次加载可能较慢。
|
||||||
|
3. 运行 `tech.qiantong.qmodel.server.QModelApplication.java`。启动成功后,可通过 `http://localhost:8090` 访问后端服务。
|
||||||
|
4. 出现以下提示,表示后端服务启动成功:
|
||||||
|
|
||||||
|
```
|
||||||
|
(♥◠‿◠)ノ゙ 千知平台启动成功 ლ(´ڡ`ლ)゙
|
||||||
|
_ __
|
||||||
|
__ _| |/ /_ __ _____ __
|
||||||
|
/ _` | ' /| '_ \ / _ \ \ /\ / /
|
||||||
|
| (_| | . \| | | | (_) \ V V /
|
||||||
|
\__, |_|\_\_| |_|\___/ \_/\_/
|
||||||
|
|_|
|
||||||
|
```
|
||||||
|
|
||||||
|
> **注意**: 仅启动后端服务不会显示静态页面,请继续部署前端服务。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 七、前端运行 <small>(启动前端服务)</small>
|
||||||
|
|
||||||
|
### 1. 根据需要修改后台服务端口配置
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// vite 相关配置
|
||||||
|
server: {
|
||||||
|
port: 80,
|
||||||
|
host: true,
|
||||||
|
open: true,
|
||||||
|
proxy: {
|
||||||
|
"/dev-api": {
|
||||||
|
target: "http://localhost:8090",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (p) => p.replace(/^\/dev-api/, ""),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 启动前端服务
|
||||||
|
|
||||||
|
#### 步骤 1: 进入项目目录
|
||||||
|
|
||||||
|
首先,导航到 `qmodel-ui` 目录下:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入项目目录
|
||||||
|
cd qmodel-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 步骤 2: 安装依赖
|
||||||
|
|
||||||
|
接下来,安装项目的依赖包。这里我们使用淘宝镜像源以加速下载速度:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装依赖(推荐使用淘宝镜像)
|
||||||
|
npm install --registry=https://registry.npmmirror.com
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 步骤 3: 本地开发并启动项目
|
||||||
|
|
||||||
|
最后,运行以下命令来启动前端开发服务器:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 本地开发 启动项目
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 测试前端服务
|
||||||
|
|
||||||
|
打开浏览器,输入 `http://localhost`。默认账户/密码为 `qModel/qModel123`。若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功。
|
||||||
|
|
||||||
|
> **提示**: 因为本项目是前后端完全分离的,所以需要前后端都单独启动好,才能进行访问。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
希望这个文档能够帮助您更好地理解和操作 **qModel模型管理平台** 项目!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://img.icons8.com/fluent/48/000000/checkmark.png" width="36"/>
|
||||||
|
<strong>完成!</strong>
|
||||||
|
</p>
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
[banner.png](.gitee/banner.png)
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://img.shields.io/badge/JDK-1.8+-brightgreen.svg" alt="JDK">
|
||||||
|
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.15-blue.svg" alt="Spring Boot">
|
||||||
|
<img src="https://img.shields.io/badge/Vue-3.4.31-blue.svg" alt="Vue">
|
||||||
|
<img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License"/>
|
||||||
|
<img src="https://img.shields.io/badge/qModel-v1.0.0-blue.svg" alt="qModel"/>
|
||||||
|
<img src="https://gitee.com/qiantongtech/qModel/badge/star.svg" alt="Gitee Stars"/>
|
||||||
|
<img src="https://img.shields.io/github/stars/qiantongtech/qModel?label=Github%20Stars" alt="GitHub Stars"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="README.md">📖简体中文</a> | 📖English
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
## 🌈 Introduction
|
||||||
|
|
||||||
|
**qModel** is an open-source model management platform centered around **full lifecycle management of AI models**. It provides capabilities including model ingestion, registration, testing, deployment, computation, fusion, orchestration, and service exposure—helping enterprises and research institutions transform algorithmic assets into intelligent services that are operable, reusable, and governable.
|
||||||
|
|
||||||
|
The platform supports multiple model formats such as Python scripts, Java JARs, and executable binaries (`exe`), bridging the engineering gap from experimentation to production, and serving as a robust foundation for collaborative applications involving traditional algorithms.
|
||||||
|
|
||||||
|
✨✨✨**Live Demo**✨✨✨
|
||||||
|
<a href="demo.qmodel.tech" target="_blank">demo.qmodel.tech</a>
|
||||||
|
(Username: `qModel`, Password: `qModel123`)
|
||||||
|
|
||||||
|
> **qModel — Empowering models throughout their full lifecycle, driving continuous value through intelligence.**
|
||||||
|
|
||||||
|
## 🍱 Typical Use Cases
|
||||||
|
|
||||||
|
| Scenario | Description |
|
||||||
|
|----------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| **AI Model Asset Management** | Centralized governance of scattered models across teams, with version control, categorization, tagging, and permission management |
|
||||||
|
| **Engineering Lab-to-Production Transition** | Rapidly package research algorithms into callable services to accelerate technology transfer |
|
||||||
|
| **Multi-Model Fusion Inference** | Supports strategies like weighted averaging, voting, and stacking to enhance prediction robustness |
|
||||||
|
| **Intelligent Workflow Orchestration** | Visually drag-and-drop to build AI workflows combining multiple models for complex business logic |
|
||||||
|
| **Private Model Marketplace** | Establish internal model sharing and trading mechanisms to promote knowledge reuse and innovation |
|
||||||
|
|
||||||
|
## 🚀 Key Advantages
|
||||||
|
|
||||||
|
- **Full lifecycle coverage**: From upload, testing, and release to monitoring and retirement—fully traceable
|
||||||
|
- **Multi-language support**: Compatible with Python, Java, executables, and more
|
||||||
|
- **Lightweight architecture**: Ready-to-run out of the box; supports one-click Docker deployment
|
||||||
|
- **Modular design**: Core features are decoupled for easy integration and secondary development
|
||||||
|
- **Open from day one**: Community-driven and continuously evolving
|
||||||
|
|
||||||
|
## ✨ Core Features
|
||||||
|
|
||||||
|
| Module | Description | Open Source Status |
|
||||||
|
|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------|
|
||||||
|
| **System Management** | Unified governance of users, roles, departments, menus, dictionaries, parameters, announcements, and logs | ✅ Implemented |
|
||||||
|
| **Model Categories** | Create and manage hierarchical model categories and tag groups | ✅ Implemented |
|
||||||
|
| **Model Management** | Register, categorize, tag, approve, publish/retire, and version-control models | ✅ Implemented |
|
||||||
|
| **Model Computation** | Manage tasks, configure parameters, visualize results, and download outputs (input data binding required manually in OSS) | ✅ Implemented |
|
||||||
|
| **Computation History** | View historical tasks; filter by model, time, status; and revisit results | ✅ Implemented |
|
||||||
|
| **Model Ingestion & Execution** | Upload multi-language models, auto-parse metadata, and perform compatibility checks | ❌ Planned |
|
||||||
|
| **Model Packaging** | Standardized packaging guidelines and documentation | ❌ Planned |
|
||||||
|
| **Service Governance & Scheduling** | Auto-generate RESTful APIs with authentication, rate limiting, concurrency control, call tracing, and watermarking | ❌ Planned |
|
||||||
|
| **Documentation Center** | Integrated developer documentation management | ❌ Planned |
|
||||||
|
|
||||||
|
> 💡 Note: Advanced features such as automated containerization, online debugging, model fusion, workflow orchestration, and training loop integration will be available in the commercial edition. Community contributions to extend the open-source version are warmly welcomed!
|
||||||
|
|
||||||
|
## 🛠️ Tech Stack
|
||||||
|
|
||||||
|
qModel adopts a frontend-backend separated architecture: Spring Boot on the backend and Vue 3 on the frontend, integrated with mainstream middleware for enterprise-grade model management.
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Tech Layer</th><th>Framework</th><th>Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="6">Backend</td><td>Spring Boot</td><td>Main application framework</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MyBatis-Plus</td><td>ORM for simplified database operations</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Spring Security</td><td>Authentication and authorization</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Quartz</td><td>Scheduled task execution (e.g., batch computations)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Alibaba Druid</td><td>High-performance database connection pool</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Swagger</td><td>Auto-generated API documentation</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="7">Frontend</td><td>Vue 3</td><td>Reactive UI framework</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vite</td><td>Ultra-fast build tool</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Element Plus</td><td>Modern UI component library</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Pinia</td><td>Lightweight state management</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vue Router</td><td>Client-side routing</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Axios</td><td>HTTP client for API calls</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ECharts</td><td>Visualization of computation results and system metrics</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="4">Third-party Dependencies</td><td>MySQL</td><td>Metadata storage</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Redis</td><td>Task queue and caching</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Docker (optional)</td><td>Containerized deployment (auto-image building in commercial edition)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Local Storage</td><td>Store model files and computation outputs</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 🏗️ Deployment Requirements
|
||||||
|
|
||||||
|
Ensure the following environment is ready before deploying qModel:
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Environment</th><th>Component</th><th>Recommended Version</th><th>Note</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="5">Backend</td><td>JDK</td><td>1.8+</td><td>Runtime environment</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Maven</td><td>3.6+</td><td>Project build tool</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MySQL</td><td>5.7 / 8.0</td><td>Metadata database</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Redis</td><td>5.0+</td><td>For task queues and caching</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>OS</td><td>Linux / Windows / macOS</td><td>Fully supported</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="3">Frontend</td><td>Node.js</td><td>16+</td><td>Build dependency</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>pnpm / npm</td><td>Latest</td><td>Package manager</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vite</td><td>≥4.0</td><td>Build tool</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 🚨 Commercial Licensing
|
||||||
|
|
||||||
|
qModel offers both **open-source** and **commercial** editions:
|
||||||
|
- The **open-source edition** is ideal for learning, evaluation, and lightweight production use, licensed under Apache 2.0 (commercial use allowed with logo retention).
|
||||||
|
- The **commercial edition** targets enterprise and government clients, offering advanced capabilities such as **automated containerization, model fusion, visual workflow orchestration, training-in-loop, and private model marketplace**, along with dedicated technical support and private repository access.
|
||||||
|
|
||||||
|
👉 For **custom branding licensing** or **commercial trial requests**, please
|
||||||
|
<a href="https://qmodel.qiantong.tech/discuss.html">join our official QQ group for consultation</a>.
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
👉 <a href="./QUICKSTART.md">View Quick Deployment Guide</a>
|
||||||
|
|
||||||
|
## 👥 Community Support
|
||||||
|
|
||||||
|
Join the official qModel QQ group to stay updated, ask questions, and share experiences!
|
||||||
|
|
||||||
|
👉 <a href="https://qmodel.qiantong.tech/discuss.html">Join the QQ Group</a>
|
||||||
|
|
||||||
|
## 🖼️ Screenshots
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Login Page" src=".gitee/system/login.png"/></td>
|
||||||
|
<td><img alt="Dashboard" src=".gitee/system/workbench.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Model List" src=".gitee/system/modelList.png"/></td>
|
||||||
|
<td><img alt="Model Detail" src=".gitee/system/modelDetail.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Compute Tasks" src=".gitee/system/taskList.png"/></td>
|
||||||
|
<td><img alt="Task History" src=".gitee/system/taskHistory.png"/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Login Page" src=".gitee/system/login.png"/></td>
|
||||||
|
<td><img alt="Dashboard" src=".gitee/system/workbench.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Model Category" src=".gitee/system/modelCategory.png"/></td>
|
||||||
|
<td><img alt="Model Input" src=".gitee/system/input.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="Model List" src=".gitee/system/modelList.png"/></td>
|
||||||
|
<td><img alt="Compute Tasks" src=".gitee/system/taskList.png"/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|

|
||||||
|
<p align="center">
|
||||||
|
<img src="https://img.shields.io/badge/JDK-1.8+-brightgreen.svg" alt="JDK">
|
||||||
|
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.15-blue.svg" alt="Spring Boot">
|
||||||
|
<img src="https://img.shields.io/badge/Vue-3.4.31-blue.svg" alt="Vue">
|
||||||
|
<img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License"/>
|
||||||
|
<img src="https://img.shields.io/badge/qModel-v1.0.0-blue.svg" alt="qModel"/>
|
||||||
|
<img src="https://gitee.com/qiantongtech/qModel/badge/star.svg" alt="Gitee Stars"/>
|
||||||
|
<img src="https://img.shields.io/github/stars/qiantongtech/qModel?label=Github%20Stars" alt="GitHub Stars"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
📖简体中文 | <a href="README.en.md">📖English</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
## 🌈平台简介
|
||||||
|
|
||||||
|
|
||||||
|
大模型很火,但真正支撑业务落地的,往往是小模型。qModel 模型平台,正是为了解决企业“小模型混乱症”而生。未来的竞争,不只是数据的竞争,更是模型资产的竞争——谁能把算法沉淀为**可管理、可迭代、可复用、可交易**的服务,谁就能掌握智能化的主动权。
|
||||||
|
|
||||||
|
**qModel** 是一个以 **模型全生命周期管理** 为核心的开源模型平台,提供行业算法模型接入、注册、测试、部署、计算、融合、编排与服务化等能力,帮助企业与科研机构将算法资产转化为可运维、可复用、可治理的智能服务。
|
||||||
|
平台支持 Python、Java、exe 等多语言模型格式,打通从实验到生产的工程链路,为传统算法的协同应用提供坚实底座。
|
||||||
|
|
||||||
|
[//]: # (✨✨✨**在线文档**✨✨✨ <a href="https://qmodel.qiantong.tech" target="_blank">https://qmodel.qiantong.tech</a>)
|
||||||
|
|
||||||
|
✨✨✨**演示地址**✨✨✨ <a href="https://demo.qmodel.tech" target="_blank">https://demo.qmodel.tech</a> (账号:`qModel`,密码:`qModel123`)
|
||||||
|
|
||||||
|
> **qModel模型管理平台,让模型贯穿全生命周期,让智能持续创造价值。**
|
||||||
|
|
||||||
|
## 🍱 典型应用场景
|
||||||
|
|
||||||
|
| 场景 | 说明 |
|
||||||
|
|----------------|--------------------------------|
|
||||||
|
| **AI 模型资产化管理** | 统一纳管散落在各团队的模型,实现版本控制、分类标签与权限治理 |
|
||||||
|
| **科研成果工程化落地** | 将实验室中的算法快速封装为可调用服务,加速成果转化 |
|
||||||
|
| **多模型融合推理** | 支持加权融合、投票、Stacking 等策略,提升预测鲁棒性 |
|
||||||
|
| **智能工作流编排** | 可视化拖拽构建包含多个模型的 AI 工作流,支撑复杂业务逻辑 |
|
||||||
|
| **私有模型市场建设** | 构建企业内部模型共享与交易机制,促进知识复用与创新协作 |
|
||||||
|
|
||||||
|
## 🚀 核心优势
|
||||||
|
|
||||||
|
- 覆盖模型 **全生命周期**:从上传、测试、发布到监控、下线,全程可追溯
|
||||||
|
- **多语言兼容**,支持 Python 脚本、Java JAR、可执行程序等多种模型形态
|
||||||
|
- **轻量级架构**,开箱即用,支持 Docker 一键部署
|
||||||
|
- **模块化设计**,核心功能解耦,便于二次开发与集成
|
||||||
|
- **初生即开源**,社区共建,持续演进
|
||||||
|
|
||||||
|
## ✨ 核心功能
|
||||||
|
|
||||||
|
| 功能模块 | 描述 | 开源版 |
|
||||||
|
|-------------|--------------------------------------------|--------|
|
||||||
|
| **系统管理** | 用户、角色、部门、菜单、字典、参数、公告、日志等统一治理 | ✅ 已完成 |
|
||||||
|
| **模型分类** | 支持创建与管理模型分类体系,包括分类层级、标签分组等 | ✅ 已完成 |
|
||||||
|
| **模型管理** | 注册、分类、标签、审批、发布/下线、版本控制 | ✅ 已完成 |
|
||||||
|
| **模型计算** | 任务管理、参数配置、结果可视化、下载;开源版需手动绑定输入数据 | ✅ 已完成 |
|
||||||
|
| **计算历史** | 查看历史计算任务记录,支持按模型、时间、状态等条件筛选与结果回溯 | ✅ 已完成 |
|
||||||
|
| **模型接入与运行** | 支持多语言模型上传、自动解析、兼容性检测;开源版支持 Python/Java/exe | ⏳ 计划中 |
|
||||||
|
| **模型封装** | 提供标准化打包规范;提供文档指导 | ⏳ 计划中 |
|
||||||
|
| **服务治理与调度** | 自动生成 RESTful API;支持鉴权、限流、并发控制、调用链监控、水印等 | ⏳ 计划中 |
|
||||||
|
| **综合管理** | 开发文档管理 | ⏳ 计划中 |
|
||||||
|
|
||||||
|
> 注:自动化容器化、在线调试、融合编排、训练闭环等高级功能将在商业版中提供,欢迎社区共建开源版能力!
|
||||||
|
|
||||||
|
## 🛠️ 技术栈
|
||||||
|
|
||||||
|
qModel 采用前后端分离架构,后端基于 Spring Boot,前端基于 Vue 3,整合主流中间件,构建企业级模型管理解决方案。
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>技术栈</th><th>技术框架</th><th>描述</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="6">后端技术栈</td><td>Spring Boot</td><td>主体框架,简化配置与开发</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MyBatis-Plus</td><td>ORM 框架,简化数据库操作</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Spring Security</td><td>认证授权与安全控制</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Quartz</td><td>定时任务调度(用于计算任务)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Alibaba Druid</td><td>高性能数据库连接池</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Swagger</td><td>自动生成 API 文档</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="7">前端技术栈</td><td>Vue 3</td><td>响应式前端框架</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vite</td><td>极速构建工具</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Element Plus</td><td>现代化 UI 组件库</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Pinia</td><td>轻量级状态管理</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vue Router</td><td>前端路由管理</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Axios</td><td>HTTP 请求封装</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ECharts</td><td>计算结果与资源监控可视化</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="5">第三方依赖</td><td>MySQL</td><td>模型元数据存储</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Redis</td><td>任务队列与缓存</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Docker(可选)</td><td>容器化部署支持(商业版自动构建镜像)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>本地存储</td><td>模型文件与计算结果存储</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 🏗️ 部署要求
|
||||||
|
|
||||||
|
在部署 qModel 之前,请确保以下环境已准备就绪:
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>环境</th><th>项目</th><th>推荐版本</th><th>说明</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="5">后端</td><td>JDK</td><td>1.8+</td><td>运行环境</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Maven</td><td>3.6+</td><td>项目构建</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MySQL</td><td>5.7 / 8.0</td><td>元数据库</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Redis</td><td>5.0+</td><td>任务队列与缓存</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>操作系统</td><td>Linux / Windows / macOS</td><td>通用支持</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td rowspan="3">前端</td><td>Node.js</td><td>16+</td><td>构建依赖</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>pnpm / npm</td><td>最新版</td><td>包管理器</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Vite</td><td>≥4.0</td><td>构建工具</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## 🚨 商用授权
|
||||||
|
|
||||||
|
qModel 提供 **开源版** 与 **商业版** 双轨模式:
|
||||||
|
- **开源版** 适合学习、评估与轻量级生产,遵循 Apache 2.0 协议(可商用,保留 Logo);
|
||||||
|
- **商业版** 面向政企客户,提供 **自动化容器化、模型融合、工作流编排、训练闭环、模型市场** 等高阶能力,并包含专属技术支持与私有仓库访问权限。
|
||||||
|
|
||||||
|
[//]: # (👉 如需 **品牌定制授权** 或 **申请商业版试用**,请访问:[💼 了解授权详情](https://qmodel.qiantong.tech/business.html))
|
||||||
|
👉 如需 **品牌定制授权** 或 **申请商业版试用**,请加入 QQ 交流群咨询
|
||||||
|
|
||||||
|
[](https://qm.qq.com/q/Ph8rhmZBQY)
|
||||||
|
|
||||||
|
## 🚀 快速开始
|
||||||
|
|
||||||
|
[//]: # (👉 <a href="https://qmodel.qiantong.tech/discuss.html">点击查看快速部署手册</a>)
|
||||||
|
👉 <a href="./QUICKSTART.md">点击查看快速部署手册</a>
|
||||||
|
|
||||||
|
## 👥 QQ交流群
|
||||||
|
|
||||||
|
欢迎加入 qModel 官方 QQ 交流群,获取最新动态、技术答疑与使用经验分享!
|
||||||
|
|
||||||
|
[](https://qm.qq.com/q/Ph8rhmZBQY)
|
||||||
|
|
||||||
|
[//]: # (👉 <a href="https://qmodel.qiantong.tech/discuss.html">点击加入 QQ 交流群</a>)
|
||||||
|
|
||||||
|
## 🖼️ 系统配图
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="登录页" src=".gitee/system/login.png"/></td>
|
||||||
|
<td><img alt="工作台" src=".gitee/system/workbench.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="模型分类" src=".gitee/system/modelCategory.png"/></td>
|
||||||
|
<td><img alt="模型输入" src=".gitee/system/input.png"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><img alt="模型列表" src=".gitee/system/modelList.png"/></td>
|
||||||
|
<td><img alt="计算任务" src=".gitee/system/taskList.png"/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package tech.qiantong.qmodel.server.project;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一键修改包名
|
||||||
|
* * @author anivia
|
||||||
|
*/
|
||||||
|
public class ProjectRenamer {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
|
// 输入修改前的工程路径
|
||||||
|
System.out.print("请输入修改前的工程路径: ");
|
||||||
|
String originalDirectory = scanner.nextLine();
|
||||||
|
|
||||||
|
// 输入修改后的工程路径
|
||||||
|
System.out.print("请输入修改后的工程路径: ");
|
||||||
|
String newDirectory = scanner.nextLine();
|
||||||
|
|
||||||
|
// 输入修改前的工程名称
|
||||||
|
System.out.print("请输入修改前的工程名称: ");
|
||||||
|
String oldProjectName = scanner.nextLine().toLowerCase();
|
||||||
|
|
||||||
|
// 输入修改后的工程名称
|
||||||
|
System.out.print("请输入修改后的工程名称: ");
|
||||||
|
String newProjectName = scanner.nextLine().toLowerCase();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 创建新的功能目录
|
||||||
|
File newDir = new File(newDirectory);
|
||||||
|
if (!newDir.exists()) {
|
||||||
|
newDir.mkdirs(); // 创建新目录
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制原工程内容到新目录并重命名
|
||||||
|
copyAndRename(new File(originalDirectory), newDir, oldProjectName, newProjectName);
|
||||||
|
// 替换文件内容中的原工程名称
|
||||||
|
replaceInFiles(newDir, oldProjectName, newProjectName);
|
||||||
|
|
||||||
|
System.out.println("工程已成功从 " + originalDirectory + " 修改为 " + newDirectory);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void copyAndRename(File srcDir, File destDir, String oldName, String newName) throws IOException {
|
||||||
|
if (srcDir.isDirectory()) {
|
||||||
|
for (File file : srcDir.listFiles()) {
|
||||||
|
File newFile = new File(destDir, file.getName().replace(oldName, newName));
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
newFile.mkdirs();
|
||||||
|
copyAndRename(file, newFile, oldName, newName);
|
||||||
|
} else {
|
||||||
|
Files.copy(file.toPath(), newFile.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void replaceInFiles(File dir, String oldString, String newString) throws IOException {
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
if (files != null) {
|
||||||
|
for (File file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
replaceInFiles(file, oldString, newString);
|
||||||
|
} else {
|
||||||
|
Path path = Paths.get(file.getPath());
|
||||||
|
String content = new String(Files.readAllBytes(path));
|
||||||
|
// 替换包路径和工程名称
|
||||||
|
content = content.replace(oldString, newString);
|
||||||
|
Files.write(path, content.getBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# ProjectRenamer 使用说明
|
||||||
|
|
||||||
|
## 功能概述
|
||||||
|
`ProjectRenamer` 是一个 Java 程序,用于根据用户输入修改工程名称及包路径,并将修改后的文件结构输出到指定的新路径。程序会保持文件结构的一致性,并替换文件中的原工程名称。
|
||||||
|
|
||||||
|
## 使用说明
|
||||||
|
|
||||||
|
0. **前提工作**:
|
||||||
|
- 拷贝一份 Anivia-Plus 并且只保留后端代码
|
||||||
|
- Anivia-Plus 名称重命名为 Anivia
|
||||||
|
- 创建新工程目录如:Surge
|
||||||
|
|
||||||
|
1. **编译和运行**
|
||||||
|
|
||||||
|
2. **输入信息**
|
||||||
|
按照提示输入以下信息:
|
||||||
|
- **修改前的工程路径**:C:\Users\Ming\Desktop\Anivia
|
||||||
|
- **修改后的工程路径**:C:\Users\Ming\Desktop\Surge
|
||||||
|
- **修改前的工程名称**:Anivia(代码中将转为小写)。
|
||||||
|
- **修改后的工程名称**:Surge(代码中将转为小写)。
|
||||||
|
|
||||||
|
3. **执行过程**
|
||||||
|
- 程序会复制原工程内容到新路径,并重命名相关目录和文件。
|
||||||
|
- 所有文件中的原工程名称和包路径将被替换为新的名称。
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- **备份**:在运行程序之前,请确保对原工程进行备份,以防数据丢失或意外修改。
|
||||||
|
- **路径有效性**:确保输入的修改前工程路径存在且有效。
|
||||||
|
- **权限**:确保你对目标路径有写入权限,否则程序可能无法创建新目录或文件。
|
||||||
|
- **文件内容**:程序会扫描所有文件并进行替换,请确认文件中内容的准确性,特别是对于代码中的包路径。
|
||||||
|
- **环境要求**:需要安装 JDK 并设置好环境变量,确保能够使用 `javac` 和 `java` 命令。
|
||||||
|
|
||||||
|
## 联系方式
|
||||||
|
如有问题,请联系开发者以获取支持。
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
!/bin/sh
|
||||||
|
#filename: restart.sh
|
||||||
|
|
||||||
|
echo "stoping ..."
|
||||||
|
pid=`jps -l | grep 'qModel-server*' | awk '{print $1}'`
|
||||||
|
if [ ! $pid ]; then
|
||||||
|
echo "no such service."
|
||||||
|
else
|
||||||
|
echo "find service. pid=$pid"
|
||||||
|
kill -9 $pid
|
||||||
|
echo "stop success."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "starting ..."
|
||||||
|
nohup java -Xms256m -Xmx1024m -server -jar -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=prod qModel-server.jar >>/dev/null &
|
||||||
|
|
||||||
|
# nohup java -Xms64m -Xmx128m -jar -Djava.security.egd=file:/dev/./urandom anivia-server.jar >>/dev/null &
|
||||||
|
pid=`jps -l | grep 'qModel-server*' | awk '{print $1}'`
|
||||||
|
echo "start success. pid=$pid"
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# ==================================== qModel 以及相关中间件 ====================================
|
||||||
|
QMODEL_HUB=crpi-kf13onfj0v8f6jax.cn-shanghai.personal.cr.aliyuncs.com/qiantongkeji
|
||||||
|
QMODEL_VERSION=1.0.1
|
||||||
|
|
||||||
|
# 数据库类型,可选值:dm8 或 mysql
|
||||||
|
DB_TYPE=dm8
|
||||||
|
|
||||||
|
# 数据库
|
||||||
|
CASE_SENSITIVE=0
|
||||||
|
INSTANCE_NAME=QMODEL_DEV
|
||||||
|
|
||||||
|
# admin 密码
|
||||||
|
SYSDBA_PWD=o5KjnPYxswsiURZHCPwd
|
||||||
|
SYSAUDITOR_PWD=o5KjnPYxswsiURZHCPwd
|
||||||
|
|
||||||
|
# 表空间名称、密码
|
||||||
|
QMODEL_USER=QMODEL_DEV
|
||||||
|
QMODEL_PWD=s2LKr6LMQxVDTQx
|
||||||
|
|
||||||
|
# redis
|
||||||
|
REDIS_PASSWORD='J98%FHF#9h@e88h9fre9'
|
||||||
|
EXPOSE_REDIS_PORT=6379
|
||||||
|
|
||||||
|
# nginx
|
||||||
|
EXPOSE_NGINX_PORT=80
|
||||||
|
NGINX_PORT=80
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# ==================================== qModel 以及相关中间件 ====================================
|
||||||
|
QMODEL_HUB=crpi-kf13onfj0v8f6jax.cn-shanghai.personal.cr.aliyuncs.com/qiantongkeji
|
||||||
|
QMODEL_VERSION=1.0.1
|
||||||
|
|
||||||
|
# 数据库类型,可选值:dm8 或 mysql
|
||||||
|
DB_TYPE=dm8
|
||||||
|
|
||||||
|
# 数据库
|
||||||
|
CASE_SENSITIVE=0
|
||||||
|
INSTANCE_NAME=QMODEL
|
||||||
|
|
||||||
|
# admin 密码
|
||||||
|
SYSDBA_PWD=o5KjnPYxswsiURZHCPwd
|
||||||
|
SYSAUDITOR_PWD=o5KjnPYxswsiURZHCPwd
|
||||||
|
|
||||||
|
# 表空间名称、密码
|
||||||
|
QMODEL_USER=QMODEL
|
||||||
|
QMODEL_PWD=s2LKr6LMQxVDTQx
|
||||||
|
|
||||||
|
# redis
|
||||||
|
REDIS_PASSWORD='J98%FHF#9h@e88h9fre9'
|
||||||
|
EXPOSE_REDIS_PORT=6379
|
||||||
|
|
||||||
|
# nginx
|
||||||
|
EXPOSE_NGINX_PORT=80
|
||||||
|
NGINX_PORT=80
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DM_PATH=/home/dmdba/dmdbms
|
||||||
|
DM_DATA_DIR=/home/dmdba/data/DAMENG
|
||||||
|
|
||||||
|
INIT_SQL=/home/dmdba/initdata/init-qmodel.sql
|
||||||
|
FIRST_RUN_FLAG=/var/run/qmodel_init.done
|
||||||
|
PORT=${PORT_NUM:-5236}
|
||||||
|
|
||||||
|
# ---------- 检查是否已经初始化 ----------
|
||||||
|
check_is_init() {
|
||||||
|
if [ -d "${DM_DATA_DIR}" ]; then
|
||||||
|
DATABASE_ALREADY_EXISTS=true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- 初始化数据库 ----------
|
||||||
|
db_init() {
|
||||||
|
echo "[dm8] init db ..."
|
||||||
|
mkdir -p "${DM_DATA_DIR}"
|
||||||
|
chown -R dmdba "${DM_DATA_DIR}"
|
||||||
|
cd "${DM_PATH}/bin"
|
||||||
|
|
||||||
|
# 初始化参数,参考你原来的需求
|
||||||
|
INIT_ARGS="PATH=/home/dmdba/data DB_NAME=DAMENG PORT_NUM=${PORT} PAGE_SIZE=16 CHARSET=1 LENGTH_IN_CHAR=1 CASE_SENSITIVE=${CASE_SENSITIVE:-0}"
|
||||||
|
|
||||||
|
if [ -n "${SYSDBA_PWD}" ]; then
|
||||||
|
INIT_ARGS="${INIT_ARGS} SYSDBA_PWD=${SYSDBA_PWD}"
|
||||||
|
fi
|
||||||
|
if [ -n "${SYSAUDITOR_PWD}" ]; then
|
||||||
|
INIT_ARGS="${INIT_ARGS} SYSAUDITOR_PWD=${SYSAUDITOR_PWD}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[dm8] dminit ${INIT_ARGS}"
|
||||||
|
gosu dmdba "${DM_PATH}/bin/dminit" ${INIT_ARGS}
|
||||||
|
echo "[dm8] db init done."
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- 等待 dmserver TCP 端口可用(参考老版本逻辑) ----------
|
||||||
|
wait_dm_ready() {
|
||||||
|
echo "[dm8] wait dmserver tcp on 127.0.0.1:${PORT} ..."
|
||||||
|
|
||||||
|
i=0
|
||||||
|
max=6000 # 最多等 6000 秒
|
||||||
|
|
||||||
|
while [ $i -lt $max ]; do
|
||||||
|
# 使用 /dev/tcp 检测端口是否可连
|
||||||
|
if (echo >"/dev/tcp/127.0.0.1/${PORT}") >/dev/null 2>&1; then
|
||||||
|
echo "[dm8] dmserver tcp ready."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[dm8] WARN: dmserver tcp not ready after ${max}s, continue anyway."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- 首次启动时导入 init-qmodel.sql ----------
|
||||||
|
run_init_sql_once() {
|
||||||
|
# 已经执行过了就直接跳过
|
||||||
|
if [ -f "${FIRST_RUN_FLAG}" ]; then
|
||||||
|
echo "[dm8] qModel init already done, skip."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 没有 SQL 文件就不导入,避免每次都尝试
|
||||||
|
if [ ! -f "${INIT_SQL}" ]; then
|
||||||
|
echo "[dm8] ${INIT_SQL} not found, skip qModel init."
|
||||||
|
mkdir -p "$(dirname "${FIRST_RUN_FLAG}")"
|
||||||
|
touch "${FIRST_RUN_FLAG}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 必要环境变量没配也跳过
|
||||||
|
if [ -z "${QMODEL_USER}" ] || [ -z "${QMODEL_PWD}" ] || [ -z "${SYSDBA_PWD}" ]; then
|
||||||
|
echo "[dm8] QMODEL_USER / QMODEL_PWD / SYSDBA_PWD not set, skip qModel init."
|
||||||
|
mkdir -p "$(dirname "${FIRST_RUN_FLAG}")"
|
||||||
|
touch "${FIRST_RUN_FLAG}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 仅用 TCP 端口检测等待服务就绪
|
||||||
|
wait_dm_ready
|
||||||
|
|
||||||
|
echo "[dm8] start create business user and import init-qmodel.sql ..."
|
||||||
|
|
||||||
|
# 为了防止“用户已存在”等导致整个容器退出,这里临时关掉 set -e
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# 1) SYSDBA 创建业务用户并授权
|
||||||
|
gosu dmdba "${DM_PATH}/bin/disql" "SYSDBA/${SYSDBA_PWD}@127.0.0.1:${PORT}" <<EOF
|
||||||
|
create user "${QMODEL_USER}" identified by "${QMODEL_PWD}" hash with SHA512 salt;
|
||||||
|
grant "PUBLIC","SOI","DBA" to "${QMODEL_USER}";
|
||||||
|
commit;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 2) 业务用户执行初始化脚本
|
||||||
|
gosu dmdba "${DM_PATH}/bin/disql" "${QMODEL_USER}/${QMODEL_PWD}@127.0.0.1:${PORT}" <<EOF
|
||||||
|
set define off;
|
||||||
|
set CHAR_CODE UTF8;
|
||||||
|
\`${INIT_SQL}
|
||||||
|
set define on;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 恢复 set -e
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "${FIRST_RUN_FLAG}")"
|
||||||
|
touch "${FIRST_RUN_FLAG}"
|
||||||
|
echo "[dm8] qModel init finished."
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------- 主流程 ----------
|
||||||
|
|
||||||
|
check_is_init
|
||||||
|
if [ -z "${DATABASE_ALREADY_EXISTS}" ]; then
|
||||||
|
db_init
|
||||||
|
else
|
||||||
|
echo "[dm8] db already exists, skip dminit."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装服务(修复你原脚本里的那一处 `DmAPService}` 的 bug)
|
||||||
|
if [ ! -f "${DM_PATH}/bin/DmAPService" ]; then
|
||||||
|
"${DM_PATH}/script/root/dm_service_installer.sh" -s "${DM_PATH}/bin/DmAPService"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${DM_PATH}/bin/DmServiceDMSERVER" ]; then
|
||||||
|
"${DM_PATH}/script/root/dm_service_installer.sh" -t dmserver -p "DMSERVER" -dm_ini "${DM_DATA_DIR}/dm.ini"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 启动服务
|
||||||
|
gosu dmdba "${DM_PATH}/bin/DmAPService" start
|
||||||
|
gosu dmdba "${DM_PATH}/bin/DmServiceDMSERVER" start
|
||||||
|
|
||||||
|
# 首次导入任务放到后台,不阻塞主进程
|
||||||
|
run_init_sql_once &
|
||||||
|
|
||||||
|
# 保持容器前台进程:沿用原脚本 tail 日志
|
||||||
|
exec gosu dmdba tail -f /home/dmdba/dmdbms/log/DmServiceDMSERVER.log
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DB_PATH=${DB_PATH:-"/home/dmdba/data"}
|
||||||
|
INSTANCE_NAME=${INSTANCE_NAME:-"DMSERVER"}
|
||||||
|
DB_NAME=${DB_NAME:-"DAMENG"}
|
||||||
|
DMDB_INSTALL_PATH=${DMDB_INSTALL_PATH:-"/home/dmdba/dmdb"}
|
||||||
|
INIT_PARAMS=""
|
||||||
|
PORT_NUM=${PORT_NUM:-"5236"}
|
||||||
|
TIME_ZONE=${TIME_ZONE:-"+08:00"}
|
||||||
|
BUFFER=${BUFFER:-"8000"}
|
||||||
|
PAGE_CHECK=${PAGE_CHECK:-"3"}
|
||||||
|
PAGE_SIZE=${PAGE_SIZE:-"8"}
|
||||||
|
LOG_SIZE=${LOG_SIZE:-"4096"}
|
||||||
|
EXTENT_SIZE=${EXTENT_SIZE:-"16"}
|
||||||
|
CHARSET=${CHARSET:-"0"}
|
||||||
|
USE_DB_NAME=${USE_DB_NAME:-"1"}
|
||||||
|
AUTO_OVERWRITE=${AUTO_OVERWRITE:-"0"}
|
||||||
|
BLANK_PAD_MODE=${BLANK_PAD_MODE:-"0"}
|
||||||
|
DPC_MODE=${DPC_MODE:-"0"}
|
||||||
|
CASE_SENSITIVE=${CASE_SENSITIVE:-"y"}
|
||||||
|
|
||||||
|
OTHER_PARAMS=${OTHER_PARAMS:-""}
|
||||||
|
|
||||||
|
SYSDBA_PWD=${SYSDBA_PWD:-""}
|
||||||
|
SYSAUDITOR_PWD=${SYSAUDITOR_PWD:-""}
|
||||||
|
|
||||||
|
# ===== 新增:一次性执行标记 & 日志路径 =====
|
||||||
|
FIRST_RUN_FLAG="/var/run/dm8_first_run.done" # 首次执行标记
|
||||||
|
INIT_LOG="/init.log" # 初始化日志文件
|
||||||
|
|
||||||
|
function init_db() {
|
||||||
|
if [ -z "$SYSDBA_PWD" ]; then
|
||||||
|
echo "SYSDBA_PWD is empty, please set it in environment variables"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$SYSAUDITOR_PWD" ]; then
|
||||||
|
echo "SYSAUDITOR_PWD is empty, please set it in environment variables"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# 判断DB_PATH文件夹内是否存在文件
|
||||||
|
if [ -d "$DB_PATH" ]; then
|
||||||
|
if [ "$(ls -A $DB_PATH)" ]; then
|
||||||
|
echo "DB_PATH is not empty, please check it"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "DB_PATH is not exist, create it"
|
||||||
|
mkdir -p $DB_PATH
|
||||||
|
chown -R dmdba $DB_PATH
|
||||||
|
fi
|
||||||
|
INIT_PARAMS="$INIT_PARAMS PATH=$DB_PATH SYSDBA_PWD=$SYSDBA_PWD SYSAUDITOR_PWD=$SYSAUDITOR_PWD INSTANCE_NAME=$INSTANCE_NAME"
|
||||||
|
INIT_PARAMS="$INIT_PARAMS PORT_NUM=$PORT_NUM DB_NAME=$DB_NAME TIME_ZONE=$TIME_ZONE BUFFER=$BUFFER PAGE_CHECK=$PAGE_CHECK PAGE_SIZE=$PAGE_SIZE"
|
||||||
|
INIT_PARAMS="$INIT_PARAMS LOG_SIZE=$LOG_SIZE EXTENT_SIZE=$EXTENT_SIZE CHARSET=$CHARSET USE_DB_NAME=$USE_DB_NAME"
|
||||||
|
INIT_PARAMS="$INIT_PARAMS AUTO_OVERWRITE=$AUTO_OVERWRITE BLANK_PAD_MODE=$BLANK_PAD_MODE DPC_MODE=$DPC_MODE CASE_SENSITIVE=$CASE_SENSITIVE"
|
||||||
|
INIT_PARAMS="$INIT_PARAMS $OTHER_PARAMS"
|
||||||
|
echo "Initializing database..."
|
||||||
|
echo "Initializing database with parameters:"
|
||||||
|
echo $INIT_PARAMS
|
||||||
|
sudo -u dmdba /home/dmdba/dmdb/bin/dminit $INIT_PARAMS
|
||||||
|
echo "Database initialized"
|
||||||
|
}
|
||||||
|
function start_dmap() {
|
||||||
|
echo "Starting DmAPService..."
|
||||||
|
sudo -u dmdba /home/dmdba/dmdb/bin/dmap dmap_ini=/home/dmdba/dmdb/bin/dmap.ini &
|
||||||
|
echo "DmAPService started"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 创建一个函数,用来修改文件的权限
|
||||||
|
function modify_db_permissions() {
|
||||||
|
echo "Modifying $DB_PATH permissions..."
|
||||||
|
chown -R dmdba $DB_PATH
|
||||||
|
echo "$DB_PATH permissions modified"
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_initialized() {
|
||||||
|
# 判断 $DB_PATH/$DB_NAME/dm.ini 是否存在
|
||||||
|
if [ -f "$DB_PATH/$DB_NAME/dm.ini" ]; then
|
||||||
|
echo "Database already initialized"
|
||||||
|
modify_db_permissions
|
||||||
|
else
|
||||||
|
echo "Database not initialized"
|
||||||
|
init_db
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== 新增:等待 TCP 就绪的小函数 =====
|
||||||
|
wait_tcp_ready() {
|
||||||
|
local waited=0
|
||||||
|
local timeout=600
|
||||||
|
echo "Waiting for dmserver TCP on 127.0.0.1:${PORT_NUM} ..."
|
||||||
|
# /dev/tcp 存在即可用;若镜像不支持,可改用 nc -z
|
||||||
|
while ! (echo >"/dev/tcp/127.0.0.1/${PORT_NUM}") >/dev/null 2>&1; do
|
||||||
|
sleep 2
|
||||||
|
waited=$((waited+2))
|
||||||
|
if [ $waited -ge $timeout ]; then
|
||||||
|
echo "ERROR: TCP 127.0.0.1:${PORT_NUM} not ready in ${timeout}s"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "TCP ready."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== 新增:首次执行的后台任务(按你的两段 disql 顺序)=====
|
||||||
|
post_boot_first_run() {
|
||||||
|
# 已执行过则直接退出
|
||||||
|
if [ -f "$FIRST_RUN_FLAG" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 等 TCP 就绪(服务启动完成)
|
||||||
|
if ! wait_tcp_ready; then
|
||||||
|
echo "WARN: dmserver TCP not ready; skip first-run init."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 准备日志
|
||||||
|
if [ ! -f "$INIT_LOG" ]; then
|
||||||
|
echo "init database at $(date +'%Y-%m-%d %H:%M:%S')" > "$INIT_LOG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Creating business user & grant ..." | tee -a "$INIT_LOG"
|
||||||
|
# 第一步:SYSDBA 执行建用户与授权
|
||||||
|
/home/dmdba/dmdb/bin/disql SYSDBA/${SYSDBA_PWD}@localhost:${PORT_NUM} <<EOF >> "$INIT_LOG" 2>&1
|
||||||
|
create user "${QMODEL_USER}" identified by "${QMODEL_PWD}" hash with SHA512 salt;
|
||||||
|
grant "PUBLIC","SOI","DBA" to "${QMODEL_USER}";
|
||||||
|
COMMIT;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Importing initial data ..." | tee -a "$INIT_LOG"
|
||||||
|
# 第二步:业务用户导入数据(确保 /home/dmdba/initdata/init-qmodel.sql 可读)
|
||||||
|
/home/dmdba/dmdb/bin/disql ${QMODEL_USER}/${QMODEL_PWD}@localhost:${PORT_NUM} <<EOF >> "$INIT_LOG" 2>&1
|
||||||
|
set define off;
|
||||||
|
set CHAR_CODE UTF8;
|
||||||
|
\`/home/dmdba/initdata/init-qmodel.sql
|
||||||
|
set define on;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 落标记:仅首次执行
|
||||||
|
touch "$FIRST_RUN_FLAG"
|
||||||
|
echo "First-run initialization finished." | tee -a "$INIT_LOG"
|
||||||
|
}
|
||||||
|
|
||||||
|
cd $DMDB_INSTALL_PATH/bin
|
||||||
|
# 检查DB是否初始化,如果没有初始化则执行初始化
|
||||||
|
check_initialized
|
||||||
|
|
||||||
|
# 启动 DmAPServer
|
||||||
|
start_dmap
|
||||||
|
|
||||||
|
# ===== 新增:后台启动首次执行任务(不阻塞主进程)=====
|
||||||
|
post_boot_first_run &
|
||||||
|
|
||||||
|
# 启动数据库实例(前台)
|
||||||
|
echo "Starting DmServer..."
|
||||||
|
exec sudo -u dmdba /home/dmdba/dmdb/bin/dmserver path=$DB_PATH/$DB_NAME/dm.ini
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
[mysqld]
|
||||||
|
pid-file = /var/run/mysqld/mysqld.pid
|
||||||
|
socket = /var/run/mysqld/mysqld.sock
|
||||||
|
datadir = /var/lib/mysql
|
||||||
|
#log-error = /var/log/mysql/error.log
|
||||||
|
#bind-address = 127.0.0.1
|
||||||
|
symbolic-links=0
|
||||||
|
|
||||||
|
character_set_server=utf8mb4
|
||||||
|
character_set_filesystem=utf8mb4
|
||||||
|
collation-server=utf8mb4_general_ci
|
||||||
|
init-connect='SET NAMES utf8mb4'
|
||||||
|
init_connect='SET collation_connection = utf8mb4_general_ci'
|
||||||
|
skip-character-set-client-handshake
|
||||||
|
lower_case_table_names=1
|
||||||
|
|
||||||
|
# 最大连接数
|
||||||
|
max_connections=500000
|
||||||
|
# 连接超时时间
|
||||||
|
connect_timeout=30
|
||||||
|
# 最大包大小 (16MB)
|
||||||
|
max_allowed_packet=16777216
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
version: "1.0.1"
|
||||||
|
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
privileged: true
|
||||||
|
image: redis:6-alpine
|
||||||
|
profiles: ["all","local"]
|
||||||
|
env_file: .env
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
REDISCLI_AUTH: ${REDIS_PASSWORD:-J98%FHF#9h@e88h9fre9}
|
||||||
|
# volumes:
|
||||||
|
# # Mount the redis data directory to the container.
|
||||||
|
# - ./redis/data:/data
|
||||||
|
# Set the redis password when startup redis server.
|
||||||
|
command: redis-server --requirepass ${REDIS_PASSWORD:-J98%FHF#9h@e88h9fre9}
|
||||||
|
ports:
|
||||||
|
- "${EXPOSE_REDIS_PORT:-6379}:6379"
|
||||||
|
healthcheck:
|
||||||
|
test: [ 'CMD', 'redis-cli', 'ping' ]
|
||||||
|
networks:
|
||||||
|
- qmodel_net
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
privileged: true
|
||||||
|
image: nginx:1.24.0
|
||||||
|
restart: always
|
||||||
|
profiles: [ "all" ]
|
||||||
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- '${EXPOSE_NGINX_PORT:-80}:${NGINX_PORT:-80}'
|
||||||
|
networks:
|
||||||
|
- qmodel_net
|
||||||
|
volumes:
|
||||||
|
- ./nginx/dist:/usr/share/nginx
|
||||||
|
- ./nginx/logs:/var/log/nginx
|
||||||
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
- ./nginx/sites/:/etc/nginx/http_vhost/:ro
|
||||||
|
|
||||||
|
dm8:
|
||||||
|
image: ${QMODEL_HUB}/dm8:mixed
|
||||||
|
profiles: [ "all", "schema","local" ,"qmodel-db"]
|
||||||
|
env_file: .env
|
||||||
|
privileged: true
|
||||||
|
hostname: dm8
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "35236:5236"
|
||||||
|
volumes:
|
||||||
|
- ./database/dm8/init-qmodel.sql:/home/dmdba/initdata/init-qmodel.sql
|
||||||
|
- ./database/dm8/entrypoint.sh:/entrypoint.sh
|
||||||
|
- ./database/dm8/entrypoint-arm64.sh:/usr/local/bin/docker-entrypoint.sh
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- CASE_SENSITIVE=${CASE_SENSITIVE}
|
||||||
|
- SYSDBA_PWD=${SYSDBA_PWD}
|
||||||
|
- SYSAUDITOR_PWD=${SYSAUDITOR_PWD}
|
||||||
|
- QMODEL_USER=${QMODEL_USER}
|
||||||
|
- QMODEL_PWD=${QMODEL_PWD}
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD-SHELL", "echo > /dev/tcp/127.0.0.1/5236" ]
|
||||||
|
interval: 20s # 每 20 秒检测一次
|
||||||
|
timeout: 5s # 超过 5 秒算失败
|
||||||
|
retries: 10 # 连续 10 次失败算 unhealthy
|
||||||
|
start_period: 1200s # 容忍 20 分钟内失败
|
||||||
|
networks:
|
||||||
|
- qmodel_net
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
version: "1.0.1"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# qmodel 后端服务
|
||||||
|
qmodel-api:
|
||||||
|
privileged: true
|
||||||
|
image: ${QMODEL_HUB}/qmodel-server-ce:${QMODEL_VERSION}
|
||||||
|
restart: always
|
||||||
|
profiles: [ "all" ]
|
||||||
|
env_file: .env
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
ports:
|
||||||
|
- "18888:8080"
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- ./qmodel-server/logs:/usr/app/jar/logs
|
||||||
|
- ./qmodel-server/upload:/usr/app/jar/upload
|
||||||
|
- ./qmodel-server/application-prod.yml:/usr/app/jar/application-prod.yml
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
dm8:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- qmodel_net
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
include:
|
||||||
|
- path: ./docker-compose-base.yml
|
||||||
|
- path: ./docker-compose-qmodel.yml
|
||||||
|
|
||||||
|
version: "1.0.1"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
qmodel_net:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 172.52.0.0/16
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
user root;
|
||||||
|
worker_processes 8;
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
server_tokens off;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 300;
|
||||||
|
keepalive_requests 1000;
|
||||||
|
|
||||||
|
client_header_timeout 60;
|
||||||
|
client_body_timeout 60;
|
||||||
|
|
||||||
|
proxy_buffering on;
|
||||||
|
proxy_buffer_size 4k;
|
||||||
|
proxy_buffers 8 16k;
|
||||||
|
proxy_busy_buffers_size 32k;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 1k;
|
||||||
|
gzip_buffers 4 16k;
|
||||||
|
gzip_comp_level 1;
|
||||||
|
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||||
|
gzip_vary off;
|
||||||
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
|
||||||
|
include http_vhost/*.conf;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
client_max_body_size 500M;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
proxy_connect_timeout 600s;
|
||||||
|
proxy_send_timeout 600s;
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
keepalive_timeout 600s;
|
||||||
|
send_timeout 60s;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_read_timeout 600;
|
||||||
|
charset utf-8;
|
||||||
|
root /usr/share/nginx;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /prod-api {
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE, OPTIONS';
|
||||||
|
proxy_read_timeout 6000;
|
||||||
|
rewrite ^/prod-api/(.*)$ /$1 break;
|
||||||
|
proxy_set_header X-Real-Ip $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_pass http://qmodel-api:8080;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
# 用户配置
|
||||||
|
user:
|
||||||
|
password:
|
||||||
|
# 密码最大错误次数
|
||||||
|
maxRetryCount: 5
|
||||||
|
# 密码锁定时间(默认10分钟)
|
||||||
|
lockTime: 10
|
||||||
|
#万能密码 配置为空则不生效
|
||||||
|
universalPassword: qModel23@qtt0317.
|
||||||
|
|
||||||
|
# 主数据源选择
|
||||||
|
datasource:
|
||||||
|
type: dm8
|
||||||
|
|
||||||
|
# Spring配置
|
||||||
|
spring:
|
||||||
|
# redis 配置
|
||||||
|
redis:
|
||||||
|
# 地址
|
||||||
|
host: redis
|
||||||
|
# 端口,默认为6379
|
||||||
|
port: 6379
|
||||||
|
# 数据库索引
|
||||||
|
database: 0
|
||||||
|
# 密码
|
||||||
|
password: J98%FHF#9h@e88h9fre9
|
||||||
|
# 连接超时时间
|
||||||
|
timeout: 10s
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
# 连接池中的最小空闲连接
|
||||||
|
min-idle: 0
|
||||||
|
# 连接池中的最大空闲连接
|
||||||
|
max-idle: 8
|
||||||
|
# 连接池的最大数据库连接数
|
||||||
|
max-active: 8
|
||||||
|
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||||
|
max-wait: -1ms
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
stat-view-servlet:
|
||||||
|
# 是否启用Druid的监控统计功能
|
||||||
|
enabled: false
|
||||||
|
# 访问Druid监控页面的用户名
|
||||||
|
loginUsername: qModel
|
||||||
|
# 访问Druid监控页面的密码
|
||||||
|
loginPassword: 123456
|
||||||
|
dynamic:
|
||||||
|
druid:
|
||||||
|
# 连接池初始化时创建的连接数量
|
||||||
|
initial-size: 5
|
||||||
|
# 连接池中最小空闲连接数
|
||||||
|
min-idle: 5
|
||||||
|
# 连接池中最大活动连接数
|
||||||
|
maxActive: 20
|
||||||
|
# 连接池等待连接的最长时间(毫秒)
|
||||||
|
maxWait: 60000
|
||||||
|
# 数据库连接超时时间(毫秒)
|
||||||
|
connectTimeout: 30000
|
||||||
|
# Socket超时时间(毫秒)
|
||||||
|
socketTimeout: 60000
|
||||||
|
# 空闲连接的检测周期(毫秒)
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 最小空闲连接的存活时间(毫秒)
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 用于检测连接是否有效的SQL语句
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
# 是否在空闲时检测连接的有效性
|
||||||
|
testWhileIdle: true
|
||||||
|
# 借用连接时是否测试连接的有效性
|
||||||
|
testOnBorrow: false
|
||||||
|
# 归还连接时是否测试连接的有效性
|
||||||
|
testOnReturn: false
|
||||||
|
# 是否打开连接池的PreparedStatement缓存
|
||||||
|
poolPreparedStatements: true
|
||||||
|
# 每个连接池的PreparedStatement缓存上限
|
||||||
|
maxPoolPreparedStatementPerConnectionSize: 20
|
||||||
|
# 配置Druid的过滤器
|
||||||
|
filters: stat,slf4j
|
||||||
|
# Druid连接属性配置
|
||||||
|
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||||
|
datasource:
|
||||||
|
# 主库数据源配置
|
||||||
|
master:
|
||||||
|
# 动态加载的配置属性
|
||||||
|
driver-class-name: ${${datasource.type}.driver-class-name}
|
||||||
|
url: ${${datasource.type}.url}
|
||||||
|
username: ${${datasource.type}.username}
|
||||||
|
password: ${${datasource.type}.password}
|
||||||
|
|
||||||
|
# 达梦配置文件
|
||||||
|
dm8:
|
||||||
|
# JDBC驱动类名
|
||||||
|
driver-class-name: dm.jdbc.driver.DmDriver
|
||||||
|
# 主库JDBC连接URL
|
||||||
|
url: jdbc:dm://dm8:5236/QMODEL_DEV?STU&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&schema=QMODEL_DEV&serverTimezone=Asia/Shanghai
|
||||||
|
# 主库用户名
|
||||||
|
username: QMODEL_DEV
|
||||||
|
# 主库密码
|
||||||
|
password: s2LKr6LMQxVDTQx
|
||||||
|
|
||||||
|
## 工作流模块的访问地址
|
||||||
|
flow:
|
||||||
|
enable: false
|
||||||
|
url: http://127.0.0.1:26859/
|
||||||
|
|
||||||
|
|
||||||
|
#模型
|
||||||
|
modelUrl: "http://192.168.200.206:8000"
|
||||||
|
modelUrl2: "http://192.168.200.182:8821"
|
||||||
|
|
||||||
|
model:
|
||||||
|
hydrodynamicModel: D:\model\chengxuhuizong11.5
|
||||||
|
newHydrodynamicModel: C:\Users\yuexin\Downloads\1.31exe\1.31exe
|
||||||
|
filePath: D:\nami\data\model
|
||||||
|
location: D:\nami\data\modelFile\
|
||||||
|
accessUrl: D:/nami/data/modelFile
|
||||||
|
After Width: | Height: | Size: 51 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
## 前端
|
||||||
|
建立 socket 连接,连接地址为/websocket/message/当前用户 id。
|
||||||
|
socket 可接收推送的消息数量,初始化时需主动获取消息数量。
|
||||||
|
离开时,务必关闭 socket 连接。
|
||||||
|

|
||||||
|
|
||||||
|
## 后端
|
||||||
|
使用方法:
|
||||||
|
消息模版操作:在系统管理中的消息模版进行增删改查。
|
||||||
|
消息发送:在messageService中的send方法进行发送(通过模版向某一用户发送消息)。
|
||||||
|
消息数量查询:在messageService中的getNum。
|
||||||
|
消息已读:在messageService中的read。
|
||||||
|
消息批量已读:在messageService中的readAll。
|
||||||
|
实现流程:读取指定模版生成对应的消息,添加到数据库中,添加完成后通过 websocket 通知对应的用户。
|
||||||
|
涉及数据库
|
||||||
|
message 消息通知
|
||||||
|
message_template 消息模版
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
mvn -Dmaven.test.skip=true clean package
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qModel</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
|
||||||
|
<name>qModel</name>
|
||||||
|
<url>https://qiantong.tech</url>
|
||||||
|
<description>qModel模型平台</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<anivia.version>1.0.1</anivia.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<spring-framework.version>5.3.33</spring-framework.version>
|
||||||
|
<spring-security.version>5.7.12</spring-security.version>
|
||||||
|
<druid.version>1.2.23</druid.version>
|
||||||
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
|
<swagger.version>3.0.0</swagger.version>
|
||||||
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
|
<pagehelper.boot.version>1.4.7</pagehelper.boot.version>
|
||||||
|
<fastjson.version>2.0.43</fastjson.version>
|
||||||
|
<oshi.version>6.6.1</oshi.version>
|
||||||
|
<commons.io.version>2.13.0</commons.io.version>
|
||||||
|
<poi.version>4.1.2</poi.version>
|
||||||
|
<velocity.version>2.3</velocity.version>
|
||||||
|
<jwt.version>0.9.1</jwt.version>
|
||||||
|
<!-- Docker 镜像构建配置 -->
|
||||||
|
<docker.hub>crpi-kf13onfj0v8f6jax.cn-shanghai.personal.cr.aliyuncs.com/qiantongkeji</docker.hub>
|
||||||
|
<!-- 镜像仓库名:默认使用模块名称(module name) -->
|
||||||
|
<docker.repo>${project.name}</docker.repo>
|
||||||
|
<!-- 镜像版本号:默认使用当前模块版本 -->
|
||||||
|
<docker.tag>${project.version}</docker.tag>
|
||||||
|
<!-- 是否打印构建命令(默认打印,便于调试,不执行实际构建) -->
|
||||||
|
<docker.print.skip>true</docker.print.skip>
|
||||||
|
<!-- 是否跳过镜像构建(默认跳过,避免在开发环境误构建镜像) -->
|
||||||
|
<docker.build.skip>true</docker.build.skip>
|
||||||
|
<!-- 是否跳过镜像推送(默认跳过,避免误将测试镜像推送至镜像仓库) -->
|
||||||
|
<docker.push.skip>true</docker.push.skip>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!-- 依赖声明 -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringFramework的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-framework-bom</artifactId>
|
||||||
|
<version>${spring-framework.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringSecurity的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-bom</artifactId>
|
||||||
|
<version>${spring-security.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot的依赖配置-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>2.5.15</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
<version>${bitwalker.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>${pagehelper.boot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 获取系统信息 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.oshi</groupId>
|
||||||
|
<artifactId>oshi-core</artifactId>
|
||||||
|
<version>${oshi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger3依赖 -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-boot-starter</artifactId>
|
||||||
|
<version>${swagger.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>-->
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons.io.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>${poi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- velocity代码生成使用模板 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
|
<version>${velocity.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>${jwt.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 验证码 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>pro.fessional</groupId>
|
||||||
|
<artifactId>kaptcha</artifactId>
|
||||||
|
<version>${kaptcha.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-quartz</artifactId>
|
||||||
|
<version>${anivia.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 代码生成-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-generator</artifactId>
|
||||||
|
<version>${anivia.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-framework</artifactId>
|
||||||
|
<version>${anivia.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 系统模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-module-system</artifactId>
|
||||||
|
<version>${anivia.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-common</artifactId>
|
||||||
|
<version>${anivia.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>qmodel-framework</module>
|
||||||
|
<module>qmodel-module-system</module>
|
||||||
|
<module>/qmodel-module-model</module>
|
||||||
|
|
||||||
|
<module>qmodel-server</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>aliyun-public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<name>maven central</name>
|
||||||
|
<url>https://repo1.maven.org/maven2/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#filename: publish-server.sh
|
||||||
|
# 部署Whale系统项目
|
||||||
|
|
||||||
|
targetPath="/home/qtt/src/qModel/qmodel-server/target"
|
||||||
|
# 运行目录
|
||||||
|
runPath="/home/qtt/opt/qmodel-server"
|
||||||
|
|
||||||
|
# publish
|
||||||
|
echo "Publishing qModel admin ... The installation directory is $runPath"
|
||||||
|
cd $targetPath
|
||||||
|
cp qmodel-server.jar $runPath
|
||||||
|
echo "Publish qModel success! Now you can go to the installation directory($runPath) and restart the server."
|
||||||
|
|
||||||
|
cd $runPath
|
||||||
|
sh restart.sh
|
||||||
|
|
||||||
|
tail -f logs/info.log
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
qModel Model Platform(Open Source Edition)
|
||||||
|
*
|
||||||
|
License:
|
||||||
|
Released under the Apache License, Version 2.0.
|
||||||
|
You may use, modify, and distribute this software for commercial purposes
|
||||||
|
under the terms of the License.
|
||||||
|
*
|
||||||
|
Special Notice:
|
||||||
|
All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
the default system logo and copyright information.
|
||||||
|
For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
*
|
||||||
|
More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
*
|
||||||
|
============================================================================
|
||||||
|
*
|
||||||
|
版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
qModel 模型平台(开源版)
|
||||||
|
*
|
||||||
|
许可协议:
|
||||||
|
本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
*
|
||||||
|
特别说明:
|
||||||
|
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
*
|
||||||
|
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qModel</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>qmodel-config</module>
|
||||||
|
<module>qmodel-websocket</module>
|
||||||
|
<module>qmodel-mybatis</module>
|
||||||
|
<module>qmodel-redis</module>
|
||||||
|
<module>qmodel-quartz</module>
|
||||||
|
<module>qmodel-security</module>
|
||||||
|
<module>qmodel-generator</module>
|
||||||
|
<module>qmodel-common</module>
|
||||||
|
<module>qmodel-file</module>
|
||||||
|
<module>qmodel-es</module>
|
||||||
|
<module>qmodel-pay</module>
|
||||||
|
<module>qmodel-auth</module>
|
||||||
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<artifactId>qmodel-framework</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
anivia-framework模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
qModel Model Platform(Open Source Edition)
|
||||||
|
*
|
||||||
|
License:
|
||||||
|
Released under the Apache License, Version 2.0.
|
||||||
|
You may use, modify, and distribute this software for commercial purposes
|
||||||
|
under the terms of the License.
|
||||||
|
*
|
||||||
|
Special Notice:
|
||||||
|
All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
the default system logo and copyright information.
|
||||||
|
For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
*
|
||||||
|
More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
*
|
||||||
|
============================================================================
|
||||||
|
*
|
||||||
|
版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
qModel 模型平台(开源版)
|
||||||
|
*
|
||||||
|
许可协议:
|
||||||
|
本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
*
|
||||||
|
特别说明:
|
||||||
|
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
*
|
||||||
|
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>qmodel-framework</artifactId>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>qmodel-auth</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
auth模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 核心模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-security</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<artifactId>qmodel-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Sa-Token 权限认证, 在线文档:https://sa-token.cc -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.dev33</groupId>
|
||||||
|
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||||
|
<version>1.39.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Sa-Token OAuth2.0 模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.dev33</groupId>
|
||||||
|
<artifactId>sa-token-oauth2</artifactId>
|
||||||
|
<version>1.39.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Sa-Token 整合 Redis (可选) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.dev33</groupId>
|
||||||
|
<artifactId>sa-token-redis-jackson</artifactId>
|
||||||
|
<version>1.39.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClient;
|
||||||
|
import tech.qiantong.qmodel.common.annotation.Log;
|
||||||
|
import tech.qiantong.qmodel.common.core.controller.BaseController;
|
||||||
|
import tech.qiantong.qmodel.common.core.domain.AjaxResult;
|
||||||
|
import tech.qiantong.qmodel.common.core.page.TableDataInfo;
|
||||||
|
import tech.qiantong.qmodel.common.enums.BusinessType;
|
||||||
|
import tech.qiantong.qmodel.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理Controller
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth/client")
|
||||||
|
public class AuthClientController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private IService<AuthClient> authClientService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(AuthClient authClient) {
|
||||||
|
startPage();
|
||||||
|
QueryWrapper<AuthClient> queryWrapper = new QueryWrapper<>(authClient);
|
||||||
|
List<AuthClient> list = authClientService.list(queryWrapper);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出应用管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:export')")
|
||||||
|
@Log(title = "应用管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AuthClient authClient) {
|
||||||
|
QueryWrapper<AuthClient> queryWrapper = new QueryWrapper<>(authClient);
|
||||||
|
List<AuthClient> list = authClientService.list(queryWrapper);
|
||||||
|
ExcelUtil<AuthClient> util = new ExcelUtil<>(AuthClient.class);
|
||||||
|
util.exportExcel(response, list, "应用管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用管理详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(authClientService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:add')")
|
||||||
|
@Log(title = "应用管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody AuthClient authClient) {
|
||||||
|
authClient.setCreatorId(getUserId());
|
||||||
|
authClient.setCreateBy(getNickName());
|
||||||
|
authClient.setSecretKey(IdUtil.simpleUUID());
|
||||||
|
return toAjax(authClientService.save(authClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:edit')")
|
||||||
|
@Log(title = "应用管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody AuthClient authClient) {
|
||||||
|
authClient.setUpdatorId(getUserId());
|
||||||
|
authClient.setUpdateBy(getNickName());
|
||||||
|
authClient.setUpdateTime(new Date());
|
||||||
|
return toAjax(authClientService.updateById(authClient));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:client:remove')")
|
||||||
|
@Log(title = "应用管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(authClientService.removeByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
|
||||||
|
import tech.qiantong.qmodel.common.annotation.Log;
|
||||||
|
import tech.qiantong.qmodel.common.core.controller.BaseController;
|
||||||
|
import tech.qiantong.qmodel.common.core.domain.AjaxResult;
|
||||||
|
import tech.qiantong.qmodel.common.core.page.TableDataInfo;
|
||||||
|
import tech.qiantong.qmodel.common.enums.BusinessType;
|
||||||
|
import tech.qiantong.qmodel.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用和用户关联Controller
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth/user")
|
||||||
|
public class AuthClientUserController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private IService<AuthClientUser> authClientUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询应用和用户关联列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(AuthClientUser authClientUser) {
|
||||||
|
startPage();
|
||||||
|
QueryWrapper<AuthClientUser> queryWrapper = new QueryWrapper<>(authClientUser);
|
||||||
|
List<AuthClientUser> list = authClientUserService.list(queryWrapper);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出应用和用户关联列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:export')")
|
||||||
|
@Log(title = "应用和用户关联", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, AuthClientUser authClientUser) {
|
||||||
|
QueryWrapper<AuthClientUser> queryWrapper = new QueryWrapper<>(authClientUser);
|
||||||
|
List<AuthClientUser> list = authClientUserService.list(queryWrapper);
|
||||||
|
ExcelUtil<AuthClientUser> util = new ExcelUtil<>(AuthClientUser.class);
|
||||||
|
util.exportExcel(response, list, "应用和用户关联数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用和用户关联详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:query')")
|
||||||
|
@GetMapping(value = "/{clientId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("clientId") Long clientId) {
|
||||||
|
return success(authClientUserService.getById(clientId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增应用和用户关联
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:add')")
|
||||||
|
@Log(title = "应用和用户关联", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody AuthClientUser authClientUser) {
|
||||||
|
return toAjax(authClientUserService.save(authClientUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改应用和用户关联
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:edit')")
|
||||||
|
@Log(title = "应用和用户关联", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody AuthClientUser authClientUser) {
|
||||||
|
return toAjax(authClientUserService.updateById(authClientUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除应用和用户关联
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('auth:user:remove')")
|
||||||
|
@Log(title = "应用和用户关联", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{clientIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] clientIds) {
|
||||||
|
return toAjax(authClientUserService.removeByIds(Arrays.asList(clientIds)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
//package tech.qiantong.qmodel.controller;
|
||||||
|
//
|
||||||
|
//import cn.dev33.satoken.context.SaHolder;
|
||||||
|
//import cn.dev33.satoken.oauth2.config.SaOAuth2ServerConfig;
|
||||||
|
//import cn.dev33.satoken.oauth2.processor.SaOAuth2ServerProcessor;
|
||||||
|
//import cn.dev33.satoken.oauth2.strategy.SaOAuth2Strategy;
|
||||||
|
//import cn.dev33.satoken.stp.SaLoginModel;
|
||||||
|
//import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
//import cn.dev33.satoken.util.SaResult;
|
||||||
|
//import cn.hutool.core.convert.Convert;
|
||||||
|
//import tech.qiantong.qmodel.entity.domain.core.common.SysUser;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
//import org.springframework.web.servlet.ModelAndView;
|
||||||
|
//
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.Map;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * OAuth2 Server 的 Controller
|
||||||
|
// * 负责 OAuth2 相关的认证、登录、授权操作
|
||||||
|
// *
|
||||||
|
// * @author anivia
|
||||||
|
// */
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("/oauth2")
|
||||||
|
//public class AuthOAuth2ServerController {
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ISysUserService userService;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 配置 OAuth2 认证服务
|
||||||
|
// */
|
||||||
|
// @Autowired
|
||||||
|
// public void configOAuth2Server(SaOAuth2ServerConfig oauth2Server) {
|
||||||
|
//
|
||||||
|
// // 配置登录处理
|
||||||
|
// oauth2Server.doLoginHandle = (name, pwd) -> {
|
||||||
|
// Boolean rememberMe = Convert.toBool(SaHolder.getRequest().getParam("rememberMe"));
|
||||||
|
// SysUser user = userService.findUserByNameOrPhone(name);
|
||||||
|
//
|
||||||
|
// if (user != null && user.comparePwd(pwd)) {
|
||||||
|
// SaLoginModel loginModel = new SaLoginModel()
|
||||||
|
// // 此次登录的客户端设备标识,用于在 [同账号异地登录] 时指定此次登录的设备标识
|
||||||
|
// .setDevice("PC")
|
||||||
|
// // 是否为持久 Cookie,持久 Cookie 在浏览器关闭时不会自动删除,下次打开仍然存在
|
||||||
|
// .setIsLastingCookie(rememberMe)
|
||||||
|
// .setIsWriteHeader(true);
|
||||||
|
// StpUtil.login(user.getUserId(), loginModel);
|
||||||
|
// // TODO: 缺少登录日志记录
|
||||||
|
// return SaResult.ok();
|
||||||
|
// } else {
|
||||||
|
// return SaResult.error("账号或密码错误");
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// // 配置未登录时返回的 View
|
||||||
|
// oauth2Server.notLoginView = () -> {
|
||||||
|
// return new ModelAndView("sso/index.html");
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// // 配置授权确认视图
|
||||||
|
// oauth2Server.confirmView = (clientId, scopes) -> {
|
||||||
|
// Map<String, Object> map = new HashMap<>();
|
||||||
|
// map.put("clientId", clientId);
|
||||||
|
// map.put("scope", scopes);
|
||||||
|
// return new ModelAndView("sso/confirm.html", map);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// // OAuth2 会话数据存储与访问策略
|
||||||
|
// SaOAuth2Strategy.instance.createAccessToken = (clientId, loginId, scopes) -> {
|
||||||
|
// return StpUtil.getOrCreateLoginSession(loginId);
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 处理 OAuth2 授权请求
|
||||||
|
// * 支持授权码模式和隐式模式
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * response_type 响应类型(必填项)
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * redirect_uri 用户确认后授权的重定向 URL 地址(必填项)
|
||||||
|
// * scope 请求授权范围,用空格分隔(必填项)
|
||||||
|
// * state 用于防止 CSRF 攻击的状态值,可选项,返回时会附加到重定向 URL(非必填项)
|
||||||
|
// *
|
||||||
|
// * @return 返回授权结果的视图
|
||||||
|
// */
|
||||||
|
// @RequestMapping("/authorize")
|
||||||
|
// public Object authorize() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.authorize();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 处理用户登录请求
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * name 用户名(必填项)
|
||||||
|
// * pwd 密码(必填项)
|
||||||
|
// * rememberMe 是否记住登录状态(必填项)
|
||||||
|
// *
|
||||||
|
// * @return 用户登录的结果
|
||||||
|
// */
|
||||||
|
// @PostMapping("/doLogin")
|
||||||
|
// public Object doLogin() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.doLogin();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 处理用户确认授权请求
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * scope 确认的授权范围,用空格分隔(必填项)
|
||||||
|
// * build_redirect_uri 是否重新构建重定向 URL(true/false)(非必填项)
|
||||||
|
// * response_type URL 上的 response_type 参数值(必填项)
|
||||||
|
// * redirect_uri URL 上的 redirect_uri 参数值(必填项)
|
||||||
|
// * state URL 上的 state 参数值(必填项)
|
||||||
|
// *
|
||||||
|
// * @return 用户确认授权的结果
|
||||||
|
// */
|
||||||
|
// @RequestMapping("/doConfirm")
|
||||||
|
// public Object doConfirm() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.doConfirm();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 通过 Code 获取 Access-Token 请求
|
||||||
|
// * 支持授权码模式(Code 模式)
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * grant_type 授权类型,应填写 authorization_code(必填项)
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * client_secret 应用密钥(必填项)
|
||||||
|
// * code 授权码(必填项)
|
||||||
|
// *
|
||||||
|
// * @return 返回 Token 结果
|
||||||
|
// */
|
||||||
|
// @PostMapping("/token")
|
||||||
|
// public Object token() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.token();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 使用 Refresh-Token 刷新 Access-Token 请求
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * grant_type 授权类型,应填写 refresh_token(必填项)
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * client_secret 应用密钥(必填项)
|
||||||
|
// * refresh_token 刷新的 Refresh-Token(必填项)
|
||||||
|
// *
|
||||||
|
// * @return 刷新 Token 的结果
|
||||||
|
// */
|
||||||
|
// @PostMapping("/refresh")
|
||||||
|
// public Object refresh() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.refresh();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 撤销 Access-Token 请求
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * client_secret 应用密钥(必填项)
|
||||||
|
// * access_token 要撤销的 Access-Token(必填项)
|
||||||
|
// *
|
||||||
|
// * @return 撤销 Token 的结果
|
||||||
|
// */
|
||||||
|
// @PostMapping("/revoke")
|
||||||
|
// public Object revoke() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.revoke();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 处理客户端凭证模式(Client Credentials)获取 Access-Token 请求
|
||||||
|
// *
|
||||||
|
// * 请求参数:
|
||||||
|
// * grant_type 授权类型,应填写 client_credentials(必填项)
|
||||||
|
// * client_id 应用 ID(必填项)
|
||||||
|
// * client_secret 应用密钥(必填项)
|
||||||
|
// * scope 请求的授权范围,用空格分隔(非必填项)
|
||||||
|
// *
|
||||||
|
// * @return 凭证模式获取的 Token 结果
|
||||||
|
// */
|
||||||
|
// @PostMapping("/client_token")
|
||||||
|
// public Object clientToken() {
|
||||||
|
// return SaOAuth2ServerProcessor.instance.clientToken();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import tech.qiantong.qmodel.common.annotation.Excel;
|
||||||
|
import tech.qiantong.qmodel.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理对象 auth_client
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "auth_client")
|
||||||
|
public class AuthClient extends BaseEntity {
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 应用ID */
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 应用秘钥 */
|
||||||
|
@Excel(name = "应用秘钥")
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/** 应用名称 */
|
||||||
|
@Excel(name = "应用名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 应用类型;0:Web,1:App,2:小程序 */
|
||||||
|
@Excel(name = "应用类型;0:Web,1:App,2:小程序")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/** 应用图标 */
|
||||||
|
@Excel(name = "应用图标")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/** 应用首页 */
|
||||||
|
@Excel(name = "应用首页")
|
||||||
|
private String homeUrl;
|
||||||
|
|
||||||
|
/** 同步地址 */
|
||||||
|
@Excel(name = "同步地址")
|
||||||
|
private String syncUrl;
|
||||||
|
|
||||||
|
/** 允许授权的url */
|
||||||
|
@Excel(name = "允许授权的url")
|
||||||
|
private String redirectUrl;
|
||||||
|
|
||||||
|
/** 是否公开 */
|
||||||
|
@Excel(name = "是否公开")
|
||||||
|
private Integer publicFlag;
|
||||||
|
|
||||||
|
/** 是否有效;0:无效,1:有效 */
|
||||||
|
@Excel(name = "是否有效;0:无效,1:有效")
|
||||||
|
private Integer validFlag;
|
||||||
|
|
||||||
|
/** 删除标志;1:已删除,0:未删除 */
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
/** 创建人id;创建者的sys_user_id */
|
||||||
|
@Excel(name = "创建人id;创建者的sys_user_id")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
/** 更新人id;更新者的sys_user_id */
|
||||||
|
@Excel(name = "更新人id;更新者的sys_user_id")
|
||||||
|
private Long updatorId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import tech.qiantong.qmodel.common.annotation.Excel;
|
||||||
|
import tech.qiantong.qmodel.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用和用户关联对象 auth_client_user
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "auth_client_user")
|
||||||
|
public class AuthClientUser extends BaseEntity {
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 应用ID */
|
||||||
|
@Excel(name = "应用ID")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long clientId;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** open_id */
|
||||||
|
@Excel(name = "open_id")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
public interface AuthClientMapper extends BaseMapper<AuthClient> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用和用户关联Mapper接口
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
public interface AuthClientUserMapper extends BaseMapper<AuthClientUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理Service接口
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
public interface IAuthClientService extends IService<AuthClient> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用和用户关联Service接口
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
public interface IAuthClientUserService extends IService<AuthClientUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClient;
|
||||||
|
import tech.qiantong.qmodel.auth.mapper.AuthClientMapper;
|
||||||
|
import tech.qiantong.qmodel.auth.service.IAuthClientService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理Service业务层处理
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class AuthClientServiceImpl extends ServiceImpl<AuthClientMapper,AuthClient> implements IAuthClientService {
|
||||||
|
@Resource
|
||||||
|
private AuthClientMapper authClientMapper;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
|
||||||
|
import tech.qiantong.qmodel.auth.mapper.AuthClientUserMapper;
|
||||||
|
import tech.qiantong.qmodel.auth.service.IAuthClientUserService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用和用户关联Service业务层处理
|
||||||
|
*
|
||||||
|
* @author qModel
|
||||||
|
* @date 2024-08-31
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class AuthClientUserServiceImpl extends ServiceImpl<AuthClientUserMapper,AuthClientUser> implements IAuthClientUserService {
|
||||||
|
@Resource
|
||||||
|
private AuthClientUserMapper authClientUserMapper;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.oauth2.consts.GrantType;
|
||||||
|
import cn.dev33.satoken.oauth2.data.loader.SaOAuth2DataLoader;
|
||||||
|
import cn.dev33.satoken.oauth2.data.model.loader.SaClientModel;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClient;
|
||||||
|
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
|
||||||
|
import tech.qiantong.qmodel.auth.service.IAuthClientService;
|
||||||
|
import tech.qiantong.qmodel.auth.service.IAuthClientUserService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth2.0 数据加载实现类
|
||||||
|
* 实现 SaOAuth2DataLoader 接口
|
||||||
|
* 负责提供 OAuth2.0 客户端信息及用户信息
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AuthOAuth2DataLoaderImpl implements SaOAuth2DataLoader {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAuthClientService clientService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAuthClientUserService clientUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 clientId 获取 Client 信息
|
||||||
|
*
|
||||||
|
* @param clientId 客户端ID
|
||||||
|
* @return SaClientModel 客户端模型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SaClientModel getClientModel(String clientId) {
|
||||||
|
AuthClient client = clientService.getById(Convert.toLong(clientId));
|
||||||
|
|
||||||
|
if (client != null) {
|
||||||
|
return new SaClientModel()
|
||||||
|
// 客户端ID
|
||||||
|
.setClientId(client.getId().toString())
|
||||||
|
// 客户端密钥
|
||||||
|
.setClientSecret(client.getSecretKey())
|
||||||
|
// 允许的重定向URL
|
||||||
|
.addAllowRedirectUris(client.getRedirectUrl().split(","))
|
||||||
|
// 允许的作用域
|
||||||
|
.addContractScopes("userinfo", "admin")
|
||||||
|
// 允许的授权模式
|
||||||
|
.addAllowGrantTypes(
|
||||||
|
GrantType.authorization_code,
|
||||||
|
GrantType.implicit,
|
||||||
|
GrantType.refresh_token,
|
||||||
|
GrantType.password,
|
||||||
|
GrantType.client_credentials
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 clientId 和 loginId 获取 openid
|
||||||
|
*
|
||||||
|
* @param clientId 客户端ID
|
||||||
|
* @param loginId 用户ID
|
||||||
|
* @return openid 用户唯一标识
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getOpenid(String clientId, Object loginId) {
|
||||||
|
AuthClientUser openid = clientUserService.lambdaQuery()
|
||||||
|
.eq(AuthClientUser::getClientId, Convert.toLong(clientId))
|
||||||
|
.eq(AuthClientUser::getUserId, Convert.toLong(loginId))
|
||||||
|
.one();
|
||||||
|
|
||||||
|
if (openid == null) {
|
||||||
|
openid = new AuthClientUser();
|
||||||
|
openid.setClientId(Convert.toLong(clientId));
|
||||||
|
openid.setUserId(Convert.toLong(loginId));
|
||||||
|
openid.setOpenId(IdUtil.simpleUUID());
|
||||||
|
|
||||||
|
clientUserService.save(openid);
|
||||||
|
}
|
||||||
|
return openid.getOpenId();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.auth.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.oauth2.template.SaOAuth2Template;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sa-Token OAuth2.0 整合实现 【重写框架】
|
||||||
|
* @author qModel
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AuthOAuth2TemplateImpl extends SaOAuth2Template {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(AuthOAuth2TemplateImpl.class);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
# qModel Model Platform(Open Source Edition)
|
||||||
|
# *
|
||||||
|
# License:
|
||||||
|
# Released under the Apache License, Version 2.0.
|
||||||
|
# You may use, modify, and distribute this software for commercial purposes
|
||||||
|
# under the terms of the License.
|
||||||
|
# *
|
||||||
|
# Special Notice:
|
||||||
|
# All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
# the default system logo and copyright information.
|
||||||
|
# For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
# *
|
||||||
|
# More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
# *
|
||||||
|
# ============================================================================
|
||||||
|
# *
|
||||||
|
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
# qModel 模型平台(开源版)
|
||||||
|
# *
|
||||||
|
# 许可协议:
|
||||||
|
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
# *
|
||||||
|
# 特别说明:
|
||||||
|
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
# *
|
||||||
|
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
|
||||||
|
sa-token:
|
||||||
|
# token 名称(同时也是 cookie 名称)
|
||||||
|
token-name: aniviaToken
|
||||||
|
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||||
|
timeout: 2592000
|
||||||
|
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||||
|
active-timeout: -1
|
||||||
|
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||||
|
is-share: true
|
||||||
|
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||||
|
token-style: uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: true
|
||||||
|
# oauth2服务配置
|
||||||
|
oauth2-server:
|
||||||
|
# 是否打开模式:授权码(Authorization Code)
|
||||||
|
enable-authorization-code: true
|
||||||
|
# 是否打开模式:隐藏式(Implicit)
|
||||||
|
enable-implicit: true
|
||||||
|
# 是否打开模式:密码式(Password)
|
||||||
|
enable-password: true
|
||||||
|
# 是否打开模式:凭证式(Client Credentials)
|
||||||
|
enable-client-credentials: true
|
||||||
|
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
|
||||||
|
is-new-refresh: false
|
||||||
|
# Code授权码 保存的时间(单位:秒) 默认五分钟
|
||||||
|
code-timeout: 300
|
||||||
|
# Access-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
access-token-timeout: 7200
|
||||||
|
# Refresh-Token 保存的时间(单位:秒) 默认30 天
|
||||||
|
refresh-token-timeout: 2592000
|
||||||
|
# Client-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
client-token-timeout: 7200
|
||||||
|
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
|
||||||
|
lower-client-token-timeout: -1
|
||||||
|
# 指定高级权限,多个用逗号隔开
|
||||||
|
higher-scope: admin
|
||||||
|
# 指定低级权限,多个用逗号隔开
|
||||||
|
lower-scope: userinfo
|
||||||
|
# 模式4是否返回 AccessToken 字段
|
||||||
|
mode4-return-access-token: false
|
||||||
|
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
|
||||||
|
hide-status-field: false
|
||||||
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
# qModel Model Platform(Open Source Edition)
|
||||||
|
# *
|
||||||
|
# License:
|
||||||
|
# Released under the Apache License, Version 2.0.
|
||||||
|
# You may use, modify, and distribute this software for commercial purposes
|
||||||
|
# under the terms of the License.
|
||||||
|
# *
|
||||||
|
# Special Notice:
|
||||||
|
# All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
# the default system logo and copyright information.
|
||||||
|
# For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
# *
|
||||||
|
# More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
# *
|
||||||
|
# ============================================================================
|
||||||
|
# *
|
||||||
|
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
# qModel 模型平台(开源版)
|
||||||
|
# *
|
||||||
|
# 许可协议:
|
||||||
|
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
# *
|
||||||
|
# 特别说明:
|
||||||
|
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
# *
|
||||||
|
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
|
||||||
|
sa-token:
|
||||||
|
# token 名称(同时也是 cookie 名称)
|
||||||
|
token-name: aniviaToken
|
||||||
|
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||||
|
timeout: 2592000
|
||||||
|
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||||
|
active-timeout: -1
|
||||||
|
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||||
|
is-share: true
|
||||||
|
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||||
|
token-style: uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: true
|
||||||
|
# oauth2服务配置
|
||||||
|
oauth2-server:
|
||||||
|
# 是否打开模式:授权码(Authorization Code)
|
||||||
|
enable-authorization-code: true
|
||||||
|
# 是否打开模式:隐藏式(Implicit)
|
||||||
|
enable-implicit: true
|
||||||
|
# 是否打开模式:密码式(Password)
|
||||||
|
enable-password: true
|
||||||
|
# 是否打开模式:凭证式(Client Credentials)
|
||||||
|
enable-client-credentials: true
|
||||||
|
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
|
||||||
|
is-new-refresh: false
|
||||||
|
# Code授权码 保存的时间(单位:秒) 默认五分钟
|
||||||
|
code-timeout: 300
|
||||||
|
# Access-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
access-token-timeout: 7200
|
||||||
|
# Refresh-Token 保存的时间(单位:秒) 默认30 天
|
||||||
|
refresh-token-timeout: 2592000
|
||||||
|
# Client-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
client-token-timeout: 7200
|
||||||
|
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
|
||||||
|
lower-client-token-timeout: -1
|
||||||
|
# 指定高级权限,多个用逗号隔开
|
||||||
|
higher-scope: admin
|
||||||
|
# 指定低级权限,多个用逗号隔开
|
||||||
|
lower-scope: userinfo
|
||||||
|
# 模式4是否返回 AccessToken 字段
|
||||||
|
mode4-return-access-token: false
|
||||||
|
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
|
||||||
|
hide-status-field: false
|
||||||
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
# qModel Model Platform(Open Source Edition)
|
||||||
|
# *
|
||||||
|
# License:
|
||||||
|
# Released under the Apache License, Version 2.0.
|
||||||
|
# You may use, modify, and distribute this software for commercial purposes
|
||||||
|
# under the terms of the License.
|
||||||
|
# *
|
||||||
|
# Special Notice:
|
||||||
|
# All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
# the default system logo and copyright information.
|
||||||
|
# For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
# *
|
||||||
|
# More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
# *
|
||||||
|
# ============================================================================
|
||||||
|
# *
|
||||||
|
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
# qModel 模型平台(开源版)
|
||||||
|
# *
|
||||||
|
# 许可协议:
|
||||||
|
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
# *
|
||||||
|
# 特别说明:
|
||||||
|
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
# *
|
||||||
|
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
|
||||||
|
sa-token:
|
||||||
|
# token 名称(同时也是 cookie 名称)
|
||||||
|
token-name: aniviaToken
|
||||||
|
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||||
|
timeout: 2592000
|
||||||
|
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||||
|
active-timeout: -1
|
||||||
|
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||||
|
is-share: true
|
||||||
|
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||||
|
token-style: uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: true
|
||||||
|
# oauth2服务配置
|
||||||
|
oauth2-server:
|
||||||
|
# 是否打开模式:授权码(Authorization Code)
|
||||||
|
enable-authorization-code: true
|
||||||
|
# 是否打开模式:隐藏式(Implicit)
|
||||||
|
enable-implicit: true
|
||||||
|
# 是否打开模式:密码式(Password)
|
||||||
|
enable-password: true
|
||||||
|
# 是否打开模式:凭证式(Client Credentials)
|
||||||
|
enable-client-credentials: true
|
||||||
|
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
|
||||||
|
is-new-refresh: false
|
||||||
|
# Code授权码 保存的时间(单位:秒) 默认五分钟
|
||||||
|
code-timeout: 300
|
||||||
|
# Access-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
access-token-timeout: 7200
|
||||||
|
# Refresh-Token 保存的时间(单位:秒) 默认30 天
|
||||||
|
refresh-token-timeout: 2592000
|
||||||
|
# Client-Token 保存的时间(单位:秒) 默认两个小时
|
||||||
|
client-token-timeout: 7200
|
||||||
|
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
|
||||||
|
lower-client-token-timeout: -1
|
||||||
|
# 指定高级权限,多个用逗号隔开
|
||||||
|
higher-scope: admin
|
||||||
|
# 指定低级权限,多个用逗号隔开
|
||||||
|
lower-scope: userinfo
|
||||||
|
# 模式4是否返回 AccessToken 字段
|
||||||
|
mode4-return-access-token: false
|
||||||
|
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
|
||||||
|
hide-status-field: false
|
||||||
|
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!--
|
||||||
|
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
qModel Model Platform(Open Source Edition)
|
||||||
|
*
|
||||||
|
License:
|
||||||
|
Released under the Apache License, Version 2.0.
|
||||||
|
You may use, modify, and distribute this software for commercial purposes
|
||||||
|
under the terms of the License.
|
||||||
|
*
|
||||||
|
Special Notice:
|
||||||
|
All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
the default system logo and copyright information.
|
||||||
|
For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
*
|
||||||
|
More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
*
|
||||||
|
============================================================================
|
||||||
|
*
|
||||||
|
版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
qModel 模型平台(开源版)
|
||||||
|
*
|
||||||
|
许可协议:
|
||||||
|
本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
*
|
||||||
|
特别说明:
|
||||||
|
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
*
|
||||||
|
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="tech.qiantong.auth.mapper.AuthClientMapper">
|
||||||
|
|
||||||
|
<resultMap type="AuthClient" id="AuthClientResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="secretKey" column="secret_key" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="icon" column="icon" />
|
||||||
|
<result property="homeUrl" column="home_url" />
|
||||||
|
<result property="syncUrl" column="sync_url" />
|
||||||
|
<result property="redirectUrl" column="redirect_url" />
|
||||||
|
<result property="publicFlag" column="public_flag" />
|
||||||
|
<result property="validFlag" column="valid_flag" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="creatorId" column="creator_id" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updatorId" column="updator_id" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAuthClientVo">
|
||||||
|
select id, secret_key, name, type, icon, home_url, sync_url, redirect_url, public_flag, valid_flag, del_flag, create_by, creator_id, create_time, update_by, updator_id, update_time, remark from auth_client
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAuthClientList" parameterType="AuthClient" resultMap="AuthClientResult">
|
||||||
|
<include refid="selectAuthClientVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="type != null "> and type = #{type}</if>
|
||||||
|
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
||||||
|
<if test="homeUrl != null and homeUrl != ''"> and home_url = #{homeUrl}</if>
|
||||||
|
<if test="syncUrl != null and syncUrl != ''"> and sync_url = #{syncUrl}</if>
|
||||||
|
<if test="redirectUrl != null and redirectUrl != ''"> and redirect_url = #{redirectUrl}</if>
|
||||||
|
<if test="publicFlag != null "> and public_flag = #{publicFlag}</if>
|
||||||
|
<if test="validFlag != null "> and valid_flag = #{validFlag}</if>
|
||||||
|
<if test="delFlag != null "> and del_flag = #{delFlag}</if>
|
||||||
|
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||||
|
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
|
||||||
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
|
||||||
|
<if test="updatorId != null and updatorId != ''"> and updator_id = #{updatorId}</if>
|
||||||
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||||
|
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAuthClientById" parameterType="Long" resultMap="AuthClientResult">
|
||||||
|
<include refid="selectAuthClientVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAuthClient" parameterType="AuthClient" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into auth_client
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="secretKey != null and secretKey != ''">secret_key,</if>
|
||||||
|
<if test="name != null and name != ''">name,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
|
<if test="icon != null">icon,</if>
|
||||||
|
<if test="homeUrl != null">home_url,</if>
|
||||||
|
<if test="syncUrl != null and syncUrl != ''">sync_url,</if>
|
||||||
|
<if test="redirectUrl != null and redirectUrl != ''">redirect_url,</if>
|
||||||
|
<if test="publicFlag != null">public_flag,</if>
|
||||||
|
<if test="validFlag != null">valid_flag,</if>
|
||||||
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="creatorId != null">creator_id,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updatorId != null">updator_id,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
|
||||||
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
|
<if test="icon != null">#{icon},</if>
|
||||||
|
<if test="homeUrl != null">#{homeUrl},</if>
|
||||||
|
<if test="syncUrl != null and syncUrl != ''">#{syncUrl},</if>
|
||||||
|
<if test="redirectUrl != null and redirectUrl != ''">#{redirectUrl},</if>
|
||||||
|
<if test="publicFlag != null">#{publicFlag},</if>
|
||||||
|
<if test="validFlag != null">#{validFlag},</if>
|
||||||
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="creatorId != null">#{creatorId},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updatorId != null">#{updatorId},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAuthClient" parameterType="AuthClient">
|
||||||
|
update auth_client
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
|
||||||
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
|
<if test="icon != null">icon = #{icon},</if>
|
||||||
|
<if test="homeUrl != null">home_url = #{homeUrl},</if>
|
||||||
|
<if test="syncUrl != null and syncUrl != ''">sync_url = #{syncUrl},</if>
|
||||||
|
<if test="redirectUrl != null and redirectUrl != ''">redirect_url = #{redirectUrl},</if>
|
||||||
|
<if test="publicFlag != null">public_flag = #{publicFlag},</if>
|
||||||
|
<if test="validFlag != null">valid_flag = #{validFlag},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updatorId != null">updator_id = #{updatorId},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAuthClientById" parameterType="Long">
|
||||||
|
delete from auth_client where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAuthClientByIds" parameterType="String">
|
||||||
|
delete from auth_client where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!--
|
||||||
|
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
qModel Model Platform(Open Source Edition)
|
||||||
|
*
|
||||||
|
License:
|
||||||
|
Released under the Apache License, Version 2.0.
|
||||||
|
You may use, modify, and distribute this software for commercial purposes
|
||||||
|
under the terms of the License.
|
||||||
|
*
|
||||||
|
Special Notice:
|
||||||
|
All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
the default system logo and copyright information.
|
||||||
|
For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
*
|
||||||
|
More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
*
|
||||||
|
============================================================================
|
||||||
|
*
|
||||||
|
版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
qModel 模型平台(开源版)
|
||||||
|
*
|
||||||
|
许可协议:
|
||||||
|
本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
*
|
||||||
|
特别说明:
|
||||||
|
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
*
|
||||||
|
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="tech.qiantong.auth.mapper.AuthClientUserMapper">
|
||||||
|
|
||||||
|
<resultMap type="AuthClientUser" id="AuthClientUserResult">
|
||||||
|
<result property="clientId" column="client_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="openId" column="open_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAuthClientUserVo">
|
||||||
|
select client_id, user_id, open_id from auth_client_user
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAuthClientUserList" parameterType="AuthClientUser" resultMap="AuthClientUserResult">
|
||||||
|
<include refid="selectAuthClientUserVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="clientId != null "> and client_id = #{clientId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="openId != null and openId != ''"> and open_id = #{openId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAuthClientUserByClientId" parameterType="Long" resultMap="AuthClientUserResult">
|
||||||
|
<include refid="selectAuthClientUserVo"/>
|
||||||
|
where client_id = #{clientId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAuthClientUser" parameterType="AuthClientUser">
|
||||||
|
insert into auth_client_user
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="clientId != null">client_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="openId != null and openId != ''">open_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="clientId != null">#{clientId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="openId != null and openId != ''">#{openId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAuthClientUser" parameterType="AuthClientUser">
|
||||||
|
update auth_client_user
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
||||||
|
</trim>
|
||||||
|
where client_id = #{clientId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAuthClientUserByClientId" parameterType="Long">
|
||||||
|
delete from auth_client_user where client_id = #{clientId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAuthClientUserByClientIds" parameterType="String">
|
||||||
|
delete from auth_client_user where client_id in
|
||||||
|
<foreach item="clientId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{clientId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
qModel Model Platform(Open Source Edition)
|
||||||
|
*
|
||||||
|
License:
|
||||||
|
Released under the Apache License, Version 2.0.
|
||||||
|
You may use, modify, and distribute this software for commercial purposes
|
||||||
|
under the terms of the License.
|
||||||
|
*
|
||||||
|
Special Notice:
|
||||||
|
All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
the default system logo and copyright information.
|
||||||
|
For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
*
|
||||||
|
More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
*
|
||||||
|
============================================================================
|
||||||
|
*
|
||||||
|
版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
qModel 模型平台(开源版)
|
||||||
|
*
|
||||||
|
许可协议:
|
||||||
|
本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
*
|
||||||
|
特别说明:
|
||||||
|
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
*
|
||||||
|
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>qmodel-framework</artifactId>
|
||||||
|
<groupId>tech.qiantong</groupId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>qmodel-common</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
common通用工具
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- Spring框架基本的核心工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringWeb模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- spring security 安全认证 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pagehelper 分页插件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自定义验证注解 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里JSON解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- io常用工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- excel工具 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- yml解析器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Token生成与解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jaxb -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis 缓存操作 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pool 对象池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-pool2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 解析客户端操作系统、浏览器等 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- servlet包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
|
<version>1.59</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.31</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.36</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mybatis-plus 增强CRUD -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 多数据源 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
|
<version>4.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
|
<version>7.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch</groupId>
|
||||||
|
<artifactId>elasticsearch</artifactId>
|
||||||
|
<version>7.14.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 对象转换 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||||
|
<version>1.5.5.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-jdk8</artifactId>
|
||||||
|
<version>1.5.5.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>1.5.5.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- knife4j -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>33.2.1-jre</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- OkHttps网络请求库: http://okhttps.ejlchina.com/ -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ejlchina</groupId>
|
||||||
|
<artifactId>okhttps</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匿名访问不鉴权注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Anonymous
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataScope
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 部门表的别名
|
||||||
|
*/
|
||||||
|
public String deptAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表的别名
|
||||||
|
*/
|
||||||
|
public String userAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
|
||||||
|
*/
|
||||||
|
public String permission() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import tech.qiantong.qmodel.common.enums.DataSourceType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义多数据源切换注解
|
||||||
|
*
|
||||||
|
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
public @interface DataSource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 切换数据源名称
|
||||||
|
*/
|
||||||
|
public DataSourceType value() default DataSourceType.MASTER;
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
import tech.qiantong.qmodel.common.utils.poi.ExcelHandlerAdapter;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义导出Excel数据注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface Excel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 导出时在excel中排序
|
||||||
|
*/
|
||||||
|
public int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出到Excel中的名字.
|
||||||
|
*/
|
||||||
|
public String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
public String dateFormat() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||||
|
*/
|
||||||
|
public String dictType() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
|
*/
|
||||||
|
public String readConverterExp() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分隔符,读取字符串组内容
|
||||||
|
*/
|
||||||
|
public String separator() default ",";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
|
*/
|
||||||
|
public int scale() default -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
|
*/
|
||||||
|
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的高度
|
||||||
|
*/
|
||||||
|
public double height() default 14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出时在excel中每个列的宽度
|
||||||
|
*/
|
||||||
|
public double width() default 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文字后缀,如% 90 变成90%
|
||||||
|
*/
|
||||||
|
public String suffix() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当值为空时,字段的默认值
|
||||||
|
*/
|
||||||
|
public String defaultValue() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示信息
|
||||||
|
*/
|
||||||
|
public String prompt() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置只能选择不能输入的列内容.
|
||||||
|
*/
|
||||||
|
public String[] combo() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否从字典读数据到combo,默认不读取,如读取需要设置dictType注解.
|
||||||
|
*/
|
||||||
|
public boolean comboReadDict() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
|
*/
|
||||||
|
public boolean needMerge() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
|
*/
|
||||||
|
public boolean isExport() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
|
*/
|
||||||
|
public String targetAttr() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
|
*/
|
||||||
|
public boolean isStatistics() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出类型(0数字 1字符串 2图片)
|
||||||
|
*/
|
||||||
|
public ColumnType cellType() default ColumnType.STRING;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出列头字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格背景颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出单元格字体颜色
|
||||||
|
*/
|
||||||
|
public IndexedColors color() default IndexedColors.BLACK;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出字段对齐方式
|
||||||
|
*/
|
||||||
|
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器
|
||||||
|
*/
|
||||||
|
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器参数
|
||||||
|
*/
|
||||||
|
public String[] args() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
|
*/
|
||||||
|
Type type() default Type.ALL;
|
||||||
|
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
Type(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ColumnType
|
||||||
|
{
|
||||||
|
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
ColumnType(int value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int value()
|
||||||
|
{
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel注解集
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Excels
|
||||||
|
{
|
||||||
|
public Excel[] value();
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import tech.qiantong.qmodel.common.enums.BusinessType;
|
||||||
|
import tech.qiantong.qmodel.common.enums.OperatorType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义操作日志记录注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface Log
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 模块
|
||||||
|
*/
|
||||||
|
public String title() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能
|
||||||
|
*/
|
||||||
|
public BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人类别
|
||||||
|
*/
|
||||||
|
public OperatorType operatorType() default OperatorType.MANAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存请求的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveResponseData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除指定的请求参数
|
||||||
|
*/
|
||||||
|
public String[] excludeParamNames() default {};
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import tech.qiantong.qmodel.common.constant.CacheConstants;
|
||||||
|
import tech.qiantong.qmodel.common.enums.LimitType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface RateLimiter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 限流key
|
||||||
|
*/
|
||||||
|
public String key() default CacheConstants.RATE_LIMIT_KEY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流时间,单位秒
|
||||||
|
*/
|
||||||
|
public int time() default 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流次数
|
||||||
|
*/
|
||||||
|
public int count() default 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流类型
|
||||||
|
*/
|
||||||
|
public LimitType limitType() default LimitType.DEFAULT;
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义注解防止表单重复提交
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Inherited
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface RepeatSubmit
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 间隔时间(ms),小于此时间视为重复提交
|
||||||
|
*/
|
||||||
|
public int interval() default 5000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
public String message() default "不允许重复提交,请稍候再试";
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.annotation;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import tech.qiantong.qmodel.common.config.serializer.SensitiveJsonSerializer;
|
||||||
|
import tech.qiantong.qmodel.common.enums.DesensitizedType;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据脱敏注解
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@JacksonAnnotationsInside
|
||||||
|
@JsonSerialize(using = SensitiveJsonSerializer.class)
|
||||||
|
public @interface Sensitive
|
||||||
|
{
|
||||||
|
DesensitizedType desensitizedType();
|
||||||
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||||
|
* qModel Model Platform(Open Source Edition)
|
||||||
|
* *
|
||||||
|
* License:
|
||||||
|
* Released under the Apache License, Version 2.0.
|
||||||
|
* You may use, modify, and distribute this software for commercial purposes
|
||||||
|
* under the terms of the License.
|
||||||
|
* *
|
||||||
|
* Special Notice:
|
||||||
|
* All derivative versions are strictly prohibited from modifying or removing
|
||||||
|
* the default system logo and copyright information.
|
||||||
|
* For brand customization, please apply for brand customization authorization via official channels.
|
||||||
|
* *
|
||||||
|
* More information: https://qmodel.qiantong.tech/business.html
|
||||||
|
* *
|
||||||
|
* ============================================================================
|
||||||
|
* *
|
||||||
|
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||||
|
* qModel 模型平台(开源版)
|
||||||
|
* *
|
||||||
|
* 许可协议:
|
||||||
|
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||||
|
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||||
|
* *
|
||||||
|
* 特别说明:
|
||||||
|
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||||
|
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||||
|
* *
|
||||||
|
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.qiantong.qmodel.common.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取项目相关配置
|
||||||
|
*
|
||||||
|
* @author anivia
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "qmodel")
|
||||||
|
public class AniviaConfig
|
||||||
|
{
|
||||||
|
/** 项目名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 版本 */
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/** 版权年份 */
|
||||||
|
private String copyrightYear;
|
||||||
|
|
||||||
|
/** 上传路径 */
|
||||||
|
private static String profile;
|
||||||
|
|
||||||
|
/** 获取地址开关 */
|
||||||
|
private static boolean addressEnabled;
|
||||||
|
|
||||||
|
/** 验证码类型 */
|
||||||
|
private static String captchaType;
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version)
|
||||||
|
{
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCopyrightYear()
|
||||||
|
{
|
||||||
|
return copyrightYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCopyrightYear(String copyrightYear)
|
||||||
|
{
|
||||||
|
this.copyrightYear = copyrightYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getProfile()
|
||||||
|
{
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfile(String profile)
|
||||||
|
{
|
||||||
|
AniviaConfig.profile = profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAddressEnabled()
|
||||||
|
{
|
||||||
|
return addressEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressEnabled(boolean addressEnabled)
|
||||||
|
{
|
||||||
|
AniviaConfig.addressEnabled = addressEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCaptchaType() {
|
||||||
|
return captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaType(String captchaType) {
|
||||||
|
AniviaConfig.captchaType = captchaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取导入上传路径
|
||||||
|
*/
|
||||||
|
public static String getImportPath()
|
||||||
|
{
|
||||||
|
return getProfile() + "/import";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取头像上传路径
|
||||||
|
*/
|
||||||
|
public static String getAvatarPath()
|
||||||
|
{
|
||||||
|
return getProfile() + "/avatar";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取下载路径
|
||||||
|
*/
|
||||||
|
public static String getDownloadPath()
|
||||||
|
{
|
||||||
|
return getProfile() + "/download/";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上传路径
|
||||||
|
*/
|
||||||
|
public static String getUploadPath()
|
||||||
|
{
|
||||||
|
return getProfile() + "/upload";
|
||||||
|
}
|
||||||
|
}
|
||||||