refactor: centralize protobuf and remove go-zero
This commit is contained in:
@@ -3,26 +3,28 @@ package deliverylogic
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.apinb.com/bsm-sdk/engine/exception"
|
||||
"git.apinb.com/bsm-sdk/engine/service"
|
||||
"bsm/full/module/ec/delivery/external/pb/delivery"
|
||||
"bsm/full/module/ec/delivery/internal/models"
|
||||
"bsm/full/module/ec/delivery/internal/svc"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"log/slog"
|
||||
|
||||
"bsm/full/shared/logging"
|
||||
)
|
||||
|
||||
type CarSetLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
*slog.Logger
|
||||
}
|
||||
|
||||
func NewCarSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CarSetLogic {
|
||||
return &CarSetLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
Logger: logging.Context(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,35 +51,35 @@ func (l *CarSetLogic) CarSet(in *delivery.CarItem) (*delivery.StatusReply, error
|
||||
err = models.DBService.Where("identity = ?", in.Identity).Updates(&data).Error
|
||||
if err != nil {
|
||||
l.Logger.Error(err.Error())
|
||||
return nil, exception.ErrDBFatal
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &delivery.StatusReply{Status: 200, Identity: in.Identity, Message: ""}, nil
|
||||
}
|
||||
func carSetChick(in *delivery.CarItem) error {
|
||||
if in.GetIdentity() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
if in.GetBrand() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
if in.GetPhone() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
// if in.GetTeamIdentity() == "" {
|
||||
// return exception.ErrInvalidArgument
|
||||
// return errcode.ErrInvalidArgument
|
||||
// }
|
||||
if in.GetContacts() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
if in.GetVersion() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
if in.GetPicture() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
if in.GetLicenseNumber() == "" {
|
||||
return exception.ErrInvalidArgument
|
||||
return errcode.ErrInvalidArgument
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user