ソースを参照

feat:刷选条件 时间调整

wangshan 2 年 前
コミット
ee8a0701b8
1 ファイル変更17 行追加1 行削除
  1. 17 1
      jyBXBase/rpc/internal/logic/showsearchlogic.go

+ 17 - 1
jyBXBase/rpc/internal/logic/showsearchlogic.go

@@ -3,12 +3,15 @@ package logic
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"context"
+	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXBase/rpc/bxbase"
 	IC "jyBXBase/rpc/init"
 	"jyBXBase/rpc/internal/svc"
 	"log"
+	"strconv"
 	"strings"
+	"time"
 )
 
 type ShowSearchLogic struct {
@@ -62,7 +65,20 @@ func (l *ShowSearchLogic) ShowSearch(in *bxbase.ShowSearchReq) (res *bxbase.Show
 			var listSearch bxbase.ListSearchRes
 			listSearch.Id = common.InterfaceToStr(vlu["_id"])
 			listSearch.Searchvalue = common.InterfaceToStr(vlu["keywords"])
-			listSearch.Publishtime = common.InterfaceToStr(vlu["publish_time"])
+			//PC端保存带时间范围的刷选条件时,到期时间选择18号,时间参数为18号0点,正常应该是18号23点59分59秒
+			//现对老数据进行处理
+			publishTime := common.InterfaceToStr(vlu["publish_time"])
+			if publishTime != "" && strings.Contains(publishTime, "_") {
+				publishTimeStart := strings.Split(publishTime, "_")[0]
+				if publishTimeEnd := strings.Split(publishTime, "_")[1]; publishTimeEnd != "" {
+					if endTimeInt, err := strconv.ParseInt(publishTimeEnd, 10, 64); err == nil {
+						endTimeUnix := time.Unix(endTimeInt, 0)
+						endTimeInt = time.Date(endTimeUnix.Year(), endTimeUnix.Month(), endTimeUnix.Day(), 23, 59, 59, 59, time.Local).Unix()
+						publishTime = fmt.Sprintf("%s_%d", publishTimeStart, endTimeInt)
+					}
+				}
+			}
+			listSearch.Publishtime = publishTime
 			listSearch.Area = common.InterfaceToStr(vlu["area"])
 			listSearch.City = common.InterfaceToStr(vlu["city"])
 			listSearch.Subtype = common.InterfaceToStr(vlu["subtype"])