|
@@ -3,8 +3,10 @@ package eta_forum
|
|
|
import (
|
|
|
"eta/eta_api/models/data_manage"
|
|
|
"eta/eta_api/services/alarm_msg"
|
|
|
+ "eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
type UserChartListReq struct {
|
|
@@ -32,14 +34,68 @@ type UserChartListRespItem struct {
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
|
}
|
|
|
|
|
|
+type UserCollectChartClassifyListResp struct {
|
|
|
+ Ret int
|
|
|
+ Msg string
|
|
|
+ ErrMsg string
|
|
|
+ ErrCode string
|
|
|
+ Data *UserCollectChartClassifyListItem
|
|
|
+ Success bool `description:"true 执行成功,false 执行失败"`
|
|
|
+ IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"`
|
|
|
+ IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" `
|
|
|
+}
|
|
|
+
|
|
|
+type UserCollectChartClassifyListItem struct {
|
|
|
+ List []*ChartCollectClassifyItem
|
|
|
+ Language string `description:"指标的展示语言,CN:中文,EN:英文"`
|
|
|
+}
|
|
|
+
|
|
|
+// ChartCollectClassifyItem 我的图表分类信息
|
|
|
+type ChartCollectClassifyItem struct {
|
|
|
+ CollectClassifyId int `description:"分类ID"`
|
|
|
+ ClassifyName string `description:"分类名称"`
|
|
|
+ UserId int `description:"创建人id"`
|
|
|
+ ChartNum int `description:"分类下的图表数量"`
|
|
|
+}
|
|
|
+
|
|
|
+type UserCollectChartListResp struct {
|
|
|
+ Ret int
|
|
|
+ Msg string
|
|
|
+ ErrMsg string
|
|
|
+ ErrCode string
|
|
|
+ Data *UserCollectChartListRespItem
|
|
|
+ Success bool `description:"true 执行成功,false 执行失败"`
|
|
|
+ IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"`
|
|
|
+ IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" `
|
|
|
+}
|
|
|
+type UserCollectChartListRespItem struct {
|
|
|
+ Paging *paging.PagingItem
|
|
|
+ List []*ChartCollectView
|
|
|
+}
|
|
|
+
|
|
|
+type ChartCollectView struct {
|
|
|
+ ChartCollectId int
|
|
|
+ ChartInfoId int `description:"图表id"`
|
|
|
+ UserId int `description:"用户id"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ CollectTime time.Time `description:"收藏时间"`
|
|
|
+ CollectClassifyId int
|
|
|
+ ChartName string `description:"来源名称"`
|
|
|
+ ChartNameEn string `description:"英文图表名称"`
|
|
|
+ ChartImage string `description:"图表图片"`
|
|
|
+ UniqueCode string `description:"图表唯一编码"`
|
|
|
+}
|
|
|
+
|
|
|
// GetUserChartList 查询社区中对用户可见的图表列表
|
|
|
func GetUserChartList(businessCode, userMobile, telAreaCode, keyword string) (resp UserChartListRespItem, err error, errMsg string) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
- go alarm_msg.SendAlarmMsg(fmt.Sprintf("查询社区中对用户可见的图表列表 GetUserChartList:Err:%v,ErrMsg:%s", err, errMsg), 3)
|
|
|
+ msg := fmt.Sprintf("查询社区中对用户可见的图表列表 GetUserChartList:Err:%v,ErrMsg:%s", err, errMsg)
|
|
|
+ utils.FileLog.Info(msg)
|
|
|
+ go alarm_msg.SendAlarmMsg(msg, 3)
|
|
|
}
|
|
|
}()
|
|
|
- urlQuery := fmt.Sprintf("BusinessCode=%s&UserMobile=%s&TelAreaCode=%s&Keyword=%s", businessCode, userMobile, telAreaCode, keyword)
|
|
|
+ urlQuery := fmt.Sprintf("BusinessCode=%s&UserMobile=%s&UserTelAreaCode=%s&Keyword=%s", businessCode, userMobile, telAreaCode, keyword)
|
|
|
result, err := GetUserChartListLib(urlQuery)
|
|
|
if err != nil {
|
|
|
errMsg = "查询失败"
|
|
@@ -48,7 +104,7 @@ func GetUserChartList(businessCode, userMobile, telAreaCode, keyword string) (re
|
|
|
}
|
|
|
if result.Ret != 200 {
|
|
|
errMsg = "查询失败"
|
|
|
- err = fmt.Errorf(result.ErrMsg)
|
|
|
+ err = fmt.Errorf(result.Msg + result.ErrMsg)
|
|
|
return
|
|
|
}
|
|
|
resp.Paging = result.Data.Paging
|
|
@@ -56,3 +112,57 @@ func GetUserChartList(businessCode, userMobile, telAreaCode, keyword string) (re
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// GetUserCollectChartClassifyList 查询社区中用户收藏的分类列表
|
|
|
+func GetUserCollectChartClassifyList(businessCode, userMobile, telAreaCode string) (resp UserCollectChartClassifyListItem, err error, errMsg string) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ msg := fmt.Sprintf("查询社区中用户收藏的分类列表 GetUserCollectChartClassifyList:Err:%v,ErrMsg:%s", err, errMsg)
|
|
|
+ utils.FileLog.Info(msg)
|
|
|
+ go alarm_msg.SendAlarmMsg(msg, 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ urlQuery := fmt.Sprintf("BusinessCode=%s&UserMobile=%s&UserTelAreaCode=%s", businessCode, userMobile, telAreaCode)
|
|
|
+ result, err := getUserCollectChartClassifyLib(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.List = result.Data.List
|
|
|
+ resp.Language = result.Data.Language
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// GetUserCollectChartList 查询社区中对用户收藏的图表列表
|
|
|
+func GetUserCollectChartList(businessCode, userMobile, telAreaCode, keyword, collectClassifyIds string, currentIndex, pageSize int) (resp UserCollectChartListRespItem, err error, errMsg string) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ msg := fmt.Sprintf("查询社区中对用户收藏的图表列表 GetUserCollectChartList:Err:%v,ErrMsg:%s", err, errMsg)
|
|
|
+ utils.FileLog.Info(msg)
|
|
|
+ go alarm_msg.SendAlarmMsg(msg, 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ urlQuery := fmt.Sprintf("BusinessCode=%s&UserMobile=%s&UserTelAreaCode=%s&Keyword=%s&CollectClassifyIds=%s&PageSize=%d&CurrentIndex=%d", businessCode, userMobile, telAreaCode, keyword, collectClassifyIds, currentIndex, pageSize)
|
|
|
+ result, err := getUserCollectChartListLib(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.Paging = result.Data.Paging
|
|
|
+ resp.List = result.Data.List
|
|
|
+
|
|
|
+ return
|
|
|
+}
|