Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4bd46ded
authored
Jan 02, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp
parent
62806811
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
order/sendPurchaseEmail/main.go
order/sendPurchaseEmail/sendEmail/sendEmail.go
util/config.go
order/sendPurchaseEmail/main.go
View file @
4bd46ded
...
...
@@ -20,7 +20,7 @@ type RecvPro struct {
//// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
//fmt.Println(string(dataByte))
//
fmt.Println(string(dataByte))
err
:=
sendEmail
.
SendPurchaseEmail
(
string
(
dataByte
))
////return errors.New("顶顶顶顶")
return
err
...
...
order/sendPurchaseEmail/sendEmail/sendEmail.go
View file @
4bd46ded
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
){
fmt
.
Println
(
"555555555555555"
)
fmt
.
Println
(
data
)
func
SendPurchaseEmail
(
data
string
)
(
err
error
)
{
crm_url
:=
util
.
Configs
.
Crm_domain
.
SendMailUrl
// CRM发送邮件接口
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
}
util/config.go
View file @
4bd46ded
...
...
@@ -36,6 +36,6 @@ func Init(){
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
fmt
.
Printf
(
"%+v"
,
Configs
.
Crm_domain
)
fmt
.
Printf
(
"%+v"
,
Configs
.
Rabbitmq_ichunt
)
//
fmt.Printf("%+v",Configs.Crm_domain)
//
fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment