Browse Source

定时任务修改专项调研,用户与公司的参与数量

xingzai 2 years ago
parent
commit
0da22db6e5

+ 99 - 85
controllers/activity.go

@@ -360,6 +360,16 @@ func (this *ActivityCoAntroller) ActivityList() {
 		keyWordItem.PageType = "ActivitSearch"
 		keyWordItem.CreateTime = time.Now()
 		go models.AddUserSearchKeyWord(keyWordItem)
+
+		cacheKey := fmt.Sprint("Search_uid:", user.UserId, "_KeyWord:", keyWordSearch, "_Source:", 6)
+		isExist := utils.Rc.IsExist(cacheKey)
+		if !isExist {
+			setNX := utils.Rc.SetNX(cacheKey, keyWordSearch, time.Minute*1)
+			if !setNX {
+				go utils.SendAlarmMsg("记录用户搜索活动关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
+			}
+			go services.AddUserSearchLog(user, keyWordSearch, 6)
+		}
 	}
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(models.GetCygxActivityListRep)
@@ -3434,53 +3444,55 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 
 	//userType = 1
 	//查询专项产业调研展示权限
-	var condition string
-	condition = ` AND art.publish_status = 1  AND art.label != '' `
-	if isPower == 1 {
-		condition += permissionSqlStr
-	}
-	//行业名称
-	if len(chartPermissionIds) > 0 {
-		condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
-	}
-	var conditionOr string
+	if whichDay == "" {
+		var condition string
+		condition = ` AND art.publish_status = 1  AND art.label != '' `
+		if isPower == 1 {
+			condition += permissionSqlStr
+		}
+		//行业名称
+		if len(chartPermissionIds) > 0 {
+			condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
+		}
+		var conditionOr string
 
-	if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (1=1 AND   art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
-	}
-	if (userType == 5) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
-	}
-	if userType == 1 {
-		conditionOr += ` OR (1=1 ` + condition + permissionSqlStr + `) `
-	}
+		if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
+			conditionOr += ` OR (1=1 AND   art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
+		}
+		if (userType == 5) && strings.Contains(permissionStr, "专家") {
+			conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
+		}
+		if userType == 1 {
+			conditionOr += ` OR (1=1 ` + condition + permissionSqlStr + `) `
+		}
 
-	if companyProduct != nil {
-		if companyProduct.Scale != "" {
-			conditionOr += ` OR (  art.scale LIKE '%` + companyProduct.Scale + `%'	 ` + condition + `) `
+		if companyProduct != nil {
+			if companyProduct.Scale != "" {
+				conditionOr += ` OR (  art.scale LIKE '%` + companyProduct.Scale + `%'	 ` + condition + `) `
+			}
 		}
-	}
 
-	condition += sqlExport + conditionOr
-	specialList, err := models.GetActivityLabelSpecialListAll(condition, pars, startSize, 8)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	for k2, v2 := range specialList {
-		specialList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName)
-		specialList[k2].ImgUrlBg = "https://hzstatic.hzinsights.com/static/temp/20220426202204/20220426/XDLLsjC9XAAy8LIzQr7GsjrBbtX6.png"
-	}
+		condition += sqlExport + conditionOr
+		specialList, err := models.GetActivityLabelSpecialListAll(condition, pars, startSize, 8)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		for k2, v2 := range specialList {
+			specialList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName)
+			specialList[k2].ImgUrlBg = "https://hzstatic.hzinsights.com/static/temp/20220426202204/20220426/XDLLsjC9XAAy8LIzQr7GsjrBbtX6.png"
+		}
 
-	itemList := new(models.ActivityTypeHome)
-	itemList.ActivityTypeName = "专项产业调研"
-	itemList.Resource = 2
-	itemList.List = specialList
-	itemList.ActivityTypeId = 7
-	itemList.ImgUrl = "https://hzstatic.hzinsights.com/static/temp/20220427202204/20220427/b2Bj3fGakP16iJRFKisQohCWnCNl.png"
-	itemList.ImgUrlBg = "https://hzstatic.hzinsights.com/static/temp/20220427202204/20220427/OkunjfKEgo5KRLifzwwLX8cDZnnN.png"
-	list = append(list, itemList)
+		itemList := new(models.ActivityTypeHome)
+		itemList.ActivityTypeName = "专项产业调研"
+		itemList.Resource = 2
+		itemList.List = specialList
+		itemList.ActivityTypeId = 7
+		itemList.ImgUrl = "https://hzstatic.hzinsights.com/static/temp/20220427202204/20220427/b2Bj3fGakP16iJRFKisQohCWnCNl.png"
+		itemList.ImgUrlBg = "https://hzstatic.hzinsights.com/static/temp/20220427202204/20220427/OkunjfKEgo5KRLifzwwLX8cDZnnN.png"
+		list = append(list, itemList)
+	}
 	//获取对应活动的数量并排序
 	intArr := make([]int, 0)
 	var items []*models.ActivityTypeHome
@@ -4486,54 +4498,56 @@ func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 		list[k].Resource = 1
 	}
 
-	//查询专项产业调研展示权限
-	var condition string
-	condition = ` AND art.publish_status = 1  AND art.label != '' `
-	if isPower == 1 {
-		condition += permissionSqlStr
-	}
-	//行业名称
-	if len(chartPermissionIds) > 0 {
-		condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
-	}
-	var conditionOr string
+	if whichDay == "" {
+		//查询专项产业调研展示权限
+		var condition string
+		condition = ` AND art.publish_status = 1  AND art.label != '' `
+		if isPower == 1 {
+			condition += permissionSqlStr
+		}
+		//行业名称
+		if len(chartPermissionIds) > 0 {
+			condition += ` AND art.chart_permission_id  IN (` + chartPermissionIds + `)`
+		}
+		var conditionOr string
 
-	if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (1=1 AND   art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
-	}
-	if (userType == 5) && strings.Contains(permissionStr, "专家") {
-		conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
-	}
-	if userType == 1 {
-		conditionOr += ` OR (1=1 ` + condition + permissionSqlStr + `) `
-	}
+		if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
+			conditionOr += ` OR (1=1 AND   art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
+		}
+		if (userType == 5) && strings.Contains(permissionStr, "专家") {
+			conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%'	 ` + condition + `) `
+		}
+		if userType == 1 {
+			conditionOr += ` OR (1=1 ` + condition + permissionSqlStr + `) `
+		}
 
-	if companyProduct != nil {
-		if companyProduct.Scale != "" {
-			conditionOr += ` OR (  art.scale LIKE '%` + companyProduct.Scale + `%'	 ` + condition + `) `
+		if companyProduct != nil {
+			if companyProduct.Scale != "" {
+				conditionOr += ` OR (  art.scale LIKE '%` + companyProduct.Scale + `%'	 ` + condition + `) `
+			}
 		}
-	}
 
-	condition += sqlExport + conditionOr
-	specialList, err := models.GetActivityLabelSpecialListAll(condition, pars, startSize, 8)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	for k2, v2 := range specialList {
-		specialList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName)
-		specialList[k2].Resource = 2
-	}
+		condition += sqlExport + conditionOr
+		specialList, err := models.GetActivityLabelSpecialListAll(condition, pars, startSize, 8)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		for k2, v2 := range specialList {
+			specialList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName)
+			specialList[k2].Resource = 2
+		}
 
