|
@@ -157,7 +157,7 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
|
|
|
if in.UserId != "" {
|
|
|
key := fmt.Sprintf(TaskActivityCacheKey, in.PositionId, TaskActiveId, TaskIdSearch)
|
|
|
if exist, _ := redis.Exists("other", key); !exist {
|
|
|
- redis.Put("other", key, 1, TaskActivityCacheTimeout)
|
|
|
+ redis.Put("other", key, 1, GetLastTime())
|
|
|
nsqNode := jy.Jyweb_node2
|
|
|
if in.Platform == "WX" {
|
|
|
nsqNode = jy.Jywx_node1
|
|
@@ -273,3 +273,16 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
|
|
|
ErrCode: 0,
|
|
|
}, nil
|
|
|
}
|
|
|
+func GetLastTime() int {
|
|
|
+ n := TaskActivityCacheTimeout
|
|
|
+ t := time.Now()
|
|
|
+ midnight := time.Date(t.Year(), t.Month(), t.Day()+1, 0, 0, 0, 0, t.Location())
|
|
|
+ if midnight.After(t) {
|
|
|
+ if int(midnight.Unix()-t.Unix()) > n {
|
|
|
+ return n
|
|
|
+ } else {
|
|
|
+ return int(midnight.Unix() - t.Unix())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return n
|
|
|
+}
|