|
@@ -6,6 +6,7 @@ import (
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
"eta/eta_mini_ht_api/common/utils/date"
|
|
"eta/eta_mini_ht_api/common/utils/date"
|
|
"eta/eta_mini_ht_api/common/utils/page"
|
|
"eta/eta_mini_ht_api/common/utils/page"
|
|
|
|
+ permissionService "eta/eta_mini_ht_api/domian/config"
|
|
mediaService "eta/eta_mini_ht_api/domian/media"
|
|
mediaService "eta/eta_mini_ht_api/domian/media"
|
|
reportService "eta/eta_mini_ht_api/domian/report"
|
|
reportService "eta/eta_mini_ht_api/domian/report"
|
|
userService "eta/eta_mini_ht_api/domian/user"
|
|
userService "eta/eta_mini_ht_api/domian/user"
|
|
@@ -43,12 +44,12 @@ type HotRankedReport struct {
|
|
CoverUrl string `json:"coverUrl"`
|
|
CoverUrl string `json:"coverUrl"`
|
|
}
|
|
}
|
|
|
|
|
|
-type PermissionNode struct {
|
|
|
|
- ID int `json:"id"`
|
|
|
|
- Name string `json:"name"`
|
|
|
|
- ParentID int `json:"parentId"`
|
|
|
|
- Children []*PermissionNode `json:"children,omitempty"`
|
|
|
|
-}
|
|
|
|
|
|
+//type PermissionNode struct {
|
|
|
|
+// ID int `json:"id"`
|
|
|
|
+// Name string `json:"name"`
|
|
|
|
+// ParentID int `json:"parentId"`
|
|
|
|
+// Children []*PermissionNode `json:"children,omitempty"`
|
|
|
|
+//}
|
|
|
|
|
|
type RecordCount struct {
|
|
type RecordCount struct {
|
|
UserId int
|
|
UserId int
|
|
@@ -310,36 +311,36 @@ func getReportPermissionsMap(id int, source string) (permissionMap map[int]strin
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-func GetPermissionList() (root *PermissionNode, err error) {
|
|
|
|
- list, err := reportService.GetPermissionList()
|
|
|
|
- if err != nil {
|
|
|
|
- logger.Error("获取品种列表失败:%v", err)
|
|
|
|
- err = exception.New(exception.GetPermissionListFailed)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- root = &PermissionNode{
|
|
|
|
- ID: 0,
|
|
|
|
- ParentID: 0,
|
|
|
|
- }
|
|
|
|
- assemblePermissionNode(list, root, 0, 2)
|
|
|
|
- return
|
|
|
|
|
|
+func GetPermissionList() (root *permissionService.PermissionNode, err error) {
|
|
|
|
+ return permissionService.GetPermissionList()
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // logger.Error("获取品种列表失败:%v", err)
|
|
|
|
+ // err = exception.New(exception.GetPermissionListFailed)
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ ////root = &PermissionNode{
|
|
|
|
+ //// ID: 0,
|
|
|
|
+ //// ParentID: 0,
|
|
|
|
+ ////}
|
|
|
|
+ ////assemblePermissionNode(list, root, 0, 2)
|
|
|
|
+ //return
|
|
}
|
|
}
|
|
|
|
|
|
-func assemblePermissionNode(list []reportService.PermissionDTO, node *PermissionNode, current int, level int) {
|
|
|
|
- if node != nil && current < level {
|
|
|
|
- for _, permission := range list {
|
|
|
|
- if permission.ParentID == node.ID {
|
|
|
|
- childNode := &PermissionNode{
|
|
|
|
- ID: permission.ID,
|
|
|
|
- Name: permission.Name,
|
|
|
|
- ParentID: permission.ParentID,
|
|
|
|
- }
|
|
|
|
- node.Children = append(node.Children, childNode)
|
|
|
|
- assemblePermissionNode(list, childNode, current+1, level)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// func assemblePermissionNode(list []reportService.PermissionDTO, node *PermissionNode, current int, level int) {
|
|
|
|
+// if node != nil && current < level {
|
|
|
|
+// for _, permission := range list {
|
|
|
|
+// if permission.ParentID == node.ID {
|
|
|
|
+// childNode := &PermissionNode{
|
|
|
|
+// ID: permission.ID,
|
|
|
|
+// Name: permission.Name,
|
|
|
|
+// ParentID: permission.ParentID,
|
|
|
|
+// }
|
|
|
|
+// node.Children = append(node.Children, childNode)
|
|
|
|
+// assemblePermissionNode(list, childNode, current+1, level)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
func convertToHotRankedReport(dto reportService.ReportDTO) (report HotRankedReport) {
|
|
func convertToHotRankedReport(dto reportService.ReportDTO) (report HotRankedReport) {
|
|
src, err := mediaService.GetImageSrc(dto.CoverSrc)
|
|
src, err := mediaService.GetImageSrc(dto.CoverSrc)
|
|
if err != nil {
|
|
if err != nil {
|