ziwen 1 год назад
Родитель
Сommit
57d88ab587

+ 9 - 0
controllers/research.go

@@ -822,6 +822,15 @@ func (this *ResearchController) ArticleNewList() {
 		} else if v.SpecialType == 2 {
 			item.Title = "【观点】" + item.Title
 		}
+		if v.CompanyTags != "" {
+			v.SpecialTags += v.CompanyTags
+		}
+		if v.IndustryTags != "" {
+			if v.SpecialTags != "" {
+				v.SpecialTags += ","
+			}
+			v.SpecialTags += v.IndustryTags
+		}
 		resp.List = append(resp.List, &item)
 	}
 	resp.Paging = page

+ 37 - 8
controllers/yanxuan_special.go

@@ -9,6 +9,7 @@ import (
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"os"
+	"strings"
 	"time"
 )
 
@@ -80,13 +81,22 @@ func (this *YanxuanSpecialController) List() {
 			v.Docs = docs
 		}
 		if v.Type == 1 {
-			v.Title = "【笔记】"+v.Title
+			v.Title = "【笔记】" + v.Title
 		} else if v.Type == 2 {
-			v.Title = "【观点】"+v.Title
+			v.Title = "【观点】" + v.Title
 		}
 		if v.MyCollectNum > 0 {
 			v.IsCollect = 1
 		}
+		if v.CompanyTags != "" {
+			v.Tags += v.CompanyTags
+		}
+		if v.IndustryTags != "" {
+			if v.Tags != "" {
+				v.Tags += ","
+			}
+			v.Tags += v.IndustryTags
+		}
 	}
 	resp := new(models.SpecialListResp)
 
@@ -150,6 +160,22 @@ func (this *YanxuanSpecialController) Detail() {
 		}
 		resp.Docs = docs
 	}
+	if item.CompanyTags != "" {
+		cTagList := strings.Split(item.CompanyTags, ",")
+		for _, s := range cTagList {
+			resp.CompanyTags = append(resp.CompanyTags, s)
+		}
+	} else {
+		resp.CompanyTags = []string{}
+	}
+	if item.IndustryTags != "" {
+		iTagList := strings.Split(item.IndustryTags, ",")
+		for _, s := range iTagList {
+			resp.IndustryTags = append(resp.IndustryTags, s)
+		}
+	} else {
+		resp.IndustryTags = []string{}
+	}
 
 	go services.AddSpecialRecord(this.User, specialId)
 
@@ -269,7 +295,7 @@ func (this *YanxuanSpecialController) Save() {
 		br.Msg = "请输入内容"
 		return
 	}
