refactor all service dependency injection
This commit is contained in:
@@ -3,8 +3,10 @@ package cart
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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"
|
||||
@@ -26,7 +28,7 @@ func Fetch(ctx context.Context, in *pb.CartGetRequest) (reply *pb.CartGetReply,
|
||||
}
|
||||
}
|
||||
// 查询购物车数据
|
||||
err = models.DBService.Where("cart_identity=? or passport_identity=?", in.GetCarIdentity(), auth.Identity).Find(&cart).Error
|
||||
err = impl.DBService.Where("cart_identity=? or passport_identity=?", in.GetCarIdentity(), auth.Identity).Find(&cart).Error
|
||||
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
@@ -35,7 +37,7 @@ func Fetch(ctx context.Context, in *pb.CartGetRequest) (reply *pb.CartGetReply,
|
||||
|
||||
for _, item := range cart {
|
||||
product := models.Product{}
|
||||
err := models.DBService.Raw(`
|
||||
err := impl.DBService.Raw(`
|
||||
SELECT
|
||||
p.id, p.identity, p.title, p.cover_image, p.args, p.cost_price,
|
||||
( SELECT MIN(mps.price)
|
||||
|
||||
Reference in New Issue
Block a user