浏览代码

Merge branch 'cygx_9.3.1_0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 年之前
父节点
当前提交
880602a777
共有 4 个文件被更改,包括 57 次插入46 次删除
  1. 7 44
      controllers/activity.go
  2. 24 0
      models/activity.go
  3. 24 0
      services/activity.go
  4. 2 2
      services/task.go

+ 7 - 44
controllers/activity.go

@@ -2618,6 +2618,12 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
+	mapCity, err := services.GetActivityCityResp()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
 	mapActivity := make(map[int][]*models.CygxActivityLabelList)
 	mapkeyWord := make(map[string]string)
 	for _, v := range listActivity {
@@ -2629,6 +2635,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 			v.ActivityTypeId = 2
 		}
 		item := new(models.CygxActivityLabelList)
+		item.City = mapCity[v.KeyWord]
 		item.KeyWord = services.LabelStrV5(v.KeyWord, v.IsShowSubjectName, v.TemporaryLabel)
 		if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)]; ok {
 			continue
@@ -2660,50 +2667,6 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	//var sqlExport string
 	resp := new(models.ActivityTypeListHomeResp)
 	for k, v := range list {
-		// 如果是C类电话会就不展示内容,且合并到分析师电话会
-		//if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
-		//	continue
-		//}
-		//var condition string
-		//conditionActivity, err := services.GetActivityonditionList(user, "", chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
-		//if err != nil && err.Error() != utils.ErrNoRow() {
-		//	br.Msg = "获取失败"
-		//	br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
-		//	return
-		//}
-		//condition += `AND art.is_limit_people = 1 ` + conditionActivity
-		//sortTime = ` mintimesort ASC `
-		//labelList, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
-		//if err != nil {
-		//	br.Msg = "获取失败"
-		//	br.ErrMsg = "获取失败,Err:" + err.Error()
-		//	return
-		//}
-		//var itemslabe []*models.CygxActivityLabelList
-
-		//mapkeyWord := make(map[string]string)
-		//标签字段关联的产业与标签处理
-		//for k2, v2 := range labelList {
-		//	if v2.YidongActivityId != 0 {
-		//		v2.IsExternalLabel = true
-		//	}
-		//	if v2.ActivityTypeId == 7 {
-		//		v2.ActivityTypeId = 2
-		//	}
-		//	if v.ActivityTypeId == 7 {
-		//		v.ActivityTypeId = 2
-		//	}
-		//	if utf8.RuneCountInString(v2.City) != 2 {
-		//		labelList[k2].City = ""
-		//	}
-		//	labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName, v2.TemporaryLabel)
-		//	labelList[k2].ImgUrlBg = v.ImgUrlBgs
-		//	if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)]; ok {
-		//		continue
-		//	}
-		//	itemslabe = append(itemslabe, labelList[k2])
-		//	mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)] = labelList[k2].KeyWord
-		//}
 		if len(mapActivity[v.ActivityTypeId]) > 0 {
 			for _, v2 := range mapActivity[v.ActivityTypeId] {
 				v2.ImgUrlBg = v.ImgUrlBgs

+ 24 - 0
models/activity.go

@@ -742,6 +742,30 @@ func GetActivityLabelListAll(condition, sortTime string, pars []interface{}, sta
 	return
 }
 
+// 主题列表
+func GetActivityLabelListCity() (items []*CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			activity_id,
+			activity_type_id,
+			activity_time,
+			label,
+			temporary_label,
+			is_show_subject_name,
+			yidong_activity_id,
+			city 
+		FROM
+			cygx_activity AS art 
+		WHERE
+			1 = 1 
+			AND art.active_state IN ( 1, 2 ) 
+			AND city != '' 
+		ORDER BY
+			activity_time ASC  `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 type GetCygxActivityLabelListRep struct {
 	Label  string `description:"主题"`
 	ImgUrl string `description:"图片路径"`

+ 24 - 0
services/activity.go

@@ -12,6 +12,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode/utf8"
 )
 
 // 修改活动状态
@@ -1991,3 +1992,26 @@ func GetActivityReportLinkToArticleList(item *models.ActivityDetail) (items []*m
 	}
 	return
 }
+
+// GetActivityCityResp 获取活动关联城市,当同一个活动标签对应多个城市的时候,展示最近举办的活动
+func GetActivityCityResp() (mapItem map[string]string, err error) {
+	activityList, err := models.GetActivityLabelListCity()
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	mapActivityCity := make(map[string]string)
+	if len(activityList) > 0 {
+		for _, v := range activityList {
+			if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
+				v.ActivityTypeId = utils.ANALYST_TELL_ACTIVITY_TYPE_ID
+			}
+			//如果城市民称长度大于2,那么就不显示
+			if utf8.RuneCountInString(v.City) != 2 || mapActivityCity[fmt.Sprint(v.Label, "{|}", v.ActivityTypeId)] != "" {
+				continue
+			}
+			mapActivityCity[fmt.Sprint(v.Label, "{|}", v.ActivityTypeId)] = v.City
+		}
+	}
+	mapItem = mapActivityCity
+	return
+}

+ 2 - 2
services/task.go

@@ -99,8 +99,8 @@ func Task() {
 		sendWxMsgActivitySpecialTwoDays := task.NewTask("sendWxMsgActivitySpecialTwoDays", "0 0 8 * * *", SendWxMsgActivitySpecialTwoDays)
 		task.AddTask("sendWxMsgActivitySpecialTwoDays", sendWxMsgActivitySpecialTwoDays) //活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
 
-		sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
-		task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
+		//sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
+		//task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
 	}
 	if utils.RunMode != "release" {
 		getArticleListByApi := task.NewTask("getArticleListByApi", "0 */60 * * * *", GetArticleListByApi) //通过三方接口获取策略平台上的文章