|
@@ -7,6 +7,7 @@ import (
|
|
"hongze/hongze_web_mfyx/utils"
|
|
"hongze/hongze_web_mfyx/utils"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
|
|
+ "time"
|
|
)
|
|
)
|
|
|
|
|
|
func GetResourceDataList(condition string, pars []interface{}, startSize, pageSize int, user *models.WxUserItem) (items []*models.CygxResourceDataNewResp, err error) {
|
|
func GetResourceDataList(condition string, pars []interface{}, startSize, pageSize int, user *models.WxUserItem) (items []*models.CygxResourceDataNewResp, err error) {
|
|
@@ -17,6 +18,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
|
|
err = errors.New("GetResourceDataList, Err: " + e.Error())
|
|
err = errors.New("GetResourceDataList, Err: " + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
mapItems := make(map[string]*models.CygxResourceDataNewResp)
|
|
mapItems := make(map[string]*models.CygxResourceDataNewResp)
|
|
for _, v := range list {
|
|
for _, v := range list {
|
|
//预处理文章
|
|
//预处理文章
|
|
@@ -31,28 +33,17 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
|
|
mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
|
|
mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
|
|
}
|
|
}
|
|
|
|
|
|
- var articleIds []int //报告
|
|
|
|
- var newchartIds []int //图表
|
|
|
|
- var roadshowIds []string //微路演
|
|
|
|
- var activityIds []int //活动
|
|
|
|
- var activityvideoIds []string // 活动视频
|
|
|
|
- var activityvoiceIds []string //活动音频
|
|
|
|
- var activityspecialIds []int //专项调研活动
|
|
|
|
- var researchsummaryIds []int //本周研究汇总
|
|
|
|
- var minutessummaryIds []int //上周纪要汇总
|
|
|
|
- var meetingreviewchaptIds []int //晨会精华
|
|
|
|
- var productinteriorIds []int //产品内测
|
|
|
|
- var reportselectionIds []int // 报告精选
|
|
|
|
- var yanxuanSpecialIds []int // 研选专栏
|
|
|
|
- var askserieVideoIds []string //问答系列视频
|
|
|
|
|
|
+ var articleIds []int //报告
|
|
|
|
+ var activityIds []int //活动
|
|
|
|
+ var activityvideoIds []string // 活动视频
|
|
|
|
+ var activityvoiceIds []string //活动音频
|
|
|
|
+ var activityspecialIds []int //专项调研活动
|
|
|
|
+ var reportselectionIds []int // 报告精选
|
|
|
|
+ var yanxuanSpecialIds []int // 研选专栏
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior
|
|
for _, v := range list {
|
|
for _, v := range list {
|
|
if v.Source == "article" {
|
|
if v.Source == "article" {
|
|
articleIds = append(articleIds, v.SourceId)
|
|
articleIds = append(articleIds, v.SourceId)
|
|
- } else if v.Source == "newchart" {
|
|
|
|
- newchartIds = append(newchartIds, v.SourceId)
|
|
|
|
- } else if v.Source == "roadshow" {
|
|
|
|
- roadshowIds = append(roadshowIds, strconv.Itoa(v.SourceId))
|
|
|
|
} else if v.Source == "activity" {
|
|
} else if v.Source == "activity" {
|
|
activityIds = append(activityIds, v.SourceId)
|
|
activityIds = append(activityIds, v.SourceId)
|
|
} else if v.Source == "activityvideo" {
|
|
} else if v.Source == "activityvideo" {
|
|
@@ -61,20 +52,10 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
|
|
activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
|
|
activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
|
|
} else if v.Source == "activityspecial" {
|
|
} else if v.Source == "activityspecial" {
|
|
activityspecialIds = append(activityspecialIds, v.SourceId)
|
|
activityspecialIds = append(activityspecialIds, v.SourceId)
|
|
- } else if v.Source == "researchsummary" {
|
|
|
|
- researchsummaryIds = append(researchsummaryIds, v.SourceId)
|
|
|
|
- } else if v.Source == "minutessummary" {
|
|
|
|
- minutessummaryIds = append(minutessummaryIds, v.SourceId)
|
|
|
|
- } else if v.Source == "meetingreviewchapt" {
|
|
|
|
- meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
|
|
|
|
- } else if v.Source == "productinterior" {
|
|
|
|
- productinteriorIds = append(productinteriorIds, v.SourceId)
|
|
|
|
} else if v.Source == "reportselection" {
|
|
} else if v.Source == "reportselection" {
|
|
reportselectionIds = append(reportselectionIds, v.SourceId)
|
|
reportselectionIds = append(reportselectionIds, v.SourceId)
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
|
|
yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
|
|
yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
|
|
- } else if v.Source == utils.CYGX_OBJ_ASKSERIEVIDEO {
|
|
|
|
- askserieVideoIds = append(askserieVideoIds, strconv.Itoa(v.SourceId))
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -176,102 +157,14 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
|
|
mapItems[fmt.Sprint("activity", v.ActivityId)].Activity = v
|
|
mapItems[fmt.Sprint("activity", v.ActivityId)].Activity = v
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds) > 0 {
|
|
|
|
-
|
|
|
|
- audioIdstr := strings.Join(activityvoiceIds, ",")
|
|
|
|
- activityVideoIdsStr := strings.Join(activityvideoIds, ",")
|
|
|
|
- roadshowIdsStr := strings.Join(roadshowIds, ",")
|
|
|
|
- askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
|
|
|
|
-
|
|
|
|
- list, _, e := GetMicroRoadShowMycollectV12(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds), 0, audioIdstr, activityVideoIdsStr, roadshowIdsStr, askserieVideoIdsStr, user)
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("GetMicroRoadShowMycollect, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- // 用户权限
|
|
|
|
- authInfo, permissionArr, e := GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("GetUserRaiPermissionInfo, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 获取默认图配置
|
|
|
|
- audioMap, videoMap, audioShareMap, videoShareMap, e := GetMicroRoadShowDefaultImgConfig()
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("GetMicroRoadShowDefaultImgConfig, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- //Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
|
|
|
|
- for i := range list {
|
|
|
|
- // 权限
|
|
|
|
- au := new(models.UserPermissionAuthInfo)
|
|
|
|
- au.SellerName = authInfo.SellerName
|
|
|
|
- au.SellerMobile = authInfo.SellerMobile
|
|
|
|
- au.HasPermission = authInfo.HasPermission
|
|
|
|
- au.OperationMode = authInfo.OperationMode
|
|
|
|
- if au.HasPermission == 1 {
|
|
|
|
- // 非宏观权限进一步判断是否有权限
|
|
|
|
- if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
|
|
|
|
- au.HasPermission = 2
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 无权限的弹框提示
|
|
|
|
- if au.HasPermission != 1 {
|
|
|
|
- if au.OperationMode == UserPermissionOperationModeCall {
|
|
|
|
- if list[i].Type == 1 {
|
|
|
|
- au.PopupMsg = UserPermissionPopupMsgCallActivity
|
|
|
|
- } else {
|
|
|
|
- au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if list[i].Type == 1 {
|
|
|
|
- au.PopupMsg = UserPermissionPopupMsgApplyActivity
|
|
|
|
- } else {
|
|
|
|
- au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- list[i].AuthInfo = au
|
|
|
|
- list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
|
|
|
|
- // 默认图
|
|
|
|
- if list[i].BackgroundImg == "" {
|
|
|
|
- if list[i].Type == 1 {
|
|
|
|
- list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
|
|
|
|
- } else {
|
|
|
|
- list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 分享图
|
|
|
|
- if list[i].ShareImg == "" {
|
|
|
|
- if list[i].Type == 1 {
|
|
|
|
- list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
|
|
|
|
- } else {
|
|
|
|
- list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //Type int `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
|
|
|
|
- for _, item := range list {
|
|
|
|
- if item.Type == 1 {
|
|
|
|
- mapItems[fmt.Sprint("activityvoice", item.Id)].Activityvoice = item
|
|
|
|
- } else if item.Type == 2 {
|
|
|
|
- mapItems[fmt.Sprint("activityvideo", item.Id)].Activityvideo = item
|
|
|
|
- } else if item.Type == 3 {
|
|
|
|
- mapItems[fmt.Sprint("roadshow", item.Id)].Roadshow = item
|
|
|
|
- } else if item.Type == 4 {
|
|
|
|
- mapItems[fmt.Sprint(utils.CYGX_OBJ_ASKSERIEVIDEO, item.Id)].AskserieVideo = item
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ fmt.Println(time.Now().UnixMilli())
|
|
//处理研选专栏
|
|
//处理研选专栏
|
|
lenyanxuanSpecialIds := len(yanxuanSpecialIds)
|
|
lenyanxuanSpecialIds := len(yanxuanSpecialIds)
|
|
if lenyanxuanSpecialIds > 0 {
|
|
if lenyanxuanSpecialIds > 0 {
|
|
pars = make([]interface{}, 0)
|
|
pars = make([]interface{}, 0)
|
|
condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanSpecialIds) + `) `
|
|
condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanSpecialIds) + `) `
|
|
pars = append(pars, yanxuanSpecialIds)
|
|
pars = append(pars, yanxuanSpecialIds)
|
|
- listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars, 0, 0)
|
|
|
|
|
|
+ listyanxuanSpecial, e := models.GetYanxuanSpecialListHome(user.UserId, condition, pars, 0, 0)
|
|
if e != nil {
|
|
if e != nil {
|
|
err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
|
|
err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
|
|
return
|
|
return
|
|
@@ -280,12 +173,13 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
|
|
for _, v := range listyanxuanSpecial {
|
|
for _, v := range listyanxuanSpecial {
|
|
v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
|
|
v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
|
|
v.Annotation, _ = GetReportContentTextSubNew(v.Content)
|
|
v.Annotation, _ = GetReportContentTextSubNew(v.Content)
|
|
|
|
+ v.Content = ""
|
|
v.Pv = yanxuanSpecialPv[v.Id]
|
|
v.Pv = yanxuanSpecialPv[v.Id]
|
|
v.LabelKeywordImgLink = utils.LABEL_ICO_4
|
|
v.LabelKeywordImgLink = utils.LABEL_ICO_4
|
|
mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
|
|
mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ fmt.Println(time.Now().UnixMilli())
|
|
for _, vList := range list {
|
|
for _, vList := range list {
|
|
for _, v := range mapItems {
|
|
for _, v := range mapItems {
|
|
//如果这些类型都为空,那么就不合并
|
|
//如果这些类型都为空,那么就不合并
|