Browse Source

Merge branch 'cygx_9.2' into debug

ziwen 2 years ago
parent
commit
53f4c5e426
2 changed files with 6 additions and 3 deletions
  1. 5 2
      models/report.go
  2. 1 1
      services/industrial_management.go

+ 5 - 2
models/report.go

@@ -4,6 +4,8 @@ import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"strconv"
+	"time"
+
 	//"github.com/rdlucklib/rdluck_tools/paging"
 )
 
@@ -934,7 +936,7 @@ type IndustrialReadNum struct {
 }
 
 //获取该产业下文章的用户阅读次数-小红点用
-func GetReportIndustrialReadNumList(userId int, industrialIds string) (items []*IndustrialReadNum, err error) {
+func GetReportIndustrialReadNumList(userId int, industrialIds string, createtime time.Time) (items []*IndustrialReadNum, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT a.industrial_management_id, MIN(a.readnum) AS readnum FROM (
 SELECT man_g.industrial_management_id,( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum 
@@ -945,8 +947,9 @@ WHERE
 	a.publish_status = 1 
 	AND a.is_class = 1
 	AND man_g.industrial_management_id IN (` + industrialIds + `)  
+	AND a.publish_date > ? 
 GROUP BY a.article_id ORDER BY publish_date DESC
 ) AS a GROUP BY industrial_management_id`
-	_, err = o.Raw(sql).QueryRows(&items)
+	_, err = o.Raw(sql, createtime).QueryRows(&items)
 	return
 }

+ 1 - 1
services/industrial_management.go

@@ -413,7 +413,7 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		industrialIds += strconv.Itoa(id) + ","
 	}
 	industrialIds = strings.TrimRight(industrialIds, ",")
-	articleList, err := models.GetReportIndustrialReadNumList(userId, industrialIds)
+	articleList, err := models.GetReportIndustrialReadNumList(userId, industrialIds, user.CreatedTime)
 	mapHistroyindustrialId := make(map[int]int)
 	for _, v := range articleList {
 		mapHistroyindustrialId[v.IndustrialManagementId] = v.Readnum