x001.go 1.6 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 X001(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) error {
  17. reqData := req.Data.(map[string]interface{})
  18. xwzh := dutils.GetStringParams(reqData, "degree_id")
  19. name := dutils.GetStringParams(reqData, "name")
  20. if xwzh == "" || 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. // 学位证
  40. case utils.ADMX01:
  41. tReq.Params = map[string]string{
  42. "degree_id": xwzh,
  43. "name": name,
  44. }
  45. ret, err = thirdparty_impl.CallThirdparty(tReq)
  46. if err != nil {
  47. continue
  48. }
  49. gutils.Convertion(respData, ret)
  50. return nil
  51. case utils.DYXW:
  52. tReq.Params = map[string]string{
  53. consts.DyBdX001P1: xwzh,
  54. consts.DyBdX001P2: name,
  55. }
  56. ret, err = thirdparty_impl.CallThirdparty(tReq)
  57. if err != nil {
  58. continue
  59. }
  60. dybd.GetDybdX001Data(ret,respData)
  61. return nil
  62. }
  63. }
  64. }
  65. return err
  66. }