-	if req.Tags == "" && req.DoType == 2 {
+	if req.CompanyTags == "" && req.IndustryTags == "" && req.DoType == 2 {
 		br.Msg = "请至少输入一个标签"
 		return
 	}
@@ -286,11 +312,14 @@ func (this *YanxuanSpecialController) Save() {
 		DocUrl:      req.DocUrl,
 		Title:       req.Title,
 		Type:        req.Type,
+		CompanyTags:  req.CompanyTags,
+		IndustryTags: req.IndustryTags,
 	}
 	if req.DoType == 1 {
 		item.Status = 1
 	} else {
 		item.Status = 2
+		//todo
 	}
 
 	if req.Id == 0 {
@@ -872,8 +901,8 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
 	}
 
 	item := models.CygxYanxuanSpecialAuthor{
-		UserId: req.UserId,
-		HeadImg:    req.HeadImg,
+		UserId:  req.UserId,
+		HeadImg: req.HeadImg,
 	}
 
 	err = models.UpdateYanxuanSpecialAuthorHeadImg(&item)
@@ -971,7 +1000,7 @@ func (this *YanxuanSpecialController) Check() {
 		return
 	}
 
-	suggest := models.WxCheckContent(itemToken.AccessToken,sysUser.OpenId, req.Content)
+	suggest := models.WxCheckContent(itemToken.AccessToken, sysUser.OpenId, req.Content)
 	if suggest == "risky" {
 		br.Msg = "文章内容含有违法违规内容"
 		br.ErrMsg = "文章内容含有违法违规内容"
@@ -1000,7 +1029,7 @@ func (this *YanxuanSpecialController) Check() {
 				br.ErrMsg = "图片内容含有违法违规内容"
 				return
 			}
-			if err := res.GetResponseError(); err !=nil {
+			if err := res.GetResponseError(); err != nil {
 				// 处理微信返回错误信息
 				return
 			}
@@ -1014,4 +1043,4 @@ func (this *YanxuanSpecialController) Check() {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "校验成功"
-}
+}

+ 10 - 2
models/cygx_yanxuan_special.go

@@ -19,6 +19,8 @@ type CygxYanxuanSpecial struct {
 	Reason      string    // 理由
 	Title       string    // 标题
 	Type        int       // 类型1:笔记,2:观点
+	CompanyTags  string    // 公司标签
+	IndustryTags string    // 行业标签
 }
 
 type CygxYanxuanSpecialItem struct {
@@ -46,6 +48,8 @@ type CygxYanxuanSpecialItem struct {
 	CollectNum    int
 	MyCollectNum  int
 	IsCollect     int
+	CompanyTags   string
+	IndustryTags  string
 	ContentHasImg int //正文是否包含图片 1包含 0不包含
 	Docs          []Doc
 }
@@ -53,6 +57,8 @@ type CygxYanxuanSpecialItem struct {
 type CygxYanxuanSpecialResp struct {
 	CygxYanxuanSpecialItem
 	Docs []Doc
+	CompanyTags  []string
+	IndustryTags []string
 }
 
 type Doc struct {
@@ -121,6 +127,8 @@ type CygxYanxuanSpecialReq struct {
 	DocUrl  string // 文档链接
 	Title   string // 标题
 	Type    int    // 类型1:笔记,2:观点
+	IndustryTags string // 行业标签
+	CompanyTags  string // 公司标签
 }
 
 func AddCygxYanxuanSpecial(item *CygxYanxuanSpecial) (lastId int64, err error) {
@@ -157,7 +165,7 @@ type CancelPublishCygxYanxuanSpecialReq struct {
 func CancelPublishYanxuanSpecial(id int) (err error) {
 	o := orm.NewOrm()
 	sql := ``
-	sql = `UPDATE cygx_yanxuan_special SET status=1,publish_time=NOW() WHERE id = ? `
+	sql = `UPDATE cygx_yanxuan_special SET status=1,publish_time=NOW(),modify_time=NOW() WHERE id = ? `
 	_, err = o.Raw(sql, id).Exec()
 	return
 }
@@ -175,6 +183,6 @@ func DelYanxuanSpecial(id int) (err error) {
 }
 
 type CygxYanxuanSpecialCheckReq struct {
-	Content string // 内容
+	Content string   // 内容
 	ImgUrl  []string // 图片
 }

+ 4 - 2
models/cygx_yanxuan_special_user.go

@@ -17,7 +17,8 @@ type CygxYanxuanSpecialAuthor struct {
 	CreateTime   time.Time // 创建时间
 	ModifyTime   time.Time // 修改时间
 	HeadImg      string    // 头像
-	BgImg        string    // 背景图
+	BgImg        string    // 背景图上部分
+	BgImgDown    string    // 背景图下部分
 	Status       int       // 1启用2禁用
 }
 
@@ -32,9 +33,10 @@ type CygxYanxuanSpecialAuthorItem struct {
 	CompanyName       string    // 公司名
 	Mobile            string    // 手机号
 	CreateTime        string    // 创建时间
-	ModifyTime        time.Time    // 修改时间
+	ModifyTime        time.Time // 修改时间
 	HeadImg           string    // 头像
 	BgImg             string    // 背景图
+	BgImgDown             string    // 背景图下半部分
 	Status            int       // 1启用2禁用
 	CollectNum        int       // 被收藏数
 	FollowNum         int       // 被关注数

+ 9 - 5
models/report.go

@@ -502,6 +502,8 @@ type ArticleCollectionResp struct {
 	SpecialTags            string                      `description:"研选专栏标签"`
 	UserId                 int                         `description:"作者id"`
 	SpecialType            int                         `description:"专栏类型 1:笔记,2:观点"`
+	IndustryTags           string                      `description:"研选专栏行业标签"`
+	CompanyTags            string                      `description:"研选专栏公司标签"`
 }
 
 type IndustrialManagementResp struct {
@@ -610,8 +612,8 @@ func GetArticleResearchCount(condition string, pars []interface{}, needYanxuanSp
 			cygx_article AS a
 		WHERE
 			1 = 1  AND a.publish_status = 1` + condition
-	if needYanxuanSpecial{
-		sqlCount = `SELECT SUM(count) AS count FROM (`+sqlCount+`
+	if needYanxuanSpecial {
+		sqlCount = `SELECT SUM(count) AS count FROM (` + sqlCount + `
 		UNION ALL
 	SELECT COUNT( 1 ) AS count FROM
 		cygx_yanxuan_special AS a WHERE
@@ -637,7 +639,8 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 			0 AS is_special,
 			0 AS special_type,
 			0 AS user_id,
-			'' AS special_tags 
+			'' AS company_tags, 
+			'' AS industry_tags 
 		FROM
 			cygx_article AS a
 			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
@@ -658,7 +661,7 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 		date_format( a.publish_time, '%Y-%m-%d' ) AS publish_date,
 		-1 AS article_type_id,
 		b.nick_name AS nick_name,
-		0 AS department_id,
+		a.user_id 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,
@@ -666,7 +669,8 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 		1 AS is_special,
 		a.type AS special_type,
 		a.user_id AS user_id,
-		a.tags AS special_tags 
+		a.company_tags AS company_tags, 
+		a.industry_tags AS industry_tags 
 	FROM
 	cygx_yanxuan_special AS a
 	JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id

+ 32 - 0
services/cygx_yanxuan_special.go

@@ -66,3 +66,35 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 	//}
 	return
 }
+
+//// SendReviewTemplateMsgAdmin 提交审核时给王芳,汪洋发消息
+//func SendReviewTemplateMsgAdmin(req models.ApplyTryReq, usermobile, applyMethod string, isResearch bool) (err error) {
+//	defer func() {
+//		if err != nil {
+//			go utils.SendAlarmMsg("处理试用申请给王芳,汪洋发消息失败, ErrMsg: "+err.Error(), 3)
+//		}
+//	}()
+//	var configCode string
+//	//如果是研选的就推送给汪洋跟王芳,否则就推送给王芳
+//	if isResearch {
+//		configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+//	} else {
+//		configCode = utils.TPL_MSG
+//	}
+//	cnf, e := models.GetConfigByCode(configCode)
+//	if e != nil {
+//		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
+//		return
+//	}
+//	openIdList, e := models.GetUserRecordListByMobile(4, cnf.ConfigValue)
+//	if e != nil && e.Error() != utils.ErrNoRow() {
+//		err = errors.New("GetUserRecordListByMobile, Err: " + e.Error() + cnf.ConfigValue)
+//		return err
+//	}
+//
+//	for _, v := range openIdList {
+//		go SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, usermobile, applyMethod, v)
+//	}
+//
+//	return
+//}