Browse Source

no message

xingzai 2 years ago
parent
commit
2265c8f911
2 changed files with 24 additions and 16 deletions
  1. 2 2
      controllers/tactics.go
  2. 22 14
      models/report_mapping.go

+ 2 - 2
controllers/tactics.go

@@ -13,7 +13,7 @@ import (
 	"time"
 )
 
-//策略
+// 策略
 type TacticsController struct {
 	BaseAuthController
 }
@@ -63,7 +63,7 @@ func (this *TacticsController) List() {
 	page := paging.GetPaging(currentIndex, pageSize, total)
 
 	//获取该产业下所对应的行业图片
-	detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
+	detail, errCategory := models.GetdetailByCategoryIdOneByHangye(categoryId)
 	if errCategory != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)

+ 22 - 14
models/report_mapping.go

@@ -46,7 +46,7 @@ type TradeReportMappingResp struct {
 	List []*TradeReportMapping
 }
 
-//获取策略下面的所有分类
+// 获取策略下面的所有分类
 func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE report_type=1 AND chart_permission_id=23 ORDER BY sort ASC `
@@ -54,7 +54,7 @@ func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 	return
 }
 
-//获取策略下面的所有分类
+// 获取策略下面的所有分类
 func GetReportMappingStrategyHomeAll() (items []*ReportMappingHome, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -73,7 +73,7 @@ ORDER BY
 	return
 }
 
-//行业列表
+// 行业列表
 func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -109,7 +109,7 @@ type IndustrialToArticleCategoryListRep struct {
 	List                   []*IndustrialToArticleCategoryRep
 }
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryId(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE report_type=1 AND category_id=? `
@@ -117,7 +117,7 @@ func GetdetailByCategoryId(categoryId int) (item *ReportMapping, err error) {
 	return
 }
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryIdSet(categoryId int) (ids string, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -130,7 +130,7 @@ func GetdetailByCategoryIdSet(categoryId int) (ids string, err error) {
 	return
 }
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryIdPush(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=? `
@@ -138,7 +138,7 @@ func GetdetailByCategoryIdPush(categoryId int) (item *ReportMapping, err error)
 	return
 }
 
-//通过分类ID获取详情主观客观
+// 通过分类ID获取详情主观客观
 func GetdetailByCategoryIdSando(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE permission_type>0 AND category_id=?  LIMIT 1`
@@ -146,15 +146,23 @@ func GetdetailByCategoryIdSando(categoryId int) (item *ReportMapping, err error)
 	return
 }
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryIdOne(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=? LIMIT 1`
+	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=?   AND report_type = 2 LIMIT 1`
 	err = o.Raw(sql, categoryId).QueryRow(&item)
 	return
 }
 
-//判断该分类下最新的文章用户是否阅读
+// 通过分类ID获取详情
+func GetdetailByCategoryIdOneByHangye(categoryId int) (item *ReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_mapping WHERE  category_id=?   AND report_type = 1 LIMIT 1`
+	err = o.Raw(sql, categoryId).QueryRow(&item)
+	return
+}
+
+// 判断该分类下最新的文章用户是否阅读
 func CheckThisCategoryNewArticleIsRead(uid, categoryId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count
@@ -165,7 +173,7 @@ func CheckThisCategoryNewArticleIsRead(uid, categoryId int) (count int, err erro
 	return
 }
 
-//获取策略下面的所有分类
+// 获取策略下面的所有分类
 func GetMatchTypeNamenNotNull() (items []*ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT category_id,category_id_set,match_type_name FROM cygx_report_mapping WHERE match_type_name <> ''`
@@ -183,7 +191,7 @@ type ReportMappingStatistical struct {
 	Uv              int    `description:"Uv"`
 }
 
-//获取报表
+// 获取报表
 func GetStatisticalReportArtilce(chartPermissionId int) (items []*ReportMappingStatistical, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -209,7 +217,7 @@ WHERE
 	return
 }
 
-//获取报表
+// 获取报表
 func GetStatisticalReportArtilceExpert() (items []*ReportMappingStatistical, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -227,7 +235,7 @@ func GetStatisticalReportArtilceExpert() (items []*ReportMappingStatistical, err
 	return
 }
 
-//通过分类ID获取详情 处理路演精华的映射
+// 通过分类ID获取详情 处理路演精华的映射
 func GetdetailByCategoryIdLyjh(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT