소스 검색

feat:月份

wangshan 3 년 전
부모
커밋
3466ee257b
3개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 1 1
      jyBXCore/rpc/etc/bxcore.yaml
  2. 1 1
      jyBXCore/rpc/internal/config/config.go
  3. 6 6
      jyBXCore/rpc/util/search.go

+ 1 - 1
jyBXCore/rpc/etc/bxcore.yaml

@@ -26,7 +26,7 @@ SearchTypeSwitch: true
 FileSignBool: true
 PaySearchLimit:
   Switch: true
-  Time: 1
+  Time: 1-2
   WordSize: 7
   PageNum: 1
   BiddingId: 6354dsew2342424wer3242423we2344

+ 1 - 1
jyBXCore/rpc/internal/config/config.go

@@ -28,7 +28,7 @@ type Config struct {
 	FileSignBool     bool
 	PaySearchLimit   struct {
 		Switch    bool
-		Time      int
+		Time      string
 		WordSize  int
 		PageNum   int64
 		BiddingId string

+ 6 - 6
jyBXCore/rpc/util/search.go

@@ -13,7 +13,6 @@ import (
 	"jyBXCore/rpc/internal/config"
 	"jyBXCore/rpc/model/es"
 	"jyBXCore/rpc/type/bxcore"
-	"log"
 	"math/big"
 	"net/http"
 	"net/url"
@@ -684,16 +683,17 @@ func IsOptimize(cc config.Config, in *bxcore.SearchReq) bool {
 }
 
 //
-func GetPublishTime(tt int, publishTime string) string {
+func GetPublishTime(ym, publishTime string) string {
 	//发布时间
 	if publishTime != "" && len(strings.Split(publishTime, "-")) > 1 {
-		now := time.Now()
 		startTime, _ := strconv.ParseInt(strings.Split(publishTime, "-")[0], 10, 64)
 		endTime, _ := strconv.ParseInt(strings.Split(publishTime, "-")[1], 10, 64)
-		pTime := time.Date(now.Year()-tt, now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
-		log.Println(pTime, "---", endTime)
+		reduceYear, _ := strconv.Atoi(strings.Split(ym, "-")[0])
+		reduceMonth, _ := strconv.Atoi(strings.Split(ym, "-")[1])
+		//因月份规范化 收到的影响 不考虑
+		pTime := time.Unix(endTime, 0).AddDate(-reduceYear, -reduceMonth, 0).Unix()
 		//超过一年
-		if endTime > startTime && pTime > startTime {
+		if endTime-startTime > pTime {
 			return fmt.Sprint(pTime) + "-" + fmt.Sprint(endTime)
 		}
 	}