xingzai преди 1 година
родител
ревизия
5b0e3c0f42
променени са 6 файла, в които са добавени 48 реда и са изтрити 19 реда
  1. 1 2
      controllers/activity.go
  2. 17 3
      controllers/micro_roadshow.go
  3. 17 7
      services/user.go
  4. 8 3
      services/wx_template_msg.go
  5. 2 2
      utils/config.go
  6. 3 2
      utils/constants.go

+ 1 - 2
controllers/activity.go

@@ -1496,6 +1496,7 @@ func (this *ActivityCoAntroller) AskAdd() {
 				sendMobile = v.Mobile
 			}
 		}
+		//如果是研选的就推送给汪洋
 		if activityInfo.ChartPermissionId == 31 {
 			sendMobile = utils.ActSendMsgMobile
 		}
@@ -1512,7 +1513,6 @@ func (this *ActivityCoAntroller) AskAdd() {
 			openIpItem, _ := models.GetUserRecordByMobile(4, sendMobile)
 			if openIpItem != nil && openIpItem.OpenId != "" {
 				if sellerItem != nil {
-					//services.SendActivityAskApplyTemplateMsg(user.RealName+"——"+user.CompanyName+"(所属销售:"+sellerItem.RealName+")", time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, activityInfo.ActivityId, openIpItem)
 					services.SendActivityAskApplyTemplateMsgV2(user.RealName+"——"+user.CompanyName+"("+sellerItem.RealName+")", "留言:"+activityInfo.ActivityName, time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, openIpItem, activityInfo, int(msgId))
 				}
 			}
@@ -1521,7 +1521,6 @@ func (this *ActivityCoAntroller) AskAdd() {
 		if sellerItem != nil {
 			openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
 			if openIpItem != nil && openIpItem.OpenId != "" {
-				//services.SendActivityAskApplyTemplateMsgV2(user.RealName+"——"+user.CompanyName, "所属销售:"+sellerItem.RealName, time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, openIpItem, activityInfo)
 				services.SendActivityAskApplyTemplateMsgV2(user.RealName+"——"+user.CompanyName+"("+sellerItem.RealName+")", "留言:"+activityInfo.ActivityName, time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, openIpItem, activityInfo, int(msgId))
 			}
 		}

+ 17 - 3
controllers/micro_roadshow.go

@@ -345,9 +345,9 @@ func (this *MicroRoadShowController) CommentAdd() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
-
+	var isResearch bool // 是否属于研选
 	sourceType := req.SourceType
-
+	title := req.Title
 	if sourceType == 0 {
 		sourceType = 1
 	}
@@ -362,6 +362,7 @@ func (this *MicroRoadShowController) CommentAdd() {
 		Content:     req.Content,
 		Title:       req.Title,
 	}
+
 	var resourceId int
 	if sourceType == 1 {
 		activityVoiceInfo, _ := models.GetCygxActivityVoiceByActivityId(req.Id)
@@ -394,13 +395,26 @@ func (this *MicroRoadShowController) CommentAdd() {
 		item.IndustryId = microVideo.IndustryId
 		resourceId = microVideo.IndustryId
 	}
+
+	if sourceType == 2 || sourceType == 3 {
+		detail, err := models.GetAddActivityInfoById(req.Id)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(req.Id)
+			return
+		}
+		title = detail.ActivityName
+		if strings.Contains(detail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			isResearch = true
+		}
+	}
 	msgId, err := models.AddArticleComment(&item)
 	if err != nil {
 		br.Msg = "提交失败"
 		br.ErrMsg = "提交留言失败,Err:" + err.Error()
 		return
 	}
-	services.SendWxMsgWithMicroRoadshowAsk(req, user, resourceId, int(msgId))
+	services.SendWxMsgWithMicroRoadshowAsk(req, user, resourceId, int(msgId), title, isResearch)
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "操作成功"

+ 17 - 7
services/user.go

@@ -1081,9 +1081,9 @@ func SendPermissionApplyTemplateMsgAdmin(req models.ApplyTryReq, usermobile, app
 		}
 	}()
 	var configCode string
-	//如果是研选的就推送给汪洋,否则就推送给王芳
+	//如果是研选的就推送给汪洋跟王芳,否则就推送给王芳
 	if isResearch {
-		configCode = utils.TPL_MSG_WANG_YANG
+		configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
 	} else {
 		configCode = utils.TPL_MSG
 	}
@@ -1092,11 +1092,21 @@ func SendPermissionApplyTemplateMsgAdmin(req models.ApplyTryReq, usermobile, app
 		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
 		return
 	}
-	openIpItem, e := models.GetUserRecordByMobile(4, cnf.ConfigValue)
-	if e != nil {
-		err = errors.New("GetUserRecordByMobile, Err: " + e.Error() + cnf.ConfigValue)
-		return
+	openIdList, e := models.GetUserRecordListByMobile(4, cnf.ConfigValue)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetUserRecordListByMobile, Err: " + e.Error() + cnf.ConfigValue)
+		return err
+	}
+
+	for _, v := range openIdList {
+		go SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, usermobile, applyMethod, v)
 	}
