浏览代码

新增wind wsd指标库

# Conflicts:
#	models/edb_info.go
tuoling805 1 年之前
父节点
当前提交
b11f84afe9

+ 244 - 0
controllers/base_from_wind_wsd.go

@@ -0,0 +1,244 @@
+package controllers
+
+import (
+	"encoding/json"
+	"eta/eta_index_lib/logic"
+	"eta/eta_index_lib/models"
+	"eta/eta_index_lib/services"
+	"eta/eta_index_lib/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// wind
+type WindWsdController struct {
+	BaseAuthController
+}
+
+// @Title 新增wind指标接口
+// @Description  新增wind指标接口
+// @Success 200 {object} models.AddEdbInfoReq
+// @router /wsd/add [post]
+func (this *WindWsdController) Add() {
+	br := new(models.BaseResponse).Init()
+	var cacheKey string
+	defer func() {
+		utils.Rc.Delete(cacheKey)
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	source := utils.DATA_SOURCE_WIND
+	var req models.AddEdbInfoReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.EdbCode == "" {
+		br.Msg = "请输入指标编码!"
+		br.ErrMsg = "请输入指标编码,指标编码为空"
+		return
+	}
+	cacheKey = utils.CACHE_EDB_DATA_ADD + strconv.Itoa(source) + "_" + req.StockCode + req.EdbCode
+	if !utils.Rc.IsExist(cacheKey) {
+		utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
+
+		//期货数据,就默认到今天,特殊处理下
+		endDate := utils.BASE_END_DATE
+		if strings.Contains(req.EdbCode, ".") {
+			endDate = time.Now().Format(utils.FormatDate)
+		}
+
+		windUrl := ``
+		terminalCode := ""
+		// 试用平台的话,需要额外从弘则这边获取下地址
+		if utils.BusinessCode == utils.HZ_TRIAL_BUSSINESS_CODE {
+			tmpWindUrl, tmpTerminalCode, err, errMsg := services.GetHzWindUrl(req.EdbCode, source)
+			if err != nil {
+				br.Msg = "添加失败!"
+				br.ErrMsg = "添加失败,Err:" + err.Error()
+				if errMsg != `` {
+					br.Msg = errMsg
+				}
+				return
+			}
+			windUrl = tmpWindUrl
+			terminalCode = tmpTerminalCode
+		}
+
+		if terminalCode == `` {
+			terminalInfo, err := services.GetTerminal(utils.DATA_SOURCE_WIND, "")
+			if err != nil {
+				br.Msg = "获取可以使用的wind地址失败!"
+				br.ErrMsg = "获取可以使用的wind地址失败,err:" + err.Error()
+				return
+			}
+			windUrl = terminalInfo.ServerUrl
+			terminalCode = terminalInfo.TerminalCode
+		}
+
+		if terminalCode == `` {
+			br.Msg = "没有配置wind终端!"
+			br.ErrMsg = "没有配置wind终端"
+			return
+		}
+
+		if windUrl == `` {
+			windUrl, err = GetServerUrl()
+			if err != nil {
+				br.Msg = "获取可以使用的wind地址失败!"
+				br.ErrMsg = "获取可以使用的wind地址失败,err:" + err.Error()
+				return
+			}
+		}
+
+		if windUrl == `` {
+			br.Msg = "没有配置wind地址!"
+			br.ErrMsg = "没有配置wind地址"
+			return
+		}
+
+		// 设置指标与终端关系的缓存
+		windUrlCacheKey := utils.CACHE_WIND_URL + ":" + req.StockCode + req.EdbCode
+		_ = utils.Rc.SetNX(windUrlCacheKey, windUrl, utils.GetTodayLastSecond())
+
+		//windUrl = utils.Hz_Wind_Data_Url_LIST[1].Url
+		dataItem, errCode, err := services.GetEdbDataFromWindUrlWsd(windUrl, req.StockCode, req.EdbCode, utils.BASE_START_DATE, endDate)
+		//dataItem, errCode, err := services.GetEdbDataFromWind(req.EdbCode, utils.BASE_START_DATE, endDate)
+		if errCode == 421 { //指标超限
+			br.Ret = 421
+			br.Msg = "指标超限!"
+			return
+		}
+		// 指标下架
+		if errCode == services.WindNoAuthCode {
+			br.Ret = 4052
+			br.Msg = "指标已下架"
+			return
+		}
+		if err != nil {
+			br.Msg = "获取指标信息失败!"
+			br.ErrMsg = "获取指标信息失败 GetEdbDataFromWind,Err:" + err.Error()
+			return
+		}
+		err = models.AddEdbDataFromWindWsd(req.EdbCode, dataItem)
+		if err != nil {
+			br.Msg = "获取指标信息失败!"
+			br.ErrMsg = "获取指标信息失败 AddEdbDataFromWindWsd,Err:" + err.Error()
+			return
+		}
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = dataItem
+	} else {
+		br.Ret = 501
+		br.Success = true
+		br.Msg = "系统处理中,请稍后重试"
+	}
+}
+
+// @Title 刷新wind指标接口
+// @Description 刷新wind指标接口
+// @Success 200 {object} models.RefreshEdbInfoReq
+// @router /wsd//refresh [post]
+func (this *WindWsdController) Refresh() {
+	br := new(models.BaseResponse).Init()
+	var cacheKey string
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	source := utils.DATA_SOURCE_WIND
+	var req models.RefreshEdbInfoReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.EdbCode == "" {
+		br.Msg = "请输入指标编码!"
+		br.ErrMsg = "请输入指标编码,指标编码为空"
+		return
+	}
+	if req.EdbInfoId <= 0 {
+		br.Msg = "请输入指标ID!"
+		br.ErrMsg = "请输入指标ID"
+		return
+	}
+
+	cacheKey = utils.CACHE_EDB_DATA_REFRESH + strconv.Itoa(source) + "_" + req.EdbCode
+	if utils.Rc.IsExist(cacheKey) {
+		br.Ret = 501
+		br.Success = true
+		br.Msg = "系统处理中,请稍后重试"
+		return
+	}
+
+	utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
+	defer func() {
+		utils.Rc.Delete(cacheKey)
+	}()
+
+	//获取指标信息
+	edbInfo, err := models.GetEdbInfoById(req.EdbInfoId)
+	if err != nil {
+		br.Msg = "查询指标信息失败!"
+		br.ErrMsg = "查询指标信息失败 Err:" + err.Error()
+		return
+	}
+
+	//期货数据,就默认到今天,特殊处理下
+	endDate := utils.BASE_END_DATE
+	if strings.Contains(req.EdbCode, ".") {
+		endDate = time.Now().Format(utils.FormatDate)
+	}
+
+	dataItem, errCode, err := services.GetEdbDataFromWindUrl(edbInfo.ServerUrl, req.EdbCode, req.StartDate, endDate)
+	if errCode == 421 { //指标超限
+		br.Ret = 421
+		br.Msg = "指标超限!"
+		return
+	}
+	// 忽略掉指标下架的错误, 并更新指标为停止更新
+	if errCode == services.WindNoAuthCode {
+		edbInfo.NoUpdate = 1
+		edbInfo.ModifyTime = time.Now().Local()
+		if e := edbInfo.Update([]string{"NoUpdate", "ModifyTime"}); e != nil {
+			br.Msg = "刷新失败"
+			br.ErrMsg = "更新wind指标停更失败, Err: " + e.Error()
+			return
+		}
+		br.Ret = 200
+		br.Msg = "操作成功"
+		return
+	}
+	if err != nil {
+		br.Msg = "获取指标信息失败!"
+		br.ErrMsg = "获取指标信息失败 GetEdbDataFromWind,Err:" + err.Error()
+		return
+	}
+	err = models.RefreshEdbDataFromWind(req.EdbInfoId, req.EdbCode, req.StartDate, dataItem)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "刷新指标信息失败!"
+		br.ErrMsg = "刷新指标信息失败 RefreshEdbDataFromWind,Err:" + err.Error()
+		return
+	}
+	// 更新指标最大最小值
+	err, errMsg := models.UnifiedModifyEdbInfoMaxAndMinInfo(edbInfo)
+	if err != nil {
+		br.Msg = errMsg
+		br.ErrMsg = err.Error()
+		return
+	}
+
+	// 更新ES
+	go logic.UpdateEs(edbInfo.EdbInfoId)
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}

+ 10 - 2
controllers/edb_info.go

@@ -105,8 +105,16 @@ func (this *EdbInfoController) Add() {
 			}
 		}
 	}
