|
@@ -17,13 +17,11 @@ func SendInterviewApplyTemplateMsg(realName, companyName, mobile, articleTitle,
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
|
|
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 != "" {
|
|
if msg != "" {
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
- utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
|
|
|
|
accessToken, err := models.GetWxAccessToken()
|
|
accessToken, err := models.GetWxAccessToken()
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -56,7 +54,6 @@ func SendInterviewApplyTemplateMsg(realName, companyName, mobile, articleTitle,
|
|
sendMap["data"] = sendData
|
|
sendMap["data"] = sendData
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
fmt.Println("send end")
|
|
fmt.Println("send end")
|
|
- utils.FileLog.Info("send end")
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -66,14 +63,11 @@ func SendInterviewApplyCancelTemplateMsg(realName, companyName, mobile, articleT
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
|
|
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 != "" {
|
|
if msg != "" {
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
- utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
-
|
|
|
|
accessToken, err := models.GetWxAccessToken()
|
|
accessToken, err := models.GetWxAccessToken()
|
|
if err != nil {
|
|
if err != nil {
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
@@ -101,7 +95,6 @@ func SendInterviewApplyCancelTemplateMsg(realName, companyName, mobile, articleT
|
|
sendMap["data"] = sendData
|
|
sendMap["data"] = sendData
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
fmt.Println("send end")
|
|
fmt.Println("send end")
|
|
- utils.FileLog.Info("send end")
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -111,14 +104,11 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, openId,applyM
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
|
|
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 != "" {
|
|
if msg != "" {
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
- utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
-
|
|
|
|
accessToken, err := models.GetWxAccessToken()
|
|
accessToken, err := models.GetWxAccessToken()
|
|
if err != nil {
|
|
if err != nil {
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
@@ -150,7 +140,6 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, openId,applyM
|
|
sendMap["data"] = sendData
|
|
sendMap["data"] = sendData
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
sendTemplateMsg(sendUrl, openId, sendMap)
|
|
fmt.Println("send end")
|
|
fmt.Println("send end")
|
|
- utils.FileLog.Info("send end")
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -159,19 +148,16 @@ func sendTemplateMsg(sendUrl, openId string, sendMap map[string]interface{}) (er
|
|
data, err := json.Marshal(sendMap)
|
|
data, err := json.Marshal(sendMap)
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println("SendTemplateMsgOne Marshal Err:", err.Error())
|
|
fmt.Println("SendTemplateMsgOne Marshal Err:", err.Error())
|
|
- utils.FileLog.Info("SendTemplateMsgOne Marshal Err:%s", err.Error())
|
|
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
err = toSendTemplateMsg(sendUrl, data)
|
|
err = toSendTemplateMsg(sendUrl, data)
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println("send err:", err.Error())
|
|
fmt.Println("send err:", err.Error())
|
|
- utils.FileLog.Info("ToSendTemplateMsg Err:%s", err.Error())
|
|
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func toSendTemplateMsg(sendUrl string, data []byte) (err error) {
|
|
func toSendTemplateMsg(sendUrl string, data []byte) (err error) {
|
|
- utils.FileLog.Info("Send:%s", string(data))
|
|
|
|
client := http.Client{}
|
|
client := http.Client{}
|
|
resp, err := client.Post(sendUrl, "application/json", bytes.NewBuffer(data))
|
|
resp, err := client.Post(sendUrl, "application/json", bytes.NewBuffer(data))
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -180,7 +166,6 @@ func toSendTemplateMsg(sendUrl string, data []byte) (err error) {
|
|
defer resp.Body.Close()
|
|
defer resp.Body.Close()
|
|
|
|
|
|
body, _ := ioutil.ReadAll(resp.Body)
|
|
body, _ := ioutil.ReadAll(resp.Body)
|
|
- utils.FileLog.Info("SendResult:%s", string(body))
|
|
|
|
var templateResponse SendTemplateResponse
|
|
var templateResponse SendTemplateResponse
|
|
err = json.Unmarshal(body, &templateResponse)
|
|
err = json.Unmarshal(body, &templateResponse)
|
|
if err != nil {
|
|
if err != nil {
|