Explorar o código

Merge branch 'bzq1/sci_hq_custom_cf' of eta_server/eta_api into debug

鲍自强 hai 8 meses
pai
achega
0317f11915

+ 4 - 4
controllers/data_manage/sci_hq_data.go

@@ -480,7 +480,7 @@ func (this *SciHqDataController) SearchList() {
 // SingleData
 // @Title 获取卓创红期据
 // @Description 获取卓创红期单条数据接口
-// @Param   IndexCode   query   string  true       "指标唯一编码"
+// @Param   BaseFromSciHqIndexId   query   string  true       "指标唯一编码"
 // @Success 200 {object} models.BaseResponse
 // @router /sci_hq/single_data [get]
 func (this *SciHqDataController) SingleData() {
@@ -489,14 +489,14 @@ func (this *SciHqDataController) SingleData() {
 		this.Data["json"] = br
 		this.ServeJSON()
 	}()
-	indexCode := this.GetString("IndexCode")
-	indexInfo, err := data_manage.GetSciHqIndexByIndexCode(indexCode)
+	baseFromSciHqIndexId, _ := this.GetInt("BaseFromSciHqIndexId")
+	indexInfo, err := data_manage.GetSciHqIndexByIndexId(baseFromSciHqIndexId)
 	if err != nil {
 		br.Msg = "获取指标信息失败"
 		br.ErrMsg = "获取指标信息失败,Err:" + err.Error()
 		return
 	}
-	dataList, err := data_manage.GetSciHqIndexDataByCode(indexCode)
+	dataList, err := data_manage.GetSciHqDataByIndexId(baseFromSciHqIndexId)
 	if err != nil {
 		br.Msg = "获取数据失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()

+ 1 - 1
models/data_manage/base_from_sci_hq_data.go

@@ -20,7 +20,7 @@ type BaseFromSciHqData struct {
 // GetSciHqDataByIndexId 根据指标id获取指标数据
 func GetSciHqDataByIndexId(indexId int) (items []*BaseFromSciHqData, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := ` SELECT * FROM base_from_sci_hq_data WHERE base_from_sci_hq_index_id=? `
+	sql := ` SELECT * FROM base_from_sci_hq_data WHERE base_from_sci_hq_index_id=? ORDER BY data_time DESC`
 	_, err = o.Raw(sql, indexId).QueryRows(&items)
 	return
 }