diff --git a/app/main/api/desc/admin/admin_feature.api b/app/main/api/desc/admin/admin_feature.api index 29b15f7..1d0b6c0 100644 --- a/app/main/api/desc/admin/admin_feature.api +++ b/app/main/api/desc/admin/admin_feature.api @@ -48,6 +48,7 @@ type ( ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元) + CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元) } // 创建功能响应 AdminCreateFeatureResp { @@ -59,6 +60,7 @@ type ( ApiId *string `json:"api_id,optional"` // API标识 Name *string `json:"name,optional"` // 描述 WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元) + CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元) } // 更新功能响应 AdminUpdateFeatureResp { @@ -85,6 +87,7 @@ type ( ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元) + CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元) CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 } @@ -103,6 +106,7 @@ type ( ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元) + CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元) CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 } diff --git a/app/main/api/desc/admin/admin_product.api b/app/main/api/desc/admin/admin_product.api index c3ba2c7..9aebc52 100644 --- a/app/main/api/desc/admin/admin_product.api +++ b/app/main/api/desc/admin/admin_product.api @@ -49,7 +49,6 @@ type ( ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes,optional"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 } @@ -65,7 +64,6 @@ type ( ProductEn *string `json:"product_en,optional"` // 英文名 Description *string `json:"description,optional"` // 描述 Notes *string `json:"notes,optional"` // 备注 - CostPrice *float64 `json:"cost_price,optional"` // 成本 SellPrice *float64 `json:"sell_price,optional"` // 售价 } @@ -99,7 +97,6 @@ type ( ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 @@ -123,7 +120,6 @@ type ( ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 diff --git a/app/main/api/internal/logic/admin_feature/admincreatefeaturelogic.go b/app/main/api/internal/logic/admin_feature/admincreatefeaturelogic.go index e5e4cfc..74d44f0 100644 --- a/app/main/api/internal/logic/admin_feature/admincreatefeaturelogic.go +++ b/app/main/api/internal/logic/admin_feature/admincreatefeaturelogic.go @@ -38,6 +38,10 @@ func (l *AdminCreateFeatureLogic) AdminCreateFeature(req *types.AdminCreateFeatu if req.WhitelistPrice != nil { data.WhitelistPrice = *req.WhitelistPrice } + // 设置成本价 + if req.CostPrice != nil { + data.CostPrice = *req.CostPrice + } // 2. 数据库操作 result, err := l.svcCtx.FeatureModel.Insert(l.ctx, nil, data) diff --git a/app/main/api/internal/logic/admin_feature/admingetfeaturedetaillogic.go b/app/main/api/internal/logic/admin_feature/admingetfeaturedetaillogic.go index 6625821..d05af00 100644 --- a/app/main/api/internal/logic/admin_feature/admingetfeaturedetaillogic.go +++ b/app/main/api/internal/logic/admin_feature/admingetfeaturedetaillogic.go @@ -39,6 +39,7 @@ func (l *AdminGetFeatureDetailLogic) AdminGetFeatureDetail(req *types.AdminGetFe ApiId: record.ApiId, Name: record.Name, WhitelistPrice: record.WhitelistPrice, + CostPrice: record.CostPrice, CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"), UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"), } diff --git a/app/main/api/internal/logic/admin_feature/admingetfeaturelistlogic.go b/app/main/api/internal/logic/admin_feature/admingetfeaturelistlogic.go index c4a91d4..a2f0aa4 100644 --- a/app/main/api/internal/logic/admin_feature/admingetfeaturelistlogic.go +++ b/app/main/api/internal/logic/admin_feature/admingetfeaturelistlogic.go @@ -53,6 +53,7 @@ func (l *AdminGetFeatureListLogic) AdminGetFeatureList(req *types.AdminGetFeatur ApiId: item.ApiId, Name: item.Name, WhitelistPrice: item.WhitelistPrice, + CostPrice: item.CostPrice, CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"), UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"), } diff --git a/app/main/api/internal/logic/admin_feature/adminupdatefeaturelogic.go b/app/main/api/internal/logic/admin_feature/adminupdatefeaturelogic.go index 73f7a9f..3a2c55d 100644 --- a/app/main/api/internal/logic/admin_feature/adminupdatefeaturelogic.go +++ b/app/main/api/internal/logic/admin_feature/adminupdatefeaturelogic.go @@ -49,6 +49,9 @@ func (l *AdminUpdateFeatureLogic) AdminUpdateFeature(req *types.AdminUpdateFeatu if req.WhitelistPrice != nil { record.WhitelistPrice = *req.WhitelistPrice } + if req.CostPrice != nil { + record.CostPrice = *req.CostPrice + } // 4. 执行更新操作 err = l.svcCtx.FeatureModel.UpdateWithVersion(l.ctx, nil, record) diff --git a/app/main/api/internal/logic/admin_product/admincreateproductlogic.go b/app/main/api/internal/logic/admin_product/admincreateproductlogic.go index 1bd61c6..25180b0 100644 --- a/app/main/api/internal/logic/admin_product/admincreateproductlogic.go +++ b/app/main/api/internal/logic/admin_product/admincreateproductlogic.go @@ -36,7 +36,6 @@ func (l *AdminCreateProductLogic) AdminCreateProduct(req *types.AdminCreateProdu ProductEn: req.ProductEn, Description: req.Description, Notes: sql.NullString{String: req.Notes, Valid: req.Notes != ""}, - CostPrice: req.CostPrice, SellPrice: req.SellPrice, } diff --git a/app/main/api/internal/logic/admin_product/admingetproductdetaillogic.go b/app/main/api/internal/logic/admin_product/admingetproductdetaillogic.go index f2172c1..080358f 100644 --- a/app/main/api/internal/logic/admin_product/admingetproductdetaillogic.go +++ b/app/main/api/internal/logic/admin_product/admingetproductdetaillogic.go @@ -39,7 +39,6 @@ func (l *AdminGetProductDetailLogic) AdminGetProductDetail(req *types.AdminGetPr ProductEn: record.ProductEn, Description: record.Description, Notes: record.Notes.String, - CostPrice: record.CostPrice, SellPrice: record.SellPrice, CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"), UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"), diff --git a/app/main/api/internal/logic/admin_product/admingetproductlistlogic.go b/app/main/api/internal/logic/admin_product/admingetproductlistlogic.go index 8d327f7..6c5c536 100644 --- a/app/main/api/internal/logic/admin_product/admingetproductlistlogic.go +++ b/app/main/api/internal/logic/admin_product/admingetproductlistlogic.go @@ -53,7 +53,6 @@ func (l *AdminGetProductListLogic) AdminGetProductList(req *types.AdminGetProduc ProductEn: item.ProductEn, Description: item.Description, Notes: item.Notes.String, - CostPrice: item.CostPrice, SellPrice: item.SellPrice, CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"), UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"), diff --git a/app/main/api/internal/logic/admin_product/adminupdateproductlogic.go b/app/main/api/internal/logic/admin_product/adminupdateproductlogic.go index e12280f..a0a9dcf 100644 --- a/app/main/api/internal/logic/admin_product/adminupdateproductlogic.go +++ b/app/main/api/internal/logic/admin_product/adminupdateproductlogic.go @@ -47,9 +47,6 @@ func (l *AdminUpdateProductLogic) AdminUpdateProduct(req *types.AdminUpdateProdu if req.Notes != nil { record.Notes = sql.NullString{String: *req.Notes, Valid: *req.Notes != ""} } - if req.CostPrice != nil { - record.CostPrice = *req.CostPrice - } if req.SellPrice != nil { record.SellPrice = *req.SellPrice } diff --git a/app/main/api/internal/types/adminfeature.go b/app/main/api/internal/types/adminfeature.go index b3d2659..0710a6a 100644 --- a/app/main/api/internal/types/adminfeature.go +++ b/app/main/api/internal/types/adminfeature.go @@ -14,6 +14,7 @@ type AdminCreateFeatureReq struct { ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元) + CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元) } type AdminCreateFeatureResp struct { @@ -37,6 +38,7 @@ type AdminGetFeatureDetailResp struct { ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元) + CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元) CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 } @@ -71,6 +73,7 @@ type AdminUpdateFeatureReq struct { ApiId *string `json:"api_id,optional"` // API标识 Name *string `json:"name,optional"` // 描述 WhitelistPrice *float64 `json:"whitelist_price,optional"` // 白名单屏蔽价格(单位:元) + CostPrice *float64 `json:"cost_price,optional"` // 天远API调用成本价(单位:元) } type AdminUpdateFeatureResp struct { diff --git a/app/main/api/internal/types/adminproduct.go b/app/main/api/internal/types/adminproduct.go index 9ccb519..4339553 100644 --- a/app/main/api/internal/types/adminproduct.go +++ b/app/main/api/internal/types/adminproduct.go @@ -6,7 +6,6 @@ type AdminCreateProductReq struct { ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes,optional"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 } @@ -32,7 +31,6 @@ type AdminGetProductDetailResp struct { ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 @@ -82,7 +80,6 @@ type AdminUpdateProductReq struct { ProductEn *string `json:"product_en,optional"` // 英文名 Description *string `json:"description,optional"` // 描述 Notes *string `json:"notes,optional"` // 备注 - CostPrice *float64 `json:"cost_price,optional"` // 成本 SellPrice *float64 `json:"sell_price,optional"` // 售价 } diff --git a/app/main/api/internal/types/types.go b/app/main/api/internal/types/types.go index 4100941..f90058b 100644 --- a/app/main/api/internal/types/types.go +++ b/app/main/api/internal/types/types.go @@ -329,6 +329,7 @@ type FeatureListItem struct { ApiId string `json:"api_id"` // API标识 Name string `json:"name"` // 描述 WhitelistPrice float64 `json:"whitelist_price"` // 白名单屏蔽价格(单位:元) + CostPrice float64 `json:"cost_price"` // 天远API调用成本价(单位:元) CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间 } @@ -512,7 +513,6 @@ type ProductListItem struct { ProductEn string `json:"product_en"` // 英文名 Description string `json:"description"` // 描述 Notes string `json:"notes"` // 备注 - CostPrice float64 `json:"cost_price"` // 成本 SellPrice float64 `json:"sell_price"` // 售价 CreateTime string `json:"create_time"` // 创建时间 UpdateTime string `json:"update_time"` // 更新时间