40 lines
974 B
Go
40 lines
974 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"lone-services/rpc/order/pb"
|
|
"lone-services/services/order/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type ItemsLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
BaseLogic
|
|
}
|
|
|
|
func NewItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemsLogic {
|
|
return &ItemsLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *ItemsLogic) Items(in *order.OrderItemsRequest) (*order.Response, error) {
|
|
//调用其它服务实例
|
|
//cli, err := svc.GetRpcClient(l.svcCtx.ExpressSvcName)
|
|
//if err != nil {
|
|
// l.Logger.Errorf("get express rpc err: %v", err)
|
|
// //降级逻辑
|
|
// return l.out(utils.ErrorInternalServer, "express"+utils.ErrorInternalServer.Msg)
|
|
//}
|
|
//expClient := express.NewExpressClient(cli.Conn())
|
|
//res, _ := expClient.Ping(context.Background(), &express.Request{})
|
|
//l.Logger.Error("res: %v", res)
|
|
|
|
return &order.Response{}, nil
|
|
}
|