Эх сурвалжийг харах

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 жил өмнө
parent
commit
85ab9d3e42

+ 31 - 16
controllers/report.go

@@ -62,6 +62,11 @@ func (this *ReportController) TradeList() {
 		categoryMap[v.CategoryId] = v.CategoryId
 		list = append(list, v)
 	}
+	//加了一个需求,现有数据结构不支持,手动添加  2023-06-12
+	if ChartPermissionId == utils.KE_JI_ID {
+		list = append(list, &models.TradeReportMapping{MatchTypeName: "AI前沿", CategoryId: utils.ACTEGORY_ID_AI_QY})
+	}
+
 	//var condition string
 	//var pars []interface{}
 	for k, v := range list {
@@ -70,24 +75,34 @@ func (this *ReportController) TradeList() {
 		//} else {
 		//	condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
 		//}
-		listArticle, _, err := models.GetReportAndproductIndustrylList(v.CategoryId, 0, 1)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.Msg = "GetHomeList,Err:" + err.Error()
-			return
+		pageSize := 1
+		var listArticle []*models.ReportArticle
+		if v.CategoryId == utils.ACTEGORY_ID_AI_QY {
+			//加了一个需求,现有数据结构不支持,手动添加  2023-06-12
+			listArticle, _, err = services.GetAiQianYanArtilceList(0, pageSize)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.Msg = "GetHomeList,Err:" + err.Error()
+				return
+			}
+			//for _, vAi := range listArticleAi {
+			//	listArticle = append(listArticle, &models.ReportArticle{
+			//		CategoryId:  vAi.CategoryId,
+			//		PublishDate: vAi.PublishDate,
+			//	})
+			//}
+		} else {
+			listArticle, _, err = models.GetReportAndproductIndustrylList(v.CategoryId, 0, pageSize)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.Msg = "GetHomeList,Err:" + err.Error()
+				return
+			}
 		}
-		if len(listArticle) > 0 {
-			list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+		//listArticle, _, err := models.GetReportAndproductIndustrylList(v.CategoryId, 0, 1)
 
-			//count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
-			//if err != nil {
-			//	br.Msg = "获取信息失败"
-			//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-			//	return
-			//}
-			//if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
-			//	list[k].IsRed = true
-			//}
+		if len(listArticle) > 0 {
+			list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式 }
 		}
 	}
 	resp := new(models.TradeReportMappingResp)

+ 9 - 98
controllers/tactics.go

