|
@@ -2,8 +2,11 @@ package index_data
|
|
|
|
|
|
import (
|
|
import (
|
|
"eta/eta_bridge/controller/resp"
|
|
"eta/eta_bridge/controller/resp"
|
|
- index_data_service "eta/eta_bridge/services/index_data"
|
|
|
|
|
|
+ "eta/eta_bridge/global"
|
|
|
|
+ indexDataReq "eta/eta_bridge/models/request/index_data"
|
|
|
|
+ indexDataService "eta/eta_bridge/services/index_data"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin"
|
|
|
|
+ "github.com/go-playground/validator/v10"
|
|
)
|
|
)
|
|
|
|
|
|
type JiaYueIndexController struct{}
|
|
type JiaYueIndexController struct{}
|
|
@@ -27,7 +30,7 @@ func (j *JiaYueIndexController) GetData(c *gin.Context) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- data, err, errMsg := index_data_service.GetIndexFromJiaYue(indexCode, source, startDate, endDate)
|
|
|
|
|
|
+ data, err, errMsg := indexDataService.GetIndexFromJiaYue(indexCode, source, startDate, endDate)
|
|
if err != nil {
|
|
if err != nil {
|
|
resp.FailMsg("查询失败", err.Error()+errMsg, c)
|
|
resp.FailMsg("查询失败", err.Error()+errMsg, c)
|
|
return
|
|
return
|
|
@@ -35,3 +38,32 @@ func (j *JiaYueIndexController) GetData(c *gin.Context) {
|
|
resp.OkData("操作成功", data, c)
|
|
resp.OkData("操作成功", data, c)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// GetPageIndex
|
|
|
|
+// @Description 获取嘉悦指标列表-分页
|
|
|
|
+// @Success 200 {string} string "获取成功"
|
|
|
|
+// @Router /jiayue/page_index [get]
|
|
|
|
+func (j *JiaYueIndexController) GetPageIndex(c *gin.Context) {
|
|
|
|
+ var req indexDataReq.JiaYuePageIndexReq
|
|
|
|
+ if e := c.BindQuery(&req); e != nil {
|
|
|
|
+ err, ok := e.(validator.ValidationErrors)
|
|
|
|
+ if !ok {
|
|
|
|
+ resp.FailData("参数解析失败", "Err:"+e.Error(), c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.FailData("参数解析失败", err.Translate(global.Trans), c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if req.Source == "" {
|
|
|
|
+ resp.FailMsg("请输入指标来源", "请输入指标来源", c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ data, err := indexDataService.GetPageIndexesFromJiaYue(req.PageIndex, req.PageSize, req.Source, req.Keyword, req.Frequency)
|
|
|
|
+ if err != nil {
|
|
|
|
+ resp.FailMsg("查询失败", err.Error(), c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.OkData("操作成功", data, c)
|
|
|
|
+ return
|
|
|
|
+}
|