ziwen 2 年之前
父节点
当前提交
960de52652
共有 3 个文件被更改,包括 38 次插入42 次删除
  1. 32 37
      controllers/report.go
  2. 5 5
      services/wx_template_msg.go
  3. 1 0
      utils/constants.go

+ 32 - 37
controllers/report.go

@@ -3133,7 +3133,7 @@ func (this *ReportController) CommentAdd() {
 		return
 	}
 
-	//
+
 	//var sendMobile string
 	//for _, v := range listEmail {
 	//	if strings.Index(activityInfo.Host, v.Name) > 0 {
@@ -3143,43 +3143,38 @@ func (this *ReportController) CommentAdd() {
 	//if activityInfo.ChartPermissionId == 31 {
 	//	sendMobile = utils.ActSendMsgMobile
 	//}
-	//
-	////获取销售信息
-	//sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	//if err != nil && err.Error() != utils.ErrNoRow() {
-	//	br.Msg = "提交失败"
-	//	br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//// 给所属销售发送消息
-	//if sellerItem != nil {
-	//	openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
-	//	if openIpItem != nil && openIpItem.OpenId != "" {
-	//		services.SendCommentWxTemplateMsg(articleInfo.Title)
-	//	}
-	//}
 
-	//var mobile string
-	//if utils.RunMode == "release" {
-	//	//mobile = utils.WxMsgTemplateIdAskMsgMobileAll + "," + companyItem.Mobile
-	//	mobile = utils.WxMsgTemplateIdAskMsgMobileAll
-	//} else {
-	//	mobile = utils.WxMsgTemplateIdAskMsgMobile
-	//}
-	//openIdList, err := models.GetWxOpenIdByMobileList(mobile)
-	//if err != nil {
-	//	br.Msg = "提交失败"
-	//	br.ErrMsg = "提交失败,Err:" + err.Error()
-	//	return
-	//}
-	//detail, err := models.GetArticleDetailById(articleId)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//companyName := user.CompanyName + "-" + user.RealName + "(" + companyItem.SellerName + ")"
-	//go services.SendWxMsgWithAsk(companyName, time.Now().Format(utils.FormatDateTime), content, detail.Title, openIdList, req.ArticleId)
+	//获取销售信息
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "提交失败"
+		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+		return
+	}
+	// 给所属销售发送消息
+	var openIdList []*models.OpenIdList
+	if sellerItem != nil {
+		openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
+		openIdList = append(openIdList, openIpItem)
+		if openIpItem != nil && openIpItem.OpenId != "" {
+			// 给芳姐发消息
+			cnf, _ := models.GetConfigByCode("tpl_msg")
+			if cnf != nil {
+				openIpItem, _ := models.GetUserRecordByMobile(4, cnf.ConfigValue)
+				openIdList = append(openIdList, openIpItem)
+			}
+			if articleId > 1000000{
+				//发给汪洋
+				cnf, _ := models.GetConfigByCode("tpl_msg")
+				if cnf != nil {
+					openIpItem, _ := models.GetUserRecordByMobile(4, cnf.ConfigValue)
+					openIdList = append(openIdList, openIpItem)
+				}
+			}
+			services.SendCommentWxTemplateMsg(articleInfo.Title, user.CompanyName, user.RealName, sellerItem.RealName,openIdList, req.ArticleId)
+		}
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "提交成功"

+ 5 - 5
services/wx_template_msg.go

@@ -660,7 +660,7 @@ func SendActivityOnenIdWxTemplateMsg(first, keyWord1, keyWord2, keyWord3, keyWor
 }
 
 //发送用户留言提醒
-func SendCommentWxTemplateMsg(keyWord1, keyWord2 string, openIdList []*models.OpenIdList, articleId int) (err error) {
+func SendCommentWxTemplateMsg(title, companyName, userName, sellerName string, openIdList []*models.OpenIdList, articleId int) (err error) {
 	var msg string
 	defer func() {
 		if err != nil {
@@ -679,17 +679,17 @@ func SendCommentWxTemplateMsg(keyWord1, keyWord2 string, openIdList []*models.Op
 		return
 	}
 	var first string
-	first = keyWord1
-	keyword1 := keyWord2
+	first = "【"+title+"】有新的留言,请及时处理"
+	keyword1 := companyName + "--" + userName + "(" + sellerName + ")"
 	sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
 	templateId := utils.WxMsgTemplateIdArticleUserRemind
 	sendMap := make(map[string]interface{})
 	sendData := make(map[string]interface{})
 	sendMap["template_id"] = templateId
-	sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": "activityPages/specialDetail/specialDetail?id=" + strconv.Itoa(articleId)}
+	sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": utils.WX_MSG_PATH_ARTICLE_DETAIL + strconv.Itoa(articleId)}
 	sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
 	sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"}
 	sendMap["data"] = sendData
-	WxSendTemplateMsg(sendUrl, sendMap, openIdList, strconv.Itoa(articleId), utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD)
+	WxSendTemplateMsg(sendUrl, sendMap, openIdList, strconv.Itoa(articleId), utils.TEMPLATE_MSG_CYGX_COMMENT)
 	return
 }

+ 1 - 0
utils/constants.go

@@ -70,6 +70,7 @@ const (
 	TEMPLATE_MSG_CYGX_ACTIVITY_ADD = 12 //查研观向小程序活动更新推送 12
 	TEMPLATE_MSG_CYGX_ARTICLE_ADD  = 13 //查研观向报告更新推送  13
 	TEMPLATE_MSG_CYGX_APPLY        = 14 //查研观向审批通知
+	TEMPLATE_MSG_CYGX_COMMENT      = 15 //查研观向留言通知
 )
 
 const (