fix 价格
This commit is contained in:
@@ -29,8 +29,9 @@ func NewAdminCreateFeatureLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
func (l *AdminCreateFeatureLogic) AdminCreateFeature(req *types.AdminCreateFeatureReq) (resp *types.AdminCreateFeatureResp, err error) {
|
||||
// 1. 数据转换
|
||||
data := &model.Feature{
|
||||
ApiId: req.ApiId,
|
||||
Name: req.Name,
|
||||
ApiId: req.ApiId,
|
||||
Name: req.Name,
|
||||
CostPrice: req.CostPrice,
|
||||
}
|
||||
|
||||
// 2. 数据库操作
|
||||
|
||||
@@ -38,6 +38,7 @@ func (l *AdminGetFeatureDetailLogic) AdminGetFeatureDetail(req *types.AdminGetFe
|
||||
Id: record.Id,
|
||||
ApiId: record.ApiId,
|
||||
Name: record.Name,
|
||||
CostPrice: record.CostPrice,
|
||||
CreateTime: record.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: record.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ func (l *AdminGetFeatureListLogic) AdminGetFeatureList(req *types.AdminGetFeatur
|
||||
Name: item.Name,
|
||||
CreateTime: item.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
UpdateTime: item.UpdateTime.Format("2006-01-02 15:04:05"),
|
||||
CostPrice: item.CostPrice,
|
||||
}
|
||||
items = append(items, listItem)
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ func (l *AdminUpdateFeatureLogic) AdminUpdateFeature(req *types.AdminUpdateFeatu
|
||||
if req.Name != nil && *req.Name != "" {
|
||||
record.Name = *req.Name
|
||||
}
|
||||
if req.CostPrice != nil {
|
||||
record.CostPrice = *req.CostPrice
|
||||
}
|
||||
|
||||
// 4. 执行更新操作
|
||||
err = l.svcCtx.FeatureModel.UpdateWithVersion(l.ctx, nil, record)
|
||||
|
||||
@@ -2,11 +2,11 @@ package admin_product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"tydata-server/app/main/api/internal/svc"
|
||||
"tydata-server/app/main/api/internal/types"
|
||||
"tydata-server/app/main/model"
|
||||
"tydata-server/common/xerr"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@@ -146,6 +146,7 @@ func (l *AdminUpdateProductFeaturesLogic) AdminUpdateProductFeatures(req *types.
|
||||
return updateErr
|
||||
}
|
||||
|
||||
// 不自动更新产品成本价,保留用户手动设置的值
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -155,5 +156,7 @@ func (l *AdminUpdateProductFeaturesLogic) AdminUpdateProductFeatures(req *types.
|
||||
}
|
||||
|
||||
// 5. 返回结果
|
||||
return &types.AdminUpdateProductFeaturesResp{Success: true}, nil
|
||||
return &types.AdminUpdateProductFeaturesResp{
|
||||
Success: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package admin_product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"tydata-server/app/main/api/internal/svc"
|
||||
"tydata-server/app/main/api/internal/types"
|
||||
"tydata-server/common/xerr"
|
||||
"database/sql"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
Reference in New Issue
Block a user