@@ -61,82 +61,14 @@ func (this *TacticsController) List() {
 	//var pars []interface{}
 	//var total int
 	resp := new(models.TacticsListResp)
-	//page := paging.GetPaging(currentIndex, pageSize, total)
-
-	//获取该产业下所对应的行业图片
-	//detail, errCategory := models.GetdetailByCategoryIdOneByHangye(categoryId)
-	//if errCategory != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-	//	return
-	//}
-	//对应行业的图片
-	//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-	//if err != nil {
-	//	br.Msg = "获取数据失败"
-	//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-	//mapChartPermission := make(map[string]string)
-	//var permissionName string
-	//var imgUrlChartPermission string
-	//for _, v := range chartPermissionUrlList {
-	//	vslice := strings.Split(v, "_")
-	//	permissionName = vslice[0]
-	//	imgUrlChartPermission = vslice[len(vslice)-1]
-	//	mapChartPermission[permissionName] = imgUrlChartPermission
-	//}
-
-	//对应分类的所图片
-	//detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
-	//if err != nil {
-	//	br.Msg = "获取数据失败"
-	//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
-	//mapCategoryUrl := make(map[string]string)
-	//var categoryIdStr string
-	//var imgUrlChart string
-	//for _, v := range categoryUrlList {
-	//	vslice := strings.Split(v, "_")
-	//	categoryIdStr = vslice[0]
-	//	imgUrlChart = vslice[len(vslice)-1]
-	//	mapCategoryUrl[categoryIdStr] = imgUrlChart
-	//}
-
-	//if categoryId < 0 {
-	//	listTactics, err := models.GetReportMappingStrategyAll()
-	//	if err != nil && err.Error() != utils.ErrNoRow() {
-	//		br.Msg = "获取信息失败"
-	//		br.ErrMsg = "获取分类权限信息失败,Err:" + err.Error()
-	//		return
-	//	}
-	//	for _, v := range listTactics {
-	//		listTacticsSrt = listTacticsSrt + strconv.Itoa(v.CategoryId) + `,`
-	//	}
-	//	listTacticsSrt = strings.TrimRight(listTacticsSrt, ",")
-	//	condition = ` AND category_id IN(` + listTacticsSrt + `)`
-	//} else {
-	//	if detail.CeLueFieldId != "" {
-	//		condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
-	//	} else if detail.PolymerizationId != "" {
-	//		condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
-	//	} else {
-	//		condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
-	//	}
-	//}
-	//total, err = models.GetHomeCount(condition, pars)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.Msg = "获取帖子总数失败,Err:" + err.Error()
-	//	return
-	//}
-
-	//list, err := models.GetReportTacticsList(condition, pars, uid, startSize, pageSize)
-
-	list, total, err := models.GetReportAndproductIndustrylList(categoryId, startSize, pageSize)
+	list := make([]*models.ReportArticle, 0)
+	var total int
+	var err error
+	if categoryId == utils.ACTEGORY_ID_AI_QY {
+		list, total, err = services.GetAiQianYanArtilceList(0, pageSize)
+	} else {
+		list, total, err = models.GetReportAndproductIndustrylList(categoryId, startSize, pageSize)
+	}
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.Msg = "获取帖子数据失败,Err:" + err.Error()
@@ -146,15 +78,12 @@ func (this *TacticsController) List() {
 	var productInteriorIs []int
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	for _, v := range list {
-		//if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
-		//	list[k].IsRed = true
-		//}
+
 		if v.Resource == 1 {
 			articleIds = append(articleIds, v.ArticleId)
 		} else {
 			productInteriorIs = append(productInteriorIs, v.ArticleId)
 		}
-		//list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
 	}
 	ArticleHistoryMap := services.GetArticleHistoryByUser(articleIds, user)
 	ProductInteriorHistoryMap := services.GetCygxProductInteriorHistoryListMap(articleIds, user)
@@ -184,24 +113,6 @@ func (this *TacticsController) List() {
 			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 		}
 	}
-	//lenList := len(list)
-	//for i := 0; i < lenList; i++ {
-	//	item := list[i]
-	//	list[i].Body, _ = services.GetReportContentTextSub(item.Body)
-	//	list[i].Abstract = html.UnescapeString(item.Abstract)
-	//	//list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
-	//	list[i].Annotation = strings.Replace(item.Annotation, "<br>", "", -1)
-	//	//行业比较研究、资金流向,显示报告的摘要
-	//	if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
-	//		list[i].Annotation = list[i].Abstract
-	//	}
-	//	//if item.ArticleId == 6881 {
-	//	//	fmt.Println(list[i].Annotation)
-	//	//}
-	//	list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
-	//}
-	//
-	//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
 	resp.List = list
 	resp.Paging = page
 	br.Ret = 200

+ 9 - 5
controllers/user.go

@@ -1099,7 +1099,7 @@ func (this *UserController) ApplyTryOut() {
 					req.RealName = user.RealName
 					req.CompanyName = user.CompanyName
 				}
-				go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
+				//go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
 			}
 		}
 	} else {
@@ -1122,10 +1122,6 @@ func (this *UserController) ApplyTryOut() {
 		}
 	}
 	//如果对应销售不存在就给王芳,汪洋推模版消息
