Jelajahi Sumber

feat:xiugai

wangchuanjin 3 bulan lalu
induk
melakukan
72b364ea25

+ 2 - 2
src/jfw/modules/subscribepay/src/config.yaml

@@ -71,9 +71,9 @@ bidCreditReport:
   sendMailRetry: 10
   appendUserMail:
   mailSubject: "投标企业信用报告(%s)"
-  mailContent: '<body style="background-color:#F5F5FB;padding:15px 0px 30px 0px;"><style> *,body,html{margin:0;padding:0;font-family:Microsoft YaHei;font-size:16px;color:#1d1d1d;text-decoration:none;}#all{border-radius:8px;padding:0px 40px;background-color: #fff;margin:0px auto;width:1040px;overflow:hidden;border-top:5px #2CB7CA solid;padding-bottom:150px;}a,a:hover{text-decoration:none !important;}.detail{border: 1px solid #E0E0E0;border-top: 2px solid #AAAAAA;font-size:14px;}.detail span,.detail a{display:block;}</style><div id="all"><div style="border-bottom: 1px solid #F6F6F6;"><IMG style="margin:auto;display:block;" width="150px" src="https://www.jianyu360.cn/images/swordfish/sf_01.png" /></div><div style="padding:30px 50px;"><div style="line-height: 25px;">尊敬的剑鱼标讯用户:<br>您好,感谢您购买剑鱼标讯投标企业信用报告,您的报告已发送到您的邮箱,请查收!如有问题,可拨打客服热线:400-108-6670。</div><a href="%s" style="display:inline-block;margin-top: 30px;padding: 5px 15px;color:#ffffff;background-color:#2ABED1;font-size:14px;border-radius: 5px;">投标企业信用报告下载</a><div style="height:1px;background-color:#F6F6F6;margin: 40px 0px;"></div><div class="detail"><div style="background-color: #F5F5FB;padding: 5px 25px;line-height:30px;"><span style="float:left;">报告详情</span><span style="float:right;"><span style="display: inline-block;margin-right:30px;color:#F56500;"><img src="%s/images/new_tips.png" style="width:16px;margin:-3px 5px 0px 0px;vertical-align: middle;">温馨提示:为了保证更好的查看效果,请在PC端查看</span><a href="%s" style="display: inline-block;color:#2ABED1;">在线查看报告</a></span><a style="clear:both;"></a></div><span style="padding: 30px 25px;line-height:30px;">投标企业名称:%s<br>招标单位名称:%s</span></div></div></div></body>'
+  mailContent: '<body style="background-color:#F5F5FB;padding:15px 0px 30px 0px;"><style> *,body,html{margin:0;padding:0;font-family:Microsoft YaHei;font-size:16px;color:#1d1d1d;text-decoration:none;}#all{border-radius:8px;padding:0px 40px;background-color: #fff;margin:0px auto;width:1040px;overflow:hidden;border-top:5px #2CB7CA solid;padding-bottom:150px;}a,a:hover{text-decoration:none !important;}.detail{border: 1px solid #E0E0E0;border-top: 2px solid #AAAAAA;font-size:14px;}.detail span,.detail a{display:block;}</style><div id="all"><div style="border-bottom: 1px solid #F6F6F6;"><IMG style="margin:auto;display:block;" width="150px" src="https://www.jianyu360.cn/images/swordfish/sf_01.png" /></div><div style="padding:30px 50px;"><div style="line-height: 25px;">尊敬的剑鱼标讯用户:<br>您好,感谢您购买剑鱼标讯投标企业信用报告,您的报告已发送到您的邮箱,请查收!如有问题,可拨打客服热线:400-108-6670。</div><a href="%s" style="display:inline-block;margin-top: 30px;padding: 5px 15px;color:#ffffff;background-color:#2ABED1;font-size:14px;border-radius: 5px;">投标企业信用报告下载</a><div style="height:1px;background-color:#F6F6F6;margin: 40px 0px;"></div><div class="detail"><div style="background-color: #F5F5FB;padding: 5px 25px;line-height:30px;"><span style="float:left;">报告详情</span><span style="float:right;"><span style="display: inline-block;margin-right:30px;color:#F56500;"><img src="%s/images/new_tips.png" style="width:16px;margin:-3px 5px 0px 0px;vertical-align: middle;">温馨提示:为了保证更好的查看效果,请在PC端查看</span><a href="%s/swordfish/page_big_pc/free/report/preview?url=%s" style="display: inline-block;color:#2ABED1;">在线查看报告</a></span><a style="clear:both;"></a></div><span style="padding: 30px 25px;line-height:30px;">投标企业名称:%s<br>招标单位名称:%s</span></div></div></div></body>'
   warnMailSubject: "投标企业信用报告来新订单了"
