|
@@ -34,7 +34,7 @@ type EdbInfoController struct {
|
|
|
// @Param Source query int true "来源:1:同花顺,2:wind,3:彭博"
|
|
|
// @Param SubSource query int true "子数据来源:0:经济数据库,1:日期序列"
|
|
|
// @Param EdbCode query string false "指标编码/指标代码"
|
|
|
-// @Param SecuritiesCode query string false "证券代码"
|
|
|
+// @Param StockCode query string false "证券代码"
|
|
|
// @Success 200 {object} data_manage.EdbInfoSearchResp
|
|
|
// @router /edb_info/search [get]
|
|
|
func (this *EdbInfoController) EdbInfoSearch() {
|
|
@@ -49,7 +49,7 @@ func (this *EdbInfoController) EdbInfoSearch() {
|
|
|
edbCode = strings.Trim(edbCode, " ")
|
|
|
edbCode = strings.Replace(edbCode, "\t", "", -1)
|
|
|
subSource, _ := this.GetInt("SubSource")
|
|
|
- securitiesCode := this.GetString("SecuritiesCode")
|
|
|
+ stockCode := this.GetString("StockCode")
|
|
|
|
|
|
if source <= 0 {
|
|
|
br.Msg = "无效的数据来源"
|
|
@@ -250,7 +250,7 @@ func (this *EdbInfoController) EdbInfoSearch() {
|
|
|
isAdd = true
|
|
|
}
|
|
|
} else if subSource == utils.DATA_SUB_SOURCE_DATE {
|
|
|
- if securitiesCode == "" {
|
|
|
+ if stockCode == "" {
|
|
|
br.Msg = "请输入证券代码"
|
|
|
return
|
|
|
}
|
|
@@ -258,7 +258,7 @@ func (this *EdbInfoController) EdbInfoSearch() {
|
|
|
br.Msg = "请输入指标代码"
|
|
|
return
|
|
|
}
|
|
|
- respItem, err := data.AddEdbDataWindWsd(source, securitiesCode, edbCode)
|
|
|
+ respItem, err := data.AddEdbDataWindWsd(source, stockCode, edbCode)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
@@ -277,7 +277,8 @@ func (this *EdbInfoController) EdbInfoSearch() {
|
|
|
}
|
|
|
isAdd = true
|
|
|
} else {
|
|
|
-
|
|
|
+ br.Msg = "无效的渠道来源"
|
|
|
+ return
|
|
|
}
|
|
|
} else if source == utils.DATA_SOURCE_PB || source == utils.DATA_SOURCE_PB_FINANCE {
|
|
|
fmt.Println("pb data exist")
|
|
@@ -1661,31 +1662,45 @@ func (this *EdbInfoController) EdbInfoSearch() {
|
|
|
}
|
|
|
}
|
|
|
if isAdd {
|
|
|
- dataList, err := data_manage.GetEdbDataAllByEdbCode(edbCode, source, utils.EDB_DATA_LIMIT)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取数据失败,GetEdbDataAllByEdbCode Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- searchItem.DataList = dataList
|
|
|
+ if subSource == utils.DATA_SUB_SOURCE_DATE {
|
|
|
+ var indexCodeArr []string
|
|
|
+ edbCodeArr := strings.Split(edbCode, ",")
|
|
|
+ stockCodeArr := strings.Split(stockCode, ",")
|
|
|
+
|
|
|
+ for _, sv := range stockCodeArr {
|
|
|
+ for _, ev := range edbCodeArr {
|
|
|
+ indexCode := utils.WindDbWsd + sv + ev
|
|
|
+ indexCodeArr = append(indexCodeArr, indexCode)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- edbInfoMaxAndMinInfo, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取数据失败,GetEdbInfoMaxAndMinInfo Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- searchItem.EdbCode = edbCode
|
|
|
- searchItem.DataList = dataList
|
|
|
- if edbInfoMaxAndMinInfo != nil {
|
|
|
- searchItem.StartDate = edbInfoMaxAndMinInfo.MinDate
|
|
|
- searchItem.EndDate = edbInfoMaxAndMinInfo.MaxDate
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ dataList, err := data_manage.GetEdbDataAllByEdbCode(edbCode, source, utils.EDB_DATA_LIMIT)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,GetEdbDataAllByEdbCode Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ searchItem.DataList = dataList
|
|
|
+
|
|
|
+ edbInfoMaxAndMinInfo, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,GetEdbInfoMaxAndMinInfo Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ searchItem.EdbCode = edbCode
|
|
|
+ searchItem.DataList = dataList
|
|
|
+ if edbInfoMaxAndMinInfo != nil {
|
|
|
+ searchItem.StartDate = edbInfoMaxAndMinInfo.MinDate
|
|
|
+ searchItem.EndDate = edbInfoMaxAndMinInfo.MaxDate
|
|
|
+ }
|
|
|
|
|
|
- //edb指标信息
|
|
|
- edbInfoItem, err := data_manage.GetEdbInfoByEdbCode(source, edbCode)
|
|
|
- if edbInfoItem != nil {
|
|
|
- searchItem.EdbName = edbInfoItem.EdbName
|
|
|
+ //edb指标信息
|
|
|
+ edbInfoItem, err := data_manage.GetEdbInfoByEdbCode(source, edbCode)
|
|
|
+ if edbInfoItem != nil {
|
|
|
+ searchItem.EdbName = edbInfoItem.EdbName
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
resp.Status = 2
|
|
@@ -4973,4 +4988,5 @@ func (this *EdbInfoController) EdbInfoExistCheck() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
}
|