xingzai 2 年 前
コミット
878195ee00

+ 4 - 0
controllers/article.go

@@ -82,6 +82,10 @@ func (this *ArticleController) Detail() {
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
+	lyjhTypeMap, _ := services.GetLyjhTypeMap()
+	if _, ok := lyjhTypeMap[detail.CategoryId]; ok {
+		detail.IsRoadShow = true
+	}
 	if isSendWx == 1 {
 		var condition string
 		var pars []interface{}

+ 5 - 0
controllers/user.go

@@ -547,6 +547,8 @@ func (this *UserController) CollectList() {
 		}
 	}
 
+	lyjhTypeMap, _ := services.GetLyjhTypeMap()
+
 	lenList := len(list)
 	for i := 0; i < lenList; i++ {
 		item := list[i]
@@ -565,6 +567,9 @@ func (this *UserController) CollectList() {
 			list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
 			list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
 		}
+		if _, ok := lyjhTypeMap[item.CategoryId]; ok {
+			list[i].IsRoadShow = true
+		}
 		//list[i].TitleEn = article.TitleEn
 		//list[i].UpdateFrequency = article.UpdateFrequency
 		//list[i].CreateDate = article.CreateDate

+ 1 - 0
models/article.go

@@ -165,6 +165,7 @@ type ArticleDetail struct {
 	Annotation              string `description:"核心观点"`
 	IsShowFollowButton      bool   `description:"是否展示关注取关按钮"`
 	IsFollowButton          bool   `description:"是否关注"`
+	IsRoadShow              bool   `description:"是否是路演精华"`
 }
 
 type ArticleDetailFileLink struct {

+ 2 - 0
models/report.go

@@ -908,6 +908,8 @@ type ArticleReportBillboardResp struct {
 	Pv             int    `description:"PV"`
 	CollectNum     int    `description:"收藏人数"`
 	Source         int    `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	IsRoadShow     bool   `description:"是否是路演精华"`
+	CategoryId     int    `description:"分类ID"`
 	List           []*IndustrialManagementIdInt
 }
 

+ 11 - 0
models/report_mapping.go

@@ -252,3 +252,14 @@ WHERE
 	err = o.Raw(sql, categoryId).QueryRow(&item)
 	return
 }
+
+// 获取分类
+func GetReportMappingList(condition string, pars []interface{}) (items []*ReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_mapping WHERE  1=1 `
+	if condition != `` {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 12 - 12
models/user.go

@@ -154,7 +154,7 @@ func GetArticleUserCollectCount(userId int) (count int, err error) {
 }
 
 func GetArticleUserCollectList(startSize, pageSize, userId int) (items []*ArticleReportBillboardResp, err error) {
-	sql := `SELECT a.* FROM cygx_article_collect AS a INNER JOIN cygx_article as art ON art.article_id = a.article_id
+	sql := `SELECT a.*,art.category_id FROM cygx_article_collect AS a INNER JOIN cygx_article as art ON art.article_id = a.article_id
 			WHERE a.user_id=? 
            ORDER BY a.create_time DESC LIMIT ?,? `
 	_, err = orm.NewOrm().Raw(sql, userId, startSize, pageSize).QueryRows(&items)
@@ -239,7 +239,7 @@ func AddCountryCode(CountryCode string, user *WxUserItem) (err error) {
 	return
 }
 
-//修改外呼手机号
+// 修改外呼手机号
 type OutboundMobileItem struct {
 	OutboundMobile      string `description:"外呼手机号"`
 	OutboundCountryCode string `description:"外呼手机号区号"`
@@ -271,7 +271,7 @@ func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
 	return
 }
 
-//用户绑定手机号时同时绑定外呼手机号
+// 用户绑定手机号时同时绑定外呼手机号
 func BindUserOutboundMobile(mobile, countryCode string, userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ?, country_code= ? WHERE user_id=? `
@@ -279,7 +279,7 @@ func BindUserOutboundMobile(mobile, countryCode string, userId int) (err error)
 	return
 }
 
-//已经绑定手机号,没有绑定外呼手机号的的用户,预约外呼的时候,将外呼手机号同步成手机号
+// 已经绑定手机号,没有绑定外呼手机号的的用户,预约外呼的时候,将外呼手机号同步成手机号
 func BindUserOutboundMobileByMobile(mobile, countryCode string, userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ? WHERE user_id=? `
@@ -287,7 +287,7 @@ func BindUserOutboundMobileByMobile(mobile, countryCode string, userId int) (err
 	return
 }
 
-//将手机号为11位的用户,区号默认设置为86
+// 将手机号为11位的用户,区号默认设置为86
 func ChangeUserOutboundMobileByMobile(userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET country_code = 86 WHERE user_id=? `
@@ -310,7 +310,7 @@ type UserWhiteListRep struct {
 	List []*UserWhiteList
 }
 
-//获取正式试用用户白名单
+// 获取正式试用用户白名单
 func GetFormalUserWhiteList(fieldStr, condition string) (items []*UserWhiteList, err error) {
 	sql := `SELECT ` + fieldStr + `
 		(SELECT cp.seller_name FROM company_product  AS cp WHERE cp.company_id = u.company_id ORDER BY cp.product_id DESC  LIMIT 0,1 ) as seller_name,
@@ -329,7 +329,7 @@ func GetFormalUserWhiteList(fieldStr, condition string) (items []*UserWhiteList,
 	return
 }
 
-//获取永续用户白名单
+// 获取永续用户白名单
 func GetSustainableUserWhiteList(fieldStr, condition string) (items []*UserWhiteList, err error) {
 	sql := `SELECT ` + fieldStr + `
 			(SELECT cp.seller_name FROM company_product  AS cp WHERE cp.company_id = u.company_id ORDER BY cp.product_id DESC  LIMIT 0,1 ) as seller_name,
@@ -355,7 +355,7 @@ func GetSustainableUserWhiteList(fieldStr, condition string) (items []*UserWhite
 	return
 }
 
-//权益用户
+// 权益用户
 type GetSendEmailAllUserWithRAIRep struct {
 	CompanyName  string `description:"客户名称"`
 	CreditCode   string `description:"社会统一信用码"`
@@ -402,7 +402,7 @@ func GetSendEmailAllUserWithRAI() (items []*GetSendEmailAllUserWithRAIRep, err e
 	return
 }
 
-//权益用户
+// 权益用户
 type GetSendEmailAllUserWithCompanyRep struct {
 	RealName    string `description:"姓名"`
 	Mobile      string `description:"手机号"`
@@ -440,7 +440,7 @@ type Headimgurl struct {
 	Headimgurl string `description:"用户头像"`
 }
 
-//更改用户手机号
+// 更改用户手机号
 func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET headimgurl = ? WHERE user_id=? `
@@ -448,7 +448,7 @@ func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
 	return
 }
 
-//更新用户标签
+// 更新用户标签
 func UpdateUserLabel(userLabel string, userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET user_label = ? WHERE user_id=? `
@@ -456,7 +456,7 @@ func UpdateUserLabel(userLabel string, userId int) (err error) {
 	return
 }
 
-//更新用户互动量
+// 更新用户互动量
 func UpdateUserInteractionNum(interactionNum, userId int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE wx_user SET interaction_num = ? WHERE user_id=? `

+ 24 - 0
services/industrial_management.go

@@ -670,3 +670,27 @@ func IndustrialManagementHotMapGropuPermission() (mapResp map[int]bool, err erro
 	}
 	return
 }
+
+// GetLyjhTypeMap 获取路演精华对应分类ID
+func GetLyjhTypeMap() (mapResp map[int]int, err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取路演精华对应分类ID失败 ErrMsg:"+err.Error(), 2)
+
+		}
+	}()
+	condition := " AND match_type_name = '路演精华'  "
+	var pars []interface{}
+	list, e := models.GetReportMappingList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
+		return
+	}
+	mapResp = make(map[int]int, 0)
+	if len(list) > 0 {
+		for _, v := range list {
+			mapResp[v.CategoryId] = v.CategoryId
+		}
+	}
+	return
+}