Преглед изворни кода

Merge branch 'cygx_9.5' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai пре 2 година
родитељ
комит
3fee7e865f

+ 1 - 1
controllers/activity.go

@@ -750,7 +750,7 @@ func (this *ActivityCoAntroller) SignupAdd() {
 				}
 				if totalRestrict >= 1 {
 					signupStatus = "BreakPromise"
-					resp.PopupMsg = "由于爽约次数过多,您暂时被限制报名资格"
+					resp.PopupMsg = "由于爽约次数过多,您暂时被限制报名资格,请联系对口销售"
 					item.FailType = 3
 				}
 				totalSignupCompany, err := models.GetActivitySignupCompanyCount(activityId, user.CompanyId)

+ 155 - 1
controllers/research.go

@@ -4,12 +4,14 @@ import (
 	"errors"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
-//研选
+// 研选
 type ResearchController struct {
 	BaseAuthController
 }
@@ -548,3 +550,155 @@ func (this *ResearchController) HotKeyWord() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 研选文章类型列表
+// @Description 研选文章类型列表接口
+// @Success 200 {object} models.CygxArticleTypeListResp
+// @router /article/typeList [get]
+func (this *ResearchController) ArticleType() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var condition string
+	condition = " AND is_show_yanx  = 1 "
+	list, err := models.GetCygxArticleTypeListCondition(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.CygxArticleTypeListResp)
+	for _, v := range list {
+		item := models.CygxArticleTypeResp{
+			ArticleTypeId:   v.ArticleTypeId,
+			ArticleTypeName: v.ArticleTypeName,
+			ButtonStyle:     v.ButtonStyle,
+		}
+		resp.List = append(resp.List, &item)
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 研选最新报告列表
+// @Description 研选最新报告列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ArticleTypeIds   query   array  true       "文章类型ID多个用  , 隔开"
+// @Success 200 {object} models.IndustrialManagementNewList
+// @router /article/newList [get]
+func (this *ResearchController) ArticleNewList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	articleTypeIds := this.GetString("ArticleTypeIds")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	condition = `    AND publish_status = 1  `
+	if articleTypeIds == "" {
+		var conditiontype string
+		conditiontype = " AND is_show_yanx  = 1 "
+		listType, err := models.GetCygxArticleTypeListCondition(conditiontype)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range listType {
+			articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
+		}
+		articleTypeIds = strings.TrimRight(articleTypeIds, ",")
+	}
+	condition += `   AND a.article_type_id IN (` + articleTypeIds + `) `
+	total, err := models.GetArticleResearchCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleResearchCount,Err:" + err.Error()
+		return
+	}
+	list, err := models.GetArticleResearchList(condition, pars, startSize, pageSize, user.UserId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	var articleIds []int
+	for k, v := range list {
+		if v.MyCollectNum > 0 {
+			list[k].IsCollect = true
+		}
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	//处理关联的产业
+	industrialMap, err := services.GetArticleIndustrialByArticleId(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取关联的产业信息失败,GetArticleIndustrialByArticleId Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementResp, 0)
+		}
+	}
+	//处理对应的文章类型标签按钮
+	nameMap, styleMap, err := services.GetArticleTypeMap()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
+		return
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(models.ArticleResearchListResp)
+	for _, v := range list {
+		item := models.ArticleResearchResp{
+			ArticleId:       v.ArticleId,
+			Title:           v.Title,
+			PublishDate:     v.PublishDate,
+			DepartmentId:    v.DepartmentId,
+			NickName:        v.NickName,
+			IsCollect:       v.IsCollect,
+			Pv:              v.Pv,
+			CollectNum:      v.CollectNum,
+			ArticleTypeName: nameMap[v.ArticleTypeId],
+			ButtonStyle:     styleMap[v.ArticleTypeId],
+			List:            v.List,
+		}
+		resp.List = append(resp.List, &item)
+	}
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 12 - 16
models/article.go

@@ -76,7 +76,7 @@ type CygxArticleEs struct {
 	MatchTypeName    string `description:"匹配类型"`
 }
 
-//新增文章
+// 新增文章
 func AddCygxArticle(item *CygxArticle) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
@@ -247,7 +247,7 @@ func ModifyArticleExpert(articleId int, expertNumStr, expertContentStr, intervie
 	return
 }
 
-//更改文章发布状态
+// 更改文章发布状态
 func UpdateArticlePublish(articleId, publishStatus int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_article SET publish_status=? WHERE article_id=? `
@@ -271,11 +271,7 @@ func GetArticleDetailTestById(articleId int) (item *ArticleDetail, err error) {
 
 func GetArticleAll() (item []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_article WHERE article_id  IN (7667,
-5282,
-5215,
-4615,
-4902) `
+	sql := `SELECT * FROM cygx_article WHERE is_summary=1`
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }
@@ -293,7 +289,7 @@ func GetArticleAll2() (item []*ArticleDetail, err error) {
 	return
 }
 
-//获取文章列表
+// 获取文章列表
 func GetArticleList(condition string, pars []interface{}) (items []*ArticleDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT	article_id FROM cygx_article  WHERE 1= 1 ` + condition
@@ -364,7 +360,7 @@ type CygxArticles struct {
 	ReportType       int    `description:"报告类型,1行业报告,2产业报告,0无"`
 }
 
-//新增文章
+// 新增文章
 func AddCygxArticles(item *CygxArticle) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
@@ -437,7 +433,7 @@ func GetPermissionMappingCategoryID() (item []*PermissionMappingCategoryRep, err
 	return
 }
 
-//检查用户是否阅读某一分类最新文章
+// 检查用户是否阅读某一分类最新文章
 func GetUserIsReadThisNewCategoryArticleCount(categoryId, uid int) (count int, err error) {
 	sqlCount := `SELECT COUNT(1) as count FROM
 	cygx_article_history_record 
@@ -453,7 +449,7 @@ type ArticleId struct {
 	ArticleId int `description:"文章id"`
 }
 
-//获取自定义分类的文章ID
+// 获取自定义分类的文章ID
 func GetCustomArticleId() (item []*ArticleId, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT article_id  FROM cygx_article WHERE is_custom = 1 `
@@ -468,7 +464,7 @@ type ArticleFollowDetail struct {
 	MacNum int `description:"本人是否收藏这个文章"`
 }
 
-//获取文章被关注被收藏的详情
+// 获取文章被关注被收藏的详情
 func GetArticleFollowDetail(articleId, uid int) (item *ArticleFollowDetail, err error) {
 	//d_num 作者被关注的数量 、 md_num 本人是否关注这个作者 、ac_num 文章被收藏的数量 、 mac_num 本人是否收藏这个文章
 	o := orm.NewOrm()
@@ -488,7 +484,7 @@ WHERE
 	return
 }
 
-//日度点评的数据同步
+// 日度点评的数据同步
 type ReportDetail struct {
 	Id                 int    `orm:"column(id)" description:"报告Id"`
 	AddType            int    `description:"新增方式:1:新增报告,2:继承报告"`
@@ -659,7 +655,7 @@ WHERE
 	return
 }
 
-//通过文章ID获取文章所关联的标的ID
+// 通过文章ID获取文章所关联的标的ID
 func GetSubjectIds(articleId int) (subjects string, err error) {
 	sql := ` SELECT
 			GROUP_CONCAT( DISTINCT industrial_subject_id ORDER BY id ASC SEPARATOR ',' ) AS subjects 
@@ -670,7 +666,7 @@ func GetSubjectIds(articleId int) (subjects string, err error) {
 	return
 }
 
-//修改发布状态
+// 修改发布状态
 func UpdateIsClassFail(articleId int) (err error) {
 	sql := `UPDATE cygx_article SET  is_class_fail=1  WHERE article_id=? `
 	o := orm.NewOrm()
@@ -684,7 +680,7 @@ type SummaryArticleStock struct {
 	Stock     string `description:"个股标签"`
 }
 
-//综述报告
+// 综述报告
 func GetSummaryArticle(chartPermissionId int) (items []*SummaryArticleStock, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT

+ 22 - 3
models/article_type.go

@@ -17,9 +17,20 @@ type CygxArticleType struct {
 	IcoLink            string    `description:"图标链接地址"`
 	IcoLinkM           string    `description:"移动端图标链接地址"`
 	IsShowLinkButton   int       `description:"这种报告类型是否展示查看报告链接"`
+	ButtonStyle        string    `description:"按钮展示样式"`
 }
 
-//详情
+type CygxArticleTypeResp struct {
+	ArticleTypeId   int    `description:"文章类型ID"`
+	ArticleTypeName string `description:"类型名称"`
+	ButtonStyle     string `description:"按钮展示样式"`
+}
+
+type CygxArticleTypeListResp struct {
+	List []*CygxArticleTypeResp
+}
+
+// 详情
 func GetCygxArticleTypeDetailById(activityTypeId int) (item *CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type WHERE article_type_id = ? `
@@ -27,7 +38,7 @@ func GetCygxArticleTypeDetailById(activityTypeId int) (item *CygxArticleType, er
 	return
 }
 
-//获取数量
+// 获取数量
 func GetCygxArticleTypeCount(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sqlCount := `SELECT COUNT(1) AS count  FROM cygx_article_type WHERE  1=1 ` + condition
@@ -35,7 +46,7 @@ func GetCygxArticleTypeCount(condition string) (count int, err error) {
 	return
 }
 
-//报告类型列表
+// 报告类型列表
 func GetCygxArticleTypeList() (items []*CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type ORDER BY sort DESC`
@@ -43,6 +54,14 @@ func GetCygxArticleTypeList() (items []*CygxArticleType, err error) {
 	return
 }
 
+// 报告类型列表
+func GetCygxArticleTypeListCondition(condition string) (items []*CygxArticleType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_article_type   WHERE  1=1 ` + condition + ` ORDER BY sort DESC`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 func GetArticleTypeInfo(activityTypeId int) (item *CygxArticleType, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_article_type   WHERE  article_type_id=? `

+ 98 - 38
models/report.go

@@ -5,7 +5,6 @@ import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"strconv"
 	"time"
-
 	//"github.com/rdlucklib/rdluck_tools/paging"
 )
 
@@ -64,7 +63,7 @@ type IndustrialSubject struct {
 	LayoutTime             string `description:"产业布局时间"`
 }
 
-//获取产业报告数量
+// 获取产业报告数量
 func GetReportIndustrialCount(categoryId, industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count 
@@ -86,7 +85,7 @@ WHERE
 	return
 }
 
-//获取产业报告列表
+// 获取产业报告列表
 func GetReportIndustrialList(pars []interface{}, categoryId, industrialManagementId, userId, startSize, pageSize int) (items []*ReportArticle, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum 
@@ -109,7 +108,7 @@ WHERE
 	return
 }
 
-//产业下所关联的文章分类列表
+// 产业下所关联的文章分类列表
 func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int) (items []*IndustrialToArticleCategoryRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT map.match_type_name,map.category_id
@@ -127,7 +126,7 @@ func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int)
 	return
 }
 
-//产业下所关联的文章分类列表 2022-10-13
+// 产业下所关联的文章分类列表 2022-10-13
 func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*IndustrialToArticleCategoryRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT map.match_type_name,map.category_id
@@ -144,7 +143,7 @@ func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*Indust
 	return
 }
 
-//判断用户是否阅读该产业下,某一分类的文章
+// 判断用户是否阅读该产业下,某一分类的文章
 func IndustrialUserRecordArticleCount(userId, industrialManagementId, categoryId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -164,7 +163,7 @@ WHERE
 	return
 }
 
-//获取最新文章
+// 获取最新文章
 func GetNewIndustrialUserRecordArticle(industrialManagementId, categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
 	//sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND match_type_name = any( SELECT match_type_name FROM cygx_report_mapping WHERE category_id = ? ) ORDER BY publish_date DESC LIMIT 0, 1`
@@ -179,7 +178,7 @@ WHERE
 	return
 }
 
-//获取最新文章
+// 获取最新文章
 func GetNewArticleByCategoryId(categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT * FROM cygx_article WHERE  category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
@@ -216,7 +215,7 @@ type ReportArticleWhichIndustrialRepList struct {
 	List         []*ReportArticleWhichIndustrial
 }
 
-//列表
+// 列表
 func IndustrialToArticleWhichDepartment(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ReportArticleWhichIndustrial, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -275,7 +274,7 @@ type SearchTxt struct {
 	TabSearch      string `description:"素材库搜索说明"`
 }
 
-//获取用户是否有查看权限
+// 获取用户是否有查看权限
 func GetUserIsAdminCount(mobile string) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count  FROM admin 
@@ -331,7 +330,7 @@ type CygxIndustrySearchListPc struct {
 	IndList        []*IndustrialManagement `description:"产业列表"`
 }
 
-//列表
+// 列表
 func GetCygxIndustryAndArticleList(keyWord string) (items []*CygxIndustryAndArticleList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -362,7 +361,7 @@ func GetArticleIdsBySubId(subjectId string) (articleIds string, err error) {
 	return
 } //end
 
-//用户收藏榜start
+// 用户收藏榜start
 type ArticleCollectionResp struct {
 	ArticleId              int                         `description:"文章id"`
 	Title                  string                      `description:"标题"`
@@ -376,6 +375,7 @@ type ArticleCollectionResp struct {
 	Pv                     int                         `description:"PV"`
 	CollectNum             int                         `description:"收藏人数"`
 	Source                 int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	ArticleTypeId          int                         `description:"文章类型ID"`
 	List                   []*IndustrialManagementResp `description:"产业列表"`
 }
 
@@ -389,7 +389,7 @@ type ArticleCollectionLIstResp struct {
 	List []*ArticleCollectionResp
 }
 
-//列表
+// 列表
 func GetArticleCollectionList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -418,7 +418,67 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
 	return
 } //end
 
-//用户收藏榜start
+type ArticleResearchListResp struct {
+	Paging *paging.PagingItem
+	List   []*ArticleResearchResp
+}
+
+type ArticleResearchResp struct {
+	ArticleId       int                         `description:"文章id"`
+	Title           string                      `description:"标题"`
+	PublishDate     string                      `description:"发布时间"`
+	DepartmentId    int                         `description:"作者Id"`
+	NickName        string                      `description:"作者昵称"`
+	IsCollect       bool                        `description:"本人是否收藏"`
+	Pv              int                         `description:"PV"`
+	CollectNum      int                         `description:"收藏人数"`
+	Source          int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	ArticleTypeId   int                         `description:"文章类型ID"`
+	ArticleTypeName string                      `description:"类型名称"`
+	ButtonStyle     string                      `description:"按钮展示样式"`
+	List            []*IndustrialManagementResp `description:"产业列表"`
+}
+
+// 获取我的日程数量
+func GetArticleResearchCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `SELECT COUNT( 1 ) AS count FROM
+			cygx_article AS a
+		WHERE
+			1 = 1  AND a.publish_status = 1` + condition
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+func GetArticleResearchList(condition string, pars []interface{}, startSize, pageSize, userId int) (items []*ArticleCollectionResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			a.article_id,
+			a.title,
+			date_format( a.publish_date, '%Y-%m-%d' ) AS publish_date,
+			a.article_type_id,
+			d.nick_name,
+			d.department_id,
+			( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id = a.article_id ) AS pv,
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id  ) AS collect_num, 
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time )  ) AS collect_num_order, 
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id  AND user_id = ? ) AS my_collect_num
+		FROM
+			cygx_article AS a
+			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
+			INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id 
+		WHERE
+			1 = 1  AND a.publish_status = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY a.article_id ORDER  BY   a.publish_date DESC  LIMIT ?,? `
+	_, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 用户收藏榜start
 type IndustrialManagementHotResp struct {
 	IndustrialManagementId int                   `orm:"column(industrial_management_id);pk" description:"产业id"`
 	IndustryName           string                `description:"产业名称"`
@@ -442,7 +502,7 @@ type IndustrialManagementHotListResp struct {
 	List   []*IndustrialManagementHotResp
 }
 
-//产业列表
+// 产业列表
 func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -467,7 +527,7 @@ func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (it
 	return
 }
 
-//获取数量
+// 获取数量
 func GetThemeHeatListCount(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT   COUNT( DISTINCT m.industrial_management_id ) FROM
@@ -482,7 +542,7 @@ func GetThemeHeatListCount(condition string) (count int, err error) {
 	return
 }
 
-//标的列表
+// 标的列表
 func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -507,7 +567,7 @@ func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err
 	return
 } //end
 
-//Kol sratr
+// Kol sratr
 type DepartmentResp struct {
 	DepartmentId int    `description:"作者Id"`
 	NickName     string `description:"作者昵称"`
@@ -526,7 +586,7 @@ type IndustrialDepartmentListResp struct {
 	DepartmentId           int    `description:"作者Id"`
 }
 
-//作者列表
+// 作者列表
 func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -551,7 +611,7 @@ func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
 	return
 }
 
-//作者文章所关联的产业列表
+// 作者文章所关联的产业列表
 func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -575,7 +635,7 @@ func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err e
 	return
 }
 
-//主题详情start
+// 主题详情start
 type GetThemeDetailListResp struct {
 	ArticleId              int    `description:"文章id"`
 	Title                  string `description:"标题"`
@@ -613,7 +673,7 @@ type GetThemeAericleListBuSubjectResp struct {
 	List        []*GetThemeAericleListResp
 }
 
-//主题详情start
+// 主题详情start
 type GetThemeDetailResp struct {
 	IndustrialManagementId int                  `description:"产业Id"`
 	IndustryName           string               `description:"产业名称"`
@@ -622,7 +682,7 @@ type GetThemeDetailResp struct {
 	List                   []*GetThemeAericleListResp
 }
 
-//列表
+// 列表
 func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*GetThemeDetailListResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -656,7 +716,7 @@ func GetThemeDetail(userId, industrialManagementId int, condition string) (items
 	return
 } //end
 
-//用户收藏榜start
+// 用户收藏榜start
 type DepartmentDetailResp struct {
 	DepartmentId   int    `description:"作者Id"`
 	NickName       string `description:"作者昵称"`
@@ -680,7 +740,7 @@ type DepartmentDetail struct {
 	MyFllowNum   int    `description:"本人是否关注"`
 }
 
-//列表
+// 列表
 func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -699,13 +759,13 @@ func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err e
 	return
 } //end
 
-//报告搜索start
+// 报告搜索start
 type ReoprtSearchResp struct {
 	ListYx []*ArticleCollectionResp `description:"研选报告"`
 	ListHz []*ArticleCollectionResp `description:"弘则报告"`
 }
 
-//列表
+// 列表
 func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -730,13 +790,13 @@ func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollecti
 	return
 } //end
 
-//搜索资源包 start
+// 搜索资源包 start
 type SearchResourceResp struct {
 	ListHz []*IndustrialManagementHotResp `description:"弘则"`
 	ListYx []*IndustrialManagementHotResp `description:"研选"`
 }
 
-//搜索资源包 start
+// 搜索资源包 start
 type SearchReportAndResourceResp struct {
 	ListHzResource []*IndustrialManagementHotResp `description:"弘则资源包"`
 	ListYxResource []*IndustrialManagementHotResp `description:"研选资源包"`
@@ -744,7 +804,7 @@ type SearchReportAndResourceResp struct {
 	ListHzReport   []*ArticleCollectionResp       `description:"弘则报告"`
 }
 
-//产业列表
+// 产业列表
 func GetSearchResourceList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -769,19 +829,19 @@ func GetSearchResourceList(userId int, condition string, startSize, pageSize int
 	return
 }
 
-//切换列表
+// 切换列表
 type ReportBillboardTableResp struct {
 	Name   string `description:"名称"`
 	Source int    `description:"类型"`
 	List   []*ChartPermission
 }
 
-//切换列表
+// 切换列表
 type ReportBillboardTableListResp struct {
 	List []*ReportBillboardTableResp
 }
 
-//报告榜单start
+// 报告榜单start
 type ArticleReportBillboardResp struct {
 	ArticleId      int    `description:"文章id"`
 	Title          string `description:"标题"`
@@ -805,7 +865,7 @@ type ArticleReportBillboardLIstPageResp struct {
 	Paging *paging.PagingItem
 }
 
-//报告收藏榜单列表
+// 报告收藏榜单列表
 func GetReportCollectionBillboardList(limit int, pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -831,7 +891,7 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
 	return
 }
 
-//报告阅读榜单列表
+// 报告阅读榜单列表
 func GetReportPvBillboardList(pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -851,7 +911,7 @@ func GetReportPvBillboardList(pars []interface{}, condition string) (items []*Ar
 	return
 }
 
-//获取产业报告+晨会点评数量
+// 获取产业报告+晨会点评数量
 func GetTimeLineReportIndustrialCount(industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT SUM(count) AS count FROM (
@@ -891,7 +951,7 @@ type TimeLineReportItem struct {
 	Readnum         int    `description:"阅读数量"`
 }
 
-//获取产业报告+晨会点评列表
+// 获取产业报告+晨会点评列表
 func GetTimeLineReportIndustrialList(userId, industrialManagementId, startSize, pageSize int) (items []*TimeLineReportItem, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -947,7 +1007,7 @@ type IndustrialReadNum struct {
 	Readnum                int `description:"阅读次数"`
 }
 
-//获取该产业下文章的用户阅读次数-小红点用
+// 获取该产业下文章的用户阅读次数-小红点用
 func GetReportIndustrialReadNumList(userId int, industrialIds string, createtime time.Time) (items []*IndustrialReadNum, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT a.industrial_management_id, MIN(a.readnum) AS readnum FROM (

+ 18 - 0
routers/commentsRouter.go

@@ -1015,6 +1015,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
+        beego.ControllerComments{
+            Method: "ArticleNewList",
+            Router: `/article/newList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
+        beego.ControllerComments{
+            Method: "ArticleType",
+            Router: `/article/typeList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
         beego.ControllerComments{
             Method: "CollectionList",

+ 59 - 11
services/industrial_management.go

@@ -11,7 +11,7 @@ import (
 	"time"
 )
 
-//修改标签状态
+// 修改标签状态
 func UpdateIndustrialManagementLabel(cont context.Context) (err error) {
 	defer func() {
 		if err != nil {
@@ -41,7 +41,7 @@ func UpdateIndustrialManagementLabel(cont context.Context) (err error) {
 	return
 }
 
-//修改活动状态
+// 修改活动状态
 func UpdateIndustrialManagementSubjectNnames() (err error) {
 	defer func() {
 		if err != nil {
@@ -108,7 +108,7 @@ func ReportBillboardUpdate(cont context.Context) (err error) {
 	return
 }
 
-//修改产业关注数量
+// 修改产业关注数量
 func IndustryFllowCountUpdate() (err error) {
 	defer func() {
 		if err != nil {
@@ -129,7 +129,7 @@ func IndustryFllowCountUpdate() (err error) {
 	return err
 }
 
-//修改文章收藏数量
+// 修改文章收藏数量
 func ArticleCollectCountUpdate() (err error) {
 	defer func() {
 		if err != nil {
@@ -150,7 +150,7 @@ func ArticleCollectCountUpdate() (err error) {
 	return err
 }
 
-//根据行业处理所选的全部赛道字段
+// 根据行业处理所选的全部赛道字段
 func DoXzsChooseSend(chartPermissionName string) string {
 	var allIn string
 	if chartPermissionName == utils.YI_YAO_NAME {
@@ -167,7 +167,7 @@ func DoXzsChooseSend(chartPermissionName string) string {
 	return allIn
 }
 
-//行业关注或者取消关注的时候,对于用户全部赛道的影响
+// 行业关注或者取消关注的时候,对于用户全部赛道的影响
 func IndustryFllowWithTrack(industrialManagementId, count, uid int) (err error) {
 	defer func() {
 		if err != nil {
@@ -272,7 +272,7 @@ func GetIndustryNewLabelMap(industryIds []int) (labelMap map[int]bool, err error
 //	GetIndustrialManagementArticleNewPublishData()
 //}
 
-//批量修改获取产业关联文章的最新发布时间
+// 批量修改获取产业关联文章的最新发布时间
 func GetIndustrialManagementArticleNewPublishData() (err error) {
 	defer func() {
 		if err != nil {
@@ -309,7 +309,7 @@ func GetIndustrialManagementArticleNewPublishData() (err error) {
 	return
 }
 
-//HandleIndustryList预处理产业列表字段
+// HandleIndustryList预处理产业列表字段
 func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUserItem) (items []*models.IndustrialManagement, err error) {
 	userId := user.UserId
 	fllowList, err := models.GetUserFllowIndustrialList(userId)
@@ -432,11 +432,11 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	industrialIdMap := make(map[string]time.Time)
 	for _, v := range recrodList {
 		industrialManagementIdstr = strings.TrimLeft(v.Parameter, "PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=")
-		if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok{
+		if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok {
 			if createTime.Before(v.CreateTime) {
 				industrialIdMap[industrialManagementIdstr] = v.CreateTime
 			}
-		}else {
+		} else {
 			industrialIdMap[industrialManagementIdstr] = v.CreateTime
 		}
 	}
@@ -452,7 +452,7 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	timeLineRedMap := make(map[int]bool, 0)
 
 	for _, industrialId := range industrialIdArr {
-		if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok{
+		if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok {
 			if createTime.Before(morningMeetingTimeMap[industrialId]) {
 				timeLineRedMap[industrialId] = true
 			}
@@ -505,3 +505,51 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	items = list
 	return
 }
+
+// 通过文章ID获取文章所关联的产业
+func GetArticleIndustrialByArticleId(articleIds []int) (itemMap map[int][]*models.IndustrialManagementResp, err error) {
+	lenarticleIds := len(articleIds)
+	if lenarticleIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND mg.article_id IN (` + utils.GetOrmInReplace(lenarticleIds) + `)`
+	pars = append(pars, articleIds)
+	industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
+	if err != nil {
+		return
+	}
+	industrialMap := make(map[int][]*models.IndustrialManagementResp)
+	if len(industrialList) > 0 {
+		for _, v := range industrialList {
+			item := new(models.IndustrialManagementResp)
+			item.IndustrialManagementId = v.IndustrialManagementId
+			item.IndustryName = v.IndustryName
+			item.ChartPermissionId = v.ChartPermissionId
+			industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
+		}
+	}
+	itemMap = industrialMap
+	return
+}
+
+func GetArticleTypeMap() (nameMapResp map[int]string, buttonStyleMapResp map[int]string, err error) {
+	condition := " AND is_show_yanx  = 1 "
+	list, e := models.GetCygxArticleTypeListCondition(condition)
+	if e != nil {
+		err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
+		return
+	}
+	nameMap := make(map[int]string)
+	buttonStyleMap := make(map[int]string)
+	if len(list) > 0 {
+		for _, v := range list {
+			nameMap[v.ArticleTypeId] = v.ArticleTypeName
+			buttonStyleMap[v.ArticleTypeId] = v.ButtonStyle
+		}
+	}
+	nameMapResp = nameMap
+	buttonStyleMapResp = buttonStyleMap
+	return
+}

+ 4 - 4
utils/config.go

@@ -18,7 +18,7 @@ var (
 	Re          error        //redis错误
 )
 
-//微信配置信息
+// 微信配置信息
 var (
 	WxId        string //微信原始ID
 	WxAppId     string //查研观向小程序
@@ -45,7 +45,7 @@ var (
 	WxMsgTemplateIdArticleUserRemindXzs string //用户阅读报告通知-模板ID(小助手)
 )
 
-//微信公众号配置信息
+// 微信公众号配置信息
 var (
 	WxPublicId        string //微信原始ID
 	WxPublicAppId     string
@@ -83,7 +83,7 @@ var (
 	ShangHaiCrmApiLink        string //上海CRM用户同步api调用地址
 )
 
-//模板消息推送
+// 模板消息推送
 var (
 	SendWxTemplateMsgUrl string
 )
@@ -160,7 +160,7 @@ func init() {
 		WxPublicAppId = "wx4a844c734d8c8e56"
 		WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
 		WxPublicId = "gh_b67e0049fb8c"
-		IndexName = "cygx_article_v1213"
+		IndexName = "cygx_article_v02_01"
 		IndexNameArticleHistory = "cygx_article_history_v07_08"
 
 		//接收附件邮箱