Browse Source

test: 共享报告回调

hsun 5 months ago
parent
commit
3c4e2e90de
1 changed files with 4 additions and 4 deletions
  1. 4 4
      services/report_outer.go

+ 4 - 4
services/report_outer.go

@@ -31,11 +31,10 @@ type OuterReportCallBackResp struct {
 
 // OuterReportCallBack 外部报告回调(提交审批)
 func OuterReportCallBack(outReportId int, title, fileUrl, fileType string) (err error) {
-	var requestUrl string
-	var params string
+	var requestUrl, params, respBody string
 	defer func() {
 		if err != nil {
-			tips := fmt.Sprintf("OuterReportCallBack-外部报告回调失败, Url: %s, Request: %s, ErrMsg: %v", requestUrl, params, err)
+			tips := fmt.Sprintf("OuterReportCallBack-外部报告回调失败, Url: %s, Request: %s, Resp: %s, ErrMsg: %v", requestUrl, params, respBody, err)
 			fmt.Println(tips)
 			utils.FileLog.Info(tips)
 			return
@@ -77,12 +76,13 @@ func OuterReportCallBack(outReportId int, title, fileUrl, fileType string) (err
 		err = fmt.Errorf("接口请求失败, %v", e)
 		return
 	}
+	respBody = string(resByte)
 	var resp OuterReportCallBackResp
 	if e := json.Unmarshal(resByte, &resp); e != nil {
 		err = fmt.Errorf("响应JSON解析失败, %v", e)
 		return
 	}
-	if resp.Code != 0 {
+	if resp.Code != 200 {
 		err = fmt.Errorf("回调失败, Code: %d, Msg: %s", resp.Code, resp.Msg)
 		return
 	}