// Copyright 2019 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. package service import ( "context" "gd_service/apis" "gd_service/consts" "gd_service/errors" "gd_service/impl/thirdparty_impl" "gd_service/impl/thirdparty_impl/dybd" "gd_service/utils" dutils "gd_service/utils" gutils "gd_service/common.in/utils" ) // 学位 func X001(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) error { reqData := req.Data.(map[string]interface{}) xwzh := dutils.GetStringParams(reqData, "degree_id") name := dutils.GetStringParams(reqData, "name") if xwzh == "" || name == "" { return errors.ArgsError } err := errors.NoRecord var ret string respData := make(map[string]string) reply.Data = respData for groupNum, group := range req.ProviderGroup { rangeNo := groupNum + 1 for _, v := range group { tReq := &apis.ThirdpartRequest{ Ctx: ctx, ProviderApiCode: v, ProviderMap: req.ProviderMap, RangeNo: rangeNo, Req: req, Reply: reply, } switch v { // 学位证 case utils.ADMX01: tReq.Params = map[string]string{ "degree_id": xwzh, "name": name, } ret, err = thirdparty_impl.CallThirdparty(tReq) if err != nil { continue } gutils.Convertion(respData, ret) return nil case utils.DYXW: tReq.Params = map[string]string{ consts.DyBdX001P1: xwzh, consts.DyBdX001P2: name, } ret, err = thirdparty_impl.CallThirdparty(tReq) if err != nil { continue } dybd.GetDybdX001Data(ret,respData) return nil } } } return err }