浏览代码

Merge remote-tracking branch 'origin/feature/v4.10.9' into feature/v4.10.9

jianghan 4 月之前
父节点
当前提交
4b1c830aee

+ 9 - 9
src/jfw/front/login.go

@@ -193,21 +193,21 @@ func (l *Login) Login() error {
 					}
 					// 新用户注册 记录来源
 					sourceLabel := redis.GetStr("limitation", fmt.Sprintf("firstVisitTagByWX_%s", l.Session().Id()))
-					if sourceLabel != "" { //合作商
-						data["s_rsource"] = sourceLabel
-						channelCode = sourceLabel
-					} else if sessVal["RSource"] != nil {
-						data["s_rsource"] = sessVal["RSource"]
+					if source == "" {
+						if sourceLabel != "" { //合作商
+							data["s_rsource"] = sourceLabel
+							channelCode = sourceLabel
+						} else if sessVal["RSource"] != nil {
+							data["s_rsource"] = sessVal["RSource"]
+						}
+					} else {
+						data["s_rsource"] = source
 					}
 					if ck, err := l.GetCookie("source"); err == nil && ck.Value != "" {
 						//cookie中记录用户的来源
 						data["s_newsource"] = ck.Value
 						data["s_module"] = GetModule(ck.Value) //根据cookie中记录的来源获取模块
 					}
-
-					if source != "" {
-						data["s_tracksource"] = source
-					}
 					//获取base_user_id
 					resp := config.Middleground.UserCenter.UserAdd(pb.UserAddReq{
 						Appid: "10000",

+ 1 - 1
src/jfw/front/org_structure.go

@@ -181,7 +181,7 @@ func (this *OrgStructure) AutoLogon() error {
 				"s_nickname":  name,
 				"s_myemail":   mail,
 			}
-			source := this.GetString("source")
+
 			if ck, err := this.GetCookie("source"); err == nil && ck.Value != "" {
 				//cookie中记录用户的来源
 				data["s_newsource"] = ck.Value

+ 4 - 4
src/jfw/modules/app/src/web/templates/commonPay/paySuccess.html

@@ -211,12 +211,12 @@
         </div>
         <div class="weui-dialog__bd">
             <p id="weuiDialogContent">
-              报告将于<span class="time"></span>分钟内发送至您的邮箱,您也可前往“资产-报告下载记录”查看详情。
+              报告将于<span class="time"></span>内发送至您的邮箱,您也可前往“资产-报告下载记录”查看详情。
             </p>
         </div>
         <div class="weui-dialog__ft">
-            <a href="javascript:;" id="weuiDialogCancel" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
-            <a href="/jy_mobile/reportanalysis/reportDownload?inside-jumps=1" id="weuiDialogConfirm" class="weui-dialog__btn weui-dialog__btn_primary">查看下载记录</a>
+            <!-- <a href="javascript:;" id="weuiDialogCancel" class="weui-dialog__btn weui-dialog__btn_default">取消</a> -->
+            <a href="javascript:;" id="weuiDialogConfirm" class="weui-dialog__btn weui-dialog__btn_primary">我知道了</a>
         </div>
     </div>
 </div>
@@ -398,7 +398,7 @@
         }
       }
     })
