From 4c0a61be435bd40decf9ba49b383ed27224a09c1 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 18 Jun 2024 20:07:42 +0800 Subject: [PATCH] by Robin at 20240618 --- app/mix/controller/hvyogo_api.go | 6 +++--- app/mix/service/apiservice.go | 8 ++++++++ app/mix/service/hvyogoservice.go | 15 ++++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/mix/controller/hvyogo_api.go b/app/mix/controller/hvyogo_api.go index 22ab7605..51cdf892 100644 --- a/app/mix/controller/hvyogo_api.go +++ b/app/mix/controller/hvyogo_api.go @@ -16,7 +16,7 @@ func ApiHvyogoQueryAgreeState(ctx *gin.Context) { // 存入数据 data, ec := service.DefaultService.ApiHvyogoQueryAgreeState(ctx, req) - if ec != errcode.ErrCodeWorkerIdSrvOk { + if ec != errcode.ErrCodeHvyogoSrvOk { logger.Error("ApiHygQueryAgreeState fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return @@ -31,7 +31,7 @@ func ApiHvyogoWorkerFindDetail(ctx *gin.Context) { // 存入数据 data, ec := service.DefaultService.ApiHvyogoWorkerFindDetail(ctx, req) - if ec != errcode.ErrCodeWorkerIdSrvOk { + if ec != errcode.ErrCodeHvyogoSrvOk { logger.Error("ApiHygWorkerFindDetail fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return @@ -46,7 +46,7 @@ func ApiHvyogoSingleDistribute(ctx *gin.Context) { // 存入数据 data, ec := service.DefaultService.ApiHvyogoSingleDistribute(ctx, req) - if ec != errcode.ErrCodeWorkerIdSrvOk { + if ec != errcode.ErrCodeHvyogoSrvOk { logger.Error("ApiHygSingleDistribute fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index f9f7b7f3..bb2bf8c4 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3258,6 +3258,9 @@ func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collabo } func (s *Service) ApiHvyogoQueryAgreeState(ctx *gin.Context, req *hvyogoproto.ApiQueryAgreeStateReq) (data *hvyogoproto.ApiQueryAgreeStateData, ec errcode.ErrCode) { + + ec = errcode.ErrCodeHvyogoSrvOk + // 1.查询workerId workerId, err := _DefaultWorkerId.OpListByMid(ctx, &workeridproto.OpListByMidReq{ BaseRequest: req.BaseRequest, @@ -3295,6 +3298,9 @@ func (s *Service) ApiHvyogoQueryAgreeState(ctx *gin.Context, req *hvyogoproto.Ap } func (s *Service) ApiHvyogoWorkerFindDetail(ctx *gin.Context, req *hvyogoproto.ApiWorkerFindDetailReq) (data *hvyogoproto.ApiWorkerFindDetailData, ec errcode.ErrCode) { + + ec = errcode.ErrCodeHvyogoSrvOk + // 1.查询workerId workerId, err := _DefaultWorkerId.OpListByMid(ctx, &workeridproto.OpListByMidReq{ BaseRequest: req.BaseRequest, @@ -3333,6 +3339,8 @@ func (s *Service) ApiHvyogoWorkerFindDetail(ctx *gin.Context, req *hvyogoproto.A func (s *Service) ApiHvyogoSingleDistribute(ctx *gin.Context, req *hvyogoproto.ApiSingleDistributeReq) (data *hvyogoproto.ApiSingleDistributeData, ec errcode.ErrCode) { + ec = errcode.ErrCodeHvyogoSrvOk + // 1.查询workerId workerId, err := _DefaultWorkerId.OpListByMid(ctx, &workeridproto.OpListByMidReq{ BaseRequest: req.BaseRequest, diff --git a/app/mix/service/hvyogoservice.go b/app/mix/service/hvyogoservice.go index 7eda30b3..49ac2d51 100644 --- a/app/mix/service/hvyogoservice.go +++ b/app/mix/service/hvyogoservice.go @@ -118,11 +118,21 @@ func (s *HvyogoService) SingleDistribute(req *request.HYG10010001Req) (vo *hvyog func afterReceiving(resp []byte, vo any) (err error) { baseResponse := &response.HygBaseResponse{} + + err = json.Unmarshal(resp, vo) + if err != nil { + logger.Error("json Unmarshal fail, err: %v", err) + return + } + err = json.Unmarshal(resp, baseResponse) if err != nil { logger.Error("json Unmarshal fail, err: %v", err) return } + if baseResponse.StatusCode != response.StatusCodeSuccess { + return + } aesEncryptedStr, ok := baseResponse.Data.(string) if !ok { err = fmt.Errorf("type assertion fail") @@ -143,11 +153,6 @@ func afterReceiving(resp []byte, vo any) (err error) { logger.Error("json Unmarshal fail, err: %v", err) return } - err = json.Unmarshal(resp, vo) - if err != nil { - logger.Error("json Unmarshal fail, err: %v", err) - return - } return }