Browse Source

no message

xingzai 1 year ago
parent
commit
173e08421e
3 changed files with 25 additions and 8 deletions
  1. 6 0
      controllers/home.go
  2. 14 1
      controllers/tag.go
  3. 5 7
      models/cygx_tag.go

+ 6 - 0
controllers/home.go

@@ -582,6 +582,7 @@ func (this *HomeController) ListHomeArtAndChart() {
 // @Title 首页列表接口
 // @Description 首页列表接口
 // @Param   TagIds   query   string  true       "标签选择"
+// @Param   ChartPermissionId   query   int	  false     "行业id"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.HomeArtAndChartListResp
@@ -602,6 +603,7 @@ func (this *HomeController) NewList() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	tagIds := this.GetString("TagIds")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -842,6 +844,10 @@ func (this *HomeController) NewList() {
 		conditionInit = " AND publish_date  >   '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
 	}
 
+	if chartPermissionId > 0 {
+		conditionInit = " AND chart_permission_id  =  " + strconv.Itoa(chartPermissionId)
+	}
+
 	//conditionInit += `  AND source IN ('newchart')`
 	if user.CompanyId <= 1 || totalRai == 0 {
 		//condition += " AND source IN ('roadshow','article') "

+ 14 - 1
controllers/tag.go

@@ -71,10 +71,23 @@ func (this *TagController) TagCustomizeList() {
 		return
 	}
 
+	//var condition string
+	condition = ` AND permission_name IN ('医药','消费','科技','智造','策略') `
+	listPermission, err := models.GetChartPermissionReportAll(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(models.CygxTagListResp)
+
+	resp.List = list
+	resp.ListPermission = listPermission
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
-	br.Data = list
+	br.Data = resp
 }
 
 // @Title 记录点击信息

+ 5 - 7
models/cygx_tag.go

@@ -20,13 +20,6 @@ type CygxTag struct {
 	Status        int       `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
 }
 
-// 添加标签
-func AddCygxTag(item *CygxTag) (id int64, err error) {
-	o := orm.NewOrm()
-	id, err = o.Insert(item)
-	return
-}
-
 func (m *CygxTag) Update(cols []string) (err error) {
 	o := orm.NewOrm()
 	_, err = o.Update(m, cols...)
@@ -53,6 +46,11 @@ type CygxTagList struct {
 	CheckList     []string // ABCD勾选了哪几列
 }
 
+type CygxTagListResp struct {
+	List           []*CygxTagList
+	ListPermission []*ChartPermission
+}
+
 // 列表
 func GetCygxTagListCondition(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxTagList, err error) {
 	o := orm.NewOrm()