|
@@ -191,19 +191,25 @@ func (s sortList) Swap(i, j int) {
|
|
|
s[i], s[j] = s[j], s[i]
|
|
|
}
|
|
|
|
|
|
-func GetHistorypush(lastindex int, userId, openId string) (int, *[]map[string]interface{}) {
|
|
|
+func GetHistorypush(lastindex int, user *map[string]interface{}, userId, openId string) (int, *[]map[string]interface{}) {
|
|
|
+ rateMode := 1
|
|
|
+ var o_jy map[string]interface{}
|
|
|
+ if user != nil {
|
|
|
+ o_jy, _ = (*user)["o_jy"].(map[string]interface{})
|
|
|
+ rateMode = util.IntAllDef(o_jy["i_ratemode"], 1)
|
|
|
+ }
|
|
|
flag := true
|
|
|
if lastindex == -1 {
|
|
|
flag = false
|
|
|
lastindex = 0
|
|
|
}
|
|
|
- pinfo := GetHistorypushDatas(flag, userId, openId)
|
|
|
+ pinfo := GetHistorypushDatas(flag, rateMode, userId, openId)
|
|
|
list := []map[string]interface{}{}
|
|
|
if len(pinfo) > 0 {
|
|
|
count := 0
|
|
|
for ; lastindex < len(pinfo); lastindex++ {
|
|
|
- info := pinfo[lastindex]
|
|
|
- tmp, _ := info.(map[string]interface{})
|
|
|
+ info, _ := pinfo[lastindex].(map[string]interface{})
|
|
|
+ tmp := ChangeMapKeyForCass(info)
|
|
|
if ats, ok := tmp["o_pushinfo"].(map[string]interface{}); ok {
|
|
|
thistime := util.Int64All(tmp["l_date"])
|
|
|
//获取已浏览记录
|
|
@@ -225,13 +231,13 @@ func GetHistorypush(lastindex int, userId, openId string) (int, *[]map[string]in
|
|
|
}
|
|
|
return lastindex + 1, &list
|
|
|
}
|
|
|
-func GetHistorypushDatas(flag bool, userId, openId string) []interface{} {
|
|
|
+func GetHistorypushDatas(flag bool, rateMode int, userId, openId string) []interface{} {
|
|
|
list := []interface{}{}
|
|
|
if flag {
|
|
|
- cacheDatas := redis.Get("pushcache", "jypush_"+userId)
|
|
|
+ cacheDatas := redis.Get("pushcache", "pushsubscribe_"+userId)
|
|
|
if cacheDatas != nil {
|
|
|
log.Println("GetHistorypushDatas from redis", userId)
|
|
|
- list = cacheDatas.([]interface{})
|
|
|
+ list, _ = cacheDatas.([]interface{})
|
|
|
return list
|
|
|
}
|
|
|
}
|
|
@@ -251,9 +257,13 @@ func GetHistorypushDatas(flag bool, userId, openId string) []interface{} {
|
|
|
sort.Sort(sl)
|
|
|
}
|
|
|
for _, v := range sl {
|
|
|
- list = append(list, ChangeMapKeyForCass(v))
|
|
|
+ list = append(list, v)
|
|
|
+ }
|
|
|
+ timeout := util.IntAllDef(config.Sysconfig["pushTimeout"], 300)
|
|
|
+ if rateMode == 2 {
|
|
|
+ timeout = util.IntAllDef(config.Sysconfig["ninePushTimeout"], 48*60*60)
|
|
|
}
|
|
|
- redis.Put("pushcache", "jypush_"+userId, list, util.IntAllDef(config.Sysconfig["pushTimeout"], 300))
|
|
|
+ redis.Put("pushcache", "pushsubscribe_"+userId, list, timeout)
|
|
|
return list
|
|
|
}
|
|
|
|