-	itemList := new(models.ActivityTypeHomePc)
-	itemList.ActivityTypeName = "专项产业调研"
-	itemList.Resource = 2
-	itemList.List = specialList
-	itemList.ActivityTypeId = 7
-	itemList.OnlineIco = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/0H4md6VgZMuIttggMUnJxgrlayxC.png"
-	itemList.ImgUrlBgPc = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/rFwAM1c4fIMJM0EGoUkUYl25XH9L.png"
-	list = append(list, itemList)
+		itemList := new(models.ActivityTypeHomePc)
+		itemList.ActivityTypeName = "专项产业调研"
+		itemList.Resource = 2
+		itemList.List = specialList
+		itemList.ActivityTypeId = 7
+		itemList.OnlineIco = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/0H4md6VgZMuIttggMUnJxgrlayxC.png"
+		itemList.ImgUrlBgPc = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/rFwAM1c4fIMJM0EGoUkUYl25XH9L.png"
+		list = append(list, itemList)
+	}
 	//记录用户搜索的筛选条件
 	item := new(models.CygxActivitySearchHistory)
 	item.UserId = user.UserId

+ 8 - 2
controllers/home.go

@@ -87,11 +87,17 @@ func (this *HomeController) ListHome() {
 			return
 		}
 		page = paging.GetPaging(currentIndex, pageSize, total)
+		//if categoryId != "" {
+		//	condition += ` AND category_id IN(` + categoryId + `)`
+		//	condition += ` OR ( category_name LIKE '%研选%' AND publish_status = 1 AND is_summary = 1 )`
+		//} else {
+		//	condition += ` AND  category_name  LIKE '%研选%' `
+		//}
 		if categoryId != "" {
 			condition += ` AND category_id IN(` + categoryId + `)`
-			condition += ` OR ( category_name LIKE '%研选%' AND publish_status = 1 AND is_summary = 1 )`
+			//condition += ` OR ( category_name  LIKE '%` + utils.CHART_PERMISSION_NAME_YANXUAN + `%' AND publish_status = 1 AND is_summary = 1 )`
 		} else {
-			condition += ` AND  category_name  LIKE '%研选%' `
+			condition += ` AND  category_name   LIKE '%` + utils.CHART_PERMISSION_NAME_YANXUAN + `%'`
 		}
 	}
 	//永续客户无法查看研选分类的内容

+ 27 - 32
controllers/report.go

@@ -589,28 +589,16 @@ func (this *ReportController) Fllow() {
 		}
 		resp.Status = 1
 	} else {
-		var doType int
-		condition = ` AND type = 1`
-		count, err = models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
-		if err != nil {
-			br.Msg = "操作失败!"
-			br.ErrMsg = "获取数据失败,Err:" + err.Error()
-			return
-		}
-		if count == 1 {
-			resp.Status = 2
-			doType = 2
-		} else {
-			resp.Status = 1
-			doType = 1
-		}
-		err = models.RemoveCygxIndustryFllow(uid, industrialManagementId, doType)
+		err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
 		if err != nil {
 			br.Msg = "操作失败"
 			br.ErrMsg = "取消关注失败,Err:" + err.Error()
 			return
 		}
 	}
