|
@@ -180,8 +180,12 @@ func (this *ReportController) ListReport() {
|
|
pvMap := make(map[int]int)
|
|
pvMap := make(map[int]int)
|
|
uvMap := make(map[int]int)
|
|
uvMap := make(map[int]int)
|
|
reportIdArr := make([]int, 0)
|
|
reportIdArr := make([]int, 0)
|
|
- syncReportIdArr := make([]string, 0)
|
|
+ syncReportIdArr := make([]string, 0)
|
|
- oldAndNewReportIdMap := make(map[int]int)
|
|
+ oldAndNewReportIdMap := make(map[int]int)
|
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
|
+ classifyIdMap := make(map[int]bool)
|
|
|
|
+ classifyMap := make(map[int]*models.Classify)
|
|
|
|
+
|
|
for i := 0; i < listLen; i++ {
|
|
for i := 0; i < listLen; i++ {
|
|
reportIdArr = append(reportIdArr, list[i].Id)
|
|
reportIdArr = append(reportIdArr, list[i].Id)
|
|
if list[i].OldReportId > 0 && list[i].ReportLayout == 1 {
|
|
if list[i].OldReportId > 0 && list[i].ReportLayout == 1 {
|
|
@@ -190,6 +194,22 @@ func (this *ReportController) ListReport() {
|
|
}
|
|
}
|
|
pvMap[list[i].Id] = list[i].Pv
|
|
pvMap[list[i].Id] = list[i].Pv
|
|
uvMap[list[i].Id] = list[i].Uv
|
|
uvMap[list[i].Id] = list[i].Uv
|
|
|
|
+
|
|
|
|
+ if list[i].ClassifyIdFirst > 0 {
|
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdFirst]; !ok {
|
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdFirst)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if list[i].ClassifyIdSecond > 0 {
|
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdSecond]; !ok {
|
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdSecond)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if list[i].ClassifyIdThird > 0 {
|
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdThird]; !ok {
|
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdThird)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -208,6 +228,18 @@ func (this *ReportController) ListReport() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if len(classifyIdList) > 0 {
|
|
|
|
+ classifyList, e := models.GetClassifyListByIdList(classifyIdList)
|
|
|
|
+ if e != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取报告分类失败, Err: " + e.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range classifyList {
|
|
|
|
+ classifyMap[v.Id] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -254,6 +286,26 @@ func (this *ReportController) ListReport() {
|
|
list[i].ChapterVideoList = chapterList
|
|
list[i].ChapterVideoList = chapterList
|
|
list[i].Pv = pvMap[list[i].Id]
|
|
list[i].Pv = pvMap[list[i].Id]
|
|
list[i].Uv = uvMap[list[i].Id]
|
|
list[i].Uv = uvMap[list[i].Id]
|
|
|
|
+
|
|
|
|
+ if list[i].ClassifyIdThird > 0 {
|
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdThird]; ok {
|
|
|
|
+ if classify.Enabled == 1 {
|
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if list[i].ClassifyIdSecond > 0 {
|
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdSecond]; ok {
|
|
|
|
+ if classify.Enabled == 1 {
|
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if list[i].ClassifyIdFirst > 0 {
|
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdFirst]; ok {
|
|
|
|
+ if classify.Enabled == 1 {
|
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -866,6 +918,7 @@ func (this *ReportController) SaveReportContent() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
func (this *ReportController) AuthorizedListReport() {
|
|
func (this *ReportController) AuthorizedListReport() {
|
|
@@ -880,6 +933,7 @@ func (this *ReportController) AuthorizedListReport() {
|
|
classifyIdFirst, _ := this.GetInt("ClassifyIdFirst", 0)
|
|
classifyIdFirst, _ := this.GetInt("ClassifyIdFirst", 0)
|
|
classifyIdSecond, _ := this.GetInt("ClassifyIdSecond", 0)
|
|
classifyIdSecond, _ := this.GetInt("ClassifyIdSecond", 0)
|
|
classifyIdThird, _ := this.GetInt("ClassifyIdThird", 0)
|
|
classifyIdThird, _ := this.GetInt("ClassifyIdThird", 0)
|
|
|
|
+ stateStr := this.GetString("State")
|
|
|
|
|
|
var startSize int
|
|
var startSize int
|
|
if pageSize <= 0 {
|
|
if pageSize <= 0 {
|
|
@@ -891,18 +945,18 @@ func (this *ReportController) AuthorizedListReport() {
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
var list []*models.ReportList
|
|
var list []*models.ReportList
|
|
|
|
|
|
-
|
|
+
|
|
- if keyword == `` && classifyIdFirst <= 0 {
|
|
+
|
|
- page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
+
|
|
- resp := new(models.ReportListResp)
|
|
+
|
|
- resp.Paging = page
|
|
+
|
|
- resp.List = list
|
|
+
|
|
- br.Ret = 200
|
|
+
|
|
- br.Success = true
|
|
+
|
|
- br.Msg = "获取成功"
|
|
+
|
|
- br.Data = resp
|
|
+
|
|
- return
|
|
+
|
|
- }
|
|
+
|
|
|
|
|
|
|
|
|
|
grantReportIdList := make([]int, 0)
|
|
grantReportIdList := make([]int, 0)
|
|
@@ -940,6 +994,12 @@ func (this *ReportController) AuthorizedListReport() {
|
|
pars = utils.GetLikeKeywordPars(pars, keyword, 1)
|
|
pars = utils.GetLikeKeywordPars(pars, keyword, 1)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if stateStr != `` {
|
|
|
|
+ stateStrList := strings.Split(stateStr, ",")
|
|
|
|
+ condition += ` AND a.state in (` + utils.GetOrmInReplace(len(stateStrList)) + `) `
|
|
|
|
+ pars = append(pars, stateStrList)
|
|
|
|
+ }
|
|
|
|
+
|
|
var err error
|
|
var err error
|
|
var total int
|
|
var total int
|
|
|
|
|
|
@@ -959,6 +1019,24 @@ func (this *ReportController) AuthorizedListReport() {
|
|
condition += orCondition
|
|
condition += orCondition
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ classifyList, err := models.GetAllEnabledClassify()
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ classifyIdNum := len(classifyList)
|
|
|
|
+ if classifyIdNum > 0 {
|
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
|
+ for _, v := range classifyList {
|
|
|
|
+ classifyIdList = append(classifyIdList, v.Id)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ condition += ` AND a.classify_id_first in (` + utils.GetOrmInReplace(classifyIdNum) + `) AND a.classify_id_second in (` + utils.GetOrmInReplace(classifyIdNum) + `) AND a.classify_id_third in (` + utils.GetOrmInReplace(classifyIdNum) + `) `
|
|
|
|
+ pars = append(pars, classifyIdList, classifyIdList, classifyIdList)
|
|
|
|
+ }
|
|
|
|
+
|
|
total, err = models.GetReportListCountByAuthorized(condition, pars)
|
|
total, err = models.GetReportListCountByAuthorized(condition, pars)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|