This commit is contained in:
liangzai 2024-12-30 19:09:10 +08:00
parent 7309ef704d
commit e96f8a5c8d
4 changed files with 10 additions and 5 deletions

View File

@ -65,7 +65,7 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告查询, 查找订单错误: %+v", err) return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告查询, 查找订单错误: %+v", err)
} }
} }
if order.Status == "failed" { if order.Status != "paid" {
return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.LOGIC_QUERY_ERROR, ""), "") return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.LOGIC_QUERY_ERROR, ""), "")
} }
// 获取报告信息 // 获取报告信息

View File

@ -62,7 +62,7 @@ func (l *QueryDetailByOrderNoLogic) QueryDetailByOrderNo(req *types.QueryDetailB
} }
} }
if order.Status != "paid" { if order.Status != "paid" {
return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.LOGIC_QUERY_WAIT, ""), "") return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.LOGIC_QUERY_ERROR, ""), "")
} }
// 获取报告信息 // 获取报告信息
queryModel, err := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, order.Id) queryModel, err := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, order.Id)

View File

@ -9,7 +9,6 @@ import (
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
"io" "io"
"log"
"net/http" "net/http"
"net/url" "net/url"
"qnc-server/app/user/cmd/api/internal/config" "qnc-server/app/user/cmd/api/internal/config"
@ -364,7 +363,6 @@ func (a *ApiRequestService) ProcessG35SC01Request(params []byte) ([]byte, error)
}, },
} }
resp, callApiErr := a.westDexService.CallAPI("G35SC01", request) resp, callApiErr := a.westDexService.CallAPI("G35SC01", request)
log.Println(string(resp))
if callApiErr != nil { if callApiErr != nil {
return nil, callApiErr return nil, callApiErr
} }
@ -386,13 +384,16 @@ func (a *ApiRequestService) ProcessG35SC01Request(params []byte) ([]byte, error)
return nil, fmt.Errorf("内层 data 字段不存在或类型错误") return nil, fmt.Errorf("内层 data 字段不存在或类型错误")
} }
if innerData == "" || innerData == "{}" || innerData == "[]" {
innerData = "{}"
}
// 第四步:解析内层 data 的 JSON 字符串 // 第四步:解析内层 data 的 JSON 字符串
var finalDataMap map[string]interface{} var finalDataMap map[string]interface{}
if err := json.Unmarshal([]byte(innerData), &finalDataMap); err != nil { if err := json.Unmarshal([]byte(innerData), &finalDataMap); err != nil {
return nil, fmt.Errorf("解析内层 data 字段失败: %v", err) return nil, fmt.Errorf("解析内层 data 字段失败: %v", err)
} }
// 将最终的 JSON 对象编码为字节数组返回
finalDataBytes, err := json.Marshal(finalDataMap) finalDataBytes, err := json.Marshal(finalDataMap)
if err != nil { if err != nil {
return nil, fmt.Errorf("编码最终的 JSON 对象失败: %v", err) return nil, fmt.Errorf("编码最终的 JSON 对象失败: %v", err)

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"github.com/pkg/errors" "github.com/pkg/errors"
"io" "io"
"log"
"net/http" "net/http"
"qnc-server/app/user/cmd/api/internal/config" "qnc-server/app/user/cmd/api/internal/config"
"qnc-server/pkg/lzkit/crypto" "qnc-server/pkg/lzkit/crypto"
@ -98,6 +99,7 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
return nil, DecryptErr return nil, DecryptErr
} }
return decryptedData, errors.New(westDexResp.Message) return decryptedData, errors.New(westDexResp.Message)
log.Println(string(decryptedData))
} }
if westDexResp.Data == "" { if westDexResp.Data == "" {
return nil, errors.New(westDexResp.Message) return nil, errors.New(westDexResp.Message)
@ -108,6 +110,8 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
return nil, DecryptErr return nil, DecryptErr
} }
// 输出解密后的数据 // 输出解密后的数据
log.Println(string(decryptedData))
return decryptedData, nil return decryptedData, nil
} }