package eta_forum import ( "eta/eta_api/controllers" "eta/eta_api/models" "eta/eta_api/models/data_manage" "eta/eta_api/services/eta_forum" "eta/eta_api/utils" ) type EtaForumController struct { controllers.BaseAuthController } // UserChartList // @Title 查询用户在eta社区中有权限查看的图表列表 // @Description 查询用户在eta社区中有权限查看的图表列表 // @Param request body data_manage.SetChartInfoImageReq true "type json string" // @Success Ret=200 保存成功 // @router /chart_list [get] func (this *EtaForumController) UserChartList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } keyword := this.GetString("keyword") businessCode := utils.BusinessCode userMobile := sysUser.Mobile telAreaCode := sysUser.TelAreaCode if businessCode == "" { br.Msg = "商户号未配置" return } if userMobile == "" { br.Msg = "请先绑定手机号" return } if telAreaCode == "" { telAreaCode = utils.TelAreaCodeHome } resp, err, errMsg := eta_forum.GetUserChartList(businessCode, userMobile, telAreaCode, keyword) if err != nil { br.Msg = errMsg br.ErrMsg = err.Error() return } br.Ret = 200 br.Success = true br.Msg = "保存成功" br.Data = resp } // UserCollectChartClassifyList // @Title 查询社区中用户收藏的分类列表 // @Description 查询社区中用户收藏的分类列表 // @Param request body data_manage.SetChartInfoImageReq true "type json string" // @Success Ret=200 保存成功 // @router /collect/chart_classify [get] func (this *EtaForumController) UserCollectChartClassifyList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } businessCode := utils.BusinessCode userMobile := sysUser.Mobile telAreaCode := sysUser.TelAreaCode if businessCode == "" { br.Msg = "商户号未配置" return } if userMobile == "" { br.Msg = "请先绑定手机号" return } if telAreaCode == "" { telAreaCode = utils.TelAreaCodeHome } resp, err, errMsg := eta_forum.GetUserCollectChartClassifyList(businessCode, userMobile, telAreaCode) if err != nil { br.Msg = errMsg br.ErrMsg = err.Error() return } br.Ret = 200 br.Success = true br.Msg = "保存成功" br.Data = resp } // UserCollectChartList // @Title 查询社区中用户收藏的图表列表 // @Description 查询社区中用户收藏的图表列表 // @Param request body data_manage.SetChartInfoImageReq true "type json string" // @Success Ret=200 保存成功 // @router /collect/chart [get] func (this *EtaForumController) UserCollectChartList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } businessCode := utils.BusinessCode userMobile := sysUser.Mobile telAreaCode := sysUser.TelAreaCode if businessCode == "" { br.Msg = "商户号未配置" return } if userMobile == "" { br.Msg = "请先绑定手机号" return } if telAreaCode == "" { telAreaCode = utils.TelAreaCodeHome } collectClassifyIds := this.GetString("CollectClassifyIds") pageSize, _ := this.GetInt("PageSize") currentIndex, _ := this.GetInt("CurrentIndex") keyword := this.GetString("Keyword") resp, err, errMsg := eta_forum.GetUserCollectChartList(businessCode, userMobile, telAreaCode, keyword, collectClassifyIds, currentIndex, pageSize) if err != nil { br.Msg = errMsg br.ErrMsg = err.Error() return } br.Ret = 200 br.Success = true br.Msg = "保存成功" br.Data = resp } // CommonChartInfoDetailFromUniqueCode // @Title 根据编码获取图表详情 // @Description 根据编码获取图表详情接口 // @Param UniqueCode query int true "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc" // @Param IsCache query bool true "是否走缓存,默认false" // @Success 200 {object} data_manage.ChartInfoDetailFromUniqueCodeResp // @router /chart/from_unique_code [get] func (this *EtaForumController) 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 } //是否走缓存 isCache, _ := this.GetBool("IsCache") resp := new(data_manage.ChartInfoDetailFromUniqueCodeResp) status := true forumResp, err, _ := eta_forum.GeChartFromUniqueCode(uniqueCode, isCache) if err != nil { endInfoList := make([]*data_manage.ChartEdbInfoMapping, 0) resp.EdbInfoList = endInfoList resp.ChartInfo = nil resp.Status = false br.Data = resp br.Ret = 200 br.Success = true br.Msg = "获取成功" return } chartInfo := forumResp.ChartInfo if chartInfo == nil { endInfoList := make([]*data_manage.ChartEdbInfoMapping, 0) resp.EdbInfoList = endInfoList resp.ChartInfo = nil resp.Status = false br.Data = resp br.Ret = 200 br.Success = true br.Msg = "获取成功" return } resp.ChartInfo = chartInfo resp.Status = status resp.DataResp = forumResp.DataResp resp.EdbInfoList = forumResp.EdbInfoList resp.XDataList = forumResp.XDataList resp.YDataList = forumResp.YDataList br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp }