Commit 4bd46ded by 朱继来

temp

parent 62806811
...@@ -20,7 +20,7 @@ type RecvPro struct { ...@@ -20,7 +20,7 @@ type RecvPro struct {
//// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db //// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db
func (t *RecvPro) Consumer(dataByte []byte) error { func (t *RecvPro) Consumer(dataByte []byte) error {
//fmt.Println(string(dataByte)) // fmt.Println(string(dataByte))
err := sendEmail.SendPurchaseEmail(string(dataByte)) err := sendEmail.SendPurchaseEmail(string(dataByte))
////return errors.New("顶顶顶顶") ////return errors.New("顶顶顶顶")
return err return err
......
package sendEmail package sendEmail
import "fmt" import (
"fmt"
// "go-queue-server/dal/db"
"go-queue-server/util"
"net/http"
"encoding/json"
"strings"
)
func SendPurchaseEmail(data string) (err error){ func SendPurchaseEmail(data string) (err error) {
fmt.Println("555555555555555") crm_url := util.Configs.Crm_domain.SendMailUrl // CRM发送邮件接口
fmt.Println(data)
client := &http.Client{}
byte, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", crm_url, strings.NewReader(string(byte)))
req.Header.Set("api-key", "crm a1b2c3d4e5f6g7h8i9jk")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
fmt.Println(resp.Body)
if err != nil {
fmt.Println(err.Error())
}
defer resp.Body.Close()
return return
} }
...@@ -36,6 +36,6 @@ func Init(){ ...@@ -36,6 +36,6 @@ func Init(){
if err!=nil{ if err!=nil{
fmt.Println(err) fmt.Println(err)
} }
fmt.Printf("%+v",Configs.Crm_domain) // fmt.Printf("%+v",Configs.Crm_domain)
fmt.Printf("%+v",Configs.Rabbitmq_ichunt) // fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment