|
@@ -6,7 +6,9 @@ import (
|
|
|
. "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
|
. "bp.jydev.jianyu360.cn/BaseService/userCenter/identity"
|
|
|
+ "bytes"
|
|
|
"encoding/csv"
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"github.com/gogf/gf/v2/container/garray"
|
|
@@ -19,9 +21,11 @@ import (
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
"github.com/gogf/gf/v2/util/guid"
|
|
|
"github.com/smartwalle/alipay/v3"
|
|
|
+ "io/ioutil"
|
|
|
"jy/src/jfw/modules/subscribepay/src/config"
|
|
|
"jy/src/jfw/modules/subscribepay/src/util"
|
|
|
"log"
|
|
|
+ "net/http"
|
|
|
"net/url"
|
|
|
"time"
|
|
|
)
|
|
@@ -199,7 +203,7 @@ func (b *bidCreditReport) ReportQuery(orderNo string) bool {
|
|
|
func (b *bidCreditReport) sendMail(userId, userMail, entName, buyer, downloadUrl, orderCode string) bool {
|
|
|
ctx := gctx.New()
|
|
|
previewUrl := fmt.Sprintf("%s/swordfish/page_big_pc/free/report/preview?url=%s", config.Config.WebDomain, url.QueryEscape(downloadUrl))
|
|
|
- content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailContent").String(), downloadUrl, previewUrl, entName, buyer)
|
|
|
+ content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailContent").String(), downloadUrl, config.Config.WebDomain, previewUrl, entName, buyer)
|
|
|
log.Println("开始给", userId, orderCode, userMail, "发送招投标企业信用报告邮件。。。")
|
|
|
if util.SendRetryMail(g.Config().MustGet(ctx, "bidCreditReport.sendMailRetry").Int(), userMail, fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailSubject").String(), entName), content, "", nil, config.GmailAuth) {
|
|
|
log.Println("给", userId, orderCode, userMail, "发送招投标企业信用报告邮件成功。。。")
|
|
@@ -456,3 +460,37 @@ func (b *bidCreditReport) NewOrderWarn() {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+// 发送企业微信机器人告警
|
|
|
+func (b *bidCreditReport) sendWebhook(orderCode, entName, buyer, url string) {
|
|
|
+ message := `订单编号:%s
|
|
|
+投标企业名称:%s
|
|
|
+招标单位名称:%s
|
|
|
+点击完善信息:%s`
|
|
|
+ type WeixinMessage struct {
|
|
|
+ MsgType string `json:"msgtype"`
|
|
|
+ Text struct {
|
|
|
+ Content string `json:"content"`
|
|
|
+ } `json:"text"`
|
|
|
+ }
|
|
|
+ var msg struct {
|
|
|
+ MsgType string `json:"msgtype"`
|
|
|
+ Text struct {
|
|
|
+ Content string `json:"content"`
|
|
|
+ } `json:"text"`
|
|
|
+ }
|
|
|
+ msg.MsgType = "text"
|
|
|
+ msg.Text.Content = fmt.Sprintf(message, orderCode, entName, buyer, url)
|
|
|
+ data, _ := json.Marshal(msg)
|
|
|
+ resp, err := http.Post(g.Config().MustGet(gctx.New(), "bidCreditReport.webhook").String(), "application/json", bytes.NewReader(data))
|
|
|
+ if err != nil {
|
|
|
+ log.Println(orderCode, entName, "投标企业信用报告订单 sendWebhook error", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer resp.Body.Close()
|
|
|
+ if resp.StatusCode != http.StatusOK {
|
|
|
+ b, _ := ioutil.ReadAll(resp.Body)
|
|
|
+ log.Println(orderCode, entName, "投标企业信用报告订单 sendWebhook 失败", string(b))
|
|
|
+ }
|
|
|
+ log.Println(orderCode, entName, "投标企业信用报告订单 sendWebhook 成功")
|
|
|
+}
|