ziwen 3 years ago
parent
commit
be4f8608fd

+ 2 - 2
service/commodity_trade_cffex.go

@@ -4,9 +4,9 @@ import (
 	"encoding/xml"
 	"fmt"
 	"github.com/mozillazg/go-pinyin"
+	"github.com/rdlucklib/rdluck_tools/http"
 	"hongze/hongze_data_crawler/models"
 	"hongze/hongze_data_crawler/utils"
-	"github.com/rdlucklib/rdluck_tools/http"
 	"strings"
 	"time"
 )
@@ -68,7 +68,7 @@ func SyncRankingFromCffex() {
 	for _, item := range allCode {
 		cffexIndexCodeMap[item.IndexName] = item.IndexCode
 	}
-	for i := 2; i > 0; i-- {
+	for i := 2; i >= 0; i-- {
 		zzUrl := "http://www.cffex.com.cn/sj/ccpm/%s/%s/"
 		date := time.Now().AddDate(0, 0, -i)
 		dateStr := date.Format(utils.FormatDateUnSpace)

+ 2 - 2
service/commodity_trade_ine.go

@@ -4,9 +4,9 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/mozillazg/go-pinyin"
+	"github.com/rdlucklib/rdluck_tools/http"
 	"hongze/hongze_data_crawler/models"
 	"hongze/hongze_data_crawler/utils"
-	"github.com/rdlucklib/rdluck_tools/http"
 	"strings"
 	"time"
 )
@@ -81,7 +81,7 @@ func SyncRankingFromIne() {
 		ineIndexCodeMap[item.IndexName] = item.IndexCode
 	}
 	//获取新的指标信息
-	for i := 2; i > 0; i-- {
+	for i := 2; i >= 0; i-- {
 		var message Message
 		var item = new(models.BaseFromTradeIneIndex)
 		zzUrl := "http://www.ine.com.cn/data/dailydata/kx/pm%s.dat"

+ 2 - 2
service/commodity_trade_shanghai.go

@@ -4,9 +4,9 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/mozillazg/go-pinyin"
+	"github.com/rdlucklib/rdluck_tools/http"
 	"hongze/hongze_data_crawler/models"
 	"hongze/hongze_data_crawler/utils"
-	"github.com/rdlucklib/rdluck_tools/http"
 	"strings"
 	"time"
 )
@@ -81,7 +81,7 @@ func SyncRankingFromShangHai() {
 		indexCodeMap[item.IndexName] = item.IndexCode
 	}
 	//获取新的指标信息
-	for i := 2; i > 0; i-- {
+	for i := 2; i >= 0; i-- {
 		var message Message
 		var item = new(models.BaseFromTradeShanghaiIndex)
 		zzUrl := "http://www.shfe.com.cn/data/dailydata/kx/pm%s.dat"

+ 2 - 2
service/commodity_trade_zhengzhou.go

@@ -3,10 +3,10 @@ package services
 import (
 	"fmt"
 	"github.com/mozillazg/go-pinyin"
+	"github.com/rdlucklib/rdluck_tools/http"
 	"hongze/hongze_data_crawler/models"
 	"hongze/hongze_data_crawler/utils"
 	"log"
-	"github.com/rdlucklib/rdluck_tools/http"
 	"strconv"
 	"strings"
 	"time"
@@ -68,7 +68,7 @@ func SyncRankingFromZhengzhou() {
 	for _, item := range allCode {
 		zIndexCodeMap[item.IndexName] = item.IndexCode
 	}
-	for i := 2; i > 0; i-- {
+	for i := 2; i >= 0; i-- {
 		var itemVerifyCode int
 		zzUrl := "http://www.czce.com.cn/cn/DFSStaticFiles/Future/%s/%s/FutureDataHolding.htm"
 		date := time.Now().AddDate(0, 0, -i)