Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_v6.3

xingzai 2 years ago
parent
commit
ff91599819
5 changed files with 53 additions and 21 deletions
  1. 4 4
      controllers/activity.go
  2. 8 0
      models/config.go
  3. 37 14
      services/activity.go
  4. 2 1
      services/article.go
  5. 2 2
      utils/config.go

+ 4 - 4
controllers/activity.go

@@ -4250,8 +4250,8 @@ func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 	if whichDay == "undefined" {
 		whichDay = ""
 	}
-	if activeState == "undefined" || activeState == "" {
-		activeState = "1"
+	if activeState == "undefined" || activeState == "" || activeState == "1" {
+		activeState = "1,2"
 	}
 	userType, permissionStr, err := services.GetUserType(user.CompanyId)
 	if err != nil {
@@ -4335,7 +4335,7 @@ func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 		if activeState != "" {
 			condition += ` AND art.active_state  IN (` + activeState + `)`
 		} else {
-			condition += ` AND art.active_state  IN (1)`
+			condition += ` AND art.active_state  IN (1,2)`
 		}
 		if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
 			conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%'	 ` + condition + `) `
@@ -4364,7 +4364,7 @@ func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 		}
 		//标签字段关联的产业与标签处理
 		for k2, v2 := range labelList {
-			labelList[k2].KeyWord = services.LabelStr(v2.KeyWord)
+			labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName)
 			labelList[k2].Resource = 1
 		}
 		list[k].List = labelList

+ 8 - 0
models/config.go

@@ -23,6 +23,14 @@ func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
 	return
 }
 
