|
@@ -2481,7 +2481,6 @@ func (f *Front) HasPushHistory() {
|
|
|
if user != nil {
|
|
|
o_jy, _ = (*user)["o_jy"].(map[string]interface{})
|
|
|
}
|
|
|
- nowUnix := time.Now().Unix()
|
|
|
haskey := false
|
|
|
if o_jy != nil || len(o_jy) == 0 {
|
|
|
a_key, _ := o_jy["a_key"].([]interface{})
|
|
@@ -2496,14 +2495,14 @@ func (f *Front) HasPushHistory() {
|
|
|
} else {
|
|
|
haskey = true
|
|
|
}
|
|
|
- thistime, list := getHistorypush(nowUnix, 0, userid, openId, nil, 0, []string{})
|
|
|
+ thistime, list := public.GetHistorypush(0, userid, openId)
|
|
|
if haskey && (list == nil || len(*list) == 0) {
|
|
|
list = &[]map[string]interface{}{}
|
|
|
flag, data := makeHistoryDatas(util.BsonIdToSId((*user)["_id"]), openId, o_jy)
|
|
|
if flag && data != nil {
|
|
|
- tmp := changeMapKeyForCass(data)
|
|
|
+ tmp := public.ChangeMapKeyForCass(data)
|
|
|
if ats, ok := tmp["o_pushinfo"].(map[string]interface{}); ok {
|
|
|
- thistime = util.Int64All(tmp["l_date"])
|
|
|
+ thistime = 0
|
|
|
tmp["count"] = len(ats)
|
|
|
*list = append(*list, tmp)
|
|
|
}
|
|
@@ -2530,11 +2529,7 @@ func (f *Front) Historypush() error {
|
|
|
userid := util.ObjToString(f.GetSession("userId"))
|
|
|
// 打开推送
|
|
|
data, ok := mongodb.FindById("user", userid, nil)
|
|
|
- log.Println("data", *data)
|
|
|
i_applystatus := (*data)["i_applystatus"]
|
|
|
- if i_applystatus != nil {
|
|
|
- // log.Println("i_applystatus", i_applystatus)
|
|
|
- }
|
|
|
|
|
|
var o_jy map[string]interface{}
|
|
|
|
|
@@ -2565,27 +2560,24 @@ func (f *Front) Historypush() error {
|
|
|
}
|
|
|
|
|
|
func (f *Front) HistorypushPaging() error {
|
|
|
- lasttime, _ := f.GetInt("lasttime")
|
|
|
+ lasttime, _ := f.GetInteger("lasttime")
|
|
|
userid := util.ObjToString(f.GetSession("userId"))
|
|
|
res := map[string]interface{}{}
|
|
|
res["success"] = false
|
|
|
if userid != "" && lasttime > 0 {
|
|
|
- if lasttime == 1 {
|
|
|
- lasttime = time.Now().Local().Unix()
|
|
|
- }
|
|
|
_, openId := public.GetOldOpenid(userid)
|
|
|
- thistime, list := getHistorypush(lasttime, 0, userid, openId, nil, 0, []string{})
|
|
|
+ thisindex, list := public.GetHistorypush(lasttime, userid, openId)
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
res["success"] = true
|
|
|
res["data"] = &list
|
|
|
- res["thistime"] = thistime
|
|
|
+ res["thistime"] = thisindex
|
|
|
}
|
|
|
}
|
|
|
f.ServeJson(&res)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func getHistorypush(lasttime, infotime int64, userId, openId string, res []map[string]interface{}, count int, vsidList []string) (thistime int64, list *[]map[string]interface{}) {
|
|
|
+func getHistorypush_old(lasttime, infotime int64, userId, 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
|
|
|
}
|
|
@@ -2598,7 +2590,7 @@ func getHistorypush(lasttime, infotime int64, userId, openId string, res []map[s
|
|
|
pinfo := cassandra.Search("select * from jy_push where id=? and openid=? and date<?", dateshort, openId, lasttime+infotime)
|
|
|
if len(pinfo) > 0 {
|
|
|
for _, info := range pinfo {
|
|
|
- tmp := changeMapKeyForCass(info)
|
|
|
+ tmp := public.ChangeMapKeyForCass(info)
|
|
|
if ats, ok := tmp["o_pushinfo"].(map[string]interface{}); ok {
|
|
|
thistime = util.Int64All(tmp["l_date"])
|
|
|
//获取已浏览记录
|
|
@@ -2648,7 +2640,7 @@ func getHistorypush(lasttime, infotime int64, userId, openId string, res []map[s
|
|
|
thistime = t.Unix() - 24*60*60
|
|
|
infotime = 24 * 60 * 60
|
|
|
}
|
|
|
- return getHistorypush(thistime, infotime, userId, openId, res, count, vsidList)
|
|
|
+ return getHistorypush_old(thistime, infotime, userId, openId, res, count, vsidList)
|
|
|
}
|
|
|
|
|
|
//电脑端招标订阅
|