fusenapi/server/product-templatev2/internal/logic/gettemplatevdetaillogic.go

66 lines
2.1 KiB
Go
Raw Normal View History

2023-06-20 08:38:03 +00:00
package logic
import (
"context"
2023-06-20 10:05:29 +00:00
"fusenapi/utils/basic"
"net/http"
2023-06-20 08:38:03 +00:00
"fusenapi/server/product-templatev2/internal/svc"
"fusenapi/server/product-templatev2/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetTemplatevDetailLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetTemplatevDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTemplatevDetailLogic {
return &GetTemplatevDetailLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
2023-06-20 10:05:29 +00:00
func (l *GetTemplatevDetailLogic) GetTemplatevDetail(req *types.GetTemplatevDetailReq, r *http.Request) (resp *basic.Response) {
/*authKey := r.Header.Get("Auth-Key")
if authKey == "" {
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first")
}
if req.TemplateId <= 0 {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "err param template_id")
}
if req.ModelId <= 0 {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "err param model_id")
}
genentModel := gmodel.NewFsGerentModel(l.svcCtx.MysqlConn)
_, err := genentModel.Find(l.ctx, authKey)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please login first..")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeUnAuth, "failed to get user info")
}
//查询产品模型并肩测数据完整性
productModel3dModel := gmodel.NewFsProductModel3dModel(l.svcCtx.MysqlConn)
model3dInfo, err := productModel3dModel.FindOne(l.ctx, req.ModelId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "product model info is not exists")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product model info")
}
//配件ids
partIds, err := format.StrSlicToIntSlice(strings.Split(*model3dInfo.PartList, ","))
//产品模型数据解析model_info
if model3dInfo.ModelInfo != nil && *model3dInfo.ModelInfo != "" {
2023-06-20 08:38:03 +00:00
2023-06-20 10:05:29 +00:00
}*/
2023-06-20 08:38:03 +00:00
return resp.SetStatus(basic.CodeOK)
}