1
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"sort"
|
||||
@@ -322,7 +323,6 @@ func genNormalHavePageResultParser(dataKey string) (handler PageResultParser) {
|
||||
}
|
||||
|
||||
result = result0
|
||||
|
||||
if totalCount == 0 {
|
||||
for _, totalCountKey := range havePageTotalCountKeys {
|
||||
if totalCount2, ok := result[totalCountKey]; ok {
|
||||
@@ -398,7 +398,9 @@ func (a *API) AccessAPIHavePage(apiStr string, jdParams map[string]interface{},
|
||||
var data map[string]interface{}
|
||||
encryptData, err := JDDecodeToData(a.appSecret, jsonResult["encryptData"].(string))
|
||||
|
||||
if err := utils.UnmarshalUseNumber([]byte(encryptData), &data); err != nil {
|
||||
if err := utils.UnmarshalUseNumber(encryptData, &data); err != nil {
|
||||
globals.SugarLogger.Errorf("err 1 := %s", err.Error())
|
||||
globals.SugarLogger.Errorf("jsonResult=========:= %s", utils.Format4Output(jsonResult, false))
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
innerCode := forceInnerCode2Str(data["code"])
|
||||
@@ -465,16 +467,16 @@ func JdMap2StructByJson(inObj interface{}, outObjAddr interface{}, weaklyTypedIn
|
||||
return utils.Map2Struct(inObj, outObjAddr, true, "", JavaDateHook)
|
||||
}
|
||||
|
||||
func JDDecodeToData(appSecret, data string) (string, error) {
|
||||
func JDDecodeToData(appSecret, data string) ([]byte, error) {
|
||||
key := appSecret[:16]
|
||||
iv := appSecret[16:32]
|
||||
sDec, err := base64.StdEncoding.DecodeString(data)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
resp, err := utils.AESCBCDecpryt(sDec, []byte(key), []byte(iv))
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
return string(resp), nil
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user