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
17895640
authored
Jun 23, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/sunlong_v5/golang-queue-server
parents
c283afc9
6b70f89e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
38 deletions
order/sendPurchaseEmail/sendEmail/sendEmail.go
order/sendPurchaseEmail/sendEmail/sendEmail.go
View file @
17895640
...
@@ -3,12 +3,12 @@ package sendEmail
...
@@ -3,12 +3,12 @@ package sendEmail
import
(
import
(
"encoding/json"
"encoding/json"
"github.com/ichunt2019/logger"
"github.com/ichunt2019/logger"
"go-queue-server/dal/order/OrderActionLog"
_
"go-queue-server/dal/order/OrderActionLog"
"go-queue-server/util"
"go-queue-server/util"
"go-queue-server/util/ding"
"go-queue-server/util/ding"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
"strconv"
_
"strconv"
"strings"
"strings"
)
)
...
@@ -45,44 +45,48 @@ func SendPurchaseEmail(data string) (err error) {
...
@@ -45,44 +45,48 @@ func SendPurchaseEmail(data string) (err error) {
return
err
return
err
}
}
// 添加操作日志
ding
.
Send
(
util
.
Configs
.
Ding_msg
.
Webhook
,
"监控告警"
,
"推送采购邮件:"
+
data
,
mobile
,
isAtAll
)
var
data_params
*
DataParams
json
.
Unmarshal
([]
byte
(
data
),
&
data_params
)
if
data_params
.
OrderId
==
0
{
ding
.
Send
(
util
.
Configs
.
Ding_msg
.
Webhook
,
"监控告警"
,
"推送采购员:"
+
data
,
mobile
,
isAtAll
)
return
}
order_id
:=
data_params
.
OrderId
operator_id
:=
data_params
.
OperatorId
operator_event
:=
data_params
.
OperatorEvent
err
=
OrderActionLog
.
Insert
(
order_id
,
operator_id
,
2
,
operator_event
)
if
err
!=
nil
{
ding
.
Send
(
util
.
Configs
.
Ding_msg
.
Webhook
,
"监控告警"
,
"添加操作日志失败"
,
mobile
,
isAtAll
)
return
err
}
// 推送ERP
api_url
:=
util
.
Configs
.
Api_domain
.
ApiUrl
+
"order/sysiteminfo"
params
:=
"order_id="
+
strconv
.
Itoa
(
order_id
)
api_header_map
:=
map
[
string
]
string
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
}
err
=
http_post
(
api_url
,
params
,
api_header_map
)
if
err
!=
nil
{
ding
.
Send
(
util
.
Configs
.
Ding_msg
.
Webhook
,
"监控告警"
,
"ERP同步接口请求失败,原因:"
+
err
.
Error
(),
mobile
,
isAtAll
)
logger
.
Info
(
err
.
Error
())
return
err
}
ding
.
Send
(
util
.
Configs
.
Ding_msg
.
Webhook
,
"监控告警"
,
"订单ID:"
+
strconv
.
Itoa
(
order_id
)
+
","
+
operator_event
+
",字段同步ERP成功"
,
mobile
,
isAtAll
)
return
return
//// 添加操作日志
//var data_params *DataParams
//json.Unmarshal([]byte(data), &data_params)
//if data_params.OrderId == 0 {
// ding.Send(util.Configs.Ding_msg.Webhook, "监控告警", "推送采购员:"+data, mobile, isAtAll)
// return
//}
//
//order_id := data_params.OrderId
//operator_id := data_params.OperatorId
//operator_event := data_params.OperatorEvent
//
//err = OrderActionLog.Insert(order_id, operator_id, 2, operator_event)
//
//if err != nil {
// ding.Send(util.Configs.Ding_msg.Webhook,"监控告警","添加操作日志失败", mobile, isAtAll)
// return err
//}
//
//// 推送ERP
//api_url := util.Configs.Api_domain.ApiUrl + "order/sysiteminfo"
//params := "order_id="+strconv.Itoa(order_id)
//api_header_map := map[string]string{
// "Content-Type": "application/x-www-form-urlencoded",
//}
//
//err = http_post(api_url, params, api_header_map)
//
//if err != nil {
// ding.Send(util.Configs.Ding_msg.Webhook, "监控告警", "ERP同步接口请求失败,原因:" + err.Error(), mobile, isAtAll)
// logger.Info(err.Error())
// return err
//}
//
//ding.Send(util.Configs.Ding_msg.Webhook, "监控告警", "订单ID:" + strconv.Itoa(order_id) + "," + operator_event + ",字段同步ERP成功", mobile, isAtAll)
//
//return
}
}
func
http_post
(
url
string
,
data
string
,
header
map
[
string
]
string
)
(
err
error
)
{
func
http_post
(
url
string
,
data
string
,
header
map
[
string
]
string
)
(
err
error
)
{
...
...
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