fix
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"context"
|
||||
"fusenapi/utils/basic"
|
||||
"net/http"
|
||||
|
||||
"fusenapi/server/product-templatev2/internal/svc"
|
||||
"fusenapi/server/product-templatev2/internal/types"
|
||||
@@ -26,9 +25,41 @@ func NewGetTemplatevDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetTemplatevDetailLogic) GetTemplatevDetail(req *types.GetTemplatevDetailReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||
// userinfo 传入值时, 一定不为null
|
||||
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 != "" {
|
||||
|
||||
}*/
|
||||
return resp.SetStatus(basic.CodeOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user