package controllers import ( "encoding/json" "eta_gn/eta_index_lib/models" edb_refreshMol "eta_gn/eta_index_lib/models/edb_refresh" "eta_gn/eta_index_lib/models/edb_refresh/request" "eta_gn/eta_index_lib/services/edb_refresh" "eta_gn/eta_index_lib/utils" ) type EdbRefreshController struct { BaseAuthController } // GetMysteelIndexConfigList // @Title 获取钢联的刷新配置 // @Description 获取钢联的刷新配置 // @Success 200 {object} // @router /config/mysteel_index/list [post] func (this *EdbRefreshController) GetMysteelIndexConfigList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() list, err := edb_refresh.GetPreviousHalfHourDefaultConfigList(utils.DATA_SOURCE_MYSTEEL_CHEMICAL, 0) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,ERR:" + err.Error() } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list } // GetSmmConfigList // @Title 获取有色的刷新配置 // @Description 获取有色的刷新配置 // @Success 200 {object} // @router /config/smm/list [post] func (this *EdbRefreshController) GetSmmConfigList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() list, err := edb_refresh.GetPreviousHalfHourDefaultConfigList(utils.DATA_SOURCE_YS, 0) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,ERR:" + err.Error() } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list } // GetDefaultConfigList // @Title 获取默认的刷新配置 // @Description 获取默认的刷新配置 // @Success 200 {object} // @router /config/default/list [post] func (this *EdbRefreshController) GetDefaultConfigList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() var req request.GetEdbRefreshConfigReq err := json.Unmarshal(this.Ctx.Input.RequestBody, &req) if err != nil { br.Msg = "参数解析异常!" br.ErrMsg = "参数解析失败,Err:" + err.Error() return } condition := ` AND source = ? AND sub_source = ? ` pars := make([]interface{}, 0) pars = append(pars, req.Source, req.SubSource) list, err := edb_refreshMol.GetListByCondition(condition, pars) if err != nil { return } if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,ERR:" + err.Error() } br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = list }