1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package controllers
- import (
- "eta/eta_chart_lib/models"
- "eta/eta_chart_lib/services/eta_forum"
- )
- type EtaForumChartController struct {
- BaseCommonController
- }
- // CommonChartInfoDetailFromUniqueCode
- // @Title 根据编码获取图表详情
- // @Description 根据编码获取图表详情接口
- // @Param UniqueCode query int true "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
- // @Param IsCache query bool true "是否走缓存,默认false"
- // @Success 200 {object} data_manage.ChartInfoDetailFromUniqueCodeResp
- // @router /chart/common/detail [get]
- func (this *EtaForumChartController) CommonChartInfoDetailFromUniqueCode() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- uniqueCode := this.GetString("UniqueCode")
- if uniqueCode == "" {
- br.Msg = "参数错误"
- br.ErrMsg = "参数错误,uniqueCode is empty"
- return
- }
- resp := new(models.ChartInfoDetailResp)
- //是否走缓存
- isCache, _ := this.GetBool("IsCache")
- forumResp, err, _ := eta_forum.GeChartFromUniqueCode(uniqueCode, isCache)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取图表信息失败, Err: " + err.Error()
- return
- }
- chartInfo := forumResp.ChartInfo
- resp.ChartInfo = chartInfo
- resp.DataResp = forumResp.DataResp
- resp.EdbInfoList = forumResp.EdbInfoList
- resp.XDataList = forumResp.XDataList
- resp.YDataList = forumResp.YDataList
- resp.WaterMark = forumResp.WaterMark
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = resp
- }
|