+//更改配置信息
+func UpdateConfigByCode(configValue, countryCode string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_config SET  config_value= ? WHERE config_code=? `
+	_, err = o.Raw(sql, configValue, countryCode).Exec()
+	return
+}
+
 type ConfigResp struct {
 	Item    *CygxConfig
 	List    []*KeyWord `description:"图表搜索推荐"`

+ 37 - 14
services/activity.go

@@ -592,10 +592,14 @@ func LabelStr(label string) (labelNew string) {
 //5.3版本活动标签字符串处理
 func LabelStrV5(label string, isShowSubjectName int) (labelNew string) {
 	slicebr := strings.Split(label, "-")
-	if len(slicebr) < 2 || isShowSubjectName == 0 {
-		labelNew = label
+	if len(slicebr) > 1 {
+		if isShowSubjectName == 1 {
+			labelNew = slicebr[1]
+		} else {
+			labelNew = slicebr[0]
+		}
 	} else {
-		labelNew = slicebr[1]
+		labelNew = label
 	}
 	return labelNew
 }
@@ -608,7 +612,21 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "ActivityAttendanceDetail ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
+
+	configCode := "jin_meng_activity_id"
+	detail, err := models.GetConfigByCode(configCode)
+	if err != nil {
+		return err
+	}
+	fmt.Println(detail.ConfigValue)
+	mapActivityId := make(map[string]string)
+	sliceValue := strings.Split(detail.ConfigValue, ",")
+	for _, v := range sliceValue {
+		mapActivityId[v] = v
+	}
+
 	var activityIds string
+	var activityIdsLongTime string //可回放的会议,到会详情持续更新加入到不做14天限制的活动中
 	fmt.Println("开始同步")
 	dateTime := time.Now().AddDate(0, 0, -14).Format(utils.FormatDate)
 	dateNow := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
@@ -655,7 +673,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 					fmt.Println("GetTacticsList Err:", err.Error())
 					return err
 				}
-
+				var isPlayback bool // 是否包含回放
 				needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
 				var mobileStr string
 				if len(list) > 0 {
@@ -682,6 +700,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 								item.MeetingStatusStr = "直播"
 							} else {
 								item.MeetingStatusStr = "回放"
+								isPlayback = true
 							}
 							item.Position = v.Occupation
 							item.UseridEntity = v.UseridEntity
@@ -691,6 +710,9 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 							needAddAttendanc = append(needAddAttendanc, item)
 						}
 					}
+					if isPlayback && mapActivityId[strconv.Itoa(activityDetail.ActivityId)] == "" {
+						activityIdsLongTime += strconv.Itoa(activityDetail.ActivityId) + ","
+					}
 					mobileStr = strings.TrimRight(mobileStr, ",")
 					if mobileStr == "" {
 						mobileStr = "1"
@@ -730,13 +752,6 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 		}
 	}
 
-	configCode := "jin_meng_activity_id"
-	detail, err := models.GetConfigByCode(configCode)
-	if err != nil {
-		return err
-	}
-	fmt.Println(detail.ConfigValue)
-
 	//获取需要处理的活动
 	listActivity, err := models.GetActivityListByDateTime(startDate, endDate, activityIds, detail.ConfigValue)
 	if err != nil {
@@ -757,7 +772,6 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 			} else {
 				activityName = nameSlice[len(nameSlice)-1]
 			}
-
 			//activityName = nameSlice[len(nameSlice)-1]
 			if activityName != "" {
 				list, err := models.GetRoadshowDataList(activityName, findStartDate, findEndDate)
@@ -765,7 +779,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 					fmt.Println("GetTacticsList Err:", err.Error())
 					return err
 				}
-
+				var isPlayback bool // 是否包含回放
 				needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
 				var mobileStr string
 				if len(list) > 0 {
@@ -792,6 +806,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 								item.MeetingStatusStr = "直播"
 							} else {
 								item.MeetingStatusStr = "回放"
+								isPlayback = true
 							}
 							item.Position = v.Occupation
 							item.UseridEntity = v.UseridEntity
@@ -801,6 +816,9 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 							needAddAttendanc = append(needAddAttendanc, item)
 						}
 					}
+					if isPlayback && mapActivityId[strconv.Itoa(vAct.ActivityId)] == "" {
+						activityIdsLongTime += strconv.Itoa(vAct.ActivityId) + ","
+					}
 					mobileStr = strings.TrimRight(mobileStr, ",")
 					if mobileStr == "" {
 						mobileStr = "1"
@@ -822,7 +840,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 							}
 						}
 					}
-					//参会记录
+					////参会记录
 					err = models.AddAttendancDetail(needAddAttendanc, vAct.ActivityId, mobileStr)
 					if err != nil {
 						fmt.Println("AddAttendancDetail Err:", err.Error())
@@ -839,6 +857,11 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 			}
 		}
 	}
+	if activityIdsLongTime != "" {
+		activityIdsLongTime = strings.TrimRight(activityIdsLongTime, ",")
+		activityIdsLongTime = detail.ConfigValue + "," + activityIdsLongTime
+		go models.UpdateConfigByCode(activityIdsLongTime, configCode)
+	}
 
 	activityIds = strings.TrimRight(activityIds, ",")
 	if activityIds != "" {

+ 2 - 1
services/article.go

@@ -1078,7 +1078,8 @@ func GetCeLueArticlePv(cont context.Context) (err error) {
 			item.CompanyName = v.CompanyName.RealName
 		}
 		item.CreateDateApi = time.Now()
-		item.CreateTime = v.CreateDate
+		t1, _ := time.Parse("2006-01-02T15:04:05Z", v.CreateDate)
+		item.CreateTime = t1.Add(+time.Hour * 8).Format(utils.FormatDateTime)
 		count, err := models.GetCeLueArticleCountById(v.CelueHistoryId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			return err

+ 2 - 2
utils/config.go

@@ -131,7 +131,7 @@ func init() {
 		WxPublicAppId = "wx4a844c734d8c8e56"
 		WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
 		WxPublicId = "gh_b67e0049fb8c"
-		IndexName = "cygx_article_v0526"
+		IndexName = "cygx_article_v0622"
 
 		//接收附件邮箱
 		EmailTechnology = "mlluo@hzinsights.com;jxu@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com"    //科技行业专家邮箱
@@ -144,7 +144,7 @@ func init() {
 		WxMsgTemplateIdAskMsg = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
 		WxMsgTemplateIdAskMsgMobile = ""
 		ActSendMsgMobile = "15618524605"
-		ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791"
+		ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672"
 
 	} else {
 		WxAppId = "wxcc32b61f96720d2f"