|
@@ -0,0 +1,57 @@
|
|
|
+package eta_forum
|
|
|
+
|
|
|
+import (
|
|
|
+ "eta/eta_chart_lib/models"
|
|
|
+ "eta/eta_chart_lib/services/alarm_msg"
|
|
|
+ "eta/eta_chart_lib/utils"
|
|
|
+ "fmt"
|
|
|
+)
|
|
|
+
|
|
|
+type ChartFromUniqueCodeResp struct {
|
|
|
+ Ret int
|
|
|
+ Msg string
|
|
|
+ ErrMsg string
|
|
|
+ ErrCode string
|
|
|
+ Data *ChartFromUniqueCodeRespItem
|
|
|
+ Success bool `description:"true 执行成功,false 执行失败"`
|
|
|
+ IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"`
|
|
|
+ IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" `
|
|
|
+}
|
|
|
+
|
|
|
+type ChartFromUniqueCodeRespItem struct {
|
|
|
+ ChartInfo *models.ChartInfo
|
|
|
+ EdbInfoList []*models.ChartEdbInfoMapping
|
|
|
+ XEdbIdValue []int `description:"柱方图的x轴数据,指标id"`
|
|
|
+ YDataList []models.YData `description:"柱方图的y轴数据"`
|
|
|
+ XDataList []models.XData `description:"商品价格曲线的X轴数据"`
|
|
|
+ //BarChartInfo BarChartInfoReq `description:"柱方图的配置"`
|
|
|
+ //CorrelationChartInfo *CorrelationInfo `description:"相关性图表信息"`
|
|
|
+ DataResp interface{} `description:"图表数据,根据图的类型而定的,没有确定的数据格式"`
|
|
|
+ WaterMark string `description:"水印"`
|
|
|
+}
|
|
|
+
|
|
|
+// GeChartFromUniqueCode 社区中根据唯一编码查询图表
|
|
|
+func GeChartFromUniqueCode(uniqueCode string, isCache bool) (resp ChartFromUniqueCodeRespItem, err error, errMsg string) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ msg := fmt.Sprintf("查询社区中对用户可见的图表列表 GeChartFromUniqueCode:Err:%v,ErrMsg:%s", err, errMsg)
|
|
|
+ utils.FileLog.Info(msg)
|
|
|
+ go alarm_msg.SendAlarmMsg(msg, 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ urlQuery := fmt.Sprintf("UniqueCode=%s&isCache=%v", uniqueCode, isCache)
|
|
|
+ result, err := getChartFromUniqueCodeLib(urlQuery)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "查询失败"
|
|
|
+ err = fmt.Errorf("查询失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if result.Ret != 200 {
|
|
|
+ errMsg = "查询失败"
|
|
|
+ err = fmt.Errorf(result.Msg + result.ErrMsg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp = *result.Data
|
|
|
+
|
|
|
+ return
|
|
|
+}
|