|
@@ -18,23 +18,28 @@ type JiaYueIndexController struct{}
|
|
|
// GetData
|
|
|
// @Description 获取嘉悦指标数据
|
|
|
// @Success 200 {string} string "操作成功"
|
|
|
-// @Router /jiayue/index [get]
|
|
|
+// @Router /jiayue/index [post]
|
|
|
func (j *JiaYueIndexController) GetData(c *gin.Context) {
|
|
|
- indexCode := c.DefaultQuery("index_code", "")
|
|
|
- source := c.DefaultQuery("source", "")
|
|
|
- startDate := c.DefaultQuery("start_date", "")
|
|
|
- endDate := c.DefaultQuery("end_date", "")
|
|
|
-
|
|
|
- if indexCode == "" {
|
|
|
+ var req indexDataReq.JiaYueIndexReq
|
|
|
+ if e := c.Bind(&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.IndexCode == "" {
|
|
|
resp.FailMsg("请输入指标code码", "请输入指标code码", c)
|
|
|
return
|
|
|
}
|
|
|
- if source == "" {
|
|
|
+ if req.Source == "" {
|
|
|
resp.FailMsg("请输入指标来源", "请输入指标来源", c)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- data, err, errMsg := indexDataService.GetIndexFromJiaYue(indexCode, source, startDate, endDate)
|
|
|
+ data, err, errMsg := indexDataService.GetIndexFromJiaYue(req.IndexCode, req.Source, req.StartDate, req.EndDate)
|
|
|
if err != nil {
|
|
|
resp.FailMsg("查询失败", err.Error()+errMsg, c)
|
|
|
return
|
|
@@ -46,10 +51,10 @@ func (j *JiaYueIndexController) GetData(c *gin.Context) {
|
|
|
// GetPageIndex
|
|
|
// @Description 获取嘉悦指标列表-分页
|
|
|
// @Success 200 {string} string "获取成功"
|
|
|
-// @Router /jiayue/page_index [get]
|
|
|
+// @Router /jiayue/page_index [post]
|
|
|
func (j *JiaYueIndexController) GetPageIndex(c *gin.Context) {
|
|
|
var req indexDataReq.JiaYuePageIndexReq
|
|
|
- if e := c.BindQuery(&req); e != nil {
|
|
|
+ if e := c.Bind(&req); e != nil {
|
|
|
err, ok := e.(validator.ValidationErrors)
|
|
|
if !ok {
|
|
|
resp.FailData("参数解析失败", "Err:"+e.Error(), c)
|
|
@@ -83,7 +88,7 @@ func (j *JiaYueIndexController) GetPageIndex(c *gin.Context) {
|
|
|
// GetIndexFrequency
|
|
|
// @Description 获取指标频度列表
|
|
|
// @Success 200 {string} string "获取成功"
|
|
|
-// @Router /jiayue/frequency_list [get]
|
|
|
+// @Router /jiayue/frequency_list [post]
|
|
|
func (j *JiaYueIndexController) GetIndexFrequency(c *gin.Context) {
|
|
|
list, err := jiayue.GetDictFrequency()
|
|
|
if err != nil {
|