package services import ( "errors" "fmt" "hongze/hongze_mfyx/models" "hongze/hongze_mfyx/utils" "time" ) // 重点公司路演申请,给吴昂迪、对口销售 func SendCygxReportSelectionLogApplyTemplateMsg(user *models.WxUserItem, content string) (err error) { var msg string msg = fmt.Sprint(user, content) defer func() { if err != nil { go utils.SendAlarmMsg("SendCygxReportSelectionLogApplyTemplateMsg Err"+msg+err.Error(), 2) } }() var mobiles []string //获取权益销售 sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2) if e != nil { err = errors.New("GetAdminByRoleName, Err: " + e.Error()) return } mobiles = append(mobiles, sellerItem.Mobile) mobiles = append(mobiles, "") mobiles = append(mobiles, utils.MobileShenTao, utils.MobileZhangChuanXin, utils.MobileWuAngDi) // 添加沈涛、张传星、吴昂迪手机号 openIdList, e := models.GetWxOpenIdByMobileSliceList(mobiles) if e != nil { err = errors.New("GetWxOpenIdByMobileSliceList, Err: " + e.Error()) return } if len(openIdList) == 0 { return } openIdArr := make([]string, 0) for _, v := range openIdList { openIdArr = append(openIdArr, v.OpenId) } fmt.Println(openIdArr) var keyword1 string var keyword2 string var keyword3 string var keyword4 string keyword1 = fmt.Sprint(user.RealName, "--", user.CompanyName, "(", sellerItem.RealName, ")") if user.Mobile == "" { user.Mobile = user.Email } keyword2 = user.Mobile keyword3 = time.Now().Format(utils.FormatDateTime) keyword4 = fmt.Sprint(content, "(申请路演)") var redirectUrl string sendInfo := new(SendWxTemplate) sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Keyword4 = keyword4 sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ACTIVITY_ADD sendInfo.TemplateId = utils.WxMsgTemplateIdApplyXzs sendInfo.RedirectUrl = redirectUrl sendInfo.RedirectTarget = 3 sendInfo.OpenIdArr = openIdArr err = PublicSendTemplateMsg(sendInfo) return }