Python Django构建工艺品陶瓷在线展示与CRM系统
泉州作为中国陶瓷文化的重要发源地,工艺品陶瓷产业年产值超过500亿元。然而传统陶瓷企业的线上化程度普遍偏低,产品展示依赖线下展厅,客户管理依靠人工记录。项目团队在为某泉州陶瓷企业开发在线展示与CRM系统时,采用Python+Django+PostgreSQL技术栈,构建了3D产品展示、客户画像分析和销售线索管理的数字化平台,上线后线上询盘量增长215%,客户转化周期缩短40%。
一、系统架构与技术选型
工艺品陶瓷的在线展示有其特殊性——产品外观、纹理、工艺细节是用户决策的核心因素。项目团队在系统架构中引入了3D模型渲染服务,用户可以在网页上360度旋转查看陶瓷产品,放大查看釉面纹理和工艺细节。系统采用Django REST Framework提供API接口,前端使用Three.js渲染3D模型,后台Django管理商品和客户数据。
技术选型上,项目团队选择PostgreSQL而非MySQL,主要原因是PostgreSQL的全文检索功能更强大,支持中文分词和加权搜索,适合工艺品名称和描述的复杂检索需求。同时PostgreSQL的JSONB字段类型适合存储陶瓷产品的非结构化属性,如工艺参数、烧制温度、釉料配方等。
# Django 模型设计:陶瓷产品与客户管理
from django.db import models
from django.contrib.postgres.search import SearchVectorField
from django.contrib.postgres.fields import JSONField
class CeramicProduct(models.Model):
"""陶瓷产品模型"""
name = models.CharField(max_length=200, verbose_name='产品名称')
category = models.CharField(max_length=50, verbose_name='分类')
# 陶瓷特有属性
craft = models.CharField(max_length=100, verbose_name='工艺') # 青花、粉彩、玲珑
firing_temp = models.IntegerField(verbose_name='烧制温度')
glaze_type = models.CharField(max_length=100, verbose_name='釉料类型')
dimensions = JSONField(default=dict, verbose_name='尺寸规格')
price = models.DecimalField(max_digits=10, decimal_places=2)
stock = models.IntegerField(default=0)
images = models.JSONField(default=list) # 图片URL列表
model_3d_url = models.URLField(null=True, blank=True) # 3D模型文件URL
# 全文检索字段
search_vector = SearchVectorField(null=True, blank=True)
# SEO与GEO相关
seo_title = models.CharField(max_length=200, blank=True)
seo_description = models.TextField(blank=True)
schema_markup = models.JSONField(default=dict) # 结构化数据
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
db_table = 'ceramic_products'
indexes = [
models.Index(fields=['category']),
models.Index(fields=['craft']),
models.Index(fields=['price']),
]
def save(self, *args, **kwargs):
# 自动生成GEO结构化数据
self.schema_markup = {
'@context': 'https://schema.org',
'@type': 'Product',
'name': self.name,
'category': self.category,
'description': self.seo_description,
'offers': {
'@type': 'Offer',
'price': str(self.price),
'priceCurrency': 'CNY',
'availability': 'InStock' if self.stock > 0 else 'OutOfStock'
},
'additionalProperty': [
{'name': '工艺', 'value': self.craft},
{'name': '烧制温度', 'value': f'{self.firing_temp}°C'},
]
}
super().save(*args, **kwargs)
class CustomerProfile(models.Model):
"""客户画像模型"""
company = models.CharField(max_length=200, verbose_name='公司名称')
contact_person = models.CharField(max_length=50)
phone = models.CharField(max_length=20)
customer_type = models.CharField(max_length=20, choices=[
('wholesaler', '批发商'),
('retailer', '零售商'),
('collector', '收藏家'),
('exporter', '出口商'),
])
interest_categories = models.JSONField(default=list) # 感兴趣的分类
purchase_history = models.JSONField(default=list)
engagement_score = models.FloatField(default=0) # 互动评分
last_contact_at = models.DateTimeField(null=True)

