add购买记录功能
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
|
||||
## 一、功能概述
|
||||
|
||||
在产品详情页面添加"下载示例报告"功能,允许用户下载与产品对应的前端组件报告。报告文件位于 `resources/Pure Component/src/ui` 目录下,通过产品编号(product_code)匹配对应的文件夹或文件。
|
||||
在产品详情页面添加"下载示例报告"功能,允许用户下载与产品对应的前端组件报告。报告文件位于 `resources/Pure_Component/src/ui` 目录下,通过产品编号(product_code)匹配对应的文件夹或文件。
|
||||
|
||||
## 二、核心需求
|
||||
|
||||
### 2.1 基本功能
|
||||
|
||||
1. **报告匹配**:根据子产品的 `product_code` 模糊匹配 `resources/Pure Component/src/ui` 下的文件夹或文件
|
||||
1. **报告匹配**:根据子产品的 `product_code` 模糊匹配 `resources/Pure_Component/src/ui` 下的文件夹或文件
|
||||
- 支持前缀匹配(如产品编号为 `DWBG6A2C`,文件夹可能是 `DWBG6A2C` 或 `多cDWBG6A2C`)
|
||||
- 匹配规则:文件夹名称包含产品编号,或产品编号包含文件夹名称的核心部分
|
||||
|
||||
@@ -537,7 +537,7 @@ func (s *ComponentReportServiceImpl) MatchProductCodeToPath(ctx context.Context,
|
||||
}
|
||||
|
||||
// 2. 扫描目录
|
||||
basePath := "resources/Pure Component/src/ui"
|
||||
basePath := "resources/Pure_Component/src/ui"
|
||||
entries, err := os.ReadDir(basePath)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
@@ -807,7 +807,7 @@ func (s *ComponentReportServiceImpl) GenerateZipFile(ctx context.Context, produc
|
||||
defer zipWriter.Close()
|
||||
|
||||
// 3. 遍历子产品,添加UI组件文件到ZIP
|
||||
basePath := "resources/Pure Component/src/ui"
|
||||
basePath := "resources/Pure_Component/src/ui"
|
||||
for _, productCode := range subProductCodes {
|
||||
path, fileType, err := s.MatchProductCodeToPath(ctx, productCode)
|
||||
if err != nil {
|
||||
@@ -847,7 +847,7 @@ func (s *ComponentReportServiceImpl) GenerateZipFile(ctx context.Context, produc
|
||||
|
||||
// 5. 添加其他必要的文件(如果需要)
|
||||
// 例如:复制 public 目录下的其他文件(如果有)
|
||||
publicBasePath := "resources/Pure Component/public"
|
||||
publicBasePath := "resources/Pure_Component/public"
|
||||
publicFiles, err := os.ReadDir(publicBasePath)
|
||||
if err == nil {
|
||||
for _, file := range publicFiles {
|
||||
|
||||
Reference in New Issue
Block a user