package client
|
|
import (
|
"encoding/json"
|
"gat1400Exchange/pkg/logger"
|
"gat1400Exchange/util"
|
"gat1400Exchange/vo"
|
)
|
|
func Notify(url string, msg []byte) int {
|
if clientStatus != vo.StatusSuccess {
|
return clientStatus
|
}
|
|
rsp, err := util.HttpPost(url, headers, msg)
|
if err != nil {
|
logger.Warn("Post notification failed, %s", err.Error())
|
return vo.StatusOtherError
|
}
|
|
var stat vo.ResponseStatusList
|
err = json.Unmarshal(rsp, &stat)
|
if err != nil {
|
logger.Warn("Post notification response unmarshal failed, %s", err.Error())
|
return vo.StatusOtherError
|
}
|
|
logger.Debug("Post notification success.")
|
|
return vo.StatusSuccess
|
}
|