|
@@ -55,7 +55,7 @@ func GetIndexFromJiaYue(indexCode string, sourceArr []string) (data *response.In
|
|
|
indexData []jiayue.DictData
|
|
|
dictMenu []jiayue.DictCategory
|
|
|
)
|
|
|
- data = FormatItem2Resp(index, indexData, dictMenu)
|
|
|
+ data = FormatJiaYueIndexItem2Resp(index, indexData, dictMenu)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -131,7 +131,7 @@ func GetIndexAndDataFromJiaYue(indexCode, startDate, endDate string, sourceArr [
|
|
|
err = fmt.Errorf("GetDictCategory err: %s", e.Error())
|
|
|
return
|
|
|
}
|
|
|
- data = FormatItem2Resp(index, indexData, menus)
|
|
|
+ data = FormatJiaYueIndexItem2Resp(index, indexData, menus)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -251,14 +251,14 @@ func GetNewIndexAndDataFromJiaYue() (indexList []*response.IndexResp, err error)
|
|
|
indexData []jiayue.DictData
|
|
|
dictMenu []jiayue.DictCategory
|
|
|
)
|
|
|
- item := FormatItem2Resp(v, indexData, dictMenu)
|
|
|
+ item := FormatJiaYueIndexItem2Resp(v, indexData, dictMenu)
|
|
|
indexList = append(indexList, item)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// FormatItem2Resp 格式化指标响应体
|
|
|
-func FormatItem2Resp(item jiayue.DictIndex, dictData []jiayue.DictData, dictMenu []jiayue.DictCategory) (res *response.IndexResp) {
|
|
|
+// FormatJiaYueIndexItem2Resp 格式化指标响应体
|
|
|
+func FormatJiaYueIndexItem2Resp(item jiayue.DictIndex, dictData []jiayue.DictData, dictMenu []jiayue.DictCategory) (res *response.IndexResp) {
|
|
|
res = new(response.IndexResp)
|
|
|
res.Id = item.Id
|
|
|
res.IndexCode = item.Code
|
|
@@ -280,15 +280,23 @@ func FormatItem2Resp(item jiayue.DictIndex, dictData []jiayue.DictData, dictMenu
|
|
|
}
|
|
|
if len(dictMenu) > 0 {
|
|
|
firstMenu := dictMenu[0]
|
|
|
- res.MenuData.Id = firstMenu.Id
|
|
|
- res.MenuData.Type = firstMenu.Type
|
|
|
- res.MenuData.Code = firstMenu.Code
|
|
|
- res.MenuData.Name = firstMenu.Name
|
|
|
- res.MenuData.Icon = firstMenu.Icon
|
|
|
- res.MenuData.Sort = firstMenu.Sorting
|
|
|
- res.MenuData.ParentId = firstMenu.ParentId
|
|
|
- res.MenuData.ParentName = firstMenu.ParentName
|
|
|
- res.MenuData.Path = firstMenu.Path
|
|
|
+ r := FormatJiaYueDictCategory2Resp(firstMenu)
|
|
|
+ res.MenuData = *r
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// FormatJiaYueDictCategory2Resp 格式化指标目录响应体
|
|
|
+func FormatJiaYueDictCategory2Resp(item jiayue.DictCategory) (res *response.IndexMenuData) {
|
|
|
+ res = new(response.IndexMenuData)
|
|
|
+ res.Id = item.Id
|
|
|
+ res.Type = item.Type
|
|
|
+ res.Code = item.Code
|
|
|
+ res.Name = item.Name
|
|
|
+ res.Icon = item.Icon
|
|
|
+ res.Sort = item.Sorting
|
|
|
+ res.ParentId = item.ParentId
|
|
|
+ res.ParentName = item.ParentName
|
|
|
+ res.Path = item.Path
|
|
|
+ return
|
|
|
+}
|