wcj 5 年之前
父节点
当前提交
3008f6acab
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      common/src/qfw/util/jy/entnichepush.go

+ 6 - 6
common/src/qfw/util/jy/entnichepush.go

@@ -46,7 +46,7 @@ func (e *entnichePush) todayKey(userId int) string {
 	return fmt.Sprintf("entnichepush_%d", userId)
 }
 
-func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId int, pageNum int, selectTime, area string) (hasNextPage bool, result []*SubPushList) {
+func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, entId, userId int, pageNum int, selectTime, area string) (hasNextPage bool, result []*SubPushList) {
 	if pageNum < 1 {
 		pageNum = 1
 	}
@@ -59,7 +59,7 @@ func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId
 			log.Println(userId, "GetTodayCache Error", err)
 		}
 		if err != nil || subPush == nil || subPush.Date != now || len(subPush.Datas) == 0 {
-			list := e.getDatasFromMysql(MQFW, PushMysql, userId, pageNum, pageSize, selectTime, area, false)
+			list := e.getDatasFromMysql(MQFW, PushMysql, entId, userId, pageNum, pageSize, selectTime, area, false)
 			subPush = &SubPush{
 				Date:  now,
 				Datas: list,
@@ -79,7 +79,7 @@ func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId
 			log.Println(userId, "GetAllCache Error", err)
 		}
 		if err != nil || allCache == nil || len(allCache) == 0 {
-			allCache = e.getDatasFromMysql(MQFW, PushMysql, userId, 1, AllSubPushCacheSize, selectTime, area, true)
+			allCache = e.getDatasFromMysql(MQFW, PushMysql, entId, userId, 1, AllSubPushCacheSize, selectTime, area, true)
 			e.PutAllCache(userId, allCache)
 		}
 		length := len(allCache)
@@ -90,7 +90,7 @@ func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId
 			result = allCache[start:end]
 		}
 	} else {
-		result = e.getDatasFromMysql(MQFW, PushMysql, userId, pageNum, pageSize, selectTime, area, true)
+		result = e.getDatasFromMysql(MQFW, PushMysql, entId, userId, pageNum, pageSize, selectTime, area, true)
 	}
 	if result == nil {
 		result = []*SubPushList{}
@@ -98,8 +98,8 @@ func (e *entnichePush) Datas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId
 	hasNextPage = len(result) >= pageSize
 	return
 }
-func (e *entnichePush) getDatasFromMysql(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId int, pageNum, myPageSize int, selectTime, area string, isLimit bool) (result []*SubPushList) {
-	findSQL := "select id,date,infoid,isvisit,matchkeys,type,1 as isvip from pushentniche where userid = " + fmt.Sprint(userId)
+func (e *entnichePush) getDatasFromMysql(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, entId, userId int, pageNum, myPageSize int, selectTime, area string, isLimit bool) (result []*SubPushList) {
+	findSQL := "select id,date,infoid,isvisit,matchkeys,type,1 as isvip from pushentniche where entid=" + fmt.Sprint(entId) + " and userid=" + fmt.Sprint(userId)
 	findStr := ""
 	if selectTime != "" {
 		startTime := selectTime + " 00:00:00"