center.go 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package query
  2. import (
  3. "context"
  4. "strings"
  5. "adm-data/errors"
  6. v1 "adm-data/pb/v1"
  7. )
  8. func Query(ctx context.Context, req *v1.QueryRequest) (reply *v1.QueryResponse, err error) {
  9. interfaces := map[string]func(ctx context.Context, params string) (reply *v1.QueryResponse, err error){
  10. "P01": BrandList,
  11. "P02": SeriesList,
  12. "P03": StyleList,
  13. "P04": SearchStyle,
  14. "P05": p05,
  15. "P06": p06,
  16. "P07": SearchStyleMapping,
  17. "P08": p08,
  18. "P09": p09,
  19. "P10": p10,
  20. "A01": PlateVIN,
  21. "A02": VINBasicInfo,
  22. "A03": ModelSearch,
  23. "V01": PlateOwner,
  24. "IS01": InsuranceDate,
  25. "V02": V02,
  26. "U01": U01,
  27. "A04": a04,
  28. "A05": a05,
  29. "P11": p11,
  30. }
  31. if v, ok := interfaces[strings.ToUpper(req.Code)]; ok {
  32. return v(ctx, req.Params)
  33. }
  34. return reply, errors.InterfaceNoExistError
  35. }