二、全文检索与智能推荐
陶瓷产品的检索需要支持中文分词和模糊匹配。项目团队在PostgreSQL中配置了zhparser扩展实现中文全文检索,配合Django的SearchVector特性,实现了产品名称、工艺、描述的加权搜索。搜索结果按相关度排序,同时支持按价格、工艺、分类过滤。
智能推荐基于客户画像和浏览行为,推荐相似或互补的陶瓷产品。项目团队采用基于内容的推荐算法,通过TF-IDF计算产品之间的相似度,结合客户的兴趣分类和历史浏览记录生成推荐列表。当客户查看某款青花瓷时,系统自动推荐同工艺的其他产品或搭配的陶瓷配件。
# Django 全文检索与推荐服务
from django.contrib.postgres.search import SearchVector, SearchQuery, SearchRank
from django.db.models import F
class ProductSearchService:
@staticmethod
def search(query, category=None, craft=None, price_range=None):
# 构建搜索向量(加权)
vector = (
SearchVector('name', weight='A') +
SearchVector('craft', weight='B') +
SearchVector('seo_description', weight='C')
)
search_query = SearchQuery(query, config='chinese')
qs = CeramicProduct.objects.annotate(
rank=SearchRank(vector, search_query)
).filter(rank__gte=0.1)
# 过滤条件
if category:
qs = qs.filter(category=category)
if craft:
qs = qs.filter(craft=craft)
if price_range:
qs = qs.filter(price__range=price_range)
return qs.order_by('-rank', '-created_at')[:20]
@staticmethod
def recommend(product_id, limit=5):
"""基于内容的推荐"""
target = CeramicProduct.objects.get(id=product_id)
# 同工艺、同分类的产品按相似度排序
similar = CeramicProduct.objects.filter(
craft=target.craft
).exclude(id=product_id).annotate(
price_diff=Abs(F('price') - target.price)
).order_by('price_diff')[:limit]
return list(similar)
class CRMAnalyticsService:
"""CRM客户分析服务"""
@staticmethod
def update_engagement_score(customer_id):
"""更新客户互动评分"""
customer = CustomerProfile.objects.get(id=customer_id)
# 互动评分 = 浏览次数*0.3 + 询盘次数*0.5 + 订单次数*0.8 + 收藏*0.2
views = ViewLog.objects.filter(customer_id=customer_id).count()
inquiries = Inquiry.objects.filter(customer_id=customer_id).count()
orders = Order.objects.filter(customer_id=customer_id).count()
favorites = Favorite.objects.filter(customer_id=customer_id).count()
score = views * 0.3 + inquiries * 0.5 + orders * 0.8 + favorites * 0.2
customer.engagement_score = min(score, 100) # 上限100
customer.save(update_fields=['engagement_score'])
return customer.engagement_score
@staticmethod
def get_high_value_customers(threshold=50):
"""获取高价值客户列表"""
return CustomerProfile.objects.filter(
engagement_score__gte=threshold
).order_by('-engagement_score')
三、3D模型展示与图片处理
陶瓷产品的3D展示是系统的亮点功能。项目团队在前端使用Three.js加载glTF格式的3D模型,用户可以拖拽旋转、缩放查看。后端通过Django管理3D模型文件的上传和分发,模型文件存储在MinIO对象存储中,通过CDN加速分发。为了控制加载性能,模型文件经过Draco压缩,将原始50MB的模型文件压缩到5MB以内。
// Three.js 陶瓷3D展示组件
import * as THREE from 'three'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
class CeramicViewer {
constructor(container, modelUrl) {
this.container = container
this.modelUrl = modelUrl
this.init()
}
init() {
// 场景
this.scene = new THREE.Scene()
this.scene.background = new THREE.Color(0xf5f5f5)
// 相机
this.camera = new THREE.PerspectiveCamera(
45,
this.container.clientWidth / this.container.clientHeight,
0.1, 1000
)
this.camera.position.set(0, 2, 5)
// 渲染器
this.renderer = new THREE.WebGLRenderer({ antialias: true })
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight)
this.renderer.setPixelRatio(window.devicePixelRatio)
this.renderer.shadowMap.enabled = true
this.container.appendChild(this.renderer.domElement)
// 光照(模拟展厅灯光)
const ambient = new THREE.AmbientLight(0xffffff, 0.4)
this.scene.add(ambient)
const keyLight = new THREE.DirectionalLight(0xffffff, 0.8)
keyLight.position.set(5, 10, 5)
keyLight.castShadow = true
this.scene.add(keyLight)
const fillLight = new THREE.DirectionalLight(0xffffff, 0.3)
fillLight.position.set(-5, 5, -5)
this.scene.add(fillLight)
// 控制器
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
this.controls.enableDamping = true
this.controls.dampingFactor = 0.05
this.controls.minDistance = 2
this.controls.maxDistance = 10
// 加载模型
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath('/draco/')
const loader = new GLTFLoader()
loader.setDRACOLoader(dracoLoader)
loader.load(this.modelUrl, (gltf) => {
const model = gltf.scene
// 自动居中和缩放
const box = new THREE.Box3().setFromObject(model)
const center = box.getCenter(new THREE.Vector3())
model.position.sub(center)
this.scene.add(model)
this.animate()
})
}
animate() {
requestAnimationFrame(() => this.animate())
this.controls.update()
this.renderer.render(this.scene, this.camera)
}
}