-    $('#weuiDialogCancel').click(function () {
+    $('#weuiDialogConfirm').click(function () {
       $('#weuiDialog').hide()
       $('#weuiMask').hide()
     })

+ 1 - 0
src/jfw/modules/publicapply/src/detail/dao/bidding.go

@@ -257,6 +257,7 @@ func (bi *BidInfo) BiddingDataFormatNoPower(obj map[string]interface{}, id, deta
 	}
 	bi.BaseInfo.Title = title
 	bi.BaseInfo.SubType = common.ObjToString(obj["subtype"])
+	bi.BaseInfo.TopType = common.ObjToString(obj["toptype"])
 	bi.BaseInfo.Area = common.ObjToString(obj["area"])
 	bi.BaseInfo.City = common.ObjToString(obj["city"])
 	bi.BaseInfo.BuyerClass = common.ObjToString(obj["buyerclass"])

+ 4 - 3
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:1200px;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><a href="%s" style="float:right;color:#2ABED1;">在线查看报告</a><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;"><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>'
   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:1200px;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</span></div><div style="margin-top: 30px;font-weight: bold;color: red;font-size: 16px;">每一份努力都在为未来的成功积攒能量,你今天流下的每一滴汗水,都会在明天浇灌出最绚烂的花朵。继续加油,你的坚持定有回报!</div></div></div></body>'
   warnIntervalMinute: 15
   warnStart: "09:00"
   warnEnd: "21:00"
@@ -85,4 +85,5 @@ bidCreditReport:
     - "5d6378301c298a5aac7b5402"
   performanceTime: 2018-01-01 00:00:00
   performanceSize: 100
-  makeTime: 30分钟
+  makeTime: 工作时段(9:00-18:00)30分钟
+  webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4fd8ccbe-02f5-41e8-9a55-3f90a4253416

+ 59 - 22
src/jfw/modules/subscribepay/src/entity/bidCreditReport/bidCreditReport.go

@@ -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, "发送招投标企业信用报告邮件成功。。。")
@@ -407,21 +411,6 @@ func (b *bidCreditReport) NewOrderWarn() {
 	ctx := gctx.New()
 	warnStart := g.Config().MustGet(ctx, "bidCreditReport.warnStart").String()
 	warnEnd := g.Config().MustGet(ctx, "bidCreditReport.warnEnd").String()
-	var sendMail = func(m *gmap.StrAnyMap) {
-		entName := m.GetVar("ent_name").String()
-		orderCode := m.GetVar("order_code").String()
-		content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.warnMailContent").String(), config.Config.WebDomain, m.GetVar("id").Int64(), orderCode, entName, m.GetVar("buyer").String())
-		for _, v := range g.Config().MustGet(ctx, "bidCreditReport.warnUserMail").Strings() {
-			go func(vv string) {
-				log.Println(orderCode, vv, "开始给运维发送有新的投标企业信用报告订单邮件。。。")
-				if util.SendRetryMail(g.Config().MustGet(ctx, "bidCreditReport.sendMailRetry").Int(), vv, g.Config().MustGet(ctx, "bidCreditReport.warnMailSubject").String(), content, "", nil, config.GmailAuth) {
-					log.Println(orderCode, vv, "给运维发送有新的投标企业信用报告订单邮件成功。。。")
-				} else {
-					log.Println(orderCode, vv, "给运维发送有新的投标企业信用报告订单邮件邮件失败。。。")
-				}
-			}(v)
-		}
-	}
 	all := map[int64]*gmap.StrAnyMap{}
 	index := 0
 	p.VarTimeTask.RunInTimeSection("有新的投标企业信用报告订单给运维发邮件", warnStart, warnEnd, 1, func(dayFirst bool) {
@@ -429,13 +418,14 @@ func (b *bidCreditReport) NewOrderWarn() {
 		ids := map[int64]bool{}
 		util.Mysql.SelectByBath(1, func(l *[]map[string]interface{}) bool {
 			v := gmap.NewStrAnyMapFrom((*l)[0])
-			log.Println("有新的投标企业信用报告订单给运维发邮件加载到数据", v.String())
 			id := v.GetVar("id").Int64()
-			if _, ok := all[id]; !ok {
-				v.Set("isNew", true)
-				sendMail(v)
-			}
 			ids[id] = true
+			if _, ok := all[id]; ok {
+				return true
+			}
+			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())
 			all[id] = v
 			return true
 		}, `select id,order_code,ent_name,buyer from jianyu.bid_credit_report where status=0`)
@@ -452,7 +442,54 @@ func (b *bidCreditReport) NewOrderWarn() {
 				v.Set("isNew", false)
 				continue
 			}
-			sendMail(v)
+			b.sendWarnNotice(v.GetVar("id").Int64(), v.GetVar("order_code").String(), v.GetVar("ent_name").String(), v.GetVar("buyer").String())
 		}
 	})
 }
