You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
722 B
31 lines
722 B
package service
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/go-kratos/kratos/v2/errors"
|
|
"valuation/internal/biz"
|
|
|
|
pb "valuation/api/valuation"
|
|
)
|
|
|
|
type ValuationService struct {
|
|
pb.UnimplementedValuationServer
|
|
vb *biz.ValuationBiz
|
|
}
|
|
|
|
func NewValuationService(vb *biz.ValuationBiz) *ValuationService {
|
|
return &ValuationService{
|
|
vb: vb,
|
|
}
|
|
}
|
|
|
|
func (s *ValuationService) GetEstimatePrice(ctx context.Context, req *pb.GetEstimatePriceReq) (*pb.GetEstimatePriceReply, error) {
|
|
distance, duration, err := s.vb.GetDrivingInfo(ctx, req.Origin, req.Destination)
|
|
if err != nil {
|
|
return nil, errors.New(200, "MAP ERROR", "get driving info error")
|
|
}
|
|
fmt.Println(distance, duration)
|
|
return &pb.GetEstimatePriceReply{}, nil
|
|
}
|