|
@@ -295,56 +295,19 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
|
|
|
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 industrialResourceIdsHz []int // 弘则产业资源包
|
|
|
- var industrialResourceIdsYx []int // 研选产业资源包
|
|
|
var yanxuanSpecialIds []int // 研选专栏
|
|
|
- var askserieVideoIds []string //问答系列视频
|
|
|
- var reportselectionIds []int //报告精选
|
|
|
+ var yanxuanspecialauthorIds []int //研选作者ID
|
|
|
//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 == "newchart" {
|
|
|
- newchartIds = append(newchartIds, v.SourceId)
|
|
|
- } else if v.Source == "roadshow" {
|
|
|
- roadshowIds = append(roadshowIds, strconv.Itoa(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 == "activityspecial" {
|
|
|
- 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 == "industrialsourceHz" {
|
|
|
- industrialResourceIdsHz = append(industrialResourceIdsHz, v.SourceId)
|
|
|
- } else if v.Source == "industrialsourceYx" {
|
|
|
- industrialResourceIdsYx = append(industrialResourceIdsYx, v.SourceId)
|
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
|
|
|
yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
|
|
|
- yanXuanbodyHighlight[v.SourceId] = v.Body
|
|
|
- } else if v.Source == utils.CYGX_OBJ_ASKSERIEVIDEO {
|
|
|
- askserieVideoIds = append(askserieVideoIds, strconv.Itoa(v.SourceId))
|
|
|
- } else if v.Source == "reportselection" {
|
|
|
- reportselectionIds = append(reportselectionIds, v.SourceId)
|
|
|
+ } else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR {
|
|
|
+ yanxuanspecialauthorIds = append(yanxuanspecialauthorIds, v.SourceId)
|
|
|
}
|
|
|
}
|
|
|
detail, e := models.GetConfigByCode("city_img_url")
|
|
@@ -457,96 +420,6 @@ 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, ",")
|
|
|
-
|
|
|
- list, _, e := GetMicroRoadShowMycollectV12(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds), 0, audioIdstr, activityVideoIdsStr, roadshowIdsStr, askserieVideoIdsStr, user)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetMicroRoadShowMycollectV12, 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
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//处理研选专栏
|
|
|
lenyanxuanSpecialIds := len(yanxuanSpecialIds)
|
|
|
if lenyanxuanSpecialIds > 0 {
|
|
@@ -574,10 +447,29 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //处理研选专栏作者
|
|
|
+ lenyanxuanspecialauthorIds := len(yanxuanspecialauthorIds)
|
|
|
+ if lenyanxuanspecialauthorIds > 0 {
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanspecialauthorIds) + `) `
|
|
|
+ condition += ` ORDER BY latest_publish_time DESC `
|
|
|
+ pars = append(pars, yanxuanspecialauthorIds)
|
|
|
+ listAuthor, e := models.GetYanxuanSpecialAuthorList("", condition, pars, 0, lenyanxuanspecialauthorIds)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetYanxuanSpecialAuthorList, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listAuthor {
|
|
|
+ v.LatestPublishDate = utils.TimeRemoveHms2(v.LatestPublishDate)
|
|
|
+ v.LabelKeywordImgLink = utils.LABEL_ICO_9
|
|
|
+ mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR, v.Id)].YanxuanSpecialAuthor = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, vList := range list {
|
|
|
for _, v := range mapItems {
|
|
|
//如果这些类型都为空,那么就不合并
|
|
|
- if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil && v.YanxuanSpecial == nil && v.AskserieVideo == nil && v.ReportSelection == nil {
|
|
|
+ if v.Article == nil && v.Activity == nil && v.Activityvideo == nil && v.YanxuanSpecial == nil && v.YanxuanSpecialAuthor == nil {
|
|
|
continue
|
|
|
}
|
|
|
if v.SourceId == vList.SourceId && v.Source == vList.Source {
|
|
@@ -585,11 +477,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- for _, v := range items {
|
|
|
- if v.IndustrialResource != nil {
|
|
|
- v.Source = "industrialsource"
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -623,11 +511,20 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
var parsTitle []interface{}
|
|
|
conditionTitle = " AND search_title LIKE ? " + condition
|
|
|
parsTitle = append(parsTitle, keyWord)
|
|
|
- totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetResourceDataCount, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ var conditionContentYxAuthor string // 研选专栏作者搜索条件
|
|
|
+ var parsContentYxAuthor []interface{}
|
|
|
+
|
|
|
+ conditionContentYxAuthor = " AND (special_name LIKE ? OR nick_name LIKE ? ) "
|
|
|
+ parsContentYxAuthor = append(parsContentYxAuthor, keyWord, keyWord)
|
|
|
+
|
|
|
+ totalTitle, e := models.GetResourceDataAndYanxuanSpecialAuthorCount(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor)
|
|
|
+
|
|
|
+ //totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
|
|
|
+ //if e != nil {
|
|
|
+ // err = errors.New("GetResourceDataCount, Err: " + e.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
|
|
|
var conditionContent string
|
|
|
var parsContent []interface{}
|
|
@@ -648,7 +545,7 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
if totalTitle >= searchTotal {
|
|
|
fmt.Println("1")
|
|
|
//全部都是标题搜索
|
|
|
- list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
return
|
|
@@ -667,9 +564,10 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
fmt.Println("3")
|
|
|
//一半标题搜索,一半内容搜索
|
|
|
|
|
|
- list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ //list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ err = errors.New("GetResourceDataAndYanxuanSpecialAuthorListCondition, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
listContent, e := models.GetResourceDataListCondition(conditionContent, parsContent, 0, pageSize-totalContent%pageSize)
|