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

Merge branch 'cygx/cygx_need_p2_800' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 жил өмнө
parent
commit
f57d7833dc

+ 14 - 6
controllers/cygx/activity.go

@@ -9,6 +9,7 @@ import (
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/services"
 	cygxService "hongze/hz_crm_api/services/cygx"
+	"hongze/hz_crm_api/services/elastic"
 	"hongze/hz_crm_api/utils"
 	"strconv"
 	"strings"
@@ -761,14 +762,18 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			br.ErrMsg = "发布失败,Err:" + err.Error()
 			return
 		}
-
 		//如果是添加多条活动那么就推送多次
 		for _, v := range activityIdArr {
 			if req.DoType == 1 {
-				go cygxService.DoActivityOnenIdWxTemplateMsg(v)
-				go cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
-				go cygxService.YiDongSaveRoadshowDetail(v)
-				go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
+				go func() {
+					//同时添加多个活动的时候,避免协程开的过多
+					cygxService.DoActivityOnenIdWxTemplateMsg(v)
+					cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
+					cygxService.YiDongSaveRoadshowDetail(v)
+					cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣
+					elastic.AddComprehensiveActivity(v)                                                    // Es添加活动
+				}()
+
 			}
 			go cygxService.MakeActivitySigninImg(v)
 		}
@@ -778,8 +783,11 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			go cygxService.UpdateResourceData(req.ActivityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
 			go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
 		}
+		//如果二次编辑的时候,取消了易董办会选项,那么就对易董发送取消发布到广场的通知
+		if req.IsYidongConduct == 0 {
+			go cygxService.YiDongUpdateActivityStatus(activityId)
+		}
 	}
-
 	// 查研观向7.4-更新产业布局时间
 	if len(industryIds) > 0 {
 		go cygxService.UpdateIndustryLayoutTime(industryIds, false)

+ 11 - 3
services/cygx/yidong.go

@@ -685,14 +685,22 @@ func YiDongUpdateActivityStatus(activityId int) {
 	if activityInfo.ActivityTypeId == 7 {
 		activityInfo.PublishStatus = 0
 	}
+	//如果关联的易董活动ID为空,那么不做处理
+	if activityInfo.YidongActivityIdByCygx == "" {
+		return
+	}
+	//如果状态是已发布,而且是易董办会那么就不做处理
+	if activityInfo.IsYidongConduct == 1 && activityInfo.PublishStatus == 1 {
+		return
+	}
 	token, _ := GetYidongToken()
 	if token == "" {
 		return
 	}
 	url := utils.YiDongZhengTongYunUrl + "interact/activityThirdApi/updateActivityStatus" + "?access_token=" + token
-	if activityInfo.IsYidongConduct == 0 || activityInfo.YidongActivityIdByCygx == "" {
-		return
-	}
+	//if activityInfo.IsYidongConduct == 0 || activityInfo.YidongActivityIdByCygx == "" {
+	//	return
+	//}
 	params := YiDongUpdateActivityPublishResp{
 		Id: activityInfo.YidongActivityIdByCygx,
 	}