x003.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package service
  4. import (
  5. "context"
  6. "gd_service/apis"
  7. "gd_service/consts"
  8. "gd_service/errors"
  9. "gd_service/impl/thirdparty_impl"
  10. "gd_service/impl/thirdparty_impl/dybd"
  11. "gd_service/utils"
  12. dutils "gd_service/utils"
  13. gutils "gd_service/common.in/utils"
  14. )
  15. // 全国个人学历信息查询数据
  16. func X003(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) error {
  17. reqData := req.Data.(map[string]interface{})
  18. idCard := dutils.GetStringParams(reqData, "id_card")
  19. name := dutils.GetStringParams(reqData, "name")
  20. if idCard == "" || name == "" {
  21. return errors.ArgsError
  22. }
  23. var err error
  24. var ret string
  25. respData := make(map[string]interface{})
  26. reply.Data = respData
  27. for groupNum, group := range req.ProviderGroup {
  28. rangeNo := groupNum + 1
  29. for _, v := range group {
  30. tReq := &apis.ThirdpartRequest{
  31. Ctx: ctx,
  32. ProviderApiCode: v,
  33. ProviderMap: req.ProviderMap,
  34. RangeNo: rangeNo,
  35. Req: req,
  36. Reply: reply,
  37. }
  38. switch v {
  39. // 学位证
  40. case utils.ADMX03:
  41. tReq.Params = map[string]string{
  42. "id_card": idCard,
  43. "name": name,
  44. }
  45. ret, err = thirdparty_impl.CallThirdparty(tReq)
  46. if err != nil {
  47. continue
  48. }
  49. respData["list"] = gutils.ConvertionSlice(ret)
  50. return nil
  51. case utils.DYXLALL:
  52. tReq.Params = map[string]string{
  53. consts.DyBdX003P1: idCard,
  54. consts.DyBdX003P2: name,
  55. "type":"education",
  56. "code":"JxeBPTiyZY",
  57. }
  58. ret, err = thirdparty_impl.CallThirdparty(tReq)
  59. if err != nil {
  60. continue
  61. }
  62. respData["list"] = dybd.GetDybdX003Data(ret)
  63. return nil
  64. }
  65. }
  66. }
  67. return err
  68. }
  69. //cb87881b6fa5ee9dfb4b0828d22e5fa9