|
@@ -770,7 +770,7 @@ func (f *Front) HasPushHistory() {
|
|
|
} else {
|
|
|
haskey = true
|
|
|
}
|
|
|
- thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0)
|
|
|
+ thistime, list := getHistorypush(nowUnix, 0, myopenid, nil, 0, nil)
|
|
|
if haskey && (list == nil || len(*list) == 0) {
|
|
|
list = &[]map[string]interface{}{}
|
|
|
flag, data := makeHistoryDatas(util.BsonIdToSId((*user)["_id"]), myopenid, o_jy)
|
|
@@ -815,7 +815,7 @@ func (f *Front) HistorypushPaging() error {
|
|
|
isFirstPage = true
|
|
|
lasttime = time.Now().Local().Unix()
|
|
|
}
|
|
|
- thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0)
|
|
|
+ thistime, list := getHistorypush(lasttime, 0, myopenid, nil, 0, nil)
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
if isFirstPage {
|
|
|
go updateUserApppushunread(myopenid)
|
|
@@ -828,7 +828,7 @@ func (f *Front) HistorypushPaging() error {
|
|
|
f.ServeJson(&res)
|
|
|
return nil
|
|
|
}
|
|
|
-func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int) (thistime int64, list *[]map[string]interface{}) {
|
|
|
+func getHistorypush(lasttime, infotime int64, openid string, res []map[string]interface{}, count int, vsidList []string) (thistime int64, list *[]map[string]interface{}) {
|
|
|
if lasttime < time.Now().Unix()-60*24*60*60 { //最多查询最近60天数据
|
|
|
return lasttime, &res
|
|
|
}
|
|
@@ -844,13 +844,15 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
|
|
|
// log.Println("date", date)
|
|
|
if date > 0 {
|
|
|
//获取已浏览记录
|
|
|
- visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate<? limit 100", openid, date)
|
|
|
- vsidList := []string{}
|
|
|
- for _, v := range visited {
|
|
|
- vsidList = append(vsidList, (v["vsid"]).(string))
|
|
|
- // log.Println("vsidList", vsidList)
|
|
|
+ dateend := date - 24*60*60
|
|
|
+ visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate<? and pdate>? limit 50", openid, date, dateend)
|
|
|
+ // vsidList := []string{}
|
|
|
+ if len(visited) > 0 {
|
|
|
+ for _, v := range visited {
|
|
|
+ vsidList = append(vsidList, (v["vsid"]).(string))
|
|
|
+ // log.Println("vsidList", vsidList)
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
dateshort := util.FormatDateByInt64(&lasttime, util.Date_Short_Layout)
|
|
|
pinfo := ca.Search("select * from jy_push where id=? and openid=? and date<?", dateshort, openid, lasttime+infotime)
|
|
|
if len(pinfo) > 0 {
|
|
@@ -858,7 +860,6 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
|
|
|
info["visit"] = vsidList
|
|
|
// log.Println("info", info)
|
|
|
tmp := changeMapKeyForCass(info)
|
|
|
- // m.T["data"] = val
|
|
|
if ats, ok := tmp["o_pushinfo"].(map[string]interface{}); ok {
|
|
|
thistime = util.Int64All(tmp["l_date"])
|
|
|
count += len(ats)
|
|
@@ -906,7 +907,7 @@ func getHistorypush(lasttime, infotime int64, openid string, res []map[string]in
|
|
|
infotime = 24 * 60 * 60
|
|
|
}
|
|
|
}
|
|
|
- return getHistorypush(thistime, infotime, openid, res, count)
|
|
|
+ return getHistorypush(thistime, infotime, openid, res, count, vsidList)
|
|
|
}
|
|
|
|
|
|
func MFollow(userId, pname, pcode, title, openid string) (bool, string) {
|
|
@@ -1062,11 +1063,12 @@ func (m *Front) WxpushAjaxReq() error {
|
|
|
defer util.Catch()
|
|
|
vsid := m.GetString("vsid")
|
|
|
pdate := m.GetString("_id")
|
|
|
+ openid := m.Session().Get("s_m_openid")
|
|
|
// log.Println("vsid", vsid)
|
|
|
// log.Println("pdate", pdate)
|
|
|
if util.Int64All(pdate) > 0 {
|
|
|
visit := map[string]interface{}{
|
|
|
- "openid": m.Session().Get("s_m_openid"),
|
|
|
+ "openid": openid,
|
|
|
"pdate": pdate,
|
|
|
"vsid": vsid,
|
|
|
"date": time.Now(),
|