fix comb298y
This commit is contained in:
parent
9d1fdd8669
commit
abe8e8ce5b
2
aes.go
2
aes.go
@ -96,7 +96,7 @@ func main() {
|
|||||||
|
|
||||||
var data interface{}
|
var data interface{}
|
||||||
|
|
||||||
decrypt, err := AesDecrypt("gSSLA3V+MoabjTyPiCvYC6bg7TLk+ja/Zly3R8wjpK/xPC6ZK0QCwdpu9kGEuUVKdfOU2IU46Q6kSZHXmpF8MdXEa0NKNh85yhlFQVy0U2jJkTxojvoM+1Y/iZlVZpFrThUc4uu+iUSm3kzXTikM9sizYmLUcaO86ad7PfvQvT4=", key)
|
decrypt, err := AesDecrypt("gSSLA3V+MoabjTyPiCvYC6bg7TLk+ja/Zly3R8wjpK/xPC6ZK0QCwdpukGEuUVKdfOU2IU46Q6kSZHXmpF8MdXEa0NKNh85yhlFQVy0U2jJkTxojvoM+1Y/iZlVZpFrx91n7+KdtZkVWkXSZk5eJcizYmLUcaO86ad7PfvQvT4=", key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("解密错误:", err)
|
fmt.Println("解密错误:", err)
|
||||||
return
|
return
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package COMB
|
package COMB
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"tianyuan-api/apps/api/internal/common"
|
"tianyuan-api/apps/api/internal/common"
|
||||||
@ -187,7 +189,35 @@ func (l *COMB298YLogic) COMB298Y(req *types.Request) (resp string, err *errs.App
|
|||||||
respData, err = l.svcCtx.WestDexService.CallAPI(req.SourceId, req.Request, l.svcCtx.Config.WestConfig.SecretId)
|
respData, err = l.svcCtx.WestDexService.CallAPI(req.SourceId, req.Request, l.svcCtx.Config.WestConfig.SecretId)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logx.Errorf("西部请求失败:sourceId:%s,err:%v, resp:%s", req.SourceId, err, string(respData))
|
// 尝试解析响应数据
|
||||||
|
var respStr string
|
||||||
|
if len(respData) > 0 {
|
||||||
|
// 先尝试解析为 JSON
|
||||||
|
var prettyJSON bytes.Buffer
|
||||||
|
if err := json.Indent(&prettyJSON, respData, "", " "); err == nil {
|
||||||
|
respStr = prettyJSON.String()
|
||||||
|
} else {
|
||||||
|
// 如果不是 JSON,检查是否是字符串形式的数组
|
||||||
|
strData := string(respData)
|
||||||
|
if strings.HasPrefix(strData, "[") && strings.HasSuffix(strData, "]") {
|
||||||
|
// 尝试解析为数组
|
||||||
|
var arr []int
|
||||||
|
if err := json.Unmarshal(respData, &arr); err == nil {
|
||||||
|
// 如果是数字数组,转换为字符串
|
||||||
|
var sb strings.Builder
|
||||||
|
for _, v := range arr {
|
||||||
|
sb.WriteByte(byte(v))
|
||||||
|
}
|
||||||
|
respStr = sb.String()
|
||||||
|
} else {
|
||||||
|
respStr = strData
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
respStr = strData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logx.Errorf("西部请求失败:sourceId:%s,err:%v, resp:%s", req.SourceId, err, respStr)
|
||||||
if appErr, ok := err.(*errs.AppError); ok {
|
if appErr, ok := err.(*errs.AppError); ok {
|
||||||
callAPIErr = appErr
|
callAPIErr = appErr
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user