1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package services
- import (
- "errors"
- "hongze/hongze_cygx/models"
- "strconv"
- "strings"
- )
- // 获取研选类型的文章分类Id
- func GetYanXuanArticleTypeIds() (articleTypeIds string, err error) {
- var condition string
- condition = " AND is_show_yanx = 1 "
- listType, e := models.GetCygxArticleTypeListCondition(condition)
- if e != nil {
- err = errors.New("GetCygxArticleTypeListCondition, Err: " + e.Error())
- return
- }
- for _, v := range listType {
- articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
- }
- articleTypeIds = strings.TrimRight(articleTypeIds, ",")
- if articleTypeIds == "" {
- err = errors.New("研选分类ID不能为空")
- return
- }
- return
- }
- // 处理研选关联的新标签
- func GetYanXuanIndustrialManagementIdNewMap(articleTypeIds string) (respMa map[int]bool, err error) {
- var condition string
- if articleTypeIds == "" {
- return
- }
- condition = ` AND a.article_type_id IN (` + articleTypeIds + `) `
- list, e := models.GetIndustrialManagementNewList(condition)
- if e != nil {
- err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
- return
- }
- newMap := make(map[int]bool)
- for _, v := range list {
- newMap[v.IndustrialManagementId] = true
- }
- return
- }
- // 处理研选关联的hot标签
- func GetYanXuanIndustrialManagementIdHotMap(articleTypeIds string) (respMa map[int]bool, err error) {
- var condition string
- var conditionOrder string
- if articleTypeIds == "" {
- return
- }
- condition = ` AND a.article_type_id IN (` + articleTypeIds + `) `
- conditionOrder = ` ORDER BY sum_num DESC `
- listHot, e := models.GetThemeHeatList(0, condition, conditionOrder, 0, 3)
- if e != nil {
- err = errors.New("GetIndustrialManagementNewList, Err: " + e.Error())
- return
- }
- newHot := make(map[int]bool)
- for _, v := range listHot {
- newHot[v.IndustrialManagementId] = true
- }
- return
- }
|