Dockerfile

This commit is contained in:
2026-03-18 10:18:03 +08:00
parent 5c5dbc7420
commit b65f3439f3
189 changed files with 19027 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package entity
import (
consts "assets/consts/asset"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
)
// Asset 资产实体
type Asset struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
// 基础信息
Name string `orm:"name" json:"name" description:"资产名称"`
Description string `orm:"description" json:"description" description:"资产描述"`
Type consts.AssetType `orm:"type" json:"type" description:"资产类型physical实物/virtual虚拟/service服务"`
CategoryId uint64 `orm:"category_id" json:"categoryId" description:"分类ID"`
CategoryPath string `orm:"category_path" json:"categoryPath" description:"分类路径"`
ImageURL string `orm:"image_url" json:"imageUrl" description:"主图URL"`
Images []string `orm:"images" json:"images" description:"图片列表(JSONB)"`
Status *consts.AssetStatus `orm:"status" json:"status" description:"资产状态1启用/0停用"`
BasePrice int `orm:"base_price" json:"basePrice" description:"基础价格(分为单位)"`
Currency string `orm:"currency" json:"currency" description:"货币单位默认CNY"`
UnlimitedStock bool `orm:"unlimited_stock" json:"unlimitedStock" description:"是否无库存限制"`
StockMode stock.StockMode `orm:"stock_mode" json:"stockMode" description:"库存管理模式1-明细模式 2-批次模式"`
// 上线和下线时间配置(由定时任务处理资产状态)
OnlineTime *gtime.Time `orm:"online_time" json:"onlineTime,omitempty" description:"上线时间"`
OfflineTime *gtime.Time `orm:"offline_time" json:"offlineTime,omitempty" description:"下线时间"`
// 类型专用配置 - 实物资产配置(JSONB)
PhysicalAssetConfig *gjson.Json `orm:"physical_asset_config" json:"physicalAssetConfig" description:"实物资产配置(JSONB)"`
// 类型专用配置 - 服务资产配置(JSONB)
ServiceAssetConfig *gjson.Json `orm:"service_asset_config" json:"serviceAssetConfig" description:"服务资产配置(JSONB)"`
// 类型专用配置 - 虚拟资产配置(JSONB)
VirtualAssetConfig *gjson.Json `orm:"virtual_asset_config" json:"virtualAssetConfig" description:"虚拟资产配置(JSONB)"`
// 扩展字段(JSONB)
Metadata *gjson.Json `orm:"metadata" json:"metadata" description:"动态元数据(JSONB)"`
TenantModuleType string `orm:"tenant_module_type" json:"tenantModuleType" description:"租户模块类型"`
}

View File

