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 CarDelLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
*slog.Logger
|
||||
}
|
||||
|
||||
func NewCarDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CarDelLogic {
|
||||
return &CarDelLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
Logger: logging.Context(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,14 +35,14 @@ func (l *CarDelLogic) CarDel(in *delivery.IdentRequest) (*delivery.StatusReply,
|
||||
return nil, err
|
||||
}
|
||||
if in.GetIdentity() == "" {
|
||||
return nil, exception.ErrInvalidArgument
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
//Todo: 删除是是否判定有未完成订单不能删除
|
||||
|
||||
err = models.DBService.Where("identity = ?", in.Identity).Delete(&models.DeliveryCar{}).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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user