-	if sellerItem == nil {
-		go services.SendPermissionApplyTemplateMsgAdmin(req, mobile, applyMethod, isResearch)
-	}
-
 	item := new(models.CygxApplyRecord)
 	item.UserId = user.UserId
 	item.BusinessCardUrl = req.BusinessCardUrl
@@ -1148,6 +1144,14 @@ func (this *UserController) ApplyTryOut() {
 		br.ErrMsg = "申请失败,Err:" + err.Error()
 		return
 	}
+	if sellerItem == nil {
+		go services.SendPermissionApplyTemplateMsgAdmin(req, mobile, applyMethod, isResearch)
+	} else {
+		openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
+		if openIpItem != nil && openIpItem.OpenId != "" {
+			go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
+		}
+	}
 	//添加成功后,设置5分钟缓存,不允许重复添加
 	//utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*60)
 

+ 23 - 0
models/article.go

@@ -729,3 +729,26 @@ func GetArticleStock() (items []*SummaryArticleStock, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetCygxCygxArticleList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxArticle, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_article as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// 获取数量
+func GetCygxArticleCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_article as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}

+ 36 - 0
services/article.go

@@ -2049,3 +2049,39 @@ func GetArticleStockMap() (mapResp map[string]int, err error) {
 	}
 	return
 }
+
+// GetAiQianYanArtilceList 获取AI前沿几篇文章
+func GetAiQianYanArtilceList(startSize, pageSize int) (items []*models.ReportArticle, total int, err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取AI前沿几篇文章失败"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition += ` AND title LIKE '%AI前沿%' AND publish_status = 1  ORDER BY publish_date DESC   `
+	articleList, e := models.GetCygxCygxArticleList(condition, pars, startSize, pageSize)
+	if e != nil {
+		err = errors.New("GetCygxCygxArticleList, Err: " + e.Error())
+		return
+	}
+	total, e = models.GetCygxArticleCount(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxArticleCount, Err: " + e.Error())
+		return
+	}
+
+	for _, v := range articleList {
+		item := new(models.ReportArticle)
+		item.ArticleId = v.ArticleId
+		item.Title = v.Title
+		item.Abstract = v.Abstract
+		item.Annotation = v.Annotation
+		item.PublishDate = v.PublishDate
+		item.Resource = 1
+		item.CategoryId = strconv.Itoa(v.CategoryId)
+		item.Body = v.Body
+		items = append(items, item)
+	}
+	return
+}

+ 1 - 1
services/init_10.3.go

