Browse Source

研选文章列表新增字段

ziwen 1 year ago
parent
commit
3af2f7022a
4 changed files with 15 additions and 102 deletions
  1. 4 0
      controllers/research.go
  2. 0 99
      controllers/yanxuan_special.go
  3. 7 3
      models/report.go
  4. 4 0
      utils/constants.go

+ 4 - 0
controllers/research.go

@@ -799,8 +799,12 @@ func (this *ResearchController) ArticleNewList() {
 			IsSpecial:       v.IsSpecial,
 			ArticleTypeName: nameMap[v.ArticleTypeId],
 			ButtonStyle:     styleMap[v.ArticleTypeId],
+			SpecialTags:     v.SpecialTags,
 			List:            v.List,
 		}
+		if v.ArticleTypeId == -1 {
+			item.ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
+		}
 		resp.List = append(resp.List, &item)
 	}
 	resp.Paging = page

+ 0 - 99
controllers/yanxuan_special.go

@@ -860,105 +860,6 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
 	br.Msg = "保存成功"
 }
 
-//ResourceUpload 上传文件
-//@Title 上传文件
-//@Description 上传文件
-//@Param   MenuId  query  int  true  "目录ID"
-//@Param   File	query  file  true  "文件"
-//@Success 200 Ret=200 操作成功
-//@router /doc/upload [post]
-//func (this *YanxuanSpecialController) ResourceUpload() {
-//	br := new(models.BaseResponse).Init()
-//	defer func() {
-//		this.Data["json"] = br
-//		this.ServeJSON()
-//	}()
-//
-//	originName := this.GetString("OriginName", "")
-//	if originName == "" {
-//		br.Msg = "请上传文件名"
-//		return
-//	}
-//	if !strings.Contains(originName, ".") {
-//		br.Msg = "文件名有误"
-//		return
-//	}
-//	f, h, e := this.GetFile("file")
-//	if e != nil {
-//		br.Msg = "获取资源信息失败"
-//		br.ErrMsg = "获取资源信息失败, Err:" + e.Error()
-//		return
-//	}
-//	defer func() {
-//		_ = f.Close()
-//	}()
-//
-//	extIndex := strings.LastIndex(originName, ".")
-//	fileName := originName[:extIndex]
-//	ext := path.Ext(h.Filename)
-//
-//	uploadDir := utils.STATIC_DIR + "hongze/" + time.Now().Format("20060102")
-//	if e = os.MkdirAll(uploadDir, 766); e != nil {
-//		br.Msg = "存储目录创建失败"
-//		br.ErrMsg = "存储目录创建失败, Err:" + e.Error()
-//		return
-//	}
-//	ossFileName := utils.GetRandStringNoSpecialChar(28) + ext
-//	filePath := uploadDir + "/" + ossFileName
-//	if e = this.SaveToFile("file", filePath); e != nil {
-//		br.Msg = "文件保存失败"
-//		br.ErrMsg = "文件保存失败, Err:" + e.Error()
-//		return
-//	}
-//	defer func() {
-//		_ = os.Remove(filePath)
-//	}()
-//	// 上传到阿里云
-//	ossDir := "static/cloud_disk/"
-//	resourceUrl, e := services.UploadAliyunToDir(ossFileName, filePath, ossDir, "")
-//	if e != nil {
-//		br.Msg = "文件上传失败"
-//		br.ErrMsg = "文件上传失败, Err:" + e.Error()
-//		return
-//	}
-//
-//	// 新增云盘资源
-//	extMap := services.GetCloudDiskResourceFileTypeExtMap()
-//	resourceIcon := extMap[ext]
-//	if resourceIcon == "" {
-//		resourceIcon = models.CloudDiskResourceFileTypeIconUnknown
-//	}
-//	resourceItem := &models.CloudDiskResource{
-//		MenuId:         menuId,
-//		ResourceName:   fileName,
-//		ResourceSuffix: ext,
-//		ResourceUrl:    resourceUrl,
-//		ResourceIcon:   resourceIcon,
-//		AdminId:        this.SysUser.AdminId,
-//		AdminName:      this.SysUser.RealName,
-//		Size:           h.Size,
-//		CreateTime:     time.Now().Local(),
-//		ModifyTime:     time.Now().Local(),
-//	}
-//	if e = resourceItem.Create(); e != nil {
-//		br.Msg = "上传失败"
-//		br.ErrMsg = "新增云盘资源失败, Err: " + e.Error()
-//		return
-//	}
-//
-//	// 更新目录大小
-//	go func() {
-//		if e = services.UpdateCloudDiskMenuSize(menuId); e != nil {
-//			alarm_msg.SendAlarmMsg("更新云盘目录大小失败, Err: "+e.Error(), 3)
-//		}
-//	}()
-//
-//	br.Msg = "上传成功"
-//	br.Ret = 200
-//	br.Success = true
-//	br.Data = resourceItem
-//}
-
 // @Title 删除专栏
 // @Description 删除专栏
 // @Param	request	body help_doc.AddHelpDocReq true "type json string"

+ 7 - 3
models/report.go

@@ -499,6 +499,7 @@ type ArticleCollectionResp struct {
 	ArticleTypeId          int                         `description:"文章类型ID"`
 	List                   []*IndustrialManagementResp `description:"产业列表"`
 	IsSpecial              int                         `description:"是否为研选专栏"`
+	SpecialTags            string                      `description:"研选专栏标签"`
 }
 
 type IndustrialManagementResp struct {
@@ -595,6 +596,7 @@ type ArticleResearchResp struct {
 	ArticleTypeName string                      `description:"类型名称"`
 	ButtonStyle     string                      `description:"按钮展示样式"`
 	IsSpecial       int                         `description:"是否为研选专栏"`
+	SpecialTags     string                      `description:"研选专栏标签"`
 	List            []*IndustrialManagementResp `description:"产业列表"`
 }
 
@@ -622,7 +624,8 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 			( 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,
-			0 AS is_special 
+			0 AS is_special,
+			'' AS special_tags 
 		FROM
 			cygx_article AS a
 			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
@@ -640,14 +643,15 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 		a.id AS article_id,
 		a.title AS title,
 		date_format( a.publish_time, '%Y-%m-%d' ) AS publish_date,
-		16 AS article_type_id,
+		-1 AS article_type_id,
 		b.nick_name AS nick_name,
 		0 AS department_id,
 		( SELECT count( 1 ) FROM cygx_yanxuan_special_record AS h WHERE h.yanxuan_special_id = a.id ) AS pv,
 		( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.yanxuan_special_id = a.id  ) AS collect_num,
 		0 AS collect_num_order,
 		( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac WHERE ac.yanxuan_special_id = a.id  AND user_id = ? ) AS my_collect_num,
-		1 AS is_special 
+		1 AS is_special,
+		a.tags AS special_tags 
 	FROM
 	cygx_yanxuan_special AS a
 	JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id

+ 4 - 0
utils/constants.go

@@ -222,3 +222,7 @@ const (
 	MobileZhangChuanXin = "15557270714" // 张传星手机号
 	MobileWangFang      = "18621268829" // 王芳手机号
 )
+
+const (
+	CYGX_YANXUAN_SPECIAL           = "研选专栏"           //用户阅读数据
+)