+
+// 发送企业微信机器人告警
+func (b *bidCreditReport) sendWarnNotice(id int64, orderCode, entName, buyer string) {
+	ctx := gctx.New()
+	message := `订单编号:%s
+投标企业名称:%s
+招标单位名称:%s
+点击完善信息:%s/swordfish/page_big_pc/free/report/examine?id=%d`
+	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, 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 {
+		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 成功")
+	//
+	content := fmt.Sprintf(g.Config().MustGet(ctx, "bidCreditReport.warnMailContent").String(), config.Config.WebDomain, id, orderCode, entName, buyer)
+	for _, v := range g.Config().MustGet(ctx, "bidCreditReport.warnUserMail").Strings() {
+		go func(vv string) {
+			log.Println(orderCode, vv, "开始给运维发送有新的投标企业信用报告订单邮件。。。")
+			if util.SendRetryMail(g.Config().MustGet(ctx, "bidCreditReport.sendMailRetry").Int(), vv, g.Config().MustGet(ctx, "bidCreditReport.warnMailSubject").String(), content, "", nil, config.GmailAuth) {
+				log.Println(orderCode, vv, "给运维发送有新的投标企业信用报告订单邮件成功。。。")
+			} else {
+				log.Println(orderCode, vv, "给运维发送有新的投标企业信用报告订单邮件邮件失败。。。")
+			}
+		}(v)
+	}
+}

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

@@ -39,6 +39,7 @@ func TestCreate(t *testing.T) {
 
 func TestNewOrderWarn(t *testing.T) {
 	BidCreditReport.NewOrderWarn()
+	time.Sleep(time.Hour)
 }
 
 func TestCallBack(t *testing.T) {
@@ -46,3 +47,8 @@ func TestCallBack(t *testing.T) {
 	log.Println(BidCreditReport.CallBack(from))
 	time.Sleep(time.Minute)
 }
+
+func TestSendWebhook(t *testing.T) {
+	BidCreditReport.sendWarnNotice(19, "264436376359", "北京剑鱼信息技术有限公司", "大数据集成平台及数据中心")
+	time.Sleep(time.Minute)
+}

+ 1 - 1
src/web/staticres/order/css/pay_success.css

@@ -268,7 +268,7 @@
 }
 .credit-report-dialog .dialog-footer{
   display: flex;
-  justify-content: space-between;
+  justify-content: center;
 }
 .credit-report-dialog .el-button{
   width: 132px;

+ 4 - 3
src/web/templates/order/pc/paySuccess.html

@@ -190,7 +190,7 @@
                 <a class="check_order sm-size default" href="/front/downloadPack/packDetail?order_code={{.T.orderCode}}">查看订单</a>
                 <span style="margin-left:16px;cursor:pointer;" class="check_order" onclick="getAnalysisJumpUrl('prop')" >下载报告</span>
             {{else if eq .T.orderType "creditReport"}}
-                <a class="check_order sm-size default" href="/front/creditReport/orderDetail?order_code={{.T.orderCode}}">查看订单</a>
+                <a class="check_order sm-size default" href="/front/creditReport/jyOrderDetail/{{.T.orderCode}}">查看订单</a>
                 <!-- <span style="margin-left:16px;cursor:pointer;" class="check_order" onclick="getAnalysisJumpUrl('creditReport')" >下载报告</span> -->
             {{end}}
 
@@ -214,8 +214,9 @@
     >
       <div class="dialog-content">报告将于${bidCreditReport_makeTime}内发送至您的邮箱,您也可前往“资产-报告下载记录”查看详情。</div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="goDownloadRecord">查看下载记录</el-button>
-        <el-button @click="dialogVisible = false">取 消</el-button>
+        <!-- <el-button type="primary" @click="goDownloadRecord">查看下载记录</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button> -->
+        <el-button type="primary" @click="dialogVisible = false">我知道了</el-button>
       </span>
     </el-dialog>
     {{end}}

+ 4 - 4
src/web/templates/weixin/commonPay/paySuccess.html

@@ -196,12 +196,12 @@
       </div>
       <div class="weui-dialog__bd">
           <p id="weuiDialogContent">
-            报告将于<span class="time"></span>分钟内发送至您的邮箱,您也可前往“资产-报告下载记录”查看详情。
+            报告将于<span class="time"></span>内发送至您的邮箱,您也可前往“资产-报告下载记录”查看详情。
           </p>
       </div>
       <div class="weui-dialog__ft">
-          <a href="javascript:;" id="weuiDialogCancel" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
-          <a href="/jy_mobile/reportanalysis/reportDownload?inside-jumps=1" id="weuiDialogConfirm" class="weui-dialog__btn weui-dialog__btn_primary">查看下载记录</a>
+          <!-- <a href="javascript:;" id="weuiDialogCancel" class="weui-dialog__btn weui-dialog__btn_default">取消</a> -->
+          <a href="javascript:;" id="weuiDialogConfirm" class="weui-dialog__btn weui-dialog__btn_primary">我知道了</a>
       </div>
   </div>
 </div>
@@ -355,7 +355,7 @@
         }
       }
     })
-    $('#weuiDialogCancel').click(function () {
+    $('#weuiDialogConfirm').click(function () {
       $('#weuiDialog').hide()
       $('#weuiMask').hide()
     })