Compare commits

..

No commits in common. "5cc0d61e82cbe9069d0a70dcb21df7c2ccdd0371" and "51808626a99b700e7841e665dfe7538660255a30" have entirely different histories.

View File

@ -14,6 +14,7 @@ import (
"strings" "strings"
"git.zhangdeman.cn/zhangdeman/gopkg/util" "git.zhangdeman.cn/zhangdeman/gopkg/util"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
@ -173,7 +174,7 @@ func (df *DataFilter) formatRule() {
} }
// 数组层级深度不同,重新对对齐数据 // 数组层级深度不同,重新对对齐数据
diffArr := sourcePathArr[0 : len(sourcePathArr)-len(mapPathArr)+1] diffArr := sourcePathArr[0 : len(sourcePathArr)-len(mapPathArr)+1]
if newPath := df.dealDiffArr(diffArr, sourcePathArr[len(sourcePathArr)-len(mapPathArr)-1:], mapPathArr); len(newPath) > 0 { if newPath := df.dealDiffArr(diffArr); len(newPath) > 0 {
sourcePathArr[len(sourcePathArr)-len(mapPathArr)] = newPath sourcePathArr[len(sourcePathArr)-len(mapPathArr)] = newPath
item.SourceKey = strings.Join(sourcePathArr[len(sourcePathArr)-len(mapPathArr):], ".[].") item.SourceKey = strings.Join(sourcePathArr[len(sourcePathArr)-len(mapPathArr):], ".[].")
} }
@ -202,10 +203,11 @@ func (df *DataFilter) formatRule() {
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 5:04 下午 2022/1/25 // Date : 5:04 下午 2022/1/25
func (df *DataFilter) dealDiffArr(diffArr []string, sourceAfterArr []string, mapArr []string) string { func (df *DataFilter) dealDiffArr(diffArr []string) string {
if len(diffArr) == 0 { if len(diffArr) == 0 {
return "" return ""
} }
diffArrStr := strings.Join(diffArr, ".[].") diffArrStr := strings.Join(diffArr, ".[].")
if _, exist := df.hasDealDiffPath[diffArrStr]; exist { if _, exist := df.hasDealDiffPath[diffArrStr]; exist {
// 已经处理过, 不再重复处理 // 已经处理过, 不再重复处理