x002.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 X002(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) error {
  17. reqData := req.Data.(map[string]interface{})
  18. certificateid := dutils.GetStringParams(reqData, "education_id")
  19. name := dutils.GetStringParams(reqData, "name")
  20. if certificateid == "" || name == "" {
  21. return errors.ArgsError
  22. }
  23. err := errors.NoRecord
  24. var ret string
  25. respData := make(map[string]string)
  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. case utils.ADMX02:
  40. tReq.Params = map[string]string{
  41. "education_id": certificateid,
  42. "name": name,
  43. }
  44. ret, err = thirdparty_impl.CallThirdparty(tReq)
  45. if err != nil {
  46. continue
  47. }
  48. gutils.Convertion(respData, ret)
  49. return nil
  50. // 学位证
  51. case utils.DYXL:
  52. tReq.Params = map[string]string{
  53. consts.DyBdX002P1: certificateid,
  54. consts.DyBdX002P2: name,
  55. }
  56. ret, err = thirdparty_impl.CallThirdparty(tReq)
  57. if err != nil {
  58. continue
  59. }
  60. dybd.GetDybdX002Data(ret,respData)
  61. return nil
  62. }
  63. }
  64. }
  65. return err
  66. }