@@ -7,7 +7,7 @@ import (
 
 //10.3版本上线需要更新的数据
 
-func init1111() {
+func init51111() {
 	var condition string
 	var pars []interface{}
 	var err error

+ 24 - 14
services/init_10.5.1.go

@@ -9,7 +9,7 @@ import (
 
 //10.5.1版本上线需要更新的数据
 
-func init5111() {
+func init1111() {
 	var condition string
 	var pars []interface{}
 	var err error
@@ -48,7 +48,7 @@ func init5111() {
 		item.CreateTime = time.Now()
 		item.ModifyTime = time.Now()
 		items = append(items, item)
-		if len(items)%5 == 0 {
+		if len(items)%5000 == 0 {
 			err = models.CygxUserLabelMulti(items)
 			fmt.Println(err)
 			items = make([]*models.CygxUserLabel, 0)
@@ -60,7 +60,7 @@ func init5111() {
 	}
 }
 
-func init52222() {
+func init123() {
 	var condition string
 	var pars []interface{}
 	var err error
@@ -86,6 +86,9 @@ func init52222() {
 	}
 	var items []*models.CygxUserLabel
 	for _, user := range list {
+		if user.IdCygx == 0 {
+			continue
+		}
 		item := new(models.CygxUserLabel)
 		item.UserId = user.UserId
 		item.CompanyId = user.CompanyId
@@ -98,8 +101,9 @@ func init52222() {
 		item.IsFollow = 1
 		item.CreateTime = time.Now()
 		item.ModifyTime = time.Now()
+		fmt.Println(item.SourceId)
 		items = append(items, item)
-		if len(items)%5 == 0 {
+		if len(items)%5000 == 0 {
 			err = models.CygxUserLabelMulti(items)
 			fmt.Println(err)
 			items = make([]*models.CygxUserLabel, 0)
@@ -176,7 +180,7 @@ func init5333() {
 				item.CreateTime = utils.StrTimeToTime(v.ActivityTime)
 				item.ModifyTime = time.Now()
 				items = append(items, item)
-				if len(items)%50 == 0 {
+				if len(items)%5000 == 0 {
 					_, err = models.AddCygxUserLabelActivityList(items)
 					fmt.Println(err)
 					items = make([]*models.CygxUserLabelActivity, 0)
@@ -246,7 +250,7 @@ func init5444() {
 			item.CreateTime = utils.StrTimeToTime(user.CreateTime)
 			item.ModifyTime = time.Now()
 			items = append(items, item)
-			if len(items)%50 == 0 {
+			if len(items)%5000 == 0 {
 				_, err = models.AddCygxUserLabelActivitySpecialList(items)
 				fmt.Println(err)
 				items = make([]*models.CygxUserLabelActivitySpecial, 0)
@@ -278,7 +282,7 @@ func init5555() {
 		mapIndustryName[v.IndustrialManagementId] = v.IndustryName
 	}
 	//fmt.Println(mapIndustryName)
-	condition = ` AND   stop_time > 4  AND create_time > '2022-11-25 00:00:00' GROUP BY article_id  `
+	condition = ` AND   stop_time > 3  AND create_time > '2022-11-25 00:00:00' GROUP BY article_id  `
 	//condition = `   AND   stop_time > 4   AND create_time > '2023-04-25 00:00:00' GROUP BY article_id  `
 	listArtGroup, err := models.GetCygxArticleHistoryRecordNewpvList(condition, pars)
 	if err != nil {
@@ -289,6 +293,7 @@ func init5555() {
 
 	itemsMap := make(map[int][]*models.CygxUserLabel)
 	for _, v := range listArtGroup {
+
 		fmt.Println(v.ArticleId)
 		var items []*models.CygxUserLabel
 		articleId := v.ArticleId
@@ -299,7 +304,8 @@ func init5555() {
 		industrialList, e := models.GetIndustrialArticleGroupManagementList(condition, pars)
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			fmt.Println(e)
-			return
+			continue
+			//return
 		}
 		if len(industrialList) == 0 {
 			//如果没有行产业归类就按照行业报告处理
@@ -307,13 +313,15 @@ func init5555() {
 			detailArticle, e := models.GetArticleDetailById(articleId)
 			if e != nil {
 				fmt.Println(e)
-				return
+				continue
+				//return
 			}
 
 			labelDetail, e := models.GetdetailByCategoryIdLabel(detailArticle.CategoryId)
 			if e != nil {
 				fmt.Println(e)
-				return
+				continue
+				//return
 			}
 			label := labelDetail.MatchTypeName
 			industrialManagementId := labelDetail.Id
@@ -340,12 +348,12 @@ func init5555() {
 				topCond = ` AND industrial_management_id IN (` + utils.GetOrmInReplace(idsLen) + `)`
 				topPars = append(topPars, industrialManagementIds)
 			} else {
-				return
+				continue
 			}
 			industrNamelist, e := models.GetTopOneMonthArtReadNumIndustryAll(topCond, topPars)
 			if e != nil {
 				fmt.Println(e)
-				return
+				continue
 			}
 			source = 1
 			for _, v := range industrNamelist {
@@ -387,7 +395,7 @@ func init5555() {
 			itemsMap[articleId] = items
 		}
 	}
-	condition = `   AND   stop_time > 4   AND create_time > '2022-11-25 00:00:00'   `
+	condition = `   AND   stop_time > 3   AND create_time > '2022-11-25 00:00:00'   `
 	//condition = `  AND   stop_time > 4    AND create_time > '2023-4-25 00:00:00'   `
 	listArt, err := models.GetCygxArticleHistoryRecordNewpvList(condition, pars)
 	if err != nil {
@@ -395,6 +403,8 @@ func init5555() {
 	}
 	var items []*models.CygxUserLabelArticle
 
+	fmt.Println(len(listArt))
+
 	for _, user := range listArt {
 		if len(itemsMap[user.ArticleId]) > 0 {
 			for k2, vlsit := range itemsMap {
@@ -420,7 +430,7 @@ func init5555() {
 					item.CreateTime = user.CreateTime
 					item.ModifyTime = time.Now()
 					items = append(items, item)
-					if len(items)%500 == 0 {
+					if len(items)%5000 == 0 {
 						_, err = models.AddCygxUserLabelArticleList(items)
 						fmt.Println(err)
 						items = make([]*models.CygxUserLabelArticle, 0)

+ 41 - 17
services/user_label.go

@@ -710,14 +710,29 @@ func ActivitySpecialUserLabelLogReduce(log models.CygxUserLabelLogRedis) (err er
 	return
 }
 
+//func init() {
+//	var condition string
+//	var pars []interface{}
+//	pars = make([]interface{}, 0)
+//	condition = ` GROUP BY user_id`
+//	listUser, _ := models.GetCygxUserLabelList(condition, pars)
+//	for k, v := range listUser {
+//		fmt.Println(k)
+//		updateUserLabelByUserId(v.UserId)
+//	}
+//	//updateUserLabelByUserId(13269)
+//}
+
 // 更新用户标签
 func updateUserLabelByUserId(userId int) (err error) {
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
+			utils.FileLog.Info("更新用户标签,Err:%s", err.Error(), userId)
 			go utils.SendAlarmMsg("更新用户标签失败:"+err.Error()+"userId:"+strconv.Itoa(userId), 2)
 		}
 	}()
+	time.Sleep(1 * time.Second)
 	var condition string
 	var pars []interface{}
 	condition = ` AND is_follow=1  AND  user_id = ?  `
@@ -740,23 +755,22 @@ func updateUserLabelByUserId(userId int) (err error) {
 		condition += `  	AND ( is_follow > 0 OR weight > 0 )  ORDER BY is_follow DESC, weight DESC  `
 		list, e = models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
-			err = errors.New("GetCygxUserLabelList" + e.Error())
+			err = errors.New("GetCygxUserLabelList当产业关注数量不超过10 ,系列关注数量不超过5" + e.Error())
 			return
 		}
 	}
 
 	//当产业关注数量超过10 ,系列关注数量超过5
-	if totalSource1 > 10 && totalSource2 > 1 {
+	if totalSource1 > 10 && totalSource2 > 5 {
 		condition += `  AND  weight > 0 ORDER BY  weight DESC  `
 		list, e = models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
-			err = errors.New("GetCygxUserLabelList" + e.Error())
+			err = errors.New("GetCygxUserLabelList 当产业关注数量超过10 ,系列关注数量超过5" + e.Error())
 			return
 		}
 	}
 	//当产业关注数量不超过10 ,系列关注数量超过5
 	if totalSource1 <= 10 && totalSource2 > 5 {
-		fmt.Println("当产业关注数量不超过10 ,系列关注数量超过5")
 		condition += `  AND  source = 1  AND is_follow = 1 ORDER BY  weight DESC  `
 		listfollow, e := models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
@@ -774,7 +788,7 @@ func updateUserLabelByUserId(userId int) (err error) {
 		condition += ` 	AND  weight > 0   ORDER BY  weight DESC  `
 		listother, e := models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
-			err = errors.New("GetCygxUserLabelList" + e.Error())
+			err = errors.New("GetCygxUserLabelList 当产业关注数量不超过10 ,系列关注数量超过5" + e.Error())
 			return
 		}
 		for _, v := range listother {
@@ -790,7 +804,7 @@ func updateUserLabelByUserId(userId int) (err error) {
 		condition += `  AND  source = 2  AND is_follow = 1 ORDER BY  weight DESC  `
 		listfollow, e := models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
-			err = errors.New("GetCygxUserLabelList" + e.Error())
+			err = errors.New("GetCygxUserLabelList 当产业关注数量超过10 ,系列关注数量不超过5" + e.Error())
 			return
 		}
 		idMap := make(map[int]bool)
@@ -804,7 +818,7 @@ func updateUserLabelByUserId(userId int) (err error) {
 		condition += ` 	AND  weight > 0   ORDER BY  weight DESC  `
 		listother, e := models.GetCygxUserLabelList(condition, pars)
 		if e != nil {
-			err = errors.New("GetCygxUserLabelList" + e.Error())
+			err = errors.New("GetCygxUserLabelList 当产业关注数量超过10 ,系列关注数量不超过5" + e.Error())
 			return
 		}
 		for _, v := range listother {
@@ -873,6 +887,7 @@ func UpdateUserLabelWeight() (err error) {
 	for _, v := range list {
 		userLabel[fmt.Sprint("user_id{|}", v.UserId, "{|}source_id{|}", v.SourceId, "{|}source{|}", v.Source)] = true
 	}
+	fmt.Println(userLabel)
 	//处理文章标签
 	var items []*models.CygxUserLabel
 	for _, user := range listArticle {
@@ -933,14 +948,22 @@ func UpdateUserLabelWeight() (err error) {
 		}
 		userLabelWeight[fmt.Sprint("user_id{|}", user.UserId, "{|}label{|}", user.Label)]++
 	}
-
+	var itemLimt []*models.CygxUserLabel
+	fmt.Println(len(items))
 	if len(items) > 0 {
-		e = models.CygxUserLabelMulti(items)
-		if e != nil {
-			err = errors.New("CygxUserLabelMulti" + e.Error())
-			return
+		for _, v := range items {
+			itemLimt = append(itemLimt, v)
+			if len(itemLimt)%5000 == 0 {
+				err = models.CygxUserLabelMulti(itemLimt)
+				fmt.Println(err)
+				itemLimt = make([]*models.CygxUserLabel, 0)
+			}
 		}
 	}
+	if len(itemLimt) > 0 {
+		err = models.CygxUserLabelMulti(itemLimt)
+		fmt.Println(err)
+	}
 	var itemsUpdate []*models.CygxUserLabel
 	for k, v := range userLabelWeight {
 		sliceUser := strings.Split(k, "{|}")
@@ -952,17 +975,18 @@ func UpdateUserLabelWeight() (err error) {
 		item.Weight = v
 		itemsUpdate = append(itemsUpdate, item)
 	}
-	e = models.UpdateCygxUserLabelMulti(itemsUpdate)
-	if e != nil {
-		err = errors.New("UpdateCygxUserLabelMulti" + e.Error())
-		return
-	}
 
 	e = models.UpdateCygxUserLabelWeightAll()
 	if e != nil {
 		err = errors.New("UpdateCygxUserLabelWeightAll" + e.Error())
 		return
 	}
+	fmt.Println(len(itemsUpdate))
+	e = models.UpdateCygxUserLabelMulti(itemsUpdate)
+	if e != nil {
+		err = errors.New("UpdateCygxUserLabelMulti" + e.Error())
+		return
+	}
 
 	pars = make([]interface{}, 0)
 	condition = ` GROUP BY user_id`

+ 3 - 7
services/wechat_send_msg.go

@@ -105,17 +105,13 @@ func SendInterviewApplyCancelTemplateMsg(realName, companyName, mobile, articleT
 
 // 权限申请
 func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod string, itemOpenid *models.OpenIdList) (err error) {
-	var msg string
+
 	defer func() {
 		if err != nil {
-			go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
-			go utils.SendAlarmMsg(fmt.Sprint("权限申请模板消息推送消息失败,手机号", mobile, "公司:", companyName, "手机号:", mobile), 2)
-		}
-		if msg != "" {
-			utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
+			go utils.SendAlarmMsg(fmt.Sprint("权限申请模板消息推送消息失败,手机号", mobile, "公司:", companyName, "手机号:", mobile, ";Err:"+err.Error()), 2)
 		}
-	}()
 
+	}()
 	var first string
 	var keyword1 string
 	var keyword2 string

+ 7 - 6
services/wx_template_msg.go

@@ -425,7 +425,7 @@ func SendActivityAskApplyTemplateMsgV2(keyword1, keyword2, keyword3, keyword4, r
 
 	activityId := itemAct.ActivityId
 	var redirectUrl string
-	redirectUrl = utils.WX_MSG_PATH_ACTIVITY_DETAIL + strconv.Itoa(activityId)
+	//redirectUrl = utils.WX_MSG_PATH_ACTIVITY_DETAIL + strconv.Itoa(activityId)
 	openIdArr := make([]string, 0)
 	openIdArr = append(openIdArr, itemOpenid.OpenId)
 	sendInfo := new(SendWxTemplate)
@@ -440,11 +440,12 @@ func SendActivityAskApplyTemplateMsgV2(keyword1, keyword2, keyword3, keyword4, r
 	sendInfo.Resource = strconv.Itoa(activityId)
 
 	//mapSource留言跳转类型,1:文章、2:活动、3:微路演视频、4:活动视频、5:活动音频
-	if utils.RunMode != "release" {
-		sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ACTIVITY_ADD
-	} else {
-		redirectUrl = utils.WX_MSG_PATH_TEMPLATE_MSG + "SourceId=" + strconv.Itoa(msgId) + "&SourceType=2"
-	}
+	//if utils.RunMode != "release" {
+	//	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ACTIVITY_ADD
+	//} else {
+	//
+	//}
+	redirectUrl = utils.WX_MSG_PATH_TEMPLATE_MSG + "SourceId=" + strconv.Itoa(msgId) + "&SourceType=2"
 
 	sendInfo.OpenIdArr = openIdArr
 	err = PublicSendTemplateMsg(sendInfo)

+ 0 - 3
services/wx_user.go

@@ -14,8 +14,6 @@ func UpdateWxUserLabel(cont context.Context) (err error) {
 	defer func() {
 		if err != nil {
 			go utils.SendAlarmMsg("更新用户标签失败;Err:"+err.Error(), 2)
-			go utils.SendEmail("更新用户标签失败"+"【"+utils.APPNAME+"】"+time.Now().Format(utils.FormatDateTime), ";Err:"+err.Error(), utils.EmailSendToUsers)
-			utils.FileLog.Info("更新用户标签失败,Err:%s", err.Error())
 		}
 	}()
 	//获取需要处理的权益客户
@@ -24,7 +22,6 @@ func UpdateWxUserLabel(cont context.Context) (err error) {
 		fmt.Println("GetUserRegisterList Err", err)
 		return err
 	}
-
 	mapChartCollect := make(map[string]int)
 	//获取已经处理记录的用户并记录切片
 	listChartCollectL, err := models.GetCygxChartCollectList()

+ 1 - 0
utils/constants.go

@@ -108,6 +108,7 @@ const (
 	CYGX_TACTICS_TIME_LINE_STATUS    string = "cygx_tactics_time_line_status" // 策略时间线是否对外开放
 	TIME_LINE_ID                     int    = 99999                           // 策略时间线的值
 	TIME_LINE_NAME                   string = "时间线"                           // 策略时间线的名称
+	ACTEGORY_ID_AI_QY                int    = 61                              // AI前沿自定义ID
 )
 
 const (