|
@@ -626,36 +626,67 @@ func (f *Front) HasPushHistory() {
|
|
|
selectTime = selectTime[0:10]
|
|
|
select_time, _ := strconv.ParseInt(selectTime, 10, 64)
|
|
|
//转化
|
|
|
- formatTime = time.Unix(select_time, 0).Format("20060102")
|
|
|
+ formatTime = time.Unix(select_time, 0).Format("2006-01-02")
|
|
|
} else if lenStr < 10 {
|
|
|
- formatTime = "1111111111"
|
|
|
+ formatTime = ""
|
|
|
}
|
|
|
}
|
|
|
userId, _ := f.GetSession("userId").(string)
|
|
|
if userId == "" {
|
|
|
return
|
|
|
}
|
|
|
- user, firstPushTime := public.HistoryPush.UserInfo(userId)
|
|
|
- var o_jy map[string]interface{}
|
|
|
- if user != nil {
|
|
|
- o_jy, _ = (*user)["o_jy"].(map[string]interface{})
|
|
|
- }
|
|
|
- keyArr := []string{}
|
|
|
- if o_jy != nil || len(o_jy) == 0 {
|
|
|
- a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
- for _, vi := range a_key {
|
|
|
- v, _ := vi.(map[string]interface{})
|
|
|
- keys_a := v["key"].([]interface{})
|
|
|
- if thiskey := strings.TrimSpace(strings.Join(util.ObjArrToStringArr(keys_a), "+")); thiskey != "" {
|
|
|
- keyArr = append(keyArr, thiskey)
|
|
|
- }
|
|
|
+ user, _ := public.HistoryPush.UserInfo(userId)
|
|
|
+ hasKeyFlag := false
|
|
|
+ isVipFlag := false
|
|
|
+ isPassCount := false
|
|
|
+ isExpire := 0
|
|
|
+ tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
|
|
|
+ isOnTail := 0
|
|
|
+
|
|
|
+ if util.IntAll((*user)["i_vip_status"]) == 1 || util.IntAll((*user)["i_vip_status"]) == 2 {
|
|
|
+ //
|
|
|
+ var threeRemind = int64(3 * 24 * 60 * 60)
|
|
|
+ var twoRemind = int64(2 * 24 * 60 * 60)
|
|
|
+ var oneRemind = int64(1 * 24 * 60 * 60)
|
|
|
+ var o_vipjy map[string]interface{}
|
|
|
+ o_vipjy, _ = (*user)["o_vipjy"].(map[string]interface{})
|
|
|
+ if o_vipjy["a_items"] != nil {
|
|
|
+ a_itmes := util.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
|
|
|
+ hasKeyFlag = len(a_itmes) > 0
|
|
|
+ }
|
|
|
+ isVipFlag = true
|
|
|
+ isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 2000
|
|
|
+ isOnTail = util.IntAll((*user)["i_vip_status"])
|
|
|
+ _endtime := (*user)["l_vip_endtime"]
|
|
|
+ //是否到期
|
|
|
+ if util.Int64All(_endtime)-time.Now().Unix() < threeRemind && util.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
|
|
|
+ isExpire = 3 //即将到期
|
|
|
+ } else if util.Int64All(_endtime)-time.Now().Unix() < twoRemind && util.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
|
|
|
+ isExpire = 2 //即将到期
|
|
|
+ } else if util.Int64All(_endtime)-time.Now().Unix() < oneRemind && util.Int64All(_endtime)-time.Now().Unix() >= 0 {
|
|
|
+ isExpire = 1 //即将到期
|
|
|
}
|
|
|
+ } else {
|
|
|
+ var o_jy map[string]interface{}
|
|
|
+ if user != nil {
|
|
|
+ o_jy, _ = (*user)["o_jy"].(map[string]interface{})
|
|
|
+ }
|
|
|
+ if o_jy != nil || len(o_jy) == 0 {
|
|
|
+ a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
+ hasKeyFlag = len(a_key) > 0
|
|
|
+ }
|
|
|
+ isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 50
|
|
|
+ }
|
|
|
+ pageNum, _ := f.GetInteger("pageNum")
|
|
|
+ if pageNum == 0 {
|
|
|
+ pageNum = 1
|
|
|
}
|
|
|
- hasNextPage, list, err := public.HistoryPush.Datas(userId, 1, firstPushTime, formatTime)
|
|
|
+ area := f.GetString("area")
|
|
|
+ hasNextPage, list := public.HistoryPush.Datas_Mysql(userId, pageNum, formatTime, area)
|
|
|
if len(list) > 0 {
|
|
|
go updateUserApppushunread(userId)
|
|
|
//formatTime
|
|
|
- } else if err == nil && len(keyArr) > 0 && formatTime == "" {
|
|
|
+ } else if hasKeyFlag && len(list) == 0 && formatTime == "" && !isVipFlag {
|
|
|
flag, data := public.HistoryPush.MakeHistoryDatas(userId, bidSearch_field)
|
|
|
if flag && data != nil {
|
|
|
list = data
|
|
@@ -663,11 +694,14 @@ func (f *Front) HasPushHistory() {
|
|
|
}
|
|
|
//
|
|
|
f.ServeJson(map[string]interface{}{
|
|
|
- "haskey": len(keyArr) > 0,
|
|
|
+ "haskey": hasKeyFlag,
|
|
|
"data": list,
|
|
|
"hasNextPage": hasNextPage,
|
|
|
"isInTSguide": isInTSguide(userId),
|
|
|
- "keys": keyArr,
|
|
|
+ "isVipSub": isVipFlag,
|
|
|
+ "isPassCount": isPassCount,
|
|
|
+ "isExpire": isExpire,
|
|
|
+ "isOnTail": isOnTail,
|
|
|
"userId": userId,
|
|
|
})
|
|
|
}
|
|
@@ -686,15 +720,16 @@ func (f *Front) HistorypushPaging() error {
|
|
|
selectTime = selectTime[0:10]
|
|
|
select_time, _ := strconv.ParseInt(selectTime, 10, 64)
|
|
|
//转化
|
|
|
- formatTime = time.Unix(select_time, 0).Format("20060102")
|
|
|
+ formatTime = time.Unix(select_time, 0).Format("2006-01-02")
|
|
|
}
|
|
|
+ area := f.GetString("area")
|
|
|
userId, _ := f.GetSession("userId").(string)
|
|
|
if userId != "" {
|
|
|
if pageNum == 1 {
|
|
|
go updateUserApppushunread(userId)
|
|
|
}
|
|
|
- _, firstPushTime := public.HistoryPush.UserInfo(userId)
|
|
|
- hasNextPage, list, _ := public.HistoryPush.Datas(userId, pageNum, firstPushTime, formatTime)
|
|
|
+ // _, firstPushTime := public.HistoryPush.UserInfo(userId)
|
|
|
+ hasNextPage, list := public.HistoryPush.Datas_Mysql(userId, pageNum, formatTime, area)
|
|
|
f.ServeJson(map[string]interface{}{
|
|
|
"hasNextPage": hasNextPage,
|
|
|
"data": list,
|
|
@@ -817,15 +852,11 @@ func saveBehaviorRecord(sess *httpsession.Session, data bson.M) bool {
|
|
|
|
|
|
func (m *Front) WxpushAjaxReq() error {
|
|
|
defer util.Catch()
|
|
|
- index, _ := m.GetInteger("index")
|
|
|
- pdate, _ := m.GetInt("_id")
|
|
|
- userid := util.ObjToString(m.GetSession("userId"))
|
|
|
- vsid := m.GetString("vsid")
|
|
|
- searchTime_ := m.GetString("searchTime_")
|
|
|
- if searchTime_ != "" {
|
|
|
- jy.HistoryPush.ClearPushCache(userid)
|
|
|
+ userId := util.ObjToString(m.GetSession("userId"))
|
|
|
+ if userId != "" {
|
|
|
+ vsid := m.GetString("vsid")
|
|
|
+ public.HistoryPush.Visit_Mysql(userId, vsid)
|
|
|
}
|
|
|
- public.HistoryPush.Visit(userid, vsid, pdate, index)
|
|
|
return nil
|
|
|
}
|
|
|
func (m *Front) DelWxHistorySearch() {
|