feat: 强化多视角图片一致性 + 修复下载逻辑 + 技术文档

- 新增品类专属背面/侧面描述(BACK_VIEW_HINTS/SIDE_VIEW_HINTS)
- 强化一致性前缀策略,按视角定制相机位置描述
- 更新视角映射提示词为纯摄影术语
- 修复前端下载逻辑:改用fetch直接下载当前视角图片
- HTTPS改HTTP修复外网URL访问
- 新增多视角一致性与3D视频生成技术文档
This commit is contained in:
2026-03-28 19:51:08 +08:00
parent 1d94ec114a
commit 2ef126e445
8 changed files with 942 additions and 286 deletions

View File

@@ -126,6 +126,18 @@ _VIEW_NAME_MAP = {
}
def _to_public_url(url: str) -> str:
"""将本地路径转换为外网可访问的完整 URL
第三方API如混元3D、可灵AI需要外网可访问的图片URL
本地存储路径(/uploads/xxx需要拼接域名。
"""
if url and url.startswith("/uploads/"):
base_domain = get_config_value("SITE_DOMAIN", "http://c02.wsg.plus")
return f"{base_domain}{url}"
return url
async def generate_3d_model(image_urls: list, view_names: Optional[list] = None) -> str:
"""
调用腾讯混元3D 专业版 API 将图片生成 3D 模型
@@ -146,6 +158,9 @@ async def generate_3d_model(image_urls: list, view_names: Optional[list] = None)
if not view_names:
view_names = ["效果图"] + ["未知"] * (len(image_urls) - 1)
# 将本地路径转换为外网可访问URL第三方API需要完整URL
image_urls = [_to_public_url(u) for u in image_urls]
# 选择主图(正面图优先,其次效果图,否则第一张)
main_url = None
multi_views = []

View File

@@ -108,6 +108,10 @@ async def generate_video(
logger.info(f"可灵视频生成,传入图片数量: {len(image_urls)}")
# 将本地路径转换为外网可访问URL可灵API需要完整URL
from .ai_3d_generator import _to_public_url
image_urls = [_to_public_url(u) for u in image_urls]
# 可灵最多支持 4 张参考图
if len(image_urls) > 4:
image_urls = image_urls[:4]

View File

@@ -3,8 +3,11 @@
处理设计相关的业务逻辑,支持 AI 多视角生图 + mock 降级
"""
import os
import uuid
import logging
from typing import List, Optional, Tuple
import httpx
from sqlalchemy.orm import Session
from sqlalchemy import desc
@@ -150,8 +153,26 @@ async def _generate_ai_images(
# 调用 AI 生图
# 后续视角传入 seedKolors或参考图 URLSeedream保持一致性
ref_url = first_remote_url if idx > 0 else None
# 后续视角在提示词前加一致性约束前缀(根据视角名称定制)
final_prompt = prompt_text
if idx > 0:
# 根据视角名称生成更具体的一致性前缀
view_angle_map = {
"正面图": "moving the camera to face the object directly from the front",
"侧面图": "moving the camera 90 degrees to the left side of the object",
"背面图": "moving the camera 180 degrees to see the reverse/back side of the object",
}
angle_desc = view_angle_map.get(view_name, "changing the camera angle")
consistency_prefix = (
f"Photograph the EXACT SAME jade object from the reference image, {angle_desc}. "
"The object does NOT move or change - only the camera position changes. "
"The shape, size, color, material texture, and all physical features must remain IDENTICAL. "
)
final_prompt = consistency_prefix + prompt_text
remote_url, returned_seed = await ai_generator.generate_image(
prompt_text, model, seed=shared_seed, ref_image_url=ref_url
final_prompt, model, seed=shared_seed, ref_image_url=ref_url
)
# 第一张图保存信息供后续视角复用
@@ -161,8 +182,9 @@ async def _generate_ai_images(
shared_seed = returned_seed
logger.info(f"多视角生图: seed={shared_seed}, ref_url={remote_url[:60]}...")
# 直接使用远程 URL不下载到本地节省服务器存储空间
image_url = remote_url
# 下载到本地持久化存储远程URL是临时链接会过期失效
image_url = await _download_image_to_local(remote_url, design.id, idx)
logger.info(f"视角[{view_name}] 已下载到本地: {image_url}")
# 创建 DesignImage 记录
design_image = DesignImage(
@@ -182,6 +204,34 @@ async def _generate_ai_images(
design.status = "completed"
async def _download_image_to_local(remote_url: str, design_id: int, idx: int) -> str:
"""
下载远程 AI 生成的图片到本地 uploads/designs/ 目录
第三方AI服务生成的图片URL是临时链接会过期失效必须下载到本地持久化
Returns:
本地图片 URL 路径,如 /uploads/designs/123_0_xxxx.png
"""
designs_dir = os.path.join(settings.UPLOAD_DIR, "designs")
os.makedirs(designs_dir, exist_ok=True)
filename = f"{design_id}_{idx}_{uuid.uuid4().hex[:8]}.png"
local_path = os.path.join(designs_dir, filename)
try:
async with httpx.AsyncClient(timeout=60, follow_redirects=True) as client:
resp = await client.get(remote_url)
resp.raise_for_status()
with open(local_path, "wb") as f:
f.write(resp.content)
logger.info(f"图片下载完成: {len(resp.content)} 字节 -> {local_path}")
except Exception as e:
logger.error(f"图片下载失败回退使用远程URL: {e}")
return remote_url # 下载失败时回退使用远程URL
return f"/uploads/designs/{filename}"
def _generate_mock_fallback(
db: Session,
design: Design,

View File

@@ -29,6 +29,41 @@ CATEGORY_VIEWS: Dict[str, List[str]] = {
"随形": ["效果图", "正面图", "侧面图", "背面图"],
}
# ============================================================
# 品类专属背面描述(不同品类的背面特征差异很大)
# ============================================================
BACK_VIEW_HINTS: Dict[str, str] = {
"牌子": (
"IMPORTANT: The reverse/back side of a jade pendant plaque is traditionally a smooth, flat, polished surface. "
"It may have a brief inscription or seal mark, but it must NOT have any carved figure, face, or decorative relief pattern. "
"The back is plain and minimalist. Do NOT mirror or duplicate the front carving on the back."
),
"手把件": (
"The back of this hand-held jade piece continues the same sculptural form as the front. "
"It is part of the same three-dimensional object, showing the natural continuation of the carving from the rear angle."
),
"雕刻件": (
"The back of this carved jade piece shows the rear of the same three-dimensional sculpture. "
"The carving continues around the object naturally, not a separate or different design."
),
"摆件": (
"The back of this jade display piece shows the rear of the same three-dimensional artwork. "
"The form and carving continue naturally around the object."
),
"随形": (
"The back of this free-form jade piece shows the natural stone surface from the rear. "
"The organic shape continues naturally, the back may show more of the raw jade texture."
),
}
# 品类专属侧面描述
SIDE_VIEW_HINTS: Dict[str, str] = {
"牌子": (
"The side/edge view of a jade pendant plaque shows its thin, flat profile. "
"The plaque is typically 5-10mm thick, showing the edge thickness and any subtle edge carving."
),
}
def _load_mappings(mapping_type: str) -> Dict[str, str]:
"""从数据库加载指定类型的映射字典"""
@@ -159,7 +194,13 @@ def build_prompt(
view_desc = view_map.get(view_name, "three-quarter view")
parts.append(view_desc)
# 12. 质量后缀
# 12. 品类专属视角描述(背面/侧面特征)
if view_name == "背面图" and category_name in BACK_VIEW_HINTS:
parts.append(BACK_VIEW_HINTS[category_name])
elif view_name == "侧面图" and category_name in SIDE_VIEW_HINTS:
parts.append(SIDE_VIEW_HINTS[category_name])
# 13. 质量后缀
parts.append(quality_suffix)
return ", ".join(parts)

View File

@@ -69,3 +69,14 @@ INFO: 127.0.0.1:63569 - "GET /uploads/models/506909359d6c45fe9e43108ee7765a9
INFO: 127.0.0.1:63575 - "POST /api/designs/27/generate-video?force=true HTTP/1.1" 200 OK
INFO: 127.0.0.1:63785 - "GET /uploads/videos/6ed3f33421a44876b303c7671c1597d5.mp4 HTTP/1.1" 200 OK
INFO: 127.0.0.1:63846 - "GET /uploads/videos/6ed3f33421a44876b303c7671c1597d5.mp4 HTTP/1.1" 200 OK
WARNING: StatReload detected changes in 'app/routers/designs.py'. Reloading...
INFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [64861]
👋 应用已关闭
INFO: Started server process [65045]
INFO: Waiting for application startup.
INFO: Application startup complete.
✅ 上传目录已准备: uploads
INFO: 127.0.0.1:64149 - "GET /uploads/videos/6ed3f33421a44876b303c7671c1597d5.mp4 HTTP/1.1" 304 Not Modified

View File

@@ -0,0 +1,539 @@
# 多视角图片一致性 & 3D/视频生成 技术文档
## 一、系统概述
玉宗珠宝 AI 设计系统支持根据用户选择的品类、颜色、工艺等参数,自动生成多视角设计图(效果图、正面图、侧面图、背面图),并基于这些图片进一步生成 3D 模型和 360 度旋转展示视频。
**核心挑战**AI 生图模型(如 Seedream 5.0 lite的"参考图"参数本质上是**风格参考**,而非"同一物体不同角度"的语义理解。因此需要通过多层提示词策略来约束 AI 保持多视角图片的一致性。
---
## 二、整体架构
```
用户提交设计请求
┌──────────────────────────────────────────────────────────────┐
│ design_service.py - create_design_async() │
│ │
│ 1. 获取品类视角列表prompt_builder.get_views_for_category
│ 2. 循环每个视角: │
│ ├── prompt_builder.build_prompt() → 构建英文提示词 │
│ ├── 添加一致性前缀(相机位置描述) │
│ ├── ai_generator.generate_image() → 调用AI生图API │
│ ├── 下载图片到本地持久化 │
│ └── 创建 DesignImage 记录 │
│ 3. 第一张图的 seed/URL 传给后续视角复用 │
└──────────────────────────────────────────────────────────────┘
▼ 用户手动触发
┌──────────────┐ ┌──────────────────┐
│ 生成3D模型 │ │ 生成旋转视频 │
│ ai_3d_ │ │ ai_video_ │
│ generator.py │ │ generator_ │
│ │ │ kling.py │
│ 腾讯混元3D │ │ 可灵AI多图参考 │
│ 专业版 │ │ 生视频 │
└──────────────┘ └──────────────────┘
```
---
## 三、涉及文件清单
| 文件路径 | 职责 |
|---------|------|
| `backend/app/services/design_service.py` | 设计生成主流程,多视角循环、一致性策略协调 |
| `backend/app/services/prompt_builder.py` | 提示词构建器,品类视角配置、品类专属背面/侧面描述 |
| `backend/app/services/ai_generator.py` | AI 生图服务,支持 SiliconFlow Kolors 和 Seedream 双模型 |
| `backend/app/services/ai_3d_generator.py` | 腾讯混元3D 模型生成服务多视角→3D |
| `backend/app/services/ai_video_generator_kling.py` | 可灵 AI 多图参考生视频服务 |
| `backend/app/routers/designs.py` | REST API 路由,收集多视角图片调用 3D/视频服务 |
| `backend/app/models/design_image.py` | DesignImage 数据模型 |
| `backend/app/services/config_service.py` | 配置服务AI Key 等从数据库优先读取 |
| `init_data.sql` | 数据库初始化,包含 prompt_mappings 视角映射 |
| `frontend/src/components/DesignPreview.vue` | 前端多视角展示与下载 |
---
## 四、品类视角配置
不同品类生成的视角数量和种类不同,定义在 `prompt_builder.py``CATEGORY_VIEWS` 字典中:
| 品类 | 视角列表 | 视角数 |
|------|---------|-------|
| 牌子 | 效果图、正面图、背面图 | 3 |
| 珠子 | 效果图、正面图 | 2 |
| 手把件 | 效果图、正面图、侧面图、背面图 | 4 |
| 雕刻件 | 效果图、正面图、侧面图、背面图 | 4 |
| 摆件 | 效果图、正面图、侧面图、背面图 | 4 |
| 随形 | 效果图、正面图、侧面图、背面图 | 4 |
| 手镯 | 效果图、正面图、侧面图 | 3 |
| 戒指 | 效果图、正面图、侧面图 | 3 |
| 耳钉/耳饰/手链/项链/表带 | 效果图、正面图 | 2 |
**生成顺序**:严格按列表顺序,第一张始终是"效果图"45度英雄镜头后续视角依次生成。
---
## 五、多视角图片一致性策略(四层保障)
### 第一层AI 模型级参考机制
位置:`design_service.py``_generate_ai_images()` 第 134-183 行
**两种模型的不同一致性方式:**
| 模型 | 一致性机制 | 参数 | 说明 |
|------|-----------|------|------|
| SiliconFlow Kolors | seed 复用 | `seed` | 第一张图返回的 seed 值传给后续视角,确保随机过程相同 |
| Seedream 5.0 lite | 参考图 | `ref_image_url``image: [url]` | 第一张图的远程 URL 作为风格参考传入后续视角 |
**代码流程:**
```python
shared_seed = None # Kolors 用: 第一张图的 seed
first_remote_url = None # Seedream 用: 第一张图的远程 URL
for idx, view_name in enumerate(views):
# 后续视角传入 seed 或参考图 URL
ref_url = first_remote_url if idx > 0 else None
remote_url, returned_seed = await ai_generator.generate_image(
final_prompt, model, seed=shared_seed, ref_image_url=ref_url
)
# 第一张图保存信息供后续复用
if idx == 0:
first_remote_url = remote_url
if returned_seed is not None:
shared_seed = returned_seed
```
**关键限制**Seedream 的 `image` 参数本质上是**风格参考**AI 不能直接理解为"同一个物体的不同角度",所以需要第二、三、四层提示词来补充约束。
---
### 第二层:一致性前缀(相机位置描述)
位置:`design_service.py` 第 159-172 行
从第 2 张图起idx > 0在提示词**最前面**拼接一段一致性约束前缀,按视角名称定制相机位置描述:
```python
view_angle_map = {
"正面图": "moving the camera to face the object directly from the front",
"侧面图": "moving the camera 90 degrees to the left side of the object",
"背面图": "moving the camera 180 degrees to see the reverse/back side of the object",
}
consistency_prefix = (
f"Photograph the EXACT SAME jade object from the reference image, {angle_desc}. "
"The object does NOT move or change - only the camera position changes. "
"The shape, size, color, material texture, and all physical features must remain IDENTICAL. "
)
final_prompt = consistency_prefix + prompt_text
```
**设计思路**
- 强调"EXACT SAME"和"IDENTICAL"强制 AI 保持物体一致
- 用"相机移动"的摄影术语描述视角变化,而非"生成另一张图"
- 明确"物体不动,只有相机位置改变"
---
### 第三层:品类专属视角描述
位置:`prompt_builder.py` 第 35-65 行 & 第 197-201 行
不同品类的背面特征差异极大,需要品类专属描述来避免 AI 产生错误理解。
**背面描述BACK_VIEW_HINTS**
| 品类 | 背面特征 | 核心约束 |
|------|---------|---------|
| **牌子** | 光滑平面,可能有题款,**绝对没有雕刻图案** | "Do NOT mirror or duplicate the front carving on the back" |
| **手把件** | 同一件三维雕塑的背面,自然延续 | "natural continuation of the carving from the rear angle" |
| **雕刻件** | 三维雕塑的背面,雕刻自然延续 | "not a separate or different design" |
| **摆件** | 三维陈列品的背面 | "form and carving continue naturally" |
| **随形** | 天然石料表面的背面 | "may show more of the raw jade texture" |
**侧面描述SIDE_VIEW_HINTS**
| 品类 | 侧面特征 |
|------|---------|
| **牌子** | 薄片轮廓5-10mm 厚度 |
**解决的核心问题**
牌子品类出现"双面佛"效果 —— 背面也有雕刻图案。真实的玉雕牌子背面是光滑平面。通过 `BACK_VIEW_HINTS["牌子"]` 强制约束 AI
> "The reverse/back side of a jade pendant plaque is traditionally a smooth, flat, polished surface. It may have a brief inscription or seal mark, but it must NOT have any carved figure, face, or decorative relief pattern."
**应用时机**:在 `build_prompt()` 构建提示词时,根据视角名称和品类名称自动追加:
```python
if view_name == "背面图" and category_name in BACK_VIEW_HINTS:
parts.append(BACK_VIEW_HINTS[category_name])
elif view_name == "侧面图" and category_name in SIDE_VIEW_HINTS:
parts.append(SIDE_VIEW_HINTS[category_name])
```
---
### 第四层:数据库视角映射提示词
位置:`prompt_mappings`mapping_type='view'
每个视角有标准化的英文摄影术语描述,存储在数据库中,支持后台热更新:
| 视角 | 英文描述 |
|------|---------|
| 效果图 | `three-quarter view at 45-degree angle, hero shot showing the complete jade artwork with depth and dimension, single object on pure white background` |
| 正面图 | `front view, camera positioned directly in front of the object facing it straight-on, showing only the front carved surface, single object on pure white background` |
| 侧面图 | `side view, camera positioned at exactly 90 degrees to the left of the object, showing the edge profile and thickness, single object on pure white background` |
| 背面图 | `back view, camera positioned directly behind the object at 180 degrees, showing the reverse side, single object on pure white background` |
**设计特点**
- 使用纯**摄影术语**camera positioned, facing, straight-on
- 精确的**角度度数**45°、90°、180°
- 统一的**纯白背景**要求pure white background
- 强调**单一物体**single object避免生成多个物体
---
### 四层策略的组合效果
以"牌子"品类的背面图为例,最终提示词结构:
```
[第二层:一致性前缀]
Photograph the EXACT SAME jade object from the reference image,
moving the camera 180 degrees to see the reverse/back side of the object.
The object does NOT move or change - only the camera position changes.
The shape, size, color, material texture, and all physical features must remain IDENTICAL.
[常规提示词内容]
Chinese Hetian nephrite jade pendant plaque,
natural Hetian nephrite jade with warm luster,
featuring dragon-phoenix auspicious pattern,
relief carving with raised design emerging from surface,
...
[第四层:视角映射]
back view, camera positioned directly behind the object at 180 degrees,
showing the reverse side, single object on pure white background,
[第三层:品类专属背面描述]
IMPORTANT: The reverse/back side of a jade pendant plaque is traditionally
a smooth, flat, polished surface. It may have a brief inscription or seal mark,
but it must NOT have any carved figure, face, or decorative relief pattern.
The back is plain and minimalist. Do NOT mirror or duplicate the front carving on the back.
[质量后缀]
professional jewelry product photography, studio lighting setup,
pure white background, ultra-detailed, sharp focus, 8K resolution,
photorealistic rendering, high-end commercial quality
```
加上 [第一层] Seedream API 的 `image` 参数传入第一张效果图作为风格参考。
---
## 六、3D 模型生成
### 6.1 技术方案
- **服务**腾讯混元3D 专业版Hunyuan3D Pro
- **API 认证**TC3-HMAC-SHA256 签名
- **输入**:主图 + 多视角图片
- **输出**ZIP 包(包含 GLB/OBJ/FBX/STL 多种格式)
### 6.2 多视角图片收集
位置:`designs.py``generate_3d_model()` 第 329-339 行
```python
# 收集所有多视角图片 URL 和视角名称
image_urls = []
view_names = []
if design.images:
for img in sorted(design.images, key=lambda x: x.sort_order):
if img.image_url:
image_urls.append(img.image_url)
view_names.append(img.view_name or "效果图")
```
### 6.3 视角映射
位置:`ai_3d_generator.py` 第 121-126 行
混元3D API 的 `MultiViewImages` 参数支持指定每张图的视角类型:
```python
_VIEW_NAME_MAP = {
"侧面图": "left",
"背面图": "back",
}
```
**主图选择逻辑**:正面图优先 → 效果图次之 → 否则取第一张
```python
for url, name in zip(image_urls, view_names):
if name == "正面图" and not main_url:
main_url = url # 正面图作为主图
elif name in _VIEW_NAME_MAP:
multi_views.append({ # 侧面/背面作为辅助视角
"ViewType": _VIEW_NAME_MAP[name],
"ViewImageUrl": url
})
elif not main_url:
main_url = url # 效果图或其他作为备选主图
```
### 6.4 URL 转换
位置:`ai_3d_generator.py``_to_public_url()` 第 129-138 行
第三方 API 需要外网可访问的完整 URL本地存储路径/uploads/xxx需要拼接域名
```python
def _to_public_url(url: str) -> str:
if url and url.startswith("/uploads/"):
base_domain = get_config_value("SITE_DOMAIN", "http://c02.wsg.plus")
return f"{base_domain}{url}"
return url
```
> **注意**:服务器仅支持 HTTP不支持 HTTPSHTTPS 会 ERR_CONNECTION_REFUSED
### 6.5 生成流程
```
收集多视角图片 → 转换为外网URL → 选择主图/辅助视角
→ 提交 SubmitHunyuanTo3DProJob (ImageUrl + MultiViewImages)
→ 轮询 QueryHunyuanTo3DProJob (每5秒最多120次≈10分钟)
→ 下载 ZIP 解压提取 .glb → 保存到 /uploads/models/
```
### 6.6 结果存储
3D 模型 URL 保存到**第一张 DesignImage** 的 `model_3d_url` 字段。同时保留 ZIP 包(包含 GLB/OBJ/FBX/STL供用户完整下载。
---
## 七、视频生成
### 7.1 技术方案
- **服务**:可灵 AIKling多图参考生视频
- **API 端点**`https://api-beijing.klingai.com/v1/videos/multi-image2video`
- **API 认证**JWTHS256Access Key + Secret Key 签发30 分钟有效期)
- **输入**1-4 张参考图片 + 提示词
- **输出**MP4 视频
### 7.2 多视角图片收集
位置:`designs.py``generate_video()` 第 273-280 行
```python
# 收集多视角图片 URL
image_urls = []
if design.images:
for img in sorted(design.images, key=lambda x: x.sort_order):
if img.image_url:
image_urls.append(img.image_url)
if not image_urls and design.image_url:
image_urls.append(design.image_url) # 兼容旧数据:只有 design.image_url
```
### 7.3 核心优势
可灵 AI 的多图参考生视频 API **原生支持传入 1-4 张参考图**AI 会理解为同一物体的多个角度参考,生成单品旋转展示视频。这是选择可灵 AI 的核心原因。
### 7.4 视频提示词
默认提示词(可通过数据库 `VIDEO_PROMPT` 配置覆盖):
```
精美玉雕工艺品在专业珠宝摄影棚内展示,
纯白色背景,柔和的珠宝摄影灯光,
玉石作品放在旋转展台上缓慢平稳地旋转360度
展示正面、侧面、背面全貌,
展现玉石温润的质感、细腻的雕刻纹理和通透的光泽,
电影级画质,微距细节感,平稳流畅的转台旋转
```
### 7.5 API 参数
```python
payload = {
"model_name": "kling-v1-6", # 可灵 v1.6 模型
"image_list": image_list, # [{"image": "url"}, ...]最多4张
"prompt": prompt, # 视频提示词
"mode": "pro", # 高品质模式Pro
"duration": "5", # 视频时长5秒或10秒
"aspect_ratio": "1:1", # 正方形比例
}
```
### 7.6 生成流程
```
收集多视角图片(最多4张) → 转换为外网URL → 构建image_list
→ 提交 POST /v1/videos/multi-image2video
→ 轮询 GET /v1/videos/multi-image2video/{task_id} (每5秒最多120次)
→ 下载 MP4 → 保存到 /uploads/videos/
```
### 7.7 JWT 认证细节
```python
headers = {"alg": "HS256", "typ": "JWT"}
payload = {
"iss": access_key, # 签发者 = Access Key
"exp": now + 1800, # 30 分钟过期
"nbf": now - 5, # 允许 5 秒时钟偏差
"iat": now, # 签发时间(必须包含!)
}
token = jwt.encode(payload, secret_key, algorithm="HS256", headers=headers)
```
> **踩坑记录**`headers` 中的 `typ` 和 `payload` 中的 `iat` 字段缺一不可,否则返回 401 认证失败。
---
## 八、图片持久化存储
### 8.1 问题背景
第三方 AI 服务(火山引擎 Seedream生成的图片 URL 是**临时链接**,一段时间后会过期失效(返回 NoSuchKey 错误)。
### 8.2 解决方案
生成图片后立即下载到本地 `uploads/designs/` 目录持久化存储:
```python
async def _download_image_to_local(remote_url, design_id, idx):
filename = f"{design_id}_{idx}_{uuid.uuid4().hex[:8]}.png"
local_path = os.path.join(designs_dir, filename)
# 下载远程图片
async with httpx.AsyncClient(timeout=60, follow_redirects=True) as client:
resp = await client.get(remote_url)
with open(local_path, "wb") as f:
f.write(resp.content)
return f"/uploads/designs/{filename}"
```
### 8.3 URL 格式
- **本地存储路径**`/uploads/designs/{design_id}_{idx}_{随机8位}.png`
- **外网访问 URL**`http://c02.wsg.plus/uploads/designs/{design_id}_{idx}_{随机8位}.png`
---
## 九、前端展示与下载
### 9.1 多视角切换
前端 `DesignPreview.vue` 通过 Tab 栏展示多视角图片,用户点击不同视角 Tab 切换显示。
### 9.2 图片下载
前端直接通过 `fetch()` 下载当前视角图片(不走后端 download 接口),确保下载的是当前展示的视角图片:
```typescript
const handleDownload = async () => {
const imgUrl = currentImageUrl.value // 当前视角的图片URL
const res = await fetch(imgUrl)
const blob = await res.blob()
// 创建 <a> 标签触发下载
_downloadBlob(blob, downloadFilename.value)
}
```
> **踩坑记录**:之前使用后端 `/api/designs/{id}/download` 接口,该接口只返回 `design.image_url`(第一张效果图),导致所有视角下载的都是效果图。
---
## 十、数据模型
### DesignImage 表
| 字段 | 类型 | 说明 |
|------|------|------|
| id | Integer | 主键 |
| design_id | Integer | 关联设计 ID |
| view_name | String(20) | 视角名称:效果图/正面图/侧面图/背面图 |
| image_url | String(500) | 图片 URL本地路径或远程链接 |
| model_used | String(50) | AI 模型标识seedream-5.0 / kolors |
| prompt_used | Text | 实际使用的英文提示词 |
| sort_order | Integer | 视角排序0=效果图, 1=正面图, 2=侧面图, 3=背面图) |
| model_3d_url | String(500) | 对应的 3D 模型 URL |
### Design 表(关键字段)
| 字段 | 说明 |
|------|------|
| image_url | 第一张效果图 URL兼容旧逻辑 |
| video_url | 生成的视频 URL |
| images | 关联的 DesignImage 列表 |
---
## 十一、API 接口
| 方法 | 路径 | 说明 |
|------|------|------|
| POST | `/api/designs/generate` | 创建设计AI 多视角生图 |
| GET | `/api/designs` | 分页查询设计历史 |
| GET | `/api/designs/{id}` | 设计详情(含 images 数组) |
| DELETE | `/api/designs/{id}` | 删除设计及所有图片 |
| GET | `/api/designs/{id}/download` | 下载效果图(兼容旧逻辑) |
| POST | `/api/designs/{id}/generate-video` | 生成旋转视频 |
| POST | `/api/designs/{id}/generate-3d` | 生成 3D 模型 |
---
## 十二、成本估算
| 服务 | 单价 | 说明 |
|------|------|------|
| Seedream 5.0 lite 生图 | ≈ 0.22 元/张 | 4 个视角 ≈ 0.88 元 |
| 腾讯混元3D 专业版 | 按量计费 | 单次 3D 生成 |
| 可灵 AI 视频 Pro 5s | ≈ 7 元/次 | Pro 模式5 秒时长 |
**单次完整设计成本**4视角品类≈ 0.88(生图)+ 混元3D + 7视频
---
## 十三、已知问题与踩坑记录
| 问题 | 原因 | 解决方案 |
|------|------|---------|
| 背面图出现"双面佛" | Seedream 参考图是风格参考AI 把正面图案复制到背面 | 品类专属 BACK_VIEW_HINTS + 一致性前缀 |
| 图片过期 404 (NoSuchKey) | 火山引擎临时链接过期 | 生成后立即下载到本地持久化 |
| HTTPS 连接被拒绝 | 服务器未配置 HTTPS | `_to_public_url` 使用 `http://` |
| 下载所有视角都是效果图 | 后端 download 接口只返回 image_url | 前端改用 fetch 直接下载当前视角 URL |
| 可灵 AI 401 认证失败 | JWT 缺少 typ header 和 iat 字段 | 显式传入 headers={typ:JWT} 和 iat |
| 混元3D 字段名错误 | ViewImage 应为 ViewImageUrl | 使用正确的 ViewImageUrl 字段 |
| 前端更新不生效 | 只上传了 .vue 源文件 | 前端是编译型项目,需上传编译后的 dist/ |
---
## 十四、配置项
以下配置通过数据库 `system_configs` 表管理,支持后台热更新:
| 配置键 | 说明 | 默认值 |
|-------|------|--------|
| `VOLCENGINE_API_KEY` | 火山引擎 Seedream API Key | - |
| `SILICONFLOW_API_KEY` | SiliconFlow Kolors API Key | - |
| `AI_IMAGE_MODEL` | 生图模型选择 | `flux-dev` |
| `AI_IMAGE_SIZE` | 图片尺寸 | `1024` |
| `TENCENT_SECRET_ID` | 腾讯云 SecretId混元3D | - |
| `TENCENT_SECRET_KEY` | 腾讯云 SecretKey混元3D | - |
| `KLING_ACCESS_KEY` | 可灵 AI Access Key | - |
| `KLING_SECRET_KEY` | 可灵 AI Secret Key | - |
| `SITE_DOMAIN` | 站点域名外网URL拼接 | `http://c02.wsg.plus` |
| `VIDEO_PROMPT` | 视频生成提示词 | 内置默认值 |
| `VIDEO_DURATION` | 视频时长(秒) | `5` |

View File

@@ -195,8 +195,7 @@ import { useRouter } from 'vue-router'
import { Loading, PictureFilled, ZoomIn, ZoomOut, RefreshRight, Download, User, Platform, VideoCameraFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import type { Design } from '@/stores/design'
import { getDesignDownloadUrl, generate3DModelApi, generateVideoApi } from '@/api/design'
import request from '@/api/request'
import { generate3DModelApi, generateVideoApi } from '@/api/design'
const props = defineProps<{
design: Design
@@ -384,38 +383,31 @@ const downloadFilename = computed(() => {
return `${category}${subType ? '-' + subType : ''}${viewSuffix}-${props.design.id}.png`
})
// 下载设计图
const handleDownload = () => {
// 下载设计图(直接下载当前视角的图片,而非固定第一张)
const handleDownload = async () => {
const imgUrl = currentImageUrl.value
if (!imgUrl) {
ElMessage.error('图片不存在')
return
}
// 远程 URL 直接新窗口打开(用户右键可保存)
if (imgUrl.startsWith('http')) {
window.open(imgUrl, '_blank')
return
}
// 本地文件通过 axios 携带 Token 下载
downloading.value = true
request.get(getDesignDownloadUrl(props.design.id), {
responseType: 'blob'
}).then((response: any) => {
const blob = new Blob([response], { type: 'image/png' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = downloadFilename.value
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
try {
// 远程 URL 或本地路径都通过 fetch 下载当前视角的图片
const res = await fetch(imgUrl)
if (!res.ok) throw new Error('下载失败')
const blob = await res.blob()
_downloadBlob(blob, downloadFilename.value)
ElMessage.success('下载成功')
}).catch(() => {
ElMessage.error('下载失败,请重试')
}).finally(() => {
} catch {
// 远程 URL fetch 失败时新窗口打开
if (imgUrl.startsWith('http')) {
window.open(imgUrl, '_blank')
} else {
ElMessage.error('下载失败,请重试')
}
} finally {
downloading.value = false
})
}
}
// 切换视角时重置缩放

View File

@@ -1,165 +1,22 @@
-- 玉宗 - 珠宝设计大师 数据库初始化脚本(全量数据)
-- 使用前请先创建数据库: CREATE DATABASE yssjs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 导入命令: mysql --default-character-set=utf8mb4 -u yssjs -pyssjs yssjs < init_data.sql
-- 包含全量数据users、system_configs 含真实 API Key
-- 玉宗珠宝设计系统 全量数据库初始化脚本
-- 自动生成,包含建表语句和全量数据
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ========================================
-- 清空所有表数据(保证每次导入都是全新数据)
-- ========================================
TRUNCATE TABLE `design_images`;
TRUNCATE TABLE `designs`;
TRUNCATE TABLE `prompt_mappings`;
TRUNCATE TABLE `prompt_templates`;
TRUNCATE TABLE `system_configs`;
TRUNCATE TABLE `colors`;
TRUNCATE TABLE `sub_types`;
TRUNCATE TABLE `categories`;
TRUNCATE TABLE `users`;
-- ----------------------------
-- Table: categories
-- ----------------------------
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '品类ID',
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品类名称',
`icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '品类图标',
`sort_order` int DEFAULT NULL COMMENT '排序',
`flow_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程类型full/size_color/simple',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ========================================
-- 建表: users
-- ========================================
CREATE TABLE IF NOT EXISTS `users` (
`id` BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '用户ID',
`username` VARCHAR(50) NOT NULL UNIQUE COMMENT '用户名',
`phone` VARCHAR(20) DEFAULT NULL UNIQUE COMMENT '手机号',
`hashed_password` VARCHAR(255) NOT NULL COMMENT '加密密码',
`nickname` VARCHAR(50) DEFAULT NULL COMMENT '昵称',
`avatar` VARCHAR(255) DEFAULT NULL COMMENT '头像URL',
`is_admin` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否管理员',
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';
-- ========================================
-- 数据: users
-- ========================================
INSERT INTO `users` (`id`, `username`, `phone`, `hashed_password`, `nickname`, `avatar`, `is_admin`, `created_at`, `updated_at`) VALUES (1, 'demo', NULL, '$2b$12$bHrcm45CwD0wbQVZIQxOmuZcx/B/MEbGYFTGpPawinDkDWI.jilY2', '演示用户', NULL, 1, '2026-03-27 04:20:30', '2026-03-27 04:20:30');
INSERT INTO `users` (`id`, `username`, `phone`, `hashed_password`, `nickname`, `avatar`, `is_admin`, `created_at`, `updated_at`) VALUES (2, 'test1', NULL, '$2b$12$BG5/I4CVswjNWhfdIP9kJeVqbqLEcWkRq8ioxdpwON7eitL.lSVMW', '测试用户', NULL, 0, '2026-03-27 04:21:36', '2026-03-27 04:21:36');
-- ========================================
-- 建表: categories
-- ========================================
CREATE TABLE IF NOT EXISTS `categories` (
`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '品类ID',
`name` VARCHAR(50) NOT NULL COMMENT '品类名称',
`icon` VARCHAR(255) DEFAULT NULL COMMENT '品类图标',
`sort_order` INT DEFAULT 0 COMMENT '排序',
`flow_type` VARCHAR(20) NOT NULL COMMENT '流程类型full/size_color/simple'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='品类表';
-- ========================================
-- 建表: sub_types
-- ========================================
CREATE TABLE IF NOT EXISTS `sub_types` (
`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '子类型ID',
`category_id` INT NOT NULL COMMENT '所属品类',
`name` VARCHAR(50) NOT NULL COMMENT '名称',
`description` VARCHAR(255) DEFAULT NULL COMMENT '描述',
`preview_image` VARCHAR(255) DEFAULT NULL COMMENT '预览图',
`sort_order` INT DEFAULT 0 COMMENT '排序',
CONSTRAINT `fk_sub_types_category` FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='子类型表';
-- ========================================
-- 建表: colors
-- ========================================
CREATE TABLE IF NOT EXISTS `colors` (
`id` INT AUTO_INCREMENT PRIMARY KEY COMMENT '颜色ID',
`category_id` INT NOT NULL COMMENT '适用品类',
`name` VARCHAR(50) NOT NULL COMMENT '颜色名称',
`hex_code` VARCHAR(7) NOT NULL COMMENT '色值',
`sort_order` INT DEFAULT 0 COMMENT '排序',
CONSTRAINT `fk_colors_category` FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='颜色表';
-- ========================================
-- 建表: designs
-- ========================================
CREATE TABLE IF NOT EXISTS `designs` (
`id` BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '设计ID',
`user_id` BIGINT NOT NULL COMMENT '用户ID',
`category_id` INT NOT NULL COMMENT '品类ID',
`sub_type_id` INT DEFAULT NULL COMMENT '子类型ID',
`color_id` INT DEFAULT NULL COMMENT '颜色ID',
`prompt` TEXT NOT NULL COMMENT '设计需求',
`carving_technique` VARCHAR(50) DEFAULT NULL COMMENT '雕刻工艺',
`design_style` VARCHAR(50) DEFAULT NULL COMMENT '设计风格',
`motif` VARCHAR(100) DEFAULT NULL COMMENT '题材纹样',
`size_spec` VARCHAR(100) DEFAULT NULL COMMENT '尺寸规格',
`surface_finish` VARCHAR(50) DEFAULT NULL COMMENT '表面处理',
`usage_scene` VARCHAR(50) DEFAULT NULL COMMENT '用途场景',
`image_url` TEXT DEFAULT NULL COMMENT '设计图URL',
`video_url` TEXT DEFAULT NULL COMMENT '360度展示视频URL',
`status` VARCHAR(20) DEFAULT 'generating' COMMENT '状态',
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
CONSTRAINT `fk_designs_user` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`),
CONSTRAINT `fk_designs_category` FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`),
CONSTRAINT `fk_designs_sub_type` FOREIGN KEY (`sub_type_id`) REFERENCES `sub_types`(`id`),
CONSTRAINT `fk_designs_color` FOREIGN KEY (`color_id`) REFERENCES `colors`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='设计作品表';
-- ========================================
-- 建表: design_images如不存在
-- ========================================
CREATE TABLE IF NOT EXISTS design_images (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '图片ID',
design_id BIGINT NOT NULL COMMENT '关联设计ID',
view_name VARCHAR(20) NOT NULL COMMENT '视角名称: 效果图/正面图/侧面图/背面图',
image_url TEXT DEFAULT NULL COMMENT '图片URL路径',
model_used VARCHAR(50) DEFAULT NULL COMMENT '使用的AI模型',
prompt_used TEXT DEFAULT NULL COMMENT '实际使用的英文prompt',
sort_order INT DEFAULT 0 COMMENT '排序',
model_3d_url TEXT DEFAULT NULL COMMENT '3D模型URL(.glb)',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
CONSTRAINT fk_design_images_design FOREIGN KEY (design_id) REFERENCES designs(id) ON DELETE CASCADE,
INDEX idx_design_images_design_id (design_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='AI多视角设计图';
-- ========================================
-- 建表: system_configs如不存在
-- ========================================
CREATE TABLE IF NOT EXISTS system_configs (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '配置ID',
config_key VARCHAR(100) NOT NULL UNIQUE COMMENT '配置键',
config_value TEXT COMMENT '配置值',
description VARCHAR(255) COMMENT '配置说明',
config_group VARCHAR(50) NOT NULL DEFAULT 'general' COMMENT '配置分组: ai/general',
is_secret CHAR(1) NOT NULL DEFAULT 'N' COMMENT '是否敏感信息(Y/N)',
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统配置表';
-- ========================================
-- 建表: prompt_mappings如不存在
-- ========================================
CREATE TABLE IF NOT EXISTS prompt_mappings (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT 'ID',
mapping_type VARCHAR(20) NOT NULL COMMENT '映射类型: category/color/view/carving/style/motif/finish/scene/sub_type',
cn_key VARCHAR(50) NOT NULL COMMENT '中文键',
en_value TEXT NOT NULL COMMENT '英文值',
sort_order INT DEFAULT 0 COMMENT '排序',
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY uk_type_key (mapping_type, cn_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='中英文提示词映射表';
-- ========================================
-- 建表: prompt_templates如不存在
-- ========================================
CREATE TABLE IF NOT EXISTS prompt_templates (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT 'ID',
template_key VARCHAR(50) NOT NULL UNIQUE COMMENT '模板键',
template_value TEXT NOT NULL COMMENT '模板内容',
description VARCHAR(255) COMMENT '说明',
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='提示词模板表';
-- ========================================
-- categories 数据 (12 条)
-- ========================================
INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUES (1, '牌子', NULL, 1, 'full');
INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUES (2, '珠子', NULL, 2, 'size_color');
INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUES (3, '手把件', NULL, 3, 'full');
@@ -174,81 +31,21 @@ INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUE
INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUES (12, '表带', NULL, 12, 'size_color');
INSERT INTO `categories` (`id`, `name`, `icon`, `sort_order`, `flow_type`) VALUES (13, '随形', NULL, 13, 'simple');
-- ========================================
-- sub_types 数据 (68 条)
-- ========================================
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (1, 1, '二五牌', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (2, 1, '三角牌', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (3, 1, '三五牌', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (4, 1, '四六牌', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (5, 1, '正方形', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (6, 1, '椭圆形', NULL, NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (7, 2, '4mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (8, 2, '6mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (9, 2, '8mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (10, 2, '10mm', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (11, 2, '12mm', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (12, 2, '14mm', NULL, NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (13, 2, '16mm', NULL, NULL, 7);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (14, 2, '18mm', NULL, NULL, 8);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (15, 2, '20mm', NULL, NULL, 9);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (16, 3, '山水手把件', '山水意境题材', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (17, 3, '动物手把件', '动物造型题材', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (18, 3, '瑞兽手把件', '貔貅、麒麟等瑞兽', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (19, 3, '人物手把件', '人物造型题材', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (20, 3, '花鸟手把件', '花鸟自然题材', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (21, 3, '佛像手把件', '佛教题材', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (22, 4, '山水雕刻', '山水意境雕刻', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (23, 4, '花鸟雕刻', '花鸟自然雕刻', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (24, 4, '人物雕刻', '人物造型雕刻', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (25, 4, '佛像雕刻', '佛教题材雕刻', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (26, 4, '瑞兽雕刻', '瑞兽神兽雕刻', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (27, 4, '仿古雕刻', '仿古纹饰雕刻', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (28, 5, '山水摆件', '山水意境摆件', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (29, 5, '人物摆件', '人物造型摆件', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (30, 5, '动物摆件', '动物造型摆件', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (31, 5, '佛像摆件', '佛教题材摆件', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (32, 5, '花鸟摆件', '花鸟自然摆件', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (33, 5, '器皿摆件', '香炉、花瓶等器皿', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (34, 6, '平安镯', '内平外圆,最经典的镯型', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (35, 6, '福镯', '内圆外圆,圆条造型', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (36, 6, '贵妃镯', '椭圆形,贴合手腕', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (37, 6, '美人镯', '条杆纤细,秀气典雅', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (38, 6, '方镯', '方形截面,棱角分明', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (39, 6, '雕花镯', '表面雕刻纹饰', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (40, 7, '圆形耳钉', '经典圆形造型', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (41, 7, '水滴形耳钉', '水滴形优雅造型', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (42, 7, '方形耳钉', '方形简约造型', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (43, 7, '花朵形耳钉', '花朵造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (44, 7, '心形耳钉', '心形浪漫造型', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (45, 7, '几何形耳钉', '几何抽象造型', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (46, 8, '耳环', '圆环形耳饰', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (47, 8, '耳坠', '垂坠型耳饰', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (48, 8, '耳夹', '无需耳洞的耳饰', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (49, 8, '流苏耳饰', '长款流苏造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (50, 9, '6mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (51, 9, '8mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (52, 9, '10mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (53, 9, '12mm', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (54, 9, '14mm', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (55, 10, '锁骨链', '短款锁骨链', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (56, 10, '吊坠项链', '搭配玉石吊坠', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (57, 10, '串珠项链', '玉珠串联而成', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (58, 10, '编绳项链', '编织绳搭配玉石', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (59, 10, '毛衣链', '长款毛衣链', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (60, 11, '素面戒指', '光面简约戒指', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (61, 11, '镶嵌戒指', '金属镶嵌玉石', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (62, 11, '雕花戒指', '表面雕刻纹饰', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (63, 11, '扳指', '传统扳指造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (64, 11, '指环', '环形简约指环', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (65, 12, '18mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (66, 12, '20mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (67, 12, '22mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (68, 12, '24mm', NULL, NULL, 4);
-- ----------------------------
-- Table: colors
-- ----------------------------
DROP TABLE IF EXISTS `colors`;
CREATE TABLE `colors` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '颜色ID',
`category_id` int NOT NULL COMMENT '适用品类',
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '颜色名称',
`hex_code` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '色值',
`sort_order` int DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`),
CONSTRAINT `colors_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=132 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ========================================
-- colors 数据 (121 条)
-- ========================================
INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VALUES (1, 2, '糖白', '#F5F0E8', 1);
INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VALUES (2, 2, '白玉', '#FEFEF2', 2);
INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VALUES (3, 2, '碧玉', '#2D5F2D', 3);
@@ -381,9 +178,85 @@ INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VAL
INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VALUES (130, 13, '藕粉', '#E8B4B8', 9);
INSERT INTO `colors` (`id`, `category_id`, `name`, `hex_code`, `sort_order`) VALUES (131, 13, '烟紫', '#8B7D9B', 10);
-- ========================================
-- prompt_mappings 数据 (93 条)
-- ========================================
-- ----------------------------
-- Table: design_images
-- ----------------------------
DROP TABLE IF EXISTS `design_images`;
CREATE TABLE `design_images` (
`id` bigint NOT NULL AUTO_INCREMENT,
`design_id` bigint NOT NULL,
`view_name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`image_url` text COLLATE utf8mb4_unicode_ci,
`model_used` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`prompt_used` text COLLATE utf8mb4_unicode_ci,
`sort_order` int DEFAULT '0',
`model_3d_url` text COLLATE utf8mb4_unicode_ci COMMENT '3D模型URL(.glb)',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_design_images_design_id` (`design_id`),
CONSTRAINT `fk_design_images_design` FOREIGN KEY (`design_id`) REFERENCES `designs` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (26, 24, '效果图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/021774603662634abef7db0e51ae42a75ef9551e31b2ffa297e1d_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T092814Z&X-Tos-Expires=86400&X-Tos-Signature=4c45a7e5cd9deab6608a0a088896b66ea86b978f80c22d725c5cdbdd8d48e72c&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade pendant plaque, rectangular tablet shape, square shaped plaque, pure white nephrite jade, milky translucent, warm ivory tone, featuring Pixiu mythical beast, Chinese fortune guardian creature, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 60x40x12mm, design concept: 桌子上, three-quarter view, 45-degree angle, hero shot, dramatic perspective showing depth and dimension, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 0, NULL, '2026-03-27 09:29:10');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (27, 24, '正面图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/021774603695370cd417e3a5d5f9b5e363d704a28c424928021b1_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T092844Z&X-Tos-Expires=86400&X-Tos-Signature=c6782b121c95d03ce6a06e492a5cc388232220c6b3647052e21ae7861090c1f8&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade pendant plaque, rectangular tablet shape, square shaped plaque, pure white nephrite jade, milky translucent, warm ivory tone, featuring Pixiu mythical beast, Chinese fortune guardian creature, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 60x40x12mm, design concept: 桌子上, front view, straight-on, flat lay centered, facing camera directly, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 1, NULL, '2026-03-27 09:29:10');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (28, 24, '背面图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/0217746037252401fad3a044f20103f8e4b726dec7c2fa48ca5da_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T092910Z&X-Tos-Expires=86400&X-Tos-Signature=4736a14a81377c899dd03fbbf28f2d70f4447c16368ea656517a260fc89c91f0&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade pendant plaque, rectangular tablet shape, square shaped plaque, pure white nephrite jade, milky translucent, warm ivory tone, featuring Pixiu mythical beast, Chinese fortune guardian creature, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 60x40x12mm, design concept: 桌子上, back view, rear side, showing reverse surface and texture, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 2, NULL, '2026-03-27 09:29:10');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (29, 27, '效果图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/0217746123473820b865ba46ab853a653f94346fa59dc1da3cf44_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T115254Z&X-Tos-Expires=86400&X-Tos-Signature=1d5da361de1e5113a0bb5d01840b388f0fd80f358ed559f28ceb3da5e75a3ee3&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form, celadon nephrite jade, muted sage green, natural earthy green, featuring Maitreya laughing Buddha, jovial happy Buddha figure, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 小(约60mm), design concept: 形状:原石随形,自由发挥, three-quarter view, 45-degree angle, hero shot, dramatic perspective showing depth and dimension, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 0, '/uploads/models/506909359d6c45fe9e43108ee7765a9a.glb', '2026-03-27 11:54:22');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (30, 27, '正面图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/021774612375050be847cf78a18700c7c5f1c903c2ea6d9bd058e_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T115322Z&X-Tos-Expires=86400&X-Tos-Signature=8436646d32886371fb2693a7d2a43476f2df124c0c6c821b64c1adb63649964e&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form, celadon nephrite jade, muted sage green, natural earthy green, featuring Maitreya laughing Buddha, jovial happy Buddha figure, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 小(约60mm), design concept: 形状:原石随形,自由发挥, front view, straight-on, flat lay centered, facing camera directly, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 1, NULL, '2026-03-27 11:54:22');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (31, 27, '侧面图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/02177461240230991172dea4c1343f5a1ee75fbf798a6b0d4fd26_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T115351Z&X-Tos-Expires=86400&X-Tos-Signature=3d15b4eb02c16e32b3c5ea6bf0c65966e97822edf9da84f072d0f9e54665f777&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form, celadon nephrite jade, muted sage green, natural earthy green, featuring Maitreya laughing Buddha, jovial happy Buddha figure, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 小(约60mm), design concept: 形状:原石随形,自由发挥, side profile view, 90-degree lateral angle, showing thickness and contour, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 2, NULL, '2026-03-27 11:54:22');
INSERT INTO `design_images` (`id`, `design_id`, `view_name`, `image_url`, `model_used`, `prompt_used`, `sort_order`, `model_3d_url`, `created_at`) VALUES (32, 27, '背面图', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/021774612432177ca53c98b4a9847edf4b59a94723c611efd12a3_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T115422Z&X-Tos-Expires=86400&X-Tos-Signature=0be7759a2bfc3b6b323417c29665910745a2d687996fb2d889a525c56b4c80ee&X-Tos-SignedHeaders=host', 'seedream-5.0', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form, celadon nephrite jade, muted sage green, natural earthy green, featuring Maitreya laughing Buddha, jovial happy Buddha figure, relief carving with raised design emerging from surface, classical traditional Chinese style, antique aesthetic, heritage craftsmanship, high-gloss mirror polish, reflective glossy surface, designed for daily wear, comfortable and practical, size approximately 小(约60mm), design concept: 形状:原石随形,自由发挥, back view, rear side, showing reverse surface and texture, professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', 3, NULL, '2026-03-27 11:54:22');
-- ----------------------------
-- Table: designs
-- ----------------------------
DROP TABLE IF EXISTS `designs`;
CREATE TABLE `designs` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '设计ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`category_id` int NOT NULL COMMENT '品类ID',
`sub_type_id` int DEFAULT NULL COMMENT '子类型ID',
`color_id` int DEFAULT NULL COMMENT '颜色ID',
`prompt` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设计需求',
`usage_scene` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`surface_finish` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`size_spec` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`motif` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`design_style` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`carving_technique` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`image_url` text COLLATE utf8mb4_unicode_ci,
`video_url` text COLLATE utf8mb4_unicode_ci COMMENT '360度展示视频URL',
`status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '状态',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `category_id` (`category_id`),
KEY `sub_type_id` (`sub_type_id`),
KEY `color_id` (`color_id`),
CONSTRAINT `designs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `designs_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
CONSTRAINT `designs_ibfk_3` FOREIGN KEY (`sub_type_id`) REFERENCES `sub_types` (`id`),
CONSTRAINT `designs_ibfk_4` FOREIGN KEY (`color_id`) REFERENCES `colors` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `designs` (`id`, `user_id`, `category_id`, `sub_type_id`, `color_id`, `prompt`, `usage_scene`, `surface_finish`, `size_spec`, `motif`, `design_style`, `carving_technique`, `image_url`, `video_url`, `status`, `created_at`, `updated_at`) VALUES (24, 1, 1, 5, 4, '桌子上', '日常佩戴', '高光抛光', '60x40x12mm', '貔貅', '古典传统', '浮雕', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/021774603662634abef7db0e51ae42a75ef9551e31b2ffa297e1d_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T092814Z&X-Tos-Expires=86400&X-Tos-Signature=4c45a7e5cd9deab6608a0a088896b66ea86b978f80c22d725c5cdbdd8d48e72c&X-Tos-SignedHeaders=host', NULL, 'completed', '2026-03-27 09:27:42', '2026-03-27 09:29:10');
INSERT INTO `designs` (`id`, `user_id`, `category_id`, `sub_type_id`, `color_id`, `prompt`, `usage_scene`, `surface_finish`, `size_spec`, `motif`, `design_style`, `carving_technique`, `image_url`, `video_url`, `status`, `created_at`, `updated_at`) VALUES (26, 1, 13, NULL, 124, '形状:原石随形,自由发挥', '日常佩戴', '高光抛光', '小(约60mm)', '弥勒', '古典传统', '浮雕', '/uploads/designs/26.png', NULL, 'completed', '2026-03-27 11:50:56', '2026-03-27 11:50:56');
INSERT INTO `designs` (`id`, `user_id`, `category_id`, `sub_type_id`, `color_id`, `prompt`, `usage_scene`, `surface_finish`, `size_spec`, `motif`, `design_style`, `carving_technique`, `image_url`, `video_url`, `status`, `created_at`, `updated_at`) VALUES (27, 1, 13, NULL, 124, '形状:原石随形,自由发挥', '日常佩戴', '高光抛光', '小(约60mm)', '弥勒', '古典传统', '浮雕', 'https://ark-acg-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-5-0/0217746123473820b865ba46ab853a653f94346fa59dc1da3cf44_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20260327%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20260327T115254Z&X-Tos-Expires=86400&X-Tos-Signature=1d5da361de1e5113a0bb5d01840b388f0fd80f358ed559f28ceb3da5e75a3ee3&X-Tos-SignedHeaders=host', '/uploads/videos/6ed3f33421a44876b303c7671c1597d5.mp4', 'completed', '2026-03-27 11:52:27', '2026-03-27 16:16:40');
-- ----------------------------
-- Table: prompt_mappings
-- ----------------------------
DROP TABLE IF EXISTS `prompt_mappings`;
CREATE TABLE `prompt_mappings` (
`id` bigint NOT NULL AUTO_INCREMENT,
`mapping_type` varchar(50) NOT NULL COMMENT '映射类型',
`cn_key` varchar(100) NOT NULL COMMENT '中文键',
`en_value` text NOT NULL COMMENT '英文描述',
`sort_order` int DEFAULT '0' COMMENT '排序',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_type_key` (`mapping_type`,`cn_key`)
) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='提示词映射';
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (1, 'category', '牌子', 'Chinese Hetian nephrite jade pendant plaque, rectangular tablet shape', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (2, 'category', '珠子', 'Chinese Hetian nephrite jade bead, perfectly round sphere', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (3, 'category', '手把件', 'Chinese Hetian nephrite jade hand piece (palm stone), ergonomic carved ornament for hand play', 2, '2026-03-27 07:20:55');
@@ -396,7 +269,6 @@ INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (10, 'category', '项链', 'Chinese Hetian nephrite jade necklace, elegant pendant on chain', 9, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (11, 'category', '戒指', 'Chinese Hetian nephrite jade ring, polished jade mounted on band', 10, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (12, 'category', '表带', 'Chinese Hetian nephrite jade watch strap, segmented jade links', 11, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (93, 'category', '随形', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form', 12, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (13, 'color', '白玉', 'pure white nephrite jade, milky translucent, warm ivory tone', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (14, 'color', '青白玉', 'celadon-white nephrite jade, pale greenish-white, subtle cool tone', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (15, 'color', '青玉', 'celadon nephrite jade, muted sage green, natural earthy green', 2, '2026-03-27 07:20:55');
@@ -408,10 +280,10 @@ INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (21, 'color', '藕粉', 'lotus-pink nephrite jade, soft blush pink, delicate pastel rose', 8, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (22, 'color', '烟紫', 'smoky purple nephrite jade, muted lavender grey, subtle violet', 9, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (23, 'color', '糖白', 'sugar-white nephrite jade, creamy white with light brown edges', 10, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (24, 'view', '效果图', 'three-quarter view, 45-degree angle, hero shot, dramatic perspective showing depth and dimension', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (25, 'view', '正面图', 'front view, straight-on, flat lay centered, facing camera directly', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (26, 'view', '侧面图', 'side profile view, 90-degree lateral angle, showing thickness and contour', 2, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (27, 'view', '背面图', 'back view, rear side, showing reverse surface and texture', 3, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (24, 'view', '效果图', 'three-quarter view at 45-degree angle, hero shot showing the complete jade artwork with depth and dimension, single object on pure white background', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (25, 'view', '正面图', 'front view, camera positioned directly in front of the object facing it straight-on, showing only the front carved surface, single object on pure white background', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (26, 'view', '侧面图', 'side view, camera positioned at exactly 90 degrees to the left of the object, showing the edge profile and thickness, single object on pure white background', 2, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (27, 'view', '背面图', 'back view, camera positioned directly behind the object at 180 degrees, showing the reverse side, single object on pure white background', 3, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (28, 'carving', '浮雕', 'relief carving with raised design emerging from surface', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (29, 'carving', '圆雕', 'full three-dimensional round carving, sculptural in the round', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (30, 'carving', '镂空雕', 'openwork pierced carving, intricate hollow cutout patterns', 2, '2026-03-27 07:20:55');
@@ -436,7 +308,7 @@ INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (49, 'motif', '人物', 'human figure motif, classical Chinese character portrayal', 8, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (50, 'motif', '回纹', 'Greek key fret pattern, Chinese meander geometric border', 9, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (51, 'motif', '如意', 'Ruyi scepter motif, auspicious cloud-head wish-granting symbol', 10, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (52, 'motif', '平安扣', 'Ping\'an buckle motif, smooth circular safety and peace symbol', 11, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (52, 'motif', '平安扣', 'Ping''an buckle motif, smooth circular safety and peace symbol', 11, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (53, 'finish', '高光抛光', 'high-gloss mirror polish, reflective glossy surface', 0, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (54, 'finish', '亚光/哑光', 'matte satin finish, soft non-reflective surface', 1, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (55, 'finish', '磨砂', 'frosted textured finish, fine granular surface', 2, '2026-03-27 07:20:55');
@@ -477,32 +349,164 @@ INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (90, 'sub_type', '串珠项链', 'beaded jade strand necklace', 29, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (91, 'sub_type', '编绳项链', 'braided cord necklace with jade', 30, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (92, 'sub_type', '毛衣链', 'long sweater chain necklace', 31, '2026-03-27 07:20:55');
INSERT INTO `prompt_mappings` (`id`, `mapping_type`, `cn_key`, `en_value`, `sort_order`, `updated_at`) VALUES (93, 'category', '随形', 'Chinese Hetian nephrite jade freeform sculpture, organic natural shape following the raw stone contour, artistic interpretation of the original rough jade form', 12, '2026-03-27 11:38:59');
-- ----------------------------
-- Table: prompt_templates
-- ----------------------------
DROP TABLE IF EXISTS `prompt_templates`;
CREATE TABLE `prompt_templates` (
`id` bigint NOT NULL AUTO_INCREMENT,
`template_key` varchar(100) NOT NULL COMMENT '模板键',
`template_value` text NOT NULL COMMENT '模板内容',
`description` varchar(255) DEFAULT NULL COMMENT '说明',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `template_key` (`template_key`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='提示词模板';
-- ========================================
-- prompt_templates 数据 (3 条)
-- ========================================
INSERT INTO `prompt_templates` (`id`, `template_key`, `template_value`, `description`, `updated_at`) VALUES (1, 'main_template', '{subject}, {sub_type}, {color}, {motif}, {carving}, {style}, {finish}, {scene}, {size}, {user_prompt}, {view}, {quality}', '主提示词模板 - 用变量拼接最终prompt。可用变量: {subject}品类主体, {sub_type}子类型, {color}颜色, {motif}题材, {carving}工艺, {style}风格, {finish}表面处理, {scene}用途, {size}尺寸, {user_prompt}用户描述, {view}视角, {quality}质量后缀', '2026-03-27 07:20:55');
INSERT INTO `prompt_templates` (`id`, `template_key`, `template_value`, `description`, `updated_at`) VALUES (2, 'quality_suffix', 'professional jewelry product photography, studio lighting setup, pure white background, ultra-detailed, sharp focus, 8K resolution, photorealistic rendering, high-end commercial quality', '质量后缀标签 - 附加在prompt末尾的通用质量描述', '2026-03-27 07:20:55');
INSERT INTO `prompt_templates` (`id`, `template_key`, `template_value`, `description`, `updated_at`) VALUES (3, 'default_color', 'natural Hetian nephrite jade with warm luster', '未选择颜色时的默认颜色描述', '2026-03-27 07:20:55');
-- ========================================
-- system_configs 数据 (6 条)
-- ========================================
-- ----------------------------
-- Table: sub_types
-- ----------------------------
DROP TABLE IF EXISTS `sub_types`;
CREATE TABLE `sub_types` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '子类型ID',
`category_id` int NOT NULL COMMENT '所属品类',
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '描述',
`preview_image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '预览图',
`sort_order` int DEFAULT NULL COMMENT '排序',
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`),
CONSTRAINT `sub_types_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (1, 1, '二五牌', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (2, 1, '三角牌', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (3, 1, '三五牌', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (4, 1, '四六牌', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (5, 1, '正方形', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (6, 1, '椭圆形', NULL, NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (7, 2, '4mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (8, 2, '6mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (9, 2, '8mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (10, 2, '10mm', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (11, 2, '12mm', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (12, 2, '14mm', NULL, NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (13, 2, '16mm', NULL, NULL, 7);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (14, 2, '18mm', NULL, NULL, 8);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (15, 2, '20mm', NULL, NULL, 9);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (16, 3, '山水手把件', '山水意境题材', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (17, 3, '动物手把件', '动物造型题材', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (18, 3, '瑞兽手把件', '貔貅、麒麟等瑞兽', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (19, 3, '人物手把件', '人物造型题材', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (20, 3, '花鸟手把件', '花鸟自然题材', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (21, 3, '佛像手把件', '佛教题材', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (22, 4, '山水雕刻', '山水意境雕刻', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (23, 4, '花鸟雕刻', '花鸟自然雕刻', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (24, 4, '人物雕刻', '人物造型雕刻', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (25, 4, '佛像雕刻', '佛教题材雕刻', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (26, 4, '瑞兽雕刻', '瑞兽神兽雕刻', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (27, 4, '仿古雕刻', '仿古纹饰雕刻', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (28, 5, '山水摆件', '山水意境摆件', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (29, 5, '人物摆件', '人物造型摆件', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (30, 5, '动物摆件', '动物造型摆件', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (31, 5, '佛像摆件', '佛教题材摆件', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (32, 5, '花鸟摆件', '花鸟自然摆件', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (33, 5, '器皿摆件', '香炉、花瓶等器皿', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (34, 6, '平安镯', '内平外圆,最经典的镯型', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (35, 6, '福镯', '内圆外圆,圆条造型', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (36, 6, '贵妃镯', '椭圆形,贴合手腕', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (37, 6, '美人镯', '条杆纤细,秀气典雅', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (38, 6, '方镯', '方形截面,棱角分明', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (39, 6, '雕花镯', '表面雕刻纹饰', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (40, 7, '圆形耳钉', '经典圆形造型', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (41, 7, '水滴形耳钉', '水滴形优雅造型', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (42, 7, '方形耳钉', '方形简约造型', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (43, 7, '花朵形耳钉', '花朵造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (44, 7, '心形耳钉', '心形浪漫造型', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (45, 7, '几何形耳钉', '几何抽象造型', NULL, 6);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (46, 8, '耳环', '圆环形耳饰', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (47, 8, '耳坠', '垂坠型耳饰', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (48, 8, '耳夹', '无需耳洞的耳饰', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (49, 8, '流苏耳饰', '长款流苏造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (50, 9, '6mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (51, 9, '8mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (52, 9, '10mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (53, 9, '12mm', NULL, NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (54, 9, '14mm', NULL, NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (55, 10, '锁骨链', '短款锁骨链', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (56, 10, '吊坠项链', '搭配玉石吊坠', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (57, 10, '串珠项链', '玉珠串联而成', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (58, 10, '编绳项链', '编织绳搭配玉石', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (59, 10, '毛衣链', '长款毛衣链', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (60, 11, '素面戒指', '光面简约戒指', NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (61, 11, '镶嵌戒指', '金属镶嵌玉石', NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (62, 11, '雕花戒指', '表面雕刻纹饰', NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (63, 11, '扳指', '传统扳指造型', NULL, 4);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (64, 11, '指环', '环形简约指环', NULL, 5);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (65, 12, '18mm', NULL, NULL, 1);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (66, 12, '20mm', NULL, NULL, 2);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (67, 12, '22mm', NULL, NULL, 3);
INSERT INTO `sub_types` (`id`, `category_id`, `name`, `description`, `preview_image`, `sort_order`) VALUES (68, 12, '24mm', NULL, NULL, 4);
-- ----------------------------
-- Table: system_configs
-- ----------------------------
DROP TABLE IF EXISTS `system_configs`;
CREATE TABLE `system_configs` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '配置ID',
`config_key` varchar(100) NOT NULL COMMENT '配置键',
`config_value` text COMMENT '配置值',
`description` varchar(255) DEFAULT NULL COMMENT '配置说明',
`config_group` varchar(50) NOT NULL DEFAULT 'general' COMMENT '配置分组',
`is_secret` char(1) NOT NULL DEFAULT 'N' COMMENT '是否敏感信息(Y/N)',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `config_key` (`config_key`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统配置表';
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (1, 'SILICONFLOW_API_KEY', 'sk-gvszgchguyhhpevafchnimpljasvtuxxuoxeilhiqzlhyvpq', 'SiliconFlow API Key', 'ai', 'Y', '2026-03-27 07:43:07');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (2, 'SILICONFLOW_BASE_URL', 'https://api.siliconflow.cn/v1', 'SiliconFlow 接口地址', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (3, 'VOLCENGINE_API_KEY', '8598f9a9-0d0b-4963-b116-d7ef5b230e04', '火山引擎 API Key', 'ai', 'Y', '2026-03-27 08:13:23');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (4, 'VOLCENGINE_BASE_URL', 'https://ark.cn-beijing.volces.com/api/v3', '火山引擎接口地址', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (5, 'AI_IMAGE_MODEL', 'seedream-5.0', '默认AI生图模型 (flux-dev / seedream-4.5)', 'ai', 'N', '2026-03-27 08:20:02');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (6, 'AI_IMAGE_SIZE', '1024', 'AI生图默认尺寸', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (7, 'TENCENT_SECRET_ID', '', ' SecretId (3D模型生成)', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (13, 'TENCENT_SECRET_KEY', '', ' SecretKey (3D模型生成)', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (8, 'VOLC_ACCESS_KEY', '', ' Access Key ()', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (9, 'VOLC_SECRET_KEY', '', ' Secret Key ()', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (10, 'VIDEO_PROMPT', '360', ' ( 3.0 Pro )', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (11, 'MODEL3D_PROMPT', '', '3D模型生成默认提示词 (3D备用)', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (12, 'VIDEO_FRAMES', '121', ': 49=2, 121=5', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (7, 'TRIPO_API_KEY', '', 'Tripo3D API Key (用于图生3D模型)', 'ai', 'Y', '2026-03-27 12:20:57');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (8, 'VOLC_ACCESS_KEY', 'AKLTOGI4NTIxNTJkZGUzNGUwMmJjMTdmYTcwOTE4ZDE0MDg', '火山引擎 Access Key (用于即梦视频生成)', 'ai', 'Y', '2026-03-27 12:53:19');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (9, 'VOLC_SECRET_KEY', 'TlRJMFpEZG1OMk0wWW1aak5ERTRNamcxT1dKbU5UazNPR00yWXpGbE1tSQ==', '火山引擎 Secret Key (用于即梦视频生成)', 'ai', 'Y', '2026-03-27 12:53:19');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (10, 'VIDEO_PROMPT', '玉雕作品在摄影棚内缓慢旋转360度展示全貌专业珠宝摄影灯光纯白色背景平稳旋转展示正面、侧面、背面各个角度电影级画质', '视频生成默认提示词 (即梦 3.0 Pro 图生视频)', 'ai', 'N', '2026-03-27 13:45:55');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (11, 'MODEL3D_PROMPT', '', '3D模型生成默认提示词 (Tripo3D备用)', 'ai', 'N', '2026-03-27 12:55:39');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (12, 'VIDEO_FRAMES', '121', '视频帧数: 49=2秒, 121=5秒', 'ai', 'N', '2026-03-27 13:02:32');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (13, 'TENCENT_SECRET_ID', 'AKID31oQoyyqVwCl7FALL8h9OQHxvhGfrrdB', NULL, 'general', 'N', '2026-03-27 14:26:02');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (14, 'TENCENT_SECRET_KEY', 'QeeR1Umqh9QULyWrzwiHeqrhLoAJF5Wn', NULL, 'general', 'N', '2026-03-27 14:26:02');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (15, 'KLING_ACCESS_KEY', 'Anra4QJQLD9hhbNdpMmypHKhYpta4HYJ', NULL, 'general', 'N', '2026-03-27 16:08:09');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (16, 'KLING_SECRET_KEY', 'pkLQffCMC4epEb38PkRArBdd4Jg8C3hL', NULL, 'general', 'N', '2026-03-27 16:08:09');
-- ----------------------------
-- Table: users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',
`phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
`hashed_password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '加密密码',
`nickname` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '昵称',
`avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像URL',
`is_admin` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否管理员',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `phone` (`phone`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `users` (`id`, `username`, `phone`, `hashed_password`, `nickname`, `avatar`, `is_admin`, `created_at`, `updated_at`) VALUES (1, 'demo', NULL, '$2b$12$bHrcm45CwD0wbQVZIQxOmuZcx/B/MEbGYFTGpPawinDkDWI.jilY2', '演示用户', NULL, 1, '2026-03-27 04:20:30', '2026-03-27 04:20:30');
INSERT INTO `users` (`id`, `username`, `phone`, `hashed_password`, `nickname`, `avatar`, `is_admin`, `created_at`, `updated_at`) VALUES (2, 'test1', NULL, '$2b$12$BG5/I4CVswjNWhfdIP9kJeVqbqLEcWkRq8ioxdpwON7eitL.lSVMW', '测试用户', NULL, 0, '2026-03-27 04:21:36', '2026-03-27 04:21:36');
SET FOREIGN_KEY_CHECKS = 1;
-- users 表添加 is_admin 字段(如果不存在)
-- ALTER TABLE users ADD COLUMN is_admin TINYINT(1) NOT NULL DEFAULT 0 COMMENT '' AFTER avatar;