Эх сурвалжийг харах

Merge branch 'dev2.6.4' of http://39.105.157.10:10080/qmx/qfw into dev2.6.4

zhangxinlei1996 5 жил өмнө
parent
commit
3b439f23f0

+ 13 - 13
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"
@@ -241,12 +241,12 @@ func (e *entnichePush) GetInfoByIds(MQFW mg.MongodbSim, pushCas []*PushCa) []*Su
 	return array
 }
 
-func (e *entnichePush) Visit(PushMysql *mysql.Mysql, userId, id string) {
-	if id == "" || userId == "" {
+func (e *entnichePush) Visit(PushMysql *mysql.Mysql, userId, id int) {
+	if id <= 0 {
 		return
 	}
-	PushMysql.UpdateOrDeleteBySql("update pushsubscribe set isvisit=1 where userid='" + userId + "' and id=" + id)
-	todaySubPush, err := SubscribePush.GetTodayCache(userId)
+	PushMysql.UpdateOrDeleteBySql("update pushsubscribe set isvisit=1 where userid=? and id=?", userId, id)
+	todaySubPush, err := e.GetTodayCache(userId)
 	if err == nil && todaySubPush != nil {
 		for _, v := range todaySubPush.Datas {
 			if v.Ca_index == Int64All(id) {
@@ -254,10 +254,10 @@ func (e *entnichePush) Visit(PushMysql *mysql.Mysql, userId, id string) {
 				break
 			}
 		}
-		SubscribePush.PutTodayCache(userId, todaySubPush)
+		e.PutTodayCache(userId, todaySubPush)
 	}
 	//
-	allSubPush, err := SubscribePush.GetAllCache(userId)
+	allSubPush, err := e.GetAllCache(userId)
 	if err == nil && allSubPush != nil {
 		for _, v := range allSubPush {
 			if v.Ca_index == Int64All(id) {
@@ -265,7 +265,7 @@ func (e *entnichePush) Visit(PushMysql *mysql.Mysql, userId, id string) {
 				break
 			}
 		}
-		SubscribePush.PutAllCache(userId, allSubPush)
+		e.PutAllCache(userId, allSubPush)
 	}
 }
 

+ 3 - 3
common/src/qfw/util/jy/subscribepush.go

@@ -436,11 +436,11 @@ func (s *subscribePush) UserInfo(MQFW mg.MongodbSim, userId string) (*map[string
 	}
 	return user, Int64All((*user)["l_firstpushtime"])
 }
-func (s *subscribePush) Visit(PushMysql *mysql.Mysql, userId, id string) {
-	if id == "" || userId == "" {
+func (s *subscribePush) Visit(PushMysql *mysql.Mysql, userId string, id int) {
+	if userId == "" {
 		return
 	}
-	PushMysql.UpdateOrDeleteBySql("update pushsubscribe set isvisit=1 where userid='" + userId + "' and id=" + id)
+	PushMysql.UpdateOrDeleteBySql("update pushsubscribe set isvisit=1 where userid=? and id=?", userId, id)
 	todaySubPush, err := s.GetTodayCache(userId)
 	if err == nil && todaySubPush != nil {
 		for _, v := range todaySubPush.Datas {