-  warnMailContent: '<body style="background-color:#F5F5FB;padding:15px 0px 30px 0px;"><style> *,body,html{margin:0;padding:0;font-family:Microsoft YaHei;font-size:16px;color:#1d1d1d;text-decoration:none;}#all{border-radius:8px;padding:0px 40px;background-color: #fff;margin:0px auto;width:1040px;overflow:hidden;border-top:5px #2CB7CA solid;padding-bottom:150px;}a,a:hover{text-decoration:none !important;}.detail{border: 1px solid #E0E0E0;border-top: 2px solid #AAAAAA;font-size:14px;}.detail span,.detail a{display:block;}</style><div id="all"><div style="border-bottom: 1px solid #F6F6F6;"><IMG style="margin:auto;display:block;" width="150px" src="https://www.jianyu360.cn/images/swordfish/sf_01.png" /></div><div style="padding:30px 50px;"><div style="line-height: 25px;">亲爱的剑鱼标讯运维工作人员:<br>这里有一个新的投标企业信用报告订单需要您处理,请点击下面链接去完善生成报告所需的内容。</div><a href="%s/swordfish/page_big_pc/free/report/examine?id=%d" style="display:inline-block;margin-top: 30px;padding: 5px 15px;color:#ffffff;background-color:#2ABED1;font-size:14px;border-radius: 5px;">点击去完善</a><div style="height:1px;background-color:#F6F6F6;margin: 40px 0px;"></div><div class="detail"><div style="background-color: #F5F5FB;padding: 5px 25px;line-height:30px;"><span>报告详情</span></div><span style="padding: 30px 25px;line-height:30px;">订单编号:%s<br>投标企业名称:%s<br>招标单位名称:%s</span></div><div style="margin-top: 30px;font-weight: bold;color: red;font-size: 16px;">每一份努力都在为未来的成功积攒能量,你今天流下的每一滴汗水,都会在明天浇灌出最绚烂的花朵。继续加油,你的坚持定有回报!</div></div></div></body>'
+  warnMailContent: '<body style="background-color:#F5F5FB;padding:15px 0px 30px 0px;"><style> *,body,html{margin:0;padding:0;font-family:Microsoft YaHei;font-size:16px;color:#1d1d1d;text-decoration:none;}#all{border-radius:8px;padding:0px 40px;background-color: #fff;margin:0px auto;width:1040px;overflow:hidden;border-top:5px #2CB7CA solid;padding-bottom:150px;}a,a:hover{text-decoration:none !important;}.detail{border: 1px solid #E0E0E0;border-top: 2px solid #AAAAAA;font-size:14px;}.detail span,.detail a{display:block;}</style><div id="all"><div style="border-bottom: 1px solid #F6F6F6;"><IMG style="margin:auto;display:block;" width="150px" src="https://www.jianyu360.cn/images/swordfish/sf_01.png" /></div><div style="padding:30px 50px;"><div style="line-height: 25px;">亲爱的剑鱼标讯运维工作人员:<br>这里有一个新的投标企业信用报告订单需要您处理,请点击下面链接去完善生成报告所需的内容。</div><a href="%s/swordfish/page_big_pc/free/report/examine?id=%d" style="display:inline-block;margin-top: 30px;padding: 5px 15px;color:#ffffff;background-color:#2ABED1;font-size:14px;border-radius: 5px;">点击去完善</a><div style="height:1px;background-color:#F6F6F6;margin: 40px 0px;"></div><div class="detail"><div style="background-color: #F5F5FB;padding: 5px 25px;line-height:30px;"><span>报告详情</span></div><span style="padding: 30px 25px;line-height:30px;">订单编号:%s<br>投标企业名称:%s<br>统一社会信用代码:%s<br>招标单位名称:%s</span></div><div style="margin-top: 30px;font-weight: bold;color: red;font-size: 16px;">每一份努力都在为未来的成功积攒能量,你今天流下的每一滴汗水,都会在明天浇灌出最绚烂的花朵。继续加油,你的坚持定有回报!</div></div></div></body>'
   warnIntervalMinute: 2
   warnStart: "09:00"
   warnEnd: "21:00"

+ 21 - 20
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -1,16 +1,24 @@
 package bidCreditReport
 
 import (
-	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/es"
-	. "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"
+	"io/ioutil"
+	"jy/src/jfw/modules/subscribepay/src/config"
+	"jy/src/jfw/modules/subscribepay/src/util"
+	"log"
+	"net/http"
+	"net/url"
+	"time"
+
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/es"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
+	. "bp.jydev.jianyu360.cn/BaseService/userCenter/identity"
 	"github.com/gogf/gf/v2/container/garray"
 	"github.com/gogf/gf/v2/container/gmap"
 	"github.com/gogf/gf/v2/crypto/gmd5"
@@ -21,13 +29,6 @@ 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"
 )
 
 const esQuery = `{"query":{"bool":{"must":[{"term":{"s_winner":"%s"}},{"range":{"lasttime":{"gt":%d}}},{"exists":{"field":"projectname"}},{"exists":{"field":"buyer"}},{"exists":{"field":"lasttime"}}]}},"_source":["id","projectname","buyer","area","city","district","sortprice","lasttime","list.infoid","topscopeclass"],"sort":{"sortprice":"desc"},"size":%d}`