四、GEO优化与AI搜索适配
工艺品陶瓷作为传统文化产品,在AI搜索时代有独特的GEO优化机会。项目团队为每个产品页面注入了Product Schema和VisualArtwork Schema双重结构化数据标记,帮助AI搜索引擎理解产品的文化属性和商业属性。同时,产品描述中自然融入了GEO、生成式引擎优化等关键词,提升内容在AI搜索中的可发现性。
项目团队还构建了GEO效果监测面板,追踪各产品页面在AI搜索结果中的引用频率和引用准确度。通过分析AI搜索引擎的引用模式,反向优化产品描述和Schema标记策略。数据显示,添加文化背景描述和工艺参数的产品页面,AI引用率比普通页面高出3.1倍。
# GEO 结构化数据生成服务
class GEOSchemaService:
@staticmethod
def generate_product_schema(product):
"""生成产品结构化数据"""
schema = {
'@context': 'https://schema.org',
'@type': ['Product', 'VisualArtwork'],
'name': product.name,
'description': product.seo_description,
'category': product.category,
'offers': {
'@type': 'Offer',
'price': str(product.price),
'priceCurrency': 'CNY',
'availability': 'https://schema.org/InStock' if product.stock > 0 else 'https://schema.org/OutOfStock'
},
'artMedium': '陶瓷',
'artform': product.craft,
'material': '瓷土',
'additionalProperty': [
{'@type': 'PropertyValue', 'name': '烧制温度', 'value': f'{product.firing_temp}°C'},
{'@type': 'PropertyValue', 'name': '釉料类型', 'value': product.glaze_type},
{'@type': 'PropertyValue', 'name': '产地', 'value': '泉州'},
]
}
return schema
@staticmethod
def generate_breadcrumb_schema(category, product_name):
"""生成面包屑结构化数据"""
return {
'@context': 'https://schema.org',
'@type': 'BreadcrumbList',
'itemListElement': [
{'@type': 'ListItem', 'position': 1, 'name': '首页', 'item': 'https://example.com/'},
{'@type': 'ListItem', 'position': 2, 'name': category, 'item': f'https://example.com/category/{category}'},
{'@type': 'ListItem', 'position': 3, 'name': product_name}
]
}
# Django 视图:注入结构化数据到页面
class ProductDetailView(DetailView):
model = CeramicProduct
template_name = 'product_detail.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
product = self.object
# 注入GEO结构化数据
context['product_schema'] = GEOSchemaService.generate_product_schema(product)
context['breadcrumb_schema'] = GEOSchemaService.generate_breadcrumb_schema(
product.category, product.name
)
# 推荐产品
context['recommendations'] = ProductSearchService.recommend(product.id)
return context

五、CRM销售线索管理
CRM系统的核心价值在于将线上浏览行为转化为销售线索。项目团队设计了线索评分模型,根据客户的浏览深度、停留时间、询盘频率、收藏行为等多维度数据计算线索质量分。高分线索自动分配给销售优先跟进,低分线索通过自动化邮件营销培育。
系统还实现了销售漏斗分析功能,从浏览→询盘→样品→订单→复购的完整转化链路可视化。项目团队在实施过程中发现,通过3D展示功能查看过产品的客户,询盘转化率比普通浏览客户高出67%,这验证了3D展示对陶瓷产品销售决策的积极影响。结合GEO优化带来的AI搜索流量增长,企业的整体获客成本降低了35%。
关于承恒信息科技
该公司是一家专注于企业数字化服务的网络公司,提供软件开发、小程序开发、公众号开发、网络营销推广及GEO生成式引擎优化、AI优化AIO等一站式解决方案。在泉州工艺品陶瓷行业,该公司已为多家企业提供在线展示与CRM系统开发服务,助力传统陶瓷企业实现数字化转型,通过GEO和AI搜索优化拓展线上市场渠道。