liujiandao
2024-03-30 aeed976c2999e2cea097cdee38d8baeefe323f3d
controllers/location.go
@@ -68,7 +68,8 @@
   if params.PageInfo.Check() {
      search.SetPage(params.Page, params.PageSize)
   }
   list, total, err := search.SetKeyword(params.KeyWord).SetType(params.Type).SetJointName(params.JointName).SetOrder("created_at desc").Find()
   list, total, err := search.SetKeyword(params.KeyWord).SetType(params.Type).SetJointName(params.JointName).
      SetIsScrapLocation(params.IsScrapLocation).SetOrder("created_at desc").Find()
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "查找失败")
      return
@@ -98,6 +99,14 @@
      if location.ParentId == 0 {
         tree = append(tree, location)
      } else {
         if _, ok := m[location.ParentId]; !ok {
            tree = append(tree, location)
            continue
         }
         if m[location.ParentId].Children == nil {
            m[location.ParentId].Children = make([]*models.Location, 0)
         }
         m[location.ParentId].Children = append(m[location.ParentId].Children, location)
      }
   }