package services import ( "encoding/json" "errors" "fmt" "hongze/hongze_mobile_admin/models" "hongze/hongze_mobile_admin/models/tables/admin" "hongze/hongze_mobile_admin/services/alarm_msg" "hongze/hongze_mobile_admin/utils" "io/ioutil" "net/http" "strings" "time" ) type SendWxTemplate struct { WxAppId string `description:"公众号appId"` First string `description:"模板消息first字段"` Keyword1 string `description:"模板消息keyword1字段"` Keyword2 string `description:"模板消息keyword2字段"` Keyword3 string `description:"模板消息keyword3字段"` Keyword4 string `description:"模板消息keyword4字段"` Keyword5 string `description:"模板消息keyword5字段"` Remark string `description:"模板消息remark字段"` TemplateId string `description:"模板id"` RedirectUrl string `description:"跳转地址"` RedirectTarget int `description:"小程序跳转目标:1:弘则研报小程序,2:随手办公小程序"` Resource string `description:"资源唯一标识"` SendType int `description:"发送的消息类型:1:报告,2:指标更新提醒,3:审批通知,4:销售领取客户通知,5:活动取消通知,6活动更改时间通知,7:关注的作者发布报告通知,8:发送日报(周报、双周报、月报)模板消息,9:活动预约/报名时间通知"` OpenIdArr []string `description:"消息接收者openid"` } type BaseResponse struct { Ret int Msg string ErrMsg string ErrCode string Data interface{} Success bool `description:"true 执行成功,false 执行失败"` IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"` IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" ` } type SendTemplateResponse struct { Errcode int `json:"errcode"` Errmsg string `json:"errmsg"` MsgID int `json:"msgid"` } // SendCompanyApplyWxTemplateMsg 发送待办消息 func SendCompanyApplyWxTemplateMsg(mobile, redirectUrl, wxAppPath string, wxMsgMap map[int]string) (err error) { var msg string defer func() { if err != nil { go alarm_msg.SendAlarmMsg(fmt.Sprintf("发送模版消息失败,Err:%s,%s", err.Error(), msg), 3) //go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers) utils.FileLog.Info("发送模版消息失败,Err:%s,%s", err.Error(), msg) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() utils.FileLog.Info("%s", "services SendMsg") utils.FileLog.Info("mobile:%s", mobile) //获取openid列表 openIdStr := WxAdminOpenIdGet() openIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr) if err != nil { msg = "get openIdList err:" + err.Error() return } utils.FileLog.Info("openIdListCount:%s", len(openIdList)) //fmt.Println("openIdListCount:", len(openIdList)) if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" { utils.FileLog.Info("start send") //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken fmt.Println("send start") utils.FileLog.Info("send start") //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) var first, keyword1, keyword2, keyword3, remark string if tmpStr, ok := wxMsgMap[0]; ok { first = tmpStr } else { first = "Hi,有新的订单需要审批" } if tmpStr, ok := wxMsgMap[1]; ok { keyword1 = tmpStr } if tmpStr, ok := wxMsgMap[2]; ok { keyword2 = tmpStr } if tmpStr, ok := wxMsgMap[3]; ok { keyword3 = tmpStr } if tmpStr, ok := wxMsgMap[4]; ok { remark = tmpStr } //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["keyword3"] = map[string]interface{}{"value": keyword3, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} // //sendMap["template_id"] = utils.TemplateIdByCompanyApply //sendMap["url"] = redirectUrl //sendMap["data"] = sendData ////小程序信息 //if wxAppPath != "" { // sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath} //} //sendTemplateMsg(sendUrl, sendMap, openIdList, mobile, utils.TEMPLATE_MSG_APPLY) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Remark = remark sendInfo.TemplateId = utils.TemplateIdByCompanyApply sendInfo.RedirectUrl = redirectUrl sendInfo.RedirectTarget = 2 sendInfo.Resource = mobile sendInfo.SendType = utils.TEMPLATE_MSG_APPLY sendInfo.OpenIdArr = openIdArr if wxAppPath != "" { sendInfo.RedirectUrl = wxAppPath } err = SendTemplateMsg(sendInfo) } utils.FileLog.Info("send end") return } // SendWxMsgWithRoadshowDetailResult 路演->销售收到处理结果 func SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, keyword3, keyword4, keyword5, remark, mobile, redirectUrl, wxAppPath string) (err error) { var msg string defer func() { if err != nil { go alarm_msg.SendAlarmMsg(fmt.Sprintf("发送模版消息失败,Err:%s,%s", err.Error(), msg), 3) //go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers) utils.FileLog.Info("发送模版消息失败,Err:%s,%s", err.Error(), msg) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() utils.FileLog.Info("%s", "services SendMsg") utils.FileLog.Info("mobile:%s", mobile) //获取openid列表 openIdStr := WxAdminOpenIdGet() openIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr) if err != nil { msg = "get openIdList err:" + err.Error() return } utils.FileLog.Info("openIdListCount:%s", len(openIdList)) //fmt.Println("openIdListCount:", len(openIdList)) if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" { utils.FileLog.Info("start send") //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken //fmt.Println("send start") //utils.FileLog.Info("send start") //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) // //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} // //sendMap["template_id"] = utils.WxMsgTemplateIdWithRoadshowDetailResult //sendMap["url"] = redirectUrl //sendMap["data"] = sendData ////小程序信息 //if wxAppPath != "" { // sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath} //} //sendTemplateMsg(sendUrl, sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Keyword4 = keyword4 sendInfo.Keyword5 = keyword5 sendInfo.Remark = remark sendInfo.TemplateId = utils.WxMsgTemplateIdWithRoadshowDetailResult if wxAppPath != "" && utils.RunMode == "release" { sendInfo.RedirectUrl = wxAppPath } sendInfo.RedirectTarget = 2 sendInfo.Resource = wxAppPath sendInfo.SendType = utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) } utils.FileLog.Info("send end") return } // SendWxMsgWithRoadshowPending 路演->研究员收到待处理的申请 func SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, mobile string) (err error) { //utils.WxMsgTemplateIdWithRoadshowPending var msg string defer func() { if err != nil { //go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers) go alarm_msg.SendAlarmMsg("发送模版消息失败,Err:"+err.Error()+msg, 3) utils.FileLog.Info("发送模版消息失败,Err:" + err.Error() + msg) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() utils.FileLog.Info("%s", "services SendMsg") //获取openid列表 openIdStr := WxAdminOpenIdGet() openIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr) if err != nil { msg = "get openIdList err:" + err.Error() return } utils.FileLog.Info("openIdListCount:%s", len(openIdList)) //fmt.Println("openIdListCount:", len(openIdList)) if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" { utils.FileLog.Info("start send") //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken //fmt.Println("send start") //utils.FileLog.Info("send start") //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) // //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["keyword3"] = map[string]interface{}{"value": keyword3, "color": "#173177"} //sendData["keyword4"] = map[string]interface{}{"value": keyword4, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} // //sendMap["template_id"] = utils.WxMsgTemplateIdWithRoadshowPending //sendMap["data"] = sendData ////小程序信息 //if wxAppPath != "" { // sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath} //} //sendTemplateMsg(sendUrl, sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Keyword4 = keyword4 sendInfo.Remark = remark sendInfo.TemplateId = utils.WxMsgTemplateIdWithRoadshowPending if wxAppPath != "" && utils.RunMode == "release" { sendInfo.RedirectUrl = wxAppPath } sendInfo.RedirectTarget = 2 sendInfo.Resource = wxAppPath sendInfo.SendType = utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) } utils.FileLog.Info("send end") return } // SendWxMsgWithRoadshowDeleteNotice 路演->研究员收到活动删除通知 func SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, remark, wxAppPath, mobile string) (err error) { var msg string defer func() { if err != nil { //go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers) go alarm_msg.SendAlarmMsg("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05")+";Msg:"+msg+";Err:"+err.Error(), 3) utils.FileLog.Info("发送模版消息失败,Err:%s,%s", err.Error(), msg) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() utils.FileLog.Info("%s", "services SendMsg") //获取openid列表 openIdStr := WxAdminOpenIdGet() openIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr) if err != nil { msg = "get openIdList err:" + err.Error() return } utils.FileLog.Info("openIdListCount:%s", len(openIdList)) //fmt.Println("openIdListCount:", len(openIdList)) if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" { utils.FileLog.Info("start send") //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) // //sendMap["template_id"] = utils.WxMsgTemplateIdWithRoadshowDeleteNotice //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} ////小程序信息 //if wxAppPath != "" { // sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath} //} //sendMap["data"] = sendData //sendTemplateMsg(sendUrl, sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Remark = remark sendInfo.TemplateId = utils.WxMsgTemplateIdWithRoadshowDeleteNotice if wxAppPath != "" && utils.RunMode == "release" { sendInfo.RedirectUrl = wxAppPath } sendInfo.RedirectTarget = 2 sendInfo.Resource = wxAppPath sendInfo.SendType = utils.TEMPLATE_MSG_ACTIVITY_APPOINTMENT sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) } utils.FileLog.Info("send end") return } // SendSealFinishedWxTemplateMsg 给销售发送 用印申请已签回的模版消息 func SendSealFinishedWxTemplateMsg(mobile string, companyName string, sealId int) (err error) { var msg string defer func() { if err != nil { fmt.Println("err:", err) go alarm_msg.SendAlarmMsg("发送模版消息失败,Err:"+err.Error()+";msg:"+msg, 3) utils.FileLog.Info(fmt.Sprintf("发送模版消息失败,Err:%s,%s", err.Error(), msg)) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() utils.FileLog.Info("%s", "services SendMsg") utils.FileLog.Info("mobile:%s", mobile) openIdStr := WxAdminOpenIdGet() openIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr) if err != nil { msg = "get openIdList err:" + err.Error() return } utils.FileLog.Info("openIdListCount:%s", len(openIdList)) if len(openIdList) > 0 && utils.WxMsgTemplateIdWithSealApplyFinished != "" { utils.FileLog.Info("start send") //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken //fmt.Println("send start") //utils.FileLog.Info("send start") //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) first := "您的用印申请已签回,可前往提交转正/续约申请" keyword1 := companyName //keyword2 := "已签回" keyword2 := "用印申请已签回,可前往提交转正/续约申请" remark := "点击查看用印详情" // //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} // //sendMap["template_id"] = utils.WxMsgTemplateIdWithSealApplyFinished //sendMap["url"] = "" //跳转地址 //sendMap["data"] = sendData // TODO 随手办公小程序的跳转地址 wxAppPath := fmt.Sprintf("pages-approve/seal/detail?SealId=%d", sealId) //sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath} //err = sendTemplateMsg(sendUrl, sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_SEAL_FINISHED) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Remark = remark sendInfo.RedirectUrl = wxAppPath sendInfo.TemplateId = utils.WxMsgTemplateIdWithSealApplyFinished sendInfo.RedirectTarget = 2 sendInfo.Resource = wxAppPath sendInfo.SendType = utils.TEMPLATE_MSG_SEAL_FINISHED sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) } utils.FileLog.Info("send end") return } // SendYbQuestionDistributeWxMsg 推送研报小程序模板消息-问答社区分配 func SendYbQuestionDistributeWxMsg(questionId, adminId int, openid, questionTitle string) (err error) { var errMsg string defer func() { if err != nil { alarmMsg := fmt.Sprintf("SendMiniProgramReportWxMsg-推送问答社区分配模版消息失败; QuestionId: %d; Err: %s; Msg: %s", questionId, err.Error(), errMsg) utils.FileLog.Error(alarmMsg) go alarm_msg.SendAlarmMsg(alarmMsg, 3) } }() openIdList := make([]*admin.OpenIdList, 0) openIdList = append(openIdList, &admin.OpenIdList{ OpenId: openid, AdminId: adminId, }) //sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken //sendMap := make(map[string]interface{}) //sendData := make(map[string]interface{}) first := "您好,有新的提问待回复" keyword1 := questionTitle keyword2 := "待回复" remark := "请点击详情尽快处理" //sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"} //sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"} //sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"} //sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"} // //sendMap["template_id"] = utils.WxMsgTemplateIdWithYbCommunityQuestion //sendMap["data"] = sendData // wxAppPath := fmt.Sprintf("pages-question/answerDetail?id=%d", questionId) //if wxAppPath != "" { // sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxYbAppId, "pagepath": wxAppPath} //} //err = sendTemplateMsg(sendUrl, sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_YB_COMMUNITY_QUESTION) openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.WxAppId = utils.AdminWxAppId sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Remark = remark sendInfo.RedirectUrl = wxAppPath sendInfo.TemplateId = utils.WxMsgTemplateIdWithYbCommunityQuestion sendInfo.RedirectTarget = 1 sendInfo.Resource = wxAppPath sendInfo.SendType = utils.TEMPLATE_MSG_YB_COMMUNITY_QUESTION sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) utils.FileLog.Info("send end") return } // 推送模板消息 func SendTemplateMsg(sendInfo *SendWxTemplate) (err error) { postData, err := json.Marshal(sendInfo) if err != nil { alarm_msg.SendAlarmMsg("SendTemplateMsg json.Marshal Err:"+err.Error(), 1) return err } body := ioutil.NopCloser(strings.NewReader(string(postData))) client := &http.Client{} req, err := http.NewRequest("POST", utils.SendWxTemplateMsgUrl, body) if err != nil { alarm_msg.SendAlarmMsg("SendTemplateMsg http.NewRequest Err:"+err.Error(), 1) return err } contentType := "application/json;charset=utf-8" req.Header.Set("Content-Type", contentType) req.Header.Set("Authorization", utils.SendTemplateMsgAuthorization) resp, err := client.Do(req) if err != nil { fmt.Println("http client.Do Err:" + err.Error()) return err } defer resp.Body.Close() b, err := ioutil.ReadAll(resp.Body) if err != nil { return err } result := new(BaseResponse) err = json.Unmarshal(b, &result) if err != nil { return err } if result.Ret != 200 { err = errors.New(string(b)) return err } return } // SendWxMsgWithRaiSell 权益销售客户申请转正后,消息群发给所有销售 func SendWxMsgWithRaiSell(first, keyword1, keyword2, keyword3, keyword4 string, openIdList []*models.OpenIdList) (err error) { var msg string defer func() { if err != nil { fmt.Println("err:", err) go alarm_msg.SendAlarmMsg("权益销售客户申请转正后,消息群发给所有销售,Err:"+err.Error()+";msg:"+msg, 3) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.First = first sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Keyword4 = keyword4 sendInfo.Remark = "" sendInfo.TemplateId = utils.WxMsgTemplateIdCompanyApprovalMessageRai sendInfo.RedirectUrl = "" sendInfo.RedirectTarget = 3 sendInfo.SendType = utils.TEMPLATE_MSG_APPLY sendInfo.OpenIdArr = openIdArr fmt.Println(sendInfo) err = SendTemplateMsg(sendInfo) return } // SendWxMsgWithRaiWangYang 客户研选行业转正时(王芳审批通过),模板消息提醒汪洋 func SendWxMsgWithRaiWangYang(keyword1, keyword2, keyword3, keyword4 string, openIdList []*models.OpenIdList) (err error) { var msg string defer func() { if err != nil { fmt.Println("err:", err) go alarm_msg.SendAlarmMsg("客户研选行业转正时(王芳审批通过),模板消息提醒汪洋,Err:"+err.Error()+";msg:"+msg, 3) } if msg != "" { utils.FileLog.Info("发送模版消息失败,msg:%s", msg) } }() openIdArr := make([]string, len(openIdList)) for i, v := range openIdList { openIdArr[i] = v.OpenId } sendInfo := new(SendWxTemplate) sendInfo.Keyword1 = keyword1 sendInfo.Keyword2 = keyword2 sendInfo.Keyword3 = keyword3 sendInfo.Keyword4 = keyword4 sendInfo.TemplateId = utils.WxMsgTemplateIdCompanyApprovalMessageRai sendInfo.RedirectUrl = "" sendInfo.RedirectTarget = 3 sendInfo.SendType = utils.TEMPLATE_MSG_APPLY sendInfo.OpenIdArr = openIdArr err = SendTemplateMsg(sendInfo) return }