更新框架,增加云库搜索模块

This commit is contained in:
chfei committed 2026-09-18 18:40:10 +08:00
1 parent 8526e5e0d2
commit f2caec6083
192 files changed
+3626 -804

No files matched your search

@@ -0,0 +1,14 @@
using Store.Modules.CloudProduct.Entities;
namespace Store.Modules.CloudProduct.Dtos
{
/// <summary>
/// 导入项:商品模型 + 原始数据
/// </summary>
public class GoodsImportItem
{
public ProductEntity ProductEntity { get; set; } = null!;
public string RawData { get; set; } = string.Empty;
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Store.Modules.CloudProduct.Dtos
{
/// <summary>
/// 商品导入结果
/// </summary>
public class GoodsImportResult
{
/// <summary>
/// 成功条数
/// </summary>
public int Success { get; set; }
/// <summary>
/// 失败条数
/// </summary>
public int Failed { get; set; }
/// <summary>
/// 总条数
/// </summary>
public int Total => Success + Failed;
/// <summary>
/// 错误明细
/// </summary>
public List<string> Errors { get; set; } = new();
}
}
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Store.Modules.CloudProduct.Dtos
{
/// <summary>
/// OpenSearch 运行状态
/// </summary>
public class OpenSearchStatusDto
{
/// <summary>
/// 节点地址
/// </summary>
public string NodeUrl { get; set; } = string.Empty;
/// <summary>
/// 索引名称
/// </summary>
public string IndexName { get; set; } = string.Empty;
/// <summary>
/// 是否可连接
/// </summary>
public bool Connected { get; set; }
/// <summary>
/// 索引是否存在
/// </summary>
public bool IndexExists { get; set; }
/// <summary>
/// 文档总数(索引不存在时为 -1)
/// </summary>
public long DocumentCount { get; set; } = -1;
/// <summary>
/// 说明信息
/// </summary>
public string? Message { get; set; }
}
}
@@ -0,0 +1,60 @@
using OpenSearch.Client;
using System;
using System.Collections.Generic;
using System.Text;
namespace Store.Modules.CloudProduct.Dtos
{
/// <summary>
/// 商品搜索模型:Id 为主键,Title 用于分词搜索
/// </summary>
public class ProductSearchInfo
{
[Number(NumberType.Byte, Name = "platform")]
public byte Platform { get; set; }
[Number(NumberType.Long, Name = "id")]
public long Id { get; set; }
[Text(Name = "title", Analyzer = "ik_max_word", SearchAnalyzer = "ik_smart")]
public string Title { get; set; } = string.Empty;
[Text(Name = "thumbUrl")]
public string? ThumbUrl { get; set; } = string.Empty;
/// <summary>一级类目ID</summary>
[Number(NumberType.Integer, Name = "cat_id_1")]
public int? CatId1 { get; set; }
/// <summary>二级类目ID</summary>
[Number(NumberType.Integer, Name = "cat_id_2")]
public int? CatId2 { get; set; }
/// <summary>三级类目ID</summary>
[Number(NumberType.Integer, Name = "cat_id_3")]
public int? CatId3 { get; set; }
/// <summary>四级类目ID</summary>
[Number(NumberType.Integer, Name = "cat_id_4")]
public int? CatId4 { get; set; }
/// <summary>最低价快照,用于价格区间过滤和按价格排序</summary>
[Number(NumberType.Long, Name = "min_price")]
public long? MinPrice { get; set; }
/// <summary>销量,用于按销量排序</summary>
[Number(NumberType.Integer, Name = "sold_quantity")]
public int SoldQuantity { get; set; }
public override string ToString() => $"[Id={Id}] Title={Title} Cat=({CatId1},{CatId2},{CatId3},{CatId4}) Price={MinPrice} Sold={SoldQuantity}";
}
/// <summary>
/// 搜索排序方式
/// </summary>
public enum GoodsSearchSortBy
{
Relevance = 0, // 相关性(默认)
PriceAsc = 1, // 价格从低到高
PriceDesc = 2, // 价格从高到低
SoldDesc = 3, // 销量从高到低
}
}
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Store.Modules.CloudProduct.Dtos
{
/// <summary>
/// 商品搜索请求
/// </summary>
public class ProductSearchRequest
{
/// <summary>
/// 标题(模糊搜索)
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// 最低价格(分)
/// </summary>
public long? MinPrice { get; set; }
/// <summary>
/// 最高价格(分)
/// </summary>
public long? MaxPrice { get; set; }
/// <summary>
/// 一级类目ID
/// </summary>
public int? CatId1 { get; set; }
/// <summary>
/// 二级类目ID
/// </summary>
public int? CatId2 { get; set; }
/// <summary>
/// 三级类目ID
/// </summary>
public int? CatId3 { get; set; }
/// <summary>
/// 四级类目ID
/// </summary>
public int? CatId4 { get; set; }
/// <summary>
/// 最低销量
/// </summary>
public int? MinSoldQuantity { get; set; }
/// <summary>
/// 最高销量
/// </summary>
public int? MaxSoldQuantity { get; set; }
/// <summary>
/// 平台类型
/// </summary>
public byte? Platform { get; set; }
/// <summary>
/// 页码(默认1)
/// </summary>
public int PageIndex { get; set; } = 1;
/// <summary>
/// 每页数量(默认20)
/// </summary>
public int PageSize { get; set; } = 20;
/// <summary>
/// 排序字段
/// </summary>
public string SortBy { get; set; } = "CreatedTime";
/// <summary>
/// 排序方式:asc/desc(默认desc)
/// </summary>
public string SortOrder { get; set; } = "desc";
}
}