refactor all service dependency injection
This commit is contained in:
@@ -4,8 +4,10 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/order/internal/impl"
|
||||
"bsm/full/module/ec/order/internal/models"
|
||||
pb "bsm/full/module/ec/order/pb"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
@@ -23,7 +25,7 @@ func Cancel(ctx context.Context, in *pb.CancelRequest) (reply *pb.OrderStatusRep
|
||||
summary = new(models.OrderSummary)
|
||||
)
|
||||
|
||||
err = models.DBService.Where("order_no = ?", in.OrderNo).First(&summary).Error
|
||||
err = impl.DBService.Where("order_no = ?", in.OrderNo).First(&summary).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
@@ -36,14 +38,14 @@ func Cancel(ctx context.Context, in *pb.CancelRequest) (reply *pb.OrderStatusRep
|
||||
}
|
||||
values.Status = -1
|
||||
|
||||
err := models.DBService.Where("order_no = ?", in.OrderNo).Updates(values).Error
|
||||
err := impl.DBService.Where("order_no = ?", in.OrderNo).Updates(values).Error
|
||||
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
err = models.DBService.Model(&models.OrderCoupon{}).Where("identity=?", summary.CouponIdentity).Update("status", 2).Error
|
||||
err = impl.DBService.Model(&models.OrderCoupon{}).Where("identity=?", summary.CouponIdentity).Update("status", 2).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
|
||||
Reference in New Issue
Block a user