-	go SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, usermobile, applyMethod, openIpItem)
+
+	//openIpItem, e := models.GetUserRecordByMobile(4, cnf.ConfigValue)
+	//if e != nil {
+	//	err = errors.New("GetUserRecordByMobile, Err: " + e.Error() + cnf.ConfigValue)
+	//	return
+	//}
+
 	return
 }

+ 8 - 3
services/wx_template_msg.go

@@ -741,7 +741,7 @@ func SendCommentWxTemplateMsg(req models.AddCygxArticleCommentReq, user *models.
 }
 
 // 微路演新增留言提问消息提醒
-func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.WxUserItem, resourceId, msgId int) (err error) {
+func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.WxUserItem, resourceId, msgId int, title string, isResearch bool) (err error) {
 	var msg string
 	defer func() {
 		if err != nil || msg != "" {
@@ -767,10 +767,15 @@ func SendWxMsgWithMicroRoadshowAsk(req models.AddVideoCommnetReq, user *models.W
 	first = req.Title + "有新的留言,请及时处理"
 	keyword1 = user.CompanyName + "——" + user.RealName + "(" + companyItem.SellerName + ")"
 	keyword3 = time.Now().Format(utils.FormatDateTime)
-	keyword2 = ""
+	keyword2 = title
 	keyword4 = req.Content
+	mobile := companyItem.Mobile
+	mobile = companyItem.Mobile + "," + utils.WxMsgTemplateIdAskMsgMobilePublic
+	if isResearch {
+
+	} else {
 
-	mobile := companyItem.Mobile + "," + utils.WxMsgTemplateIdAskMsgMobilePublic
+	}
 	openIdList, e := models.GetWxOpenIdByMobileList(mobile)
 	if e != nil {
 		err = errors.New("GetWxOpenIdByMobileList, Err: " + e.Error())

+ 2 - 2
utils/config.go

@@ -73,7 +73,7 @@ var (
 	HtgjSalt                  string //海通加密使用的盐
 	HtgjName                  string //海通国际名称
 	HtgjPublicMobile          string //海通国际公共请求的手机号
-	ActSendMsgMobile          string //活动带问发送模板消息接收者的手机号 (汪洋手机号)
+	ActSendMsgMobile          string //研选活动带问发送模板消息接收者的手机号 (汪洋手机号)
 	StrategyPlatform          string //策略品台跳转链接地址
 	ArticleTaskClassMobile    string //策略平台报告自动归类消息通知对象
 	YiDongZhengTongYunUrl     string //易董 证通云请求域名
@@ -209,7 +209,7 @@ func init() {
 		EmaiWhiteUserList = "cxzhang@hzinsights.com"
 		WxMsgTemplateIdAskMsg = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
 		WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
-		ActSendMsgMobile = "17634786714"
+		ActSendMsgMobile = "15557270714"
 		ArticleTaskClassMobile = "15557270714,18767183922,17706316791"
 
 		ShangHaiCrmApiLink = "http://106.15.192.100:8100/"

+ 3 - 2
utils/constants.go

@@ -199,6 +199,7 @@ const (
 )
 
 const (
-	TPL_MSG_WANG_YANG = "tpl_msg_wang_yang" //汪洋手机号地址参数
-	TPL_MSG           = "tpl_msg"           //王芳手机号地址参数
+	TPL_MSG_WANG_YANG           = "tpl_msg_wang_yang"           //汪洋手机号地址参数
+	TPL_MSG_WANG_FANG_WANG_YANG = "tpl_msg_wang_fang_wang_yang" //权限模板消息接收人,王芳,汪洋
+	TPL_MSG                     = "tpl_msg"                     //王芳手机号地址参数
 )