fix
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
|
||||
"context"
|
||||
|
||||
"fusenapi/server/product-model/internal/svc"
|
||||
"fusenapi/server/product-model/internal/types"
|
||||
@@ -30,17 +28,7 @@ func NewGetModelDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetModelDetailLogic) GetModelDetail(req *types.GetModelDetailReq, r *http.Request) (resp *basic.Response) {
|
||||
authKey := r.Header.Get("Auth-Key")
|
||||
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")
|
||||
}
|
||||
func (l *GetModelDetailLogic) GetModelDetail(req *types.GetModelDetailReq, userInfo *auth.BackendUserInfo) (resp *basic.Response) {
|
||||
if req.ModelId <= 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "param model_id is required")
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
|
||||
"context"
|
||||
|
||||
"fusenapi/server/product-model/internal/svc"
|
||||
"fusenapi/server/product-model/internal/types"
|
||||
@@ -31,17 +28,7 @@ func NewGetModelOtherInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetModelOtherInfoLogic) GetModelOtherInfo(req *types.GetModelOtherInfoReq, r *http.Request) (resp *basic.Response) {
|
||||
authKey := r.Header.Get("Auth-Key")
|
||||
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")
|
||||
}
|
||||
func (l *GetModelOtherInfoLogic) GetModelOtherInfo(req *types.GetModelOtherInfoReq, userInfo *auth.BackendUserInfo) (resp *basic.Response) {
|
||||
//获取所有灯光列表
|
||||
modelLightList, err := l.svcCtx.AllModels.FsProductModel3dLight.GetAll(l.ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -33,17 +33,7 @@ func NewUpdateProductModelLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateProductModelLogic) UpdateProductModel(req *types.UpdateProductModelReq, r *http.Request) (resp *basic.Response) {
|
||||
authKey := r.Header.Get("Auth-Key")
|
||||
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")
|
||||
}
|
||||
func (l *UpdateProductModelLogic) UpdateProductModel(req *types.UpdateProductModelReq, userInfo *auth.BackendUserInfo) (resp *basic.Response) {
|
||||
if req.ModelData.Id <= 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "modelData`s id is required")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user