-	admnId, _ := strconv.Atoi(utils.InitAdminId)
-	edbInfo, err := models.EdbInfoAdd(&req, windUrl, admnId, utils.InitAdminName)
+
+	adminId, _ := strconv.Atoi(utils.InitAdminId)
+	if req.AdminId > 0 {
+		adminId = req.AdminId
+	}
+	adminName := utils.InitAdminName
+	if req.AdminName != "" {
+		adminName = strings.TrimSpace(req.AdminName)
+	}
+	edbInfo, err := models.EdbInfoAdd(&req, windUrl, adminId, adminName)
 	if err != nil {
 		br.Msg = "新增指标失败!"
 		br.ErrMsg = "新增指标失败,Err:" + err.Error()

+ 158 - 0
models/base_from_wind_wsd.go

@@ -0,0 +1,158 @@
+package models
+
+import (
+	"eta/eta_index_lib/utils"
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"strconv"
+	"strings"
+	"time"
+)
+
+var windWsd = "wsd"
+
+func AddEdbDataFromWindWsd(securitiesCode string, item map[string]map[string]interface{}) (err error) {
+	o := orm.NewOrm()
+
+	var isAdd bool
+	addSql := ` INSERT INTO edb_data_wind_wsd(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
+
+	for wk, wv := range item {
+		for vk, vv := range wv {
+			var indexCode string
+			wkInt, err := strconv.ParseInt(wk, 10, 64)
+			if err != nil {
+				return err
+			}
+
+			vk = strings.ToLower(vk)
+			indexCode = windWsd + securitiesCode + vk
+
+			timeStr := wk
+			wkInt = wkInt / 1000
+			t := time.Unix(wkInt, 0)
+			dateTime := t.Format(utils.FormatDate)
+			//saveVal := utils.SubFloatToString(val, 20)
+			var saveVal string
+			switch vt := vv.(type) {
+			case int:
+				saveVal = strconv.Itoa(vt)
+			case float64:
+				saveVal = utils.SubFloatToFloatStr(vt, 20)
+			case string:
+				saveVal = vt
+			}
+			addSql += GetAddSql("0", indexCode, dateTime, timeStr, saveVal)
+			isAdd = true
+		}
+	}
+
+	if isAdd {
+		addSql = strings.TrimRight(addSql, ",")
+		_, err = o.Raw(addSql).Exec()
+		if err != nil {
+			return
+		}
+	}
+	return
+}
+
+// RefreshEdbDataFromWind 刷新wind指标数据
+func RefreshEdbDataFromWindWsd(edbInfoId int, edbCode, startDate string, item *EdbDataFromWind) (err error) {
+	o := orm.NewOrm()
+	source := utils.DATA_SOURCE_WIND
+
+	// 真实数据的最大日期  , 插入规则配置的日期
+	var realDataMaxDate, edbDataInsertConfigDate time.Time
+	var edbDataInsertConfig *EdbDataInsertConfig
+	var isFindConfigDateRealData bool //是否找到配置日期的实际数据的值
+	{
+		edbDataInsertConfig, err = GetEdbDataInsertConfigByEdbId(edbInfoId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return
+		}
+		if edbDataInsertConfig != nil {
+			edbDataInsertConfigDate = edbDataInsertConfig.Date
+		}
+	}
+
+	var condition string
+	var pars []interface{}
+
+	condition += " AND edb_info_id=? "
+	pars = append(pars, edbInfoId)
+
+	var startDateTime time.Time
+	if startDate != "" {
+		condition += " AND data_time>=? "
+		pars = append(pars, startDate)
+		startDateTime, _ = time.ParseInLocation(utils.FormatDate, startDate, time.Local)
+	}
+
+	existList, err := GetEdbDataByCondition(source, condition, pars)
+	existMap := make(map[string]*EdbInfoSearchData)
+	for _, v := range existList {
+		existMap[v.DataTime] = v
+	}
+	addSql := ` INSERT INTO edb_data_wind(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
+	var isAdd bool
+	addMap := make(map[string]string)
+	edbInfoIdStr := strconv.Itoa(edbInfoId)
+	for k, v := range item.Dt {
+		timeStr := fmt.Sprintf("%d", v)
+		v = v / 1000
+		t := time.Unix(v, 0)
+		dateTime := t.Format(utils.FormatDate)
+		t, _ = time.ParseInLocation(utils.FormatDate, dateTime, time.Local) // 这里的目的是为了处理成北京时间,所以多转一遍
+
+		val := item.Close[k]
+		saveVal := utils.SubFloatToString(val, 30)
+
+		//如果传入的开始时间是空的,且当前数据日期早于传入的开始日期,那么需要判断下当前日期的数据是否存在
+		if !startDateTime.IsZero() && t.Before(startDateTime) {
+			tmpItem, tmpErr := GetEdbDataByDate(source, edbCode, dateTime)
+			if tmpErr == nil && tmpItem != nil {
+				existMap[tmpItem.DataTime] = tmpItem
+			}
+		}
+
+		if findItem, ok := existMap[dateTime]; !ok {
+			if _, existOk := addMap[dateTime]; !existOk {
+				isAdd = true
+				addSql += GetAddSql(edbInfoIdStr, edbCode, dateTime, timeStr, saveVal)
+				addMap[dateTime] = saveVal
+			}
+		} else {
+			if findItem != nil && utils.SubFloatToString(findItem.Value, 30) != saveVal {
+				err = ModifyEdbDataById(source, findItem.EdbDataId, saveVal)
+				if err != nil {
+					return err
+				}
+			}
+		}
+
+		// 下面代码主要目的是处理掉手动插入的数据判断
+		{
+			if realDataMaxDate.IsZero() || t.After(realDataMaxDate) {
+				realDataMaxDate = t
+			}
+			if edbDataInsertConfigDate.IsZero() || t.Equal(edbDataInsertConfigDate) {
+				isFindConfigDateRealData = true
+			}
+		}
+	}
+
+	// 处理手工数据补充的配置
+	HandleConfigInsertEdbData(realDataMaxDate, edbDataInsertConfig, edbInfoId, source, existMap, isFindConfigDateRealData)
+
+	if isAdd {
+		addSql = strings.TrimRight(addSql, ",")
+		_, err = o.Raw(addSql).Exec()
+		if err != nil {
+			fmt.Println("RefreshEdbDataFromWind add Err", err.Error())
+			return
+		}
+	}
+
+	return
+}

+ 3 - 2
models/edb_data_base.go

@@ -43,8 +43,9 @@ func GetAddSql(edbInfoId, edbCode, dataTime, timestampStr string, value string)
 }
 
 type AddEdbInfoReq struct {
-	EdbCode string `description:"指标编码"`
-	Source  int    `description:"指标来源ID"`
+	EdbCode   string `description:"指标编码"`
+	Source    int    `description:"指标来源ID"`
+	StockCode string `description:"证券代码"`
 }
 
 // GetEdbInfoCountByCondition 获取指标数量

+ 2 - 0
models/edb_info.go

@@ -1066,6 +1066,8 @@ type AddEdbInfoParams struct {
 	Frequency    string `description:"频率"`
 	Unit         string `description:"单位"`
 	ClassifyId   int    `description:"分类id"`
+	AdminId      int    `description:"创建人ID"`
+	AdminName    string `description:"创建人姓名"`
 	TerminalCode string `description:"终端编码"`
 }
 

+ 18 - 0
routers/commentsRouter.go

@@ -979,6 +979,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_index_lib/controllers:WindWsdController"] = append(beego.GlobalControllerRouter["eta/eta_index_lib/controllers:WindWsdController"],
+        beego.ControllerComments{
+            Method: "Refresh",
+            Router: `/wsd//refresh`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_index_lib/controllers:WindWsdController"] = append(beego.GlobalControllerRouter["eta/eta_index_lib/controllers:WindWsdController"],
+        beego.ControllerComments{
+            Method: "Add",
+            Router: `/wsd/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_index_lib/controllers:ZzController"] = append(beego.GlobalControllerRouter["eta/eta_index_lib/controllers:ZzController"],
         beego.ControllerComments{
             Method: "Add",

+ 2 - 1
services/base_from_jiayue.go

@@ -303,7 +303,8 @@ func SyncJiaYueNewIndex(item models.BridgeJiaYueIndexAndData, menus []models.Bri
 	addParams.Unit = item.Unit
 	addParams.ClassifyId = classify.ClassifyId
 	addParams.Source = sourceId
-	edbInfo, e := models.EdbInfoAdd(addParams, "", 0, "")
+	adminId, _ := strconv.Atoi(utils.InitAdminId)
+	edbInfo, e := models.EdbInfoAdd(addParams, "", adminId, utils.InitAdminName)
 	if e != nil {
 		err = fmt.Errorf("EdbInfoAdd err: %s", e.Error())
 		return

+ 178 - 0
services/base_from_wind_wsd.go

@@ -0,0 +1,178 @@
+package services
+
+import (
+	"encoding/json"
+	"eta/eta_index_lib/models"
+	"eta/eta_index_lib/services/alarm_msg"
+	"eta/eta_index_lib/utils"
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/http"
+)
+
+// GetEdbDataFromWind 获取wind数据
+func GetEdbDataFromWindWsd(securitiesCode, edbCode, startDate, endDate string) (item *models.EdbDataFromWind, errorCode int, err error) {
+	windUrl, err := GetWindUrl(edbCode)
+	if err != nil {
+		errorCode = 421
+		go alarm_msg.SendAlarmMsg(fmt.Sprintf("获取wind服务器地址失败,err:%s", err.Error()), 3)
+		return
+	}
+	thsUrl := windUrl + `edbInfo/wind?EdbCode=%s&StartDate=%s&EndDate=%s`
+	thsUrl = fmt.Sprintf(thsUrl, edbCode, startDate, endDate)
+	utils.FileLog.Info(fmt.Sprintf("windUrl:%s", thsUrl))
+	body, err := http.Get(thsUrl)
+	fmt.Println("GetEdbDataByWind body:")
+	fmt.Println(string(body))
+	utils.FileLog.Info(fmt.Sprint("指标编码:", edbCode, ";wind result:", string(body)))
+
+	if err != nil {
+		return
+	}
+	item = new(models.EdbDataFromWind)
+	err = json.Unmarshal(body, &item)
+
+	//异常的话,需要邮件通知
+	if len(item.ErrorCode) > 0 {
+		if item.ErrorCode["0"] != 0 {
+			if item.ErrorCode["0"] == -40522017 {
+				//{
+				//DT: {
+				//0: 1654646400000
+				//},
+				//CLOSE: {
+				//0: "CEDBService:: quota exceeded."
+				//},
+				//ErrorCode: {
+				//0: -40522017
+				//}
+				//}
+				// 设置服务器已超限
+				SetIsLimitEdbCodeInWindUrl(windUrl)
+				err = DeleteEdbCodeInWindUrl(edbCode)
+				if err != nil {
+					return
+				}
+				return GetEdbDataFromWind(edbCode, startDate, endDate)
+			} else if item.ErrorCode["0"] == -40520005 {
+				//.ErrorCode=-40520005
+				//.Data=[No Python API Authority
+				SetIsLimitEdbCodeInWindUrl(windUrl)
+				err = DeleteEdbCodeInWindUrl(edbCode)
+				if err != nil {
+					return
+				}
+				go alarm_msg.SendAlarmMsg(fmt.Sprintf("wind数据服务异常,edbCode:%s,ErrorCode:%d,result:%s", edbCode, item.ErrorCode["0"], string(body)), 3)
+				return GetEdbDataFromWind(edbCode, startDate, endDate)
+			} else if item.ErrorCode["0"] == WindNoAuthCode {
+				// 指标下架, 无权限
+				return nil, WindNoAuthCode, nil
+			} else {
+				go alarm_msg.SendAlarmMsg(fmt.Sprintf("wind数据服务异常,edbCode:%s,ErrorCode:%d,result:%s", edbCode, item.ErrorCode["0"], string(body)), 3)
+			}
+		}
+	}
+	return
+}
+
+// GetEdbDataFromWindUrlWsd 通过url获取wind wsd数据
+func GetEdbDataFromWindUrlWsd(windUrl, securitiesCode, edbCode, startDate, endDate string) (item map[string]map[string]interface{}, errorCode int, err error) {
+	requestWindUrl := windUrl + `/edbInfo/wind/wsd?SecuritiesCode=%s&EdbCode=%s&StartDate=%s&EndDate=%s`
+	requestWindUrl = fmt.Sprintf(requestWindUrl, securitiesCode, edbCode, startDate, endDate)
+	utils.FileLog.Info(fmt.Sprintf("windUrl:%s", requestWindUrl))
+	body, err := http.Get(requestWindUrl)
+	fmt.Println("GetEdbDataFromWindUrlWsd body:")
+	fmt.Println(string(body))
+	utils.FileLog.Info(fmt.Sprint("wind result:", string(body)))
+	err = json.Unmarshal(body, &item)
+	return
+}
+
+//
+//// GetWindUrl 获取wind的url
+//func GetWindUrl(edbCode string) (windUrl string, err error) {
+//	defer func() {
+//		if err == nil && windUrl == "" {
+//			err = errors.New("获取wind服务器地址失败,指标超限了")
+//		}
+//	}()
+//	//从缓存中获取
+//	cacheKey := utils.CACHE_WIND_URL + ":" + edbCode
+//	windUrl, _ = utils.Rc.RedisString(cacheKey)
+//	if windUrl != "" {
+//		return
+//	}
+//	//如果缓存中没有的话,那么从配置中获取
+//	for _, windUrlMap := range utils.Hz_Wind_Data_Url_LIST {
+//		//判断该url是否被占满了
+//		//count, tmpErr := GetCountEdbCodeInWindUrl(windUrlMap.Url)
+//		//if tmpErr != nil && tmpErr.Error() != "nil returned" {
+//		//	err = tmpErr
+//		//	return
+//		//}
+//		//if count < windUrlMap.Num {
+//		//	windUrl = windUrlMap.Url
+//		//	AddEdbCodeInWindUrl(windUrlMap.Url, edbCode)
+//		//	return
+//		//}
+//		//如果超限了,那么进入下一循环
+//		isLimit, tmpErr := GetIsLimitEdbCodeInWindUrl(windUrlMap.Url)
+//		if isLimit {
+//			err = tmpErr
+//			continue
+//		}
+//
+//		windUrl = windUrlMap.Url
+//		AddEdbCodeInWindUrl(windUrlMap.Url, edbCode)
+//		return
+//	}
+//	return
+//}
+//
+//// GetCountEdbCodeInWindUrl 从缓存key中获取已经插入入的指标数
+//func GetCountEdbCodeInWindUrl(windUrl string) (num int, err error) {
+//	cacheKey := utils.CACHE_WIND_URL + time.Now().Format(utils.FormatDateUnSpace) + ":" + utils.MD5(windUrl)
+//	num, err = utils.Rc.RedisInt(cacheKey)
+//	if err != nil && err.Error() == "redigo: nil returned" {
+//		err = nil
+//	}
+//	return
+//}
+//
+//// GetIsLimitEdbCodeInWindUrl 从缓存key中获取是否超限
+//func GetIsLimitEdbCodeInWindUrl(windUrl string) (isLimit bool, err error) {
+//	cacheKey := utils.CACHE_WIND_URL + ":limit:" + time.Now().Format(utils.FormatDateUnSpace) + ":" + utils.MD5(windUrl)
+//
+//	num, err := utils.Rc.RedisInt(cacheKey)
+//	if err != nil && err.Error() == "redigo: nil returned" {
+//		err = nil
+//	}
+//	if num > 0 {
+//		isLimit = true
+//	}
+//	return
+//}
+//
+//// SetIsLimitEdbCodeInWindUrl 设置服务器已超限
+//func SetIsLimitEdbCodeInWindUrl(windUrl string) {
+//	cacheKey := utils.CACHE_WIND_URL + ":limit:" + time.Now().Format(utils.FormatDateUnSpace) + ":" + utils.MD5(windUrl)
+//	_ = utils.Rc.SetNX(cacheKey, 1, utils.GetTodayLastSecond())
+//	return
+//}
+//
+//// AddEdbCodeInWindUrl 将指标插入到缓存key中
+//// @return isInsert bool 是否插入数据,true时为插入数据,false表示数据已存在
+//func AddEdbCodeInWindUrl(windUrl, edbCode string) (isInsert bool) {
+//	cacheKey := utils.CACHE_WIND_URL + ":" + edbCode
+//	isInsert = utils.Rc.SetNX(cacheKey, windUrl, utils.GetTodayLastSecond())
+//
+//	cacheKey2 := utils.CACHE_WIND_URL + time.Now().Format(utils.FormatDateUnSpace) + ":" + utils.MD5(windUrl)
+//	utils.Rc.Incrby(cacheKey2, 1)
+//	return
+//}
+//
+//// DeleteEdbCodeInWindUrl 删除指标编码 服务器归属 缓存
+//func DeleteEdbCodeInWindUrl(edbCode string) (err error) {
+//	cacheKey := utils.CACHE_WIND_URL + ":" + edbCode
+//	err = utils.Rc.Delete(cacheKey)
+//	return
+//}