Pārlūkot izejas kodu

fix:seo发布时间展示问题修改

duxin 2 mēneši atpakaļ
vecāks
revīzija
55f2fca9d3
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 2 1
      internal/service/detailStruct.go
  2. 2 1
      internal/service/queryStruct.go

+ 2 - 1
internal/service/detailStruct.go

@@ -41,7 +41,8 @@ func (dRoot *DetailRoot) GetDetail(ctx context.Context, seoId string, isLogin bo
 		}
 		obj["title"] = gconv.String(fmt.Sprintf("【%s】%s", consts.TopTypeMap[gconv.String(obj["toptype"])], obj["title"]))
 		var publishTime int64
-		if gconv.Int64(obj["publish_time"])+3600*24 > time.Now().Unix() {
+		tm := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 23, 59, 59, 59, time.Now().Location())
+		if gconv.Int64(obj["publish_time"])+3600*24 > tm.Unix() {
 			publishTime = gconv.Int64(obj["publish_time"])
 		} else {
 			publishTime = gconv.Int64(obj["publish_time"]) + 3600*24

+ 2 - 1
internal/service/queryStruct.go

@@ -87,7 +87,8 @@ func (query *SeoBiddingQuery) dataFormat(data []map[string]interface{}) (bList [
 		titleReduction := map[string]int{}
 		for _, v := range data {
 			var publishTime int64
-			if gconv.Int64(v["publish_time"])+3600*24 > time.Now().Unix() {
+			tm := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 23, 59, 59, 59, time.Now().Location())
+			if gconv.Int64(v["publish_time"])+3600*24 > tm.Unix() {
 				publishTime = gconv.Int64(v["publish_time"])
 			} else {
 				publishTime = gconv.Int64(v["publish_time"]) + 3600*24