+
+	//处理是否关注全部赛道字段
+	go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
 	br.Msg = "操作成功"
 	br.Ret = 200
 	br.Success = true
@@ -2292,6 +2280,7 @@ func (this *ReportController) SearchReport() {
 		keyWordItem.PageType = "ReortSearch"
 		keyWordItem.CreateTime = time.Now()
 		go models.AddUserSearchKeyWord(keyWordItem)
+		go services.AddUserSearchLog(user, keyWord, 5)
 	}
 	if len(listYx) == 0 {
 		listYx = make([]*models.ArticleCollectionResp, 0)
@@ -2368,40 +2357,43 @@ func (this *ReportController) SearchResource() {
 		br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
 		return
 	}
+	industrialIdArr := make([]int, 0)
 	for k, v := range listHz {
 		listHz[k].Source = 1
-		for _, v2 := range listSubjcet {
-			if v2.IndustrialManagementId == v.IndustrialManagementId {
-				listHz[k].IndustrialSubjectList = append(listHz[k].IndustrialSubjectList, v2)
-			}
-		}
 		if fllowMap[v.IndustrialManagementId] > 0 {
 			listHz[k].IsFollw = true
 		}
+		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
 	}
-	var IndustrialManagementIdStr string
+
 	for k, v := range listYx {
 		listYx[k].Source = 2
-		IndustrialManagementIdStr += "," + strconv.Itoa(v.IndustrialManagementId)
 		if fllowMap[v.IndustrialManagementId] > 0 {
 			listYx[k].IsFollw = true
 		}
+		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
 	}
-	IndustrialManagementIdStr = strings.TrimLeft(IndustrialManagementIdStr, ",")
-	if IndustrialManagementIdStr != "" {
+
+	if len(industrialIdArr) > 0 {
 		//合并产业关联的标的
-		condition = ` 	AND mg.article_id IN (SELECT mg.article_id FROM cygx_industrial_article_group_management  as mg 
-	INNER JOIN cygx_article as a ON  a.article_id = mg.article_id AND article_type != 'lyjh' WHERE mg.industrial_management_id IN (` + IndustrialManagementIdStr + `) AND mg.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` )`
-		listSubjcet, err = models.GetThemeHeatSubjectList(condition)
+		listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
 			return
 		}
-		for k, v := range listYx {
-			for _, v2 := range listSubjcet {
-				if v2.IndustrialManagementId == v.IndustrialManagementId {
-					listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+		mapIndustrial := make(map[string]int)
+		for _, v := range listSubjcet {
+			for k2, v2 := range listYx {
+				if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
+					listYx[k2].IndustrialSubjectList = append(listYx[k2].IndustrialSubjectList, v)
+					mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
+				}
+			}
+			for k2, v2 := range listHz {
+				if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
+					listHz[k2].IndustrialSubjectList = append(listHz[k2].IndustrialSubjectList, v)
+					mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] = v2.IndustrialManagementId
 				}
 			}
 		}
@@ -2414,7 +2406,10 @@ func (this *ReportController) SearchResource() {
 		keyWordItem.PageType = "ReortSearch"
 		keyWordItem.CreateTime = time.Now()
 		go models.AddUserSearchKeyWord(keyWordItem)
+
+		go services.AddUserSearchLog(user, keyWord, 4)
 	}
+
 	resp := new(models.SearchResourceResp)
 	if len(listYx) == 0 {
 		listYx = make([]*models.IndustrialManagementHotResp, 0)

+ 25 - 79
controllers/search.go

@@ -6,7 +6,6 @@ import (
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"strings"
-	"time"
 )
 
 type SearchController struct {
@@ -107,26 +106,9 @@ func (this *SearchController) SearchList() {
 	if len(result) == 0 {
 		result = make([]*models.SearchItem, 0)
 	}
-	detail, errKey := models.GetNewSearchKeyWordByThisUser(user.UserId, keyWord)
-	if errKey != nil && errKey.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + errKey.Error()
-		return
-	}
-	//同一个用户一分钟之内搜索的词不重复记录
-	if detail == nil || time.Now().After(detail.CreateTime.Add(+time.Minute*1)) {
-		//fmt.Println("一分钟之内没有搜索")
-		keyWordItem := new(models.CygxSearchKeyWord)
-		keyWordItem.UserId = user.UserId
-		keyWordItem.KeyWord = keyWord
-		keyWordItem.CreateTime = time.Now()
-		keyWordItem.Mobile = user.Mobile
-		keyWordItem.Email = user.Email
-		keyWordItem.CompanyId = user.CompanyId
-		keyWordItem.CompanyName = user.CompanyName
-		keyWordItem.RealName = user.RealName
-		go models.AddSearchKeyWord(keyWordItem)
-	}
+	//记录用户搜索关键词
+	go services.AddSearchKeyWord(user, keyWord, 1)
+
 	for k, v := range result {
 		//如果是研选系列的任意取五张图片的中的一张
 		if v.CategoryId == "0" {
@@ -202,26 +184,8 @@ func (this *SearchController) SearchReport() {
 	if len(result) == 0 {
 		result = make([]*models.SearchItem, 0)
 	}
-	detail, errKey := models.GetNewSearchKeyWordByThisUser(user.UserId, keyWord)
-	if errKey != nil && errKey.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + errKey.Error()
-		return
-	}
-	//同一个用户一分钟之内搜索的词不重复记录
-	if detail == nil || time.Now().After(detail.CreateTime.Add(+time.Minute*1)) {
-		//fmt.Println("一分钟之内没有搜索")
-		keyWordItem := new(models.CygxSearchKeyWord)
-		keyWordItem.UserId = user.UserId
-		keyWordItem.KeyWord = keyWord
-		keyWordItem.CreateTime = time.Now()
-		keyWordItem.Mobile = user.Mobile
-		keyWordItem.Email = user.Email
-		keyWordItem.CompanyId = user.CompanyId
-		keyWordItem.CompanyName = user.CompanyName
-		keyWordItem.RealName = user.RealName
-		go models.AddSearchKeyWord(keyWordItem)
-	}
+	//记录用户搜索关键词
+	go services.AddSearchKeyWord(user, keyWord, 1)
 	resp := new(models.SearchResp)
 	page := paging.GetPaging(currentIndex, pageSize, int(total))
 	resp.Paging = page
@@ -312,24 +276,14 @@ func (this *BaseSearchController) SearchListPublic() {
 			return
 		}
 		user := wxUser
-		detail, errKey := models.GetNewSearchKeyWordByThisUser(user.UserId, keyWord)
-		if errKey != nil && errKey.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取信息失败,Err:" + errKey.Error()
-			return
-		}
-		//同一个用户一分钟之内搜索的词不重复记录
-		if detail == nil || time.Now().After(detail.CreateTime.Add(+time.Minute*1)) {
-			keyWordItem := new(models.CygxSearchKeyWord)
-			keyWordItem.UserId = user.UserId
-			keyWordItem.KeyWord = keyWord
-			keyWordItem.CreateTime = time.Now()
-			keyWordItem.Mobile = user.Mobile
-			keyWordItem.Email = user.Email
-			keyWordItem.CompanyId = user.CompanyId
-			keyWordItem.RealName = user.RealName
-			go models.AddSearchKeyWord(keyWordItem)
-		}
+		userItem := new(models.WxUserItem)
+		userItem.UserId = user.UserId
+		userItem.Mobile = user.Mobile
+		userItem.Email = user.Email
+		userItem.CompanyId = user.CompanyId
+		userItem.RealName = user.RealName
+		//记录用户搜索关键词
+		go services.AddSearchKeyWord(userItem, keyWord, 1)
 	}
 
 	for k, _ := range result {
@@ -353,7 +307,7 @@ func (this *BaseSearchController) SearchListPublic() {
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Param   KeyWord   query   string  true       "搜索关键词"
 // @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
-// @Param   ListType   query   int  true       "列表类型,1最新,2 纪要 ,3图表 默认1"
+// @Param   ListType   query   int  true       "列表类型,1最新/全部,2 纪要 ,3图表 默认1"
 // @Success 200 {object} models.SearchItem
 // @router /artAndChart/list [get]
 func (this *SearchController) ListHomeArtAndChart() {
@@ -498,26 +452,18 @@ func (this *SearchController) ListHomeArtAndChart() {
 			result[k].Source = 1
 		}
 	}
-	detail, errKey := models.GetNewSearchKeyWordByThisUser(user.UserId, keyWord)
-	if errKey != nil && errKey.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + errKey.Error()
-		return
-	}
-	//同一个用户一分钟之内搜索的词不重复记录
-	if detail == nil || time.Now().After(detail.CreateTime.Add(+time.Minute*1)) {
-		//fmt.Println("一分钟之内没有搜索")
-		keyWordItem := new(models.CygxSearchKeyWord)
-		keyWordItem.UserId = user.UserId
-		keyWordItem.KeyWord = keyWord
-		keyWordItem.CreateTime = time.Now()
-		keyWordItem.Mobile = user.Mobile
-		keyWordItem.Email = user.Email
-		keyWordItem.CompanyId = user.CompanyId
-		keyWordItem.CompanyName = user.CompanyName
-		keyWordItem.RealName = user.RealName
-		go models.AddSearchKeyWord(keyWordItem)
+	// ListType   query   int  true       "列表类型,1最新/全部,2 纪要 ,3图表 默认1"
+	//记录用户搜索关键词
+	var source int
+	if listType == 1 {
+		source = 3
+	} else if listType == 2 {
+		source = 1
+	} else {
+		source = 2
 	}
+	go services.AddSearchKeyWord(user, keyWord, source)
+
 	if chartTotal > int(total) {
 		total = int64(chartTotal)
 	}

+ 1 - 0
models/db.go

@@ -111,6 +111,7 @@ func init() {
 		new(CygxCompanyInteractionNum),
 		new(CygxChartAll),
 		new(CygxSessionMobile),
+		new(CygxSearchKeyWordLog),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 29 - 5
models/industrial_management.go

@@ -10,11 +10,12 @@ import (
 )
 
 type IndustrialManagementRep struct {
-	IndustryName      string `description:"产业名称"`
-	ChartPermissionId int    `description:"权限id"`
-	RecommendedIndex  int    `description:"推荐指数"`
-	LayoutTime        string `description:"布局时间"`
-	ArticleReadNum    int    `description:"文章阅读数量"`
+	IndustryName           string `description:"产业名称"`
+	IndustrialManagementId int    `description:"产业id"`
+	ChartPermissionId      int    `description:"权限id"`
+	RecommendedIndex       int    `description:"推荐指数"`
+	LayoutTime             string `description:"布局时间"`
+	ArticleReadNum         int    `description:"文章阅读数量"`
 }
 
 type IndustrialManagementCount struct {
@@ -133,6 +134,14 @@ func GetIndustrialSubjectAll(IndustrialManagementId int) (items []*IndustrialSub
 	return
 }
 
+//标的列表
+func GetIndustrialSubjectAllByIndustrialId(industrialIdArr []int) (items []*IndustrialSubject, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_industrial_subject WHERE industrial_management_id IN  (` + utils.GetOrmInReplace(len(industrialIdArr)) + `)   `
+	_, err = o.Raw(sql, industrialIdArr).QueryRows(&items)
+	return
+}
+
 //分析师列表
 func GetIndustrialAnalystAll(IndustrialManagementId int) (items []*IndustrialAnalyst, err error) {
 	o := orm.NewOrm()
@@ -522,6 +531,7 @@ func GetIndustrialManagemenDetailByAaticleID(articleId int) (items []*Industrial
 	o := orm.NewOrm()
 	sql := `SELECT
 			article_id,
+			m.industrial_management_id,
 			industry_name 
 		FROM
 			cygx_industrial_article_group_management AS mg
@@ -531,3 +541,17 @@ func GetIndustrialManagemenDetailByAaticleID(articleId int) (items []*Industrial
 	_, err = o.Raw(sql, articleId).QueryRows(&items)
 	return
 }
+
+//获取所有的产业
+func GetindustrialManagement() (items []*IndustrialManagementRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			i.* 
+		FROM
+			cygx_industrial_management AS i
+			INNER JOIN cygx_industrial_article_group_management AS m ON m.industrial_management_id = i.industrial_management_id 
+		GROUP BY
+			i.industrial_management_id `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 37 - 1
models/industry_fllow.go

@@ -17,6 +17,7 @@ type CygxIndustryFllow struct {
 	CreateTime             time.Time `description:"创建时间"`
 	ModifyTime             time.Time `description:"更新时间"`
 	RealName               string    `description:"用户实际名称"`
+	Source                 int       `description:"来源1查研观向,2查研观向小助手,3勾选全部赛道的用户进行自动关注"`
 }
 
 type CygxIndustryFllowRep struct {
@@ -30,12 +31,22 @@ func AddCygxIndustryFllow(item *CygxIndustryFllow) (lastId int64, err error) {
 	return
 }
 
+//批量添加
+func AddCygxIndustryFllowMulti(items []*CygxIndustryFllow) (err error) {
+	o := orm.NewOrm()
+	if len(items) > 0 {
+		//批量添加新的关注记录
+		_, err = o.InsertMulti(len(items), items)
+	}
+	return
+}
+
 type CygxIndustryFllowResp struct {
 	Status   int  `description:"1:关注,2:取消关注"`
 	GoFollow bool `description:"是否去关注"`
 }
 
-func RemoveCygxIndustryFllow(userId, industrialManagementId, doType int) (err error) {
+func RemoveCygxIndustryFllow(userId, industrialManagementId int) (err error) {
 	o := orm.NewOrm()
 	sql := `DELETE FROM cygx_industry_fllow WHERE user_id=? AND industrial_management_id=? `
 	_, err = o.Raw(sql, userId, industrialManagementId).Exec()
@@ -121,3 +132,28 @@ func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+//GetUserFllowIndustrialListByUserIdAndIndustrial 通过用户ID 跟产业ID获取用户关注的产业列表
+func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string) (items []*CygxIndustryFllow, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_industry_fllow 
+			WHERE 1 = 1 
+		AND user_id IN ( ` + userIds + ` ) 
+		AND industrial_management_id IN ( ` + industrials + `) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+//获取某个用户关注某个行业下的产业数量
+func GetCountCygxIndustryFllowByUidAndChartPermissionId(userId, ChartPermissionId int) (count int, err error) {
+	sql := `SELECT
+			COUNT( 1 ) AS count 
+		FROM
+			cygx_industry_fllow AS f
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = f.industrial_management_id 
+		WHERE
+			user_id = ? 
+			AND m.chart_permission_id = ? `
+	err = orm.NewOrm().Raw(sql, userId, ChartPermissionId).QueryRow(&count)
+	return
+}

+ 1 - 1
models/search_key_word.go

@@ -47,7 +47,7 @@ func GetCygxSearchKeyWordList(condition string) (items []*CygxSearchKeyWord, err
 	return
 }
 
-//修改用户收藏文章的相关信息
+//修改用户搜索的相关信息
 func UpdateCygxSearchKeyWord(wxUser *WxUserItem) (err error) {
 	o := orm.NewOrm()
 	var sql string

+ 40 - 0
models/search_key_word_log.go

@@ -0,0 +1,40 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxSearchKeyWordLog struct {
+	Id          int       `orm:"column(id);" description:"id"`
+	KeyWord     string    `description:"搜索关键词"`
+	UserId      int       `description:"用户ID"`
+	CreateTime  time.Time `description:"搜索时间"`
+	Mobile      string    `description:"手机号"`
+	Email       string    `description:"邮箱"`
+	CompanyId   int       `description:"公司id"`
+	CompanyName string    `description:"公司名称"`
+	RealName    string    `description:"用户实际名称"`
+	Source      int       `description:"来源;1:纪要、2:图表、3:纪要/图表、4:产业资源包、5:报告、6:活动"`
+}
+
+//新增搜索
+func AddSearchKeyWordLog(item *CygxSearchKeyWordLog) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+//修改用户搜索的相关信息
+func UpdateCygxSearchKeyWordLog(wxUser *WxUserItem) (err error) {
+	o := orm.NewOrm()
+	var sql string
+	if wxUser.Mobile != "" {
+		sql = `UPDATE cygx_search_key_word SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
+		_, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
+	} else if wxUser.Email != "" {
+		sql = `UPDATE cygx_search_key_word SET mobile=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE email=? `
+		_, err = o.Raw(sql, wxUser.Mobile, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Email).Exec()
+	}
+	return
+}

+ 10 - 0
models/wx_user.go

@@ -546,6 +546,16 @@ func GetCygxCompanyUserUserInteraction(userIds string) (items []*CygxUserInterac
 	return
 }
 
+// GetWxUserListByUserIds 根据用户ID集合获取用户
+func GetWxUserListByUserIds(userIds string) (list []*WxUserItem, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT u.*, c.company_name FROM wx_user AS u
+			INNER JOIN company AS c ON c.company_id = u.company_id 
+			WHERE user_id IN (` + userIds + `) `
+	_, err = o.Raw(sql).QueryRows(&list)
+	return
+}
+
 // GetWxUserByMobiles 根据用户手机号获取用户详情
 func GetWxUserByMobiles(mobiles []string) (items []*WxUser, err error) {
 	lenmobiles := len(mobiles)

+ 1 - 25
models/wx_user_code.go

@@ -106,30 +106,6 @@ func GetCygxUserFllowCeLueOpenid(categoryId int) (items []*OpenIdList, err error
 	return
 }
 
-type CygxXzsChooseSend struct {
-	Id           int       `orm:"column(id);pk"`
-	UserId       int       `description:"用户ID"`
-	Mobile       string    `description:"手机号"`
-	Email        string    `description:"邮箱"`
-	CompanyId    int       `description:"公司id"`
-	CompanyName  string    `description:"公司名称"`
-	RealName     string    `description:"用户实际名称"`
-	IsRefuse     int       `description:"是否拒绝推送,0否、1是  如果为1 则不做任何推送"`
-	IsSubjective int       `description:"是否选择主观推送, 1 是 、 0否"`
-	IsObjective  int       `description:"是否选择客观推送, 1 是 、 0否"`
-	CreateTime   time.Time `description:"创建时间"`
-	ModifyTime   time.Time `description:"更新时间"`
-}
-
-//获取提交过推送规则用户的userId
-func GetCygxXzsChooseSend() (items []*CygxXzsChooseSend, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_xzs_choose_send `
-	_, err = o.Raw(sql).QueryRows(&items)
-	return
-}
-
-
 //获取提交过推送规则用户的userId
 func GetCygxXzsChooseSendOpenIdByUserIds(idStr string) (items []*OpenIdList, err error) {
 	o := orm.NewOrm()
@@ -138,4 +114,4 @@ INNER JOIN cygx_user_record AS cr
 WHERE ur.user_id IN (` + idStr + `) AND create_platform=4 AND ur.union_id=cr.union_id `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 51 - 0
models/xzs_choose_send.go

@@ -0,0 +1,51 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxXzsChooseSend struct {
+	Id           int       `orm:"column(id);pk"`
+	UserId       int       `description:"用户ID"`
+	Mobile       string    `description:"手机号"`
+	Email        string    `description:"邮箱"`
+	CompanyId    int       `description:"公司id"`
+	CompanyName  string    `description:"公司名称"`
+	RealName     string    `description:"用户实际名称"`
+	IsRefuse     int       `description:"是否拒绝推送,0否、1是  如果为1 则不做任何推送"`
+	IsSubjective int       `description:"是否选择主观推送, 1 是 、 0否"`
+	IsObjective  int       `description:"是否选择客观推送, 1 是 、 0否"`
+	CreateTime   time.Time `description:"创建时间"`
+	ModifyTime   time.Time `description:"更新时间"`
+	AllInYiYao   int       `description:"是否选择医药全部赛道"`
+	AllInXiaoFei int       `description:"是否选择消费全部赛道"`
+	AllInKeJi    int       `description:"是否选择科技全部赛道"`
+	AllInZhiZao  int       `description:"是否选择智造全部赛道"`
+	AllInCeLue   int       `description:"是否选择策略全部赛道"`
+	AllInYanXuan int       `description:"是否选择研选全部赛道"`
+}
+
+//获取提交过推送规则用户的userId
+func GetCygxXzsChooseSend() (items []*CygxXzsChooseSend, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_xzs_choose_send `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+//获取某个行业勾选全部赛道的用户
+func GetCygxXzsChooseSendByAllIn(allIn string) (items []*CygxXzsChooseSend, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_xzs_choose_send  WHERE ` + allIn + ` = 1	`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+//修改某个用户的行业是否勾选全部赛道
+func UpdateCygxXzsChooseSendIsAllIn(allIn string, isAllIn, userId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_xzs_choose_send SET ` + allIn + ` = ? WHERE user_id = ?`
+	_, err = o.Raw(sql, isAllIn, userId).Exec()
+	return
+}

+ 84 - 17
services/article.go

@@ -1198,6 +1198,86 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 		}
 		chartPermissionId = chartPermissionDetail.ChartPermissionId
 	}
+
+	//文章关联的产业
+	var industryName string
+	var industrialManagementId string
+	if chartPermissionId == utils.CE_LUE_ID {
+		industryName = reportMapDetail.SubCategoryName
+	} else {
+		detailIndustryNameList, err := models.GetIndustrialManagemenDetailByAaticleID(articleId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			return err
+		}
+		//如果不存在关联的产业则不推送
+		if len(detailIndustryNameList) == 0 {
+			return err
+		}
+		for _, v := range detailIndustryNameList {
+			industryName += v.IndustryName + ","
+			industrialManagementId += strconv.Itoa(v.IndustrialManagementId) + ","
+		}
+		industryName = strings.TrimRight(industryName, ",")
+		industrialManagementId = strings.TrimRight(industrialManagementId, ",")
+
+		//处理勾选了全部行业赛道的用户
+		var allIn string
+		allIn = DoXzsChooseSend(reportMapDetail.ChartPermissionName)
+		if allIn != "" {
+			allInList, err := models.GetCygxXzsChooseSendByAllIn(allIn)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				return err
+			}
+			if len(allInList) > 0 {
+				var allInUserId string
+				for _, v := range allInList {
+					allInUserId += strconv.Itoa(v.UserId) + ","
+				}
+				allInUserId = strings.TrimRight(allInUserId, ",")
+
+				userFllowIndustrialList, err := models.GetUserFllowIndustrialListByUserIdAndIndustrial(allInUserId, industrialManagementId)
+				if err != nil && err.Error() != utils.ErrNoRow() {
+					return err
+				}
+				mapUserFllowed := make(map[string]int)
+				for _, v := range userFllowIndustrialList {
+					//用户ID与其关注的产业组成唯一索引,判断是否存在,如果不存在就进行自动关注
+					mapUserFllowed[fmt.Sprint("uid:", v.UserId, "_Industrial:", v.IndustrialManagementId)] = v.UserId
+				}
+				//获取这些allIN用户的的信息进行遍历生成需要插入的数据
+				userList, err := models.GetWxUserListByUserIds(allInUserId)
+				if err != nil && err.Error() != utils.ErrNoRow() {
+					return err
+				}
+				var industryFllowItems []*models.CygxIndustryFllow
+				for _, v := range detailIndustryNameList {
+					for _, vUser := range userList {
+						//如果用户这个用户没有关注这个产业就进行自动关注
+						if mapUserFllowed[fmt.Sprint("uid:", vUser.UserId, "_Industrial:", v.IndustrialManagementId)] == 0 {
+							item := new(models.CygxIndustryFllow)
+							item.IndustrialManagementId = v.IndustrialManagementId
+							item.UserId = vUser.UserId
+							item.Email = vUser.Email
+							item.Mobile = vUser.Mobile
+							item.RealName = vUser.RealName
+							item.CompanyId = vUser.CompanyId
+							item.CompanyName = vUser.CompanyName
+							item.Source = 3
+							item.Type = 1
+							item.CreateTime = time.Now()
+							item.ModifyTime = time.Now()
+							industryFllowItems = append(industryFllowItems, item)
+						}
+					}
+				}
+				err = models.AddCygxIndustryFllowMulti(industryFllowItems)
+				if err != nil {
+					go utils.SendAlarmMsg("用户关注全部赛道,出现新赛道批量添加失败 ,AddCygxIndustryFllowMulti ErrMsg:"+err.Error(), 2)
+				}
+			}
+		}
+	}
+
 	// 获取所有有权的用户的 openid
 	mapOpenidPower := make(map[int]string)
 	permissionIdList := make([]string, 0)
@@ -1261,22 +1341,9 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 	}
 	//已经推送了的openid
 	mapOpenidPushed := make(map[int]string)
-	//文章关联的产业
-	var industryName string
-	if chartPermissionId != utils.CE_LUE_ID {
-		detailIndustryNameList, err := models.GetIndustrialManagemenDetailByAaticleID(articleId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			return err
-		}
-		for _, v := range detailIndustryNameList {
-			industryName += v.IndustryName + ","
-		}
-		industryName = strings.TrimRight(industryName, ",")
-	} else {
-		industryName = reportMapDetail.SubCategoryName
-	}
+
 	keyword2 := articleInfo.Title
-	keyword3 := articleInfo.PublishDate
+	keyword3 := time.Now().Format(utils.FormatDateTime)
 	keyword4 := articleInfo.Abstract
 	mapAlreadySend := make(map[int]int)
 	//如果是策略就按照策略的推送方式来写
@@ -1322,7 +1389,7 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 							return err
 						}
 						for _, item := range openIdLists {
-							first := "您预约的调研,有关联的纪要发布/更新了1"
+							first := "您预约的调研,有关联的纪要发布/更新了"
 							keyword1 := industryName
 							openIditem := new(models.OpenIdList)
 							openIditem.OpenId = item.OpenId
@@ -1414,7 +1481,7 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 							return err
 						}
 						for _, item := range openIdLists {
-							first := "您预约的调研,有关联的纪要发布/更新了1"
+							first := "您预约的调研,有关联的纪要发布/更新了"
 							keyword1 := industryName
 							openIditem := new(models.OpenIdList)
 							openIditem.OpenId = item.OpenId

+ 68 - 0
services/industrial_management.go

@@ -146,3 +146,71 @@ func ArticleCollectCountUpdate() (err error) {
 	}
 	return err
 }
+
+//根据行业处理所选的全部赛道字段
+func DoXzsChooseSend(chartPermissionName string) string {
+	var allIn string
+	if chartPermissionName == utils.YI_YAO_NAME {
+		allIn = "all_in_yi_yao"
+	} else if chartPermissionName == utils.XIAO_FEI_NAME {
+		allIn = "all_in_xiao_fei"
+	} else if chartPermissionName == utils.KE_JI_NAME {
+		allIn = "all_in_ke_ji"
+	} else if chartPermissionName == utils.ZHI_ZAO_NAME {
+		allIn = "all_in_zhi_zao"
+	} else if chartPermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN {
+		allIn = "all_in_yan_xuan"
+	}
+	return allIn
+}
+
+//行业关注或者取消关注的时候,对于用户全部赛道的影响
+func IndustryFllowWithTrack(industrialManagementId, count, uid int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("修改行业关注或者取消关注的时候,对于用户全部赛道的影响信息失败"+err.Error(), 2)
+			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "修改行业关注或者取消关注的时候,对于用户全部赛道的影响信息失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+		}
+	}()
+	detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
+	if err != nil {
+		return err
+	}
+	categoryinfo, err := models.GetChartPermissionById(detail.ChartPermissionId)
+	if err != nil {
+		return err
+	}
+	var allIn string
+	allIn = DoXzsChooseSend(categoryinfo.PermissionName)
+	if allIn != "" {
+		//如果取消关注就把该赛道设置为非全部赛道
+		if count == 1 {
+			err = models.UpdateCygxXzsChooseSendIsAllIn(allIn, 0, uid)
+			if err != nil {
+				return err
+			}
+		} else {
+			//医药、消费、科技、智造、研选下的产业赛道
+			mapIndustrial := make(map[int][]*models.IndustrialManagementRep)
+			industrialList, err := models.GetindustrialManagement()
+			if err != nil {
+				return err
+			}
+			for _, v := range industrialList {
+				mapIndustrial[v.ChartPermissionId] = append(mapIndustrial[v.ChartPermissionId], v)
+			}
+			fllowNum, err := models.GetCountCygxIndustryFllowByUidAndChartPermissionId(uid, detail.ChartPermissionId)
+			if err != nil {
+				return err
+			}
+			if fllowNum == len(mapIndustrial[detail.ChartPermissionId]) {
+				err = models.UpdateCygxXzsChooseSendIsAllIn(allIn, 1, uid)
+				if err != nil {
+					return err
+				}
+			}
+		}
+	}
+	return err
+}

+ 63 - 0
services/keyword.go

@@ -0,0 +1,63 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"time"
+)
+
+//AddSearchKeyWord 记录用户搜索关键词
+func AddSearchKeyWord(user *models.WxUserItem, keyWord string, source int) (err error) {
+	cacheKey := fmt.Sprint("Search_uid:", user.UserId, "_KeyWord:", keyWord, "_Source:", source)
+	isExist := utils.Rc.IsExist(cacheKey)
+	if isExist {
+		return err
+	}
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(" 记录用户搜索关键词失败"+err.Error(), 2)
+			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "记录用户搜索关键词失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+		}
+	}()
+	keyWordItem := new(models.CygxSearchKeyWord)
+	keyWordItem.UserId = user.UserId
+	keyWordItem.KeyWord = keyWord
+	keyWordItem.CreateTime = time.Now()
+	keyWordItem.Mobile = user.Mobile
+	keyWordItem.Email = user.Email
+	keyWordItem.CompanyId = user.CompanyId
+	keyWordItem.CompanyName = user.CompanyName
+	keyWordItem.RealName = user.RealName
+	_, err = models.AddSearchKeyWord(keyWordItem)
+	go AddUserSearchLog(user, keyWord, source)
+	//一分钟之内的相同搜索词不重复记录
+	setNX := utils.Rc.SetNX(cacheKey, keyWord, time.Minute*1)
+	if !setNX {
+		go utils.SendAlarmMsg("记录用户搜索关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
+	}
+	return
+}
+
+//AddUserSearchLog 记录用户搜索关键词的日志
+func AddUserSearchLog(user *models.WxUserItem, keyWord string, source int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(" 记录用户搜索关键词的日志"+err.Error(), 2)
+			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "修改活动状态至进行中失败 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+		}
+	}()
+	item := new(models.CygxSearchKeyWordLog)
+	item.UserId = user.UserId
+	item.KeyWord = keyWord
+	item.CreateTime = time.Now()
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.RealName = user.RealName
+	item.Source = source
+	_, err = models.AddSearchKeyWordLog(item)
+	return
+}