Quellcode durchsuchen

修改朋友数据新增

longyu vor 3 Jahren
Ursprung
Commit
6a5403c032
3 geänderte Dateien mit 12 neuen und 9 gelöschten Zeilen
  1. 2 2
      controllers/base_from_pb.go
  2. 6 5
      services/base_from_pb.go
  3. 4 2
      utils/constants.go

+ 2 - 2
controllers/base_from_pb.go

@@ -42,7 +42,7 @@ func (this *PbController) Add() {
 	cacheKey = utils.CACHE_EDB_DATA_ADD + strconv.Itoa(source) + "_" + req.EdbCode
 	if !utils.Rc.IsExist(cacheKey) {
 		utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
-		dataItem, err := services.GetEdbDataFromPb(req.EdbCode, utils.BASE_START_DATE, utils.BASE_END_DATE)
+		dataItem, err := services.GetEdbDataFromPb(req.EdbCode, utils.BASE_START_DATE_UnSpace, utils.BASE_END_DATE_UnSpace)
 		if err != nil {
 			br.Msg = "获取指标信息失败!"
 			br.ErrMsg = "获取指标信息失败 GetEdbDataFromPb,Err:" + err.Error()
@@ -97,7 +97,7 @@ func (this *PbController) Refresh() {
 	cacheKey = utils.CACHE_EDB_DATA_REFRESH + strconv.Itoa(source) + "_" + req.EdbCode
 	if !utils.Rc.IsExist(cacheKey) {
 		utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
-		dataItem, err := services.GetEdbDataFromPb(req.EdbCode, req.StartDate, utils.BASE_END_DATE)
+		dataItem, err := services.GetEdbDataFromPb(req.EdbCode, req.StartDate, utils.BASE_END_DATE_UnSpace)
 		if err != nil {
 			br.Msg = "获取指标信息失败!"
 			br.ErrMsg = "获取指标信息失败 GetEdbDataFromPb,Err:" + err.Error()

+ 6 - 5
services/base_from_pb.go

@@ -3,9 +3,10 @@ package services
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/rdlucklib/rdluck_tools/http"
 	"hongze/hongze_edb_lib/utils"
 	"net/url"
+
+	"github.com/rdlucklib/rdluck_tools/http"
 )
 
 type EdbDataFromPb struct {
@@ -20,17 +21,17 @@ func GetEdbDataFromPb(edbCode, startDate, endDate string) (item *EdbDataFromPb,
 	edbCode = url.QueryEscape(edbCode)
 	bpUrl := utils.Hz_Pb_Data_Url + `edbInfo/pb?EdbCode=%s&StartDate=%s&EndDate=%s`
 	bpUrl = fmt.Sprintf(bpUrl, edbCode, startDate, endDate)
-	utils.FileLog.Info("bpUrl:%s", bpUrl)
+	utils.FileLog.Info("bpUrl:" + bpUrl)
 	body, err := http.Get(bpUrl)
 	if err != nil {
-		utils.FileLog.Info("GetEdbDataByPb Err:%s", err.Error())
+		utils.FileLog.Info("GetEdbDataByPb Err:"+err.Error())
 		return
 	}
-	utils.FileLog.Info("GetEdbDataByPb result:%s", string(body))
+	utils.FileLog.Info("GetEdbDataByPb result:" + string(body))
 	item = new(EdbDataFromPb)
 	err = json.Unmarshal(body, &item)
 	if err != nil {
-		utils.FileLog.Info("GetEdbDataByPb Unmarshal Err:%s", err.Error())
+		utils.FileLog.Info("GetEdbDataByPb Unmarshal Err:"+err.Error())
 		return
 	}
 	edbCode, _ = url.QueryUnescape(edbCode)

+ 4 - 2
utils/constants.go

@@ -57,8 +57,10 @@ const (
 
 //基础数据初始化日期
 var (
-	BASE_START_DATE = time.Now().AddDate(-30, 0, 0).Format(FormatDate) //基础数据开始日期
-	BASE_END_DATE   = time.Now().AddDate(4, 0, 0).Format(FormatDate)   //基础数据结束日期
+	BASE_START_DATE         = time.Now().AddDate(-30, 0, 0).Format(FormatDate)        //基础数据开始日期
+	BASE_END_DATE           = time.Now().AddDate(4, 0, 0).Format(FormatDate)          //基础数据结束日期
+	BASE_START_DATE_UnSpace = time.Now().AddDate(-30, 0, 0).Format(FormatDateUnSpace) //基础数据开始日期
+	BASE_END_DATE_UnSpace   = time.Now().AddDate(4, 0, 0).Format(FormatDateUnSpace)   //基础数据结束日期
 )
 
 var (