fix
This commit is contained in:
@@ -2,12 +2,14 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/server/canteen/internal/svc"
|
||||
"fusenapi/server/canteen/internal/types"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -35,12 +37,12 @@ func (l *GetCanteenDetailLogic) GetCanteenDetail(req *types.GetCanteenDetailReq,
|
||||
canteenTypeModel := gmodel.NewFsCanteenTypeModel(l.svcCtx.MysqlConn)
|
||||
canteenTypeInfo, err := canteenTypeModel.FindOne(l.ctx, req.Id)
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "canteen type is not exists ")
|
||||
}
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get canteen type info ")
|
||||
}
|
||||
if canteenTypeInfo.Id == 0 {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "canteen type is not exists ")
|
||||
}
|
||||
//获取餐厅类型关联的所有产品
|
||||
canteenProductModel := gmodel.NewFsCanteenProductModel(l.svcCtx.MysqlConn)
|
||||
canteenProductList, err := canteenProductModel.GetAllByCanteenTypeId(l.ctx, req.Id)
|
||||
|
||||
Reference in New Issue
Block a user