This commit is contained in:
2026-01-13 19:14:05 +08:00
parent 04df8460a4
commit 586330cfa6
13 changed files with 17 additions and 14 deletions

View File

@@ -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"` // 更新时间
}

View File

@@ -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"` // 更新时间

View File

@@ -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)

View File

@@ -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"),
}

View File

@@ -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"),
}

View File

@@ -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)

View File

@@ -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,
}

View File

@@ -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"),

View File

@@ -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"),

View File

@@ -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
}

View File

@@ -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 {

View File

@@ -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"` // 售价
}

View File

@@ -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"` // 更新时间