Browse Source

Merge branch 'cygx/cygx_14.0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

zhangchuanxing 3 months ago
parent
commit
0d033f2560

+ 1 - 0
models/article.go

@@ -187,6 +187,7 @@ type ArticleDetail struct {
 	IsRoadShow               bool   `description:"是否是路演精华"`
 	ReportType               int    `description:"报告类型,1行业报告,2产业报告,0无"`
 	FieldName                string `description:"策略平台的领域字段名称"`
+	SeriesName               string `description:"策略平台系列名称"`
 	TypeName                 string `description:"策略平台类型字段名称"`
 	IsApplyAppointmentExpert bool   `description:"是否属于专家访谈"`
 	ArticleTypeName          string `description:"权限名称"`

+ 8 - 1
models/industry_fllow.go

@@ -97,6 +97,13 @@ func GetCountCygxIndustryFllow(userId, industrialManagementId int, condition str
 	return
 }
 
+// 获取关注数量
+func GetCountCygxIndustryFllowByType(userId, industrialManagementId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? AND industrial_management_id=?  AND  follow_type = 1  `
+	err = orm.NewOrm().Raw(sql, userId, industrialManagementId).QueryRow(&count)
+	return
+}
+
 // 获取数量
 func GetCountCygxIndustryFllowByUid(userId int) (count int, err error) {
 	sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? `
@@ -227,7 +234,7 @@ func GetTopIndustryFollowData(startSize, pageSize int, condition string, pars []
 }
 
 // 列表
-func GetCygxIndustryFllowListByCon(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxIndustryFllow, err error) {
+func GetCygxIndustryFllowListByCon(condition string, pars []interface{}) (items []*CygxIndustryFllow, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_industry_fllow as art WHERE 1= 1 `
 	if condition != "" {

+ 1 - 0
models/wx_user_code.go

@@ -63,6 +63,7 @@ func GetCygxUserFllowOpenid(articleId int) (items []*OpenIdList, err error) {
 		WHERE
 			1 = 1 
 			AND mg.article_id = ? 
+			AND f.follow_type = 1
 			GROUP BY f.user_id `
 	_, err = o.Raw(sql, articleId).QueryRows(&items)
 	return

+ 15 - 0
models/xzs_choose_category.go

@@ -95,3 +95,18 @@ func UpdateCygxXzsChooseCategory(idCygx, id int) (err error) {
 	_, err = o.Raw(sql, idCygx, id).Exec()
 	return
 }
+
+// 列表
+func GetCygxXzsChooseCategoryListFollowType(categoryId, followType int) (items []*CygxXzsChooseCategory, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_xzs_choose_category as art WHERE category_id  = ? AND  follow_type = ?  `
+	_, err = o.Raw(sql, categoryId, followType).QueryRows(&items)
+	return
+}
+
+// 获取重点关注数量
+func GetCountCygxXzsChooseCategoryFllowByType(userId, categoryId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_xzs_choose_category WHERE user_id=? AND category_id=?  AND  follow_type = 1  `
+	err = orm.NewOrm().Raw(sql, userId, categoryId).QueryRow(&count)
+	return
+}

+ 16 - 0
models/xzs_choose_category_zhouqi.go

@@ -26,3 +26,19 @@ func GetCygxXzsChooseCategoryZhouqiList(mobile string) (items []*CygxXzsChooseCa
 	_, err = o.Raw(sql, mobile).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetCygxXzsChooseCategoryZhouqiListFollowType(categoryName, seriesName string, followType int) (items []*CygxXzsChooseCategoryZhouqi, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	f.* 
+FROM
+	cygx_zhouqi_article_map AS m
+	INNER JOIN cygx_xzs_choose_category_zhouqi AS f ON f.category_id = m.category_id 
+WHERE
+	1 = 1 
+	AND ( m.match_type_name = ? OR m.series_name = ? ) 
+	AND follow_type = ?  `
+	_, err = o.Raw(sql, categoryName, seriesName, followType).QueryRows(&items)
+	return
+}

File diff suppressed because it is too large
+ 415 - 735
services/article.go


+ 50 - 50
services/init_10.5.1.go

@@ -10,56 +10,56 @@ import (
 
 //10.5.1版本上线需要更新的数据
 
-func init1111() {
-	var condition string
-	var pars []interface{}
-	var err error
-	fmt.Print()
-
-	var topCond string
-	var topPars []interface{}
-	toplist, err := models.GetTopOneMonthArtReadNumIndustryAll(topCond, topPars)
-	if err != nil {
-		return
-	}
-
-	mapIndustryName := make(map[int]string)
-	for _, v := range toplist {
-		mapIndustryName[v.IndustrialManagementId] = v.IndustryName
-	}
-	fmt.Println(mapIndustryName)
-	//处理上周纪要汇总
-	condition = ` AND  type = 1  `
-	list, err := models.GetCygxIndustryFllowListByCon(condition, pars, 0, 100000)
-	if err != nil {
-		fmt.Println(err)
-	}
-	var items []*models.CygxUserLabel
-	for _, user := range list {
-		item := new(models.CygxUserLabel)
-		item.UserId = user.UserId
-		item.CompanyId = user.CompanyId
-		item.RealName = user.RealName
-		item.Mobile = user.Mobile
-		item.Email = user.Email
-		item.Label = mapIndustryName[user.IndustrialManagementId]
-		item.SourceId = user.IndustrialManagementId
-		item.Source = 1
-		item.IsFollow = 1
-		item.CreateTime = time.Now()
-		item.ModifyTime = time.Now()
-		items = append(items, item)
-		if len(items)%5000 == 0 {
-			err = models.CygxUserLabelMulti(items)
-			fmt.Println(err)
-			items = make([]*models.CygxUserLabel, 0)
-		}
-	}
-	if len(items) > 0 {
-		err = models.CygxUserLabelMulti(items)
-		fmt.Println(err, "555")
-	}
-}
+//func init1111() {
+//	var condition string
+//	var pars []interface{}
+//	var err error
+//	fmt.Print()
+//
+//	var topCond string
+//	var topPars []interface{}
+//	toplist, err := models.GetTopOneMonthArtReadNumIndustryAll(topCond, topPars)
+//	if err != nil {
+//		return
+//	}
+//
+//	mapIndustryName := make(map[int]string)
+//	for _, v := range toplist {
+//		mapIndustryName[v.IndustrialManagementId] = v.IndustryName
+//	}
+//	fmt.Println(mapIndustryName)
+//	//处理上周纪要汇总
+//	condition = ` AND  type = 1  `
+//	list, err := models.GetCygxIndustryFllowListByCon(condition, pars, 0, 100000)
+//	if err != nil {
+//		fmt.Println(err)
+//	}
+//	var items []*models.CygxUserLabel
+//	for _, user := range list {
+//		item := new(models.CygxUserLabel)
+//		item.UserId = user.UserId
+//		item.CompanyId = user.CompanyId
+//		item.RealName = user.RealName
+//		item.Mobile = user.Mobile
+//		item.Email = user.Email
+//		item.Label = mapIndustryName[user.IndustrialManagementId]
+//		item.SourceId = user.IndustrialManagementId
+//		item.Source = 1
+//		item.IsFollow = 1
+//		item.CreateTime = time.Now()
+//		item.ModifyTime = time.Now()
+//		items = append(items, item)
+//		if len(items)%5000 == 0 {
+//			err = models.CygxUserLabelMulti(items)
+//			fmt.Println(err)
+//			items = make([]*models.CygxUserLabel, 0)
+//		}
+//	}
+//	if len(items) > 0 {
+//		err = models.CygxUserLabelMulti(items)
+//		fmt.Println(err, "555")
+//	}
+//}
 
 func init123() {
 	var condition string

+ 13 - 0
services/user_label.go

@@ -409,6 +409,12 @@ func IndustryFllowUserLabelLogReduce(log models.CygxUserLabelLogRedis) (err erro
 		err = errors.New("GetIndustrialManagementDetail" + e.Error())
 		return
 	}
+	countFllow, e := models.GetCountCygxIndustryFllowByType(userId, industrialManagementId) // 是否重点关注
+	if e != nil {
+		err = errors.New("GetCountCygxIndustryFllowByType" + e.Error())
+		return
+	}
+	isFllow = countFllow
 	label := detailIndustrial.IndustryName
 	if isFllow == 0 {
 		e = models.UpdateCygxUserLabelIsFollow(isFllow, industrialManagementId, source, userId, label)
@@ -572,6 +578,13 @@ func CategoryFllowUserLabelLogReduce(log models.CygxUserLabelLogRedis) (err erro
 		return
 	}
 	label := detailIndustrial.MatchTypeName
+
+	countFllow, e := models.GetCountCygxXzsChooseCategoryFllowByType(userId, industrialManagementId) // 是否重点关注
+	if e != nil {
+		err = errors.New("GetCountCygxIndustryFllowByType" + e.Error())
+		return
+	}
+	isFllow = countFllow
 	if isFllow == 0 {
 		e = models.UpdateCygxUserLabelIsFollow(isFllow, industrialManagementId, source, userId, label)
 		if e != nil {

+ 23 - 25
services/wx_template_msg.go

@@ -497,31 +497,6 @@ func SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4 st
 			go utils.SendAlarmMsg(fmt.Sprint("发送报告提问消息提醒模版消息失败,SendWxMsgWithArticleUpdate 文章ID:", articleId, "Err:"+err.Error()), 2)
 		}
 	}()
-	//accessToken, err := models.GetWxAccessTokenByXzs()
-	//if err != nil {
-	//	msg = "GetWxAccessToken Err:" + err.Error()
-	//	return
-	//}
-	//if accessToken == "" {
-	//	msg = "accessToken is empty"
-	//	return
-	//}
-	//var openIdList []*models.OpenIdList
-	//openIdList = append(openIdList, item)
-	//sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
-	//templateId := utils.TemplateIdByProductXzs
-	//sendMap := make(map[string]interface{})
-	//sendData := make(map[string]interface{})
-	//sendMap["template_id"] = templateId
-	//sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": "pageMy/reportDetail/reportDetail?id=" + strconv.Itoa(articleId) + "&IsSendWx=1"}
-	//sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
-	//sendData["keyword1"] = map[string]interface{}{"value": keyWord1, "color": "#173177"}
-	//sendData["keyword2"] = map[string]interface{}{"value": keyWord2, "color": "#173177"}
-	//sendData["keyword3"] = map[string]interface{}{"value": keyWord3, "color": "#173177"}
-	//sendData["keyword4"] = map[string]interface{}{"value": keyWord4, "color": "#173177"}
-	//sendData["remark"] = map[string]interface{}{"value": "点击查看报告详情", "color": "#173177"}
-	//sendMap["data"] = sendData
-	//WxSendTemplateMsg(sendUrl, sendMap, openIdList, strconv.Itoa(articleId), utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD)
 
 	openIdArr := make([]string, 0)
 	openIdArr = append(openIdArr, item.OpenId)
@@ -541,6 +516,29 @@ func SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4 st
 	return
 }
 
+func SendWxMsgWithArticleUpdateList(keyword1, keyword2, keyword3, keyword4 string, openIdArr []string, articleId int) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("发送报告提问消息提醒模版消息失败,SendWxMsgWithArticleUpdate 文章ID:", articleId, "Err:"+err.Error()), 2)
+		}
+	}()
+
+	redirectUrl := utils.WX_MSG_PATH_ARTICLE_DETAIL + strconv.Itoa(articleId)
+	sendInfo := new(SendWxTemplate)
+	sendInfo.Keyword1 = keyword1
+	sendInfo.Keyword2 = keyword2
+	sendInfo.Keyword3 = keyword3
+	sendInfo.Keyword4 = keyword4
+	sendInfo.TemplateId = utils.TemplateIdByProductXzs
+	sendInfo.RedirectUrl = redirectUrl
+	sendInfo.RedirectTarget = 3
+	sendInfo.Resource = strconv.Itoa(articleId)
+	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD
+	sendInfo.OpenIdArr = openIdArr
+	err = PublicSendTemplateMsg(sendInfo)
+	return
+}
+
 // 周日下午4点半,推送全部活动
 func SendActivityOnenIdWxTemplateMsg(first, keyword1, keyword2, keyword3, keyword4 string, openIdList []*models.OpenIdList) (err error) {
 	defer func() {

Some files were not shown because too many files changed in this diff