package service import ( "context" "github.com/go-kratos/kratos/v2/errors" "map/internal/biz" pb "map/api/mapService" ) type MapServiceService struct { pb.UnimplementedMapServiceServer msbiz *biz.MapServiceBiz } func NewMapServiceService(mz *biz.MapServiceBiz) *MapServiceService { return &MapServiceService{ msbiz: mz, } } func (this *MapServiceService) GetDrivingInfo(ctx context.Context, req *pb.GetDrivingInfoReq) (*pb.GetDrivingInfoReply, error) { distance, duration, err := this.msbiz.GetDriverInfo(req.Origin, req.Destination) if err != nil { return nil, errors.New(200, "LBS_ERROR", "lbs api error") } return &pb.GetDrivingInfoReply{ Origin: req.Origin, Destination: req.Destination, Distance: distance, Duration: duration, }, nil }