@@ -202,8 +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, config.Config.WebDomain, previewUrl, entName, buyer)
+	content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.mailContent").String(), downloadUrl, config.Config.WebDomain, config.Config.WebDomain, url.QueryEscape(downloadUrl), 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, "发送招投标企业信用报告邮件成功。。。")
@@ -425,10 +425,10 @@ func (b *bidCreditReport) NewOrderWarn() {
 			}
 			log.Println("有新的投标企业信用报告订单给运维发邮件加载到数据", v.String())
 			v.Set("isNew", true)
-			b.sendWarnNotice(v.GetVar("id").Int64(), v.GetVar("order_code").String(), v.GetVar("ent_name").String(), v.GetVar("buyer").String())
+			b.sendWarnNotice(v.GetVar("id").Int64(), v.GetVar("order_code").String(), v.GetVar("ent_name").String(), v.GetVar("cert_no").String(), v.GetVar("buyer").String())
 			all[id] = v
 			return true
-		}, `select id,order_code,ent_name,buyer from jianyu.bid_credit_report where status=0`)
+		}, `select id,order_code,ent_name,cert_no,buyer from jianyu.bid_credit_report where status=0`)
 		if index < g.Config().MustGet(ctx, "bidCreditReport.warnIntervalMinute", 15).Int() {
 			return
 		}
@@ -442,16 +442,17 @@ func (b *bidCreditReport) NewOrderWarn() {
 				v.Set("isNew", false)
 				continue
 			}
-			b.sendWarnNotice(v.GetVar("id").Int64(), v.GetVar("order_code").String(), v.GetVar("ent_name").String(), v.GetVar("buyer").String())
+			b.sendWarnNotice(v.GetVar("id").Int64(), v.GetVar("order_code").String(), v.GetVar("ent_name").String(), v.GetVar("cert_no").String(), v.GetVar("buyer").String())
 		}
 	})
 }
 
 // 发送企业微信机器人告警
-func (b *bidCreditReport) sendWarnNotice(id int64, orderCode, entName, buyer string) {
+func (b *bidCreditReport) sendWarnNotice(id int64, orderCode, entName, certNo, buyer string) {
 	ctx := gctx.New()
 	message := `订单编号:%s
 投标企业名称:%s
+统一社会信用代码:%s
 招标单位名称:%s
 点击完善信息:%s/swordfish/page_big_pc/free/report/examine?id=%d`
 	type WeixinMessage struct {
@@ -467,7 +468,7 @@ func (b *bidCreditReport) sendWarnNotice(id int64, orderCode, entName, buyer str
 		} `json:"text"`
 	}
 	msg.MsgType = "text"
-	msg.Text.Content = fmt.Sprintf(message, orderCode, entName, buyer, config.Config.WebDomain, id)
+	msg.Text.Content = fmt.Sprintf(message, orderCode, entName, certNo, buyer, config.Config.WebDomain, id)
 	data, _ := json.Marshal(msg)
 	resp, err := http.Post(g.Config().MustGet(gctx.New(), "bidCreditReport.webhook").String(), "application/json", bytes.NewReader(data))
 	if err != nil {
@@ -481,7 +482,7 @@ func (b *bidCreditReport) sendWarnNotice(id int64, orderCode, entName, buyer str
 	}
 	log.Println(orderCode, entName, "投标企业信用报告订单 sendWebhook 成功")
 	//
-	content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.warnMailContent").String(), config.Config.WebDomain, id, orderCode, entName, buyer)
+	content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.warnMailContent").String(), config.Config.WebDomain, id, orderCode, entName, certNo, buyer)
 	for _, v := range g.Config().MustGet(ctx, "bidCreditReport.warnUserMail").Strings() {
 		go func(vv string) {
 			log.Println(orderCode, vv, "开始给运维发送有新的投标企业信用报告订单邮件。。。")

+ 1 - 1
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport_test.go

@@ -49,6 +49,6 @@ func TestCallBack(t *testing.T) {
 }
 
 func TestSendWebhook(t *testing.T) {
-	BidCreditReport.sendWarnNotice(19, "264436376359", "北京剑鱼信息技术有限公司", "大数据集成平台及数据中心")
+	BidCreditReport.sendWarnNotice(19, "264436376359", "北京剑鱼信息技术有限公司", "", "大数据集成平台及数据中心")
 	time.Sleep(time.Minute)
 }