|
@@ -298,12 +298,20 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
var activityIds []int //活动
|
|
|
var yanxuanSpecialIds []int // 研选专栏
|
|
|
var yanxuanspecialauthorIds []int //研选作者ID
|
|
|
+ var activityvideoIds []string // 活动视频
|
|
|
+ var activityvoiceIds []string //活动音频
|
|
|
+ var roadshowIds []string //微路演
|
|
|
+ var askserieVideoIds []string //问答系列视频
|
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior
|
|
|
for _, v := range list {
|
|
|
if v.Source == "article" {
|
|
|
articleIds = append(articleIds, v.SourceId)
|
|
|
} else if v.Source == "activity" {
|
|
|
activityIds = append(activityIds, v.SourceId)
|
|
|
+ } else if v.Source == "activityvideo" {
|
|
|
+ activityvideoIds = append(activityvideoIds, strconv.Itoa(v.SourceId))
|
|
|
+ } else if v.Source == "activityvoice" {
|
|
|
+ activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
|
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
|
|
|
yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
|
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR {
|
|
@@ -466,10 +474,99 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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, ",")
|
|
|
+
|
|
|
+ listv, _, 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 listv {
|
|
|
+ // 权限
|
|
|
+ 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 listv[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, listv[i].ChartPermissionName) {
|
|
|
+ au.HasPermission = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 无权限的弹框提示
|
|
|
+ if au.HasPermission != 1 {
|
|
|
+ if au.OperationMode == UserPermissionOperationModeCall {
|
|
|
+ if listv[i].Type == 1 {
|
|
|
+ au.PopupMsg = UserPermissionPopupMsgCallActivity
|
|
|
+ } else {
|
|
|
+ au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if listv[i].Type == 1 {
|
|
|
+ au.PopupMsg = UserPermissionPopupMsgApplyActivity
|
|
|
+ } else {
|
|
|
+ au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listv[i].AuthInfo = au
|
|
|
+ listv[i].PublishTime = utils.StrTimeToTime(listv[i].PublishTime).Format(utils.FormatDate)
|
|
|
+ // 默认图
|
|
|
+ if listv[i].BackgroundImg == "" {
|
|
|
+ if listv[i].Type == 1 {
|
|
|
+ listv[i].BackgroundImg = audioMap[listv[i].ChartPermissionId]
|
|
|
+ } else {
|
|
|
+ listv[i].BackgroundImg = videoMap[listv[i].ChartPermissionId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 分享图
|
|
|
+ if listv[i].ShareImg == "" {
|
|
|
+ if listv[i].Type == 1 {
|
|
|
+ listv[i].ShareImg = audioShareMap[listv[i].ChartPermissionId]
|
|
|
+ } else {
|
|
|
+ listv[i].ShareImg = videoShareMap[listv[i].ChartPermissionId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listv[i].LabelKeywordImgLink = utils.LABEL_ICO_10
|
|
|
+ }
|
|
|
+ //Type int `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
|
|
|
+ for _, item := range listv {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, vList := range list {
|
|
|
for _, v := range mapItems {
|
|
|
//如果这些类型都为空,那么就不合并
|
|
|
- if v.Article == nil && v.Activity == nil && v.YanxuanSpecial == nil && v.YanxuanSpecialAuthor == nil {
|
|
|
+ if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.YanxuanSpecial == nil && v.AskserieVideo == nil {
|
|
|
continue
|
|
|
}
|
|
|
if v.SourceId == vList.SourceId && v.Source == vList.Source {
|
|
@@ -499,7 +596,7 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
}
|
|
|
|
|
|
//yanxuanspecialIds = append(yanxuanspecialIds, 0)
|
|
|
- condition := " AND source IN ('article','activity','yanxuanspecial') " // 只有研选的文章、研选的活动、研选的专栏这三种
|
|
|
+ condition := " AND source IN ('article','activity','yanxuanspecial','activityvoice','activityvideo') AND IF ( source IN('activityvoice','activityvideo') , chart_permission_id = 31 ,1=1 ) " // 只有研选的文章、研选的活动、研选的专栏这三种
|
|
|
condition += ` AND IF ( source = 'article' , source_id IN (` + strings.Join(yanxuanArticleIdsStr, ",") + `) ,1=1 ) `
|
|
|
//pars = append(pars, yanxuanArticleIds)
|
|
|
|
|
@@ -539,11 +636,7 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
var searchTotal int
|
|
|
searchTotal = (startSize/pageSize + 1) * pageSize
|
|
|
var list []*models.CygxResourceData
|
|
|
- fmt.Println("totalTitle", totalTitle)
|
|
|
- fmt.Println("totalContent", totalContent)
|
|
|
- fmt.Println(searchTotal)
|
|
|
if totalTitle >= searchTotal {
|
|
|
- fmt.Println("1")
|
|
|
//全部都是标题搜索
|
|
|
list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
@@ -551,7 +644,6 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
return
|
|
|
}
|
|
|
} else if totalTitle <= searchTotal-pageSize {
|
|
|
- fmt.Println("2")
|
|
|
//全部都是内容搜索
|
|
|
startSize = startSize - totalTitle
|
|
|
|
|
@@ -561,7 +653,6 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- fmt.Println("3")
|
|
|
//一半标题搜索,一半内容搜索
|
|
|
|
|
|
//list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|