@@ -0,0 +1,44 @@
package entity
import (
consts "assets/consts/asset"
"assets/consts/public"
"assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
"go.mongodb.org/mongo-driver/v2/bson"
)
// AssetSku 资产SKU实体
type AssetSku struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
AssetName string `bson:"assetName" json:"assetName"` // 资产名称
SkuName string `bson:"skuName" json:"skuName"` // SKU名称
ImageURL string `bson:"imageUrl,omitempty" json:"imageUrl"` // SKU主图
SpecValues []map[string]interface{} `bson:"specValues" json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
Price int `bson:"price" json:"price"` // 价格(分为单位)
UnlimitedStock bool `bson:"unlimitedStock" json:"unlimitedStock"` // 是否无库存限制
Stock int `bson:"stock" json:"stock"` // 库存数量
SpecsCount int `bson:"specsCount" json:"specsCount"` // 规格数量
SpecsUnit *SpecsUnitKeyValue `bson:"specsUnit" json:"specsUnit"` // 规格单位
Sort int `bson:"sort" json:"sort"` // 排序
Status *consts.AssetSkuStatus `bson:"status" json:"status"` // 状态active/inactive/disabled
StockMode stock.StockMode `bson:"stockMode" json:"stockMode"` // 库存管理模式1-明细模式 2-批次模式
CategoryId *bson.ObjectID `bson:"categoryId" json:"categoryId"` // 分类ID
CategoryPath string `bson:"categoryPath" json:"categoryPath"` // 分类路径
CapacityUnitType stock.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
Capacity config.Capacity `bson:"capacity" json:"capacity"` //容量
TenantModuleType beans.TenantModuleType `bson:"tenantModuleType" json:"tenantModuleType"`
}
type SpecsUnitKeyValue struct {
Key string `bson:"key" json:"key"` // 对应原有常量值
Value string `bson:"value" json:"value"` // 对应描述信息
}
// CollectionName 获取集合名称
func (AssetSku) CollectionName() string {
return public.AssetSkuCollection
}

View File

@@ -0,0 +1,74 @@
package entity
import (
consts "assets/consts/category"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/encoding/gjson"
)
type categoryCol struct {
beans.SQLBaseCol
Name string
ParentId string
Path string
Level string
IsLeafNode string
Sort string
Image string
Attrs string
Status string
}
var CategoryCol = categoryCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
ParentId: "parent_id",
Path: "path",
Level: "level",
IsLeafNode: "isLeaf_node",
Sort: "sort",
Image: "image",
Attrs: "attrs",
Status: "status",
}
// Category 分类实体
type Category struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
Name string `orm:"name" json:"name"` // 分类名称
ParentId string `orm:"parent_id" json:"parentId"` // 父分类ID为空表示根分类
Path string `orm:"path" json:"path"` // 分类路径,如:/root/parent/child
Level int `orm:"level" json:"level"` // 分类层级
IsLeafNode bool `orm:"isLeaf_node" json:"isLeafNode"` // 是叶子节点
Sort int `orm:"sort" json:"sort"` // 排序
Image string `orm:"image" json:"image"` // 分类图片
Attrs []gjson.Json `orm:"attrs" json:"attrs,omitempty"` // 分类属性
// 使用场景说明:
// 1. 商品分类属性:为该分类下的商品定义标准化的属性模板,如服装分类可定义尺寸、颜色、材质等属性
// 2. 服务分类属性:为服务类目定义特性参数,如咨询服务可定义服务时长、服务方式、专业领域等
// 3. 商品发布约束:当商品归属于某个分类时,必须填写该分类定义的必填属性
// 4. 搜索筛选:基于分类属性进行商品筛选和搜索,提升用户体验
// 5. 数据标准化:确保同一分类下的商品具有统一的属性结构,便于数据管理
// 支持的属性类型:文本(text)、数字(number)、日期(date)、单选(select)、多选(multi_select)、布尔(boolean)、图片(image)
Status consts.CategoryStatusType `orm:"status" json:"status"` // 状态1启用/0禁用
}
// CategoryAttr 分类属性
// 用于定义分类下商品或服务的标准化属性模板,确保同类商品属性统一
type CategoryAttr struct {
Name string `json:"name"` // 属性名称,如:尺寸、颜色、品牌等
Type string `json:"type"` // 属性类型text文本/number数字/date日期/select选择/multi_select多选/boolean布尔/image图片
DictType string `json:"dictType"` // 字典类型如果是select/multi_select类型时有效
Required bool `json:"required"` // 是否必填true表示商品发布时必须填写此属性
Options []FieldOption `json:"options"` // 选项配置JSON字符串格式用于select/multi_select类型的可选值列表
// 示例:'{"options":[{"label":"红色","value":"red"},{"label":"蓝色","value":"blue"}]}'
Description string `json:"description"` // 属性描述,向用户说明此属性的具体含义和填写要求
Sort int `json:"sort"` // 排序权重,数值越小排序越靠前,用于属性在界面的显示顺序
}
// FieldOption 字段选项
type FieldOption struct {
Label string `json:"label" dc:"选项标签"`
Value interface{} `json:"value" dc:"选项值"`
}

View File

@@ -0,0 +1,25 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
)
// PrivateCategory 私域分类实体
type PrivateCategory struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
Name string `bson:"name" json:"name"` // 分类名称
ParentID string `bson:"parentId" json:"parentId"` // 父分类ID为空表示根分类
Path string `bson:"path" json:"path"` // 分类路径,如:/root/parent
Level int `bson:"level" json:"level"` // 分类层级
IsLeafNode bool `bson:"isLeafNode" json:"isLeafNode"` // 是叶子节点
Sort int `bson:"sort" json:"sort"` // 排序
Image string `bson:"image" json:"image"` // 分类图片
}
// CollectionName 分类集合名称
func (PrivateCategory) CollectionName() string {
return public.PrivateCategoryCollection
}

View File

@@ -0,0 +1,27 @@
package entity
import (
"assets/consts/public"
consts "assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
)
// PrivateSku 私域资产SKU实体
type PrivateSku struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
SkuName string `bson:"skuName" json:"skuName"` // SKU名称
ImageURL string `bson:"imageUrl,omitempty" json:"imageUrl"` // SKU主图
Price int `bson:"price" json:"price"` // 价格(分为单位)
Stock int `bson:"stock" json:"stock"` // 库存数量
Sort int `bson:"sort" json:"sort"` // 排序
CapacityUnitType consts.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
Capacity config.Capacity `bson:"capacity" json:"capacity"` //容量
PrivateCategoryPath string `bson:"privateCategoryPath" json:"privateCategoryPath"` // 私域分类路径
}
// CollectionName 获取集合名称
func (PrivateSku) CollectionName() string {
return public.PrivateSkuCollection
}