Browse Source

扫描二维码

zhangxinlei1996 3 năm trước cách đây
mục cha
commit
f0510868ce

+ 13 - 7
src/jfw/modules/weixin/src/wx/wx.go

@@ -786,9 +786,11 @@ func Subscribe(w ResponseWriter, r *Request) {
 				w.ReplyText(fmt.Sprintf(exists, strings.ReplaceAll(subkey, "++", " "), fastSubscribeText["skill"].(string)))
 			} else if pcresult == "vipsubscribe##reply" { //关注
 				vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
-				time.AfterFunc(time.Second/2, func() {
-					w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
-				})
+				if switchBl, ok := vipsubReply["switch"].(bool); switchBl && ok {
+					time.AfterFunc(time.Second/2, func() {
+						w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+					})
+				}
 				isAutoRepl = true
 			} else {
 				if subkey != "" {
@@ -1207,9 +1209,11 @@ func ScanHandler(w ResponseWriter, r *Request) {
 					w.ReplyText(fmt.Sprintf(config.Sysconfig["welcomemsg"].(string), url))
 					if pcresult == "vipsubscribe##reply" { //新用户扫码
 						vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
-						time.AfterFunc(time.Second/2, func() {
-							w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
-						})
+						if switchBl, ok := vipsubReply["switch"].(bool); switchBl && ok {
+							time.AfterFunc(time.Second/2, func() {
+								w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+							})
+						}
 					}
 				}
 			}
@@ -1292,7 +1296,9 @@ func ScanHandler(w ResponseWriter, r *Request) {
 					w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_fail"]), strings.ReplaceAll(subkey, "++", " "), url))
 				} else if pcresult == "vipsubscribe##reply" { //老用户扫码
 					vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
-					w.ReplyText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+					if switchBl, ok := vipsubReply["switch"].(bool); switchBl && ok {
+						w.ReplyText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+					}
 				}
 			} else if pccodepre == "18" { //关注企业
 				company := redis.GetStr("sso", "pc_subscribe_"+r.EventKey) //企业名称

+ 2 - 2
src/jfw/modules/wxtoken/src/config.json

@@ -1,8 +1,8 @@
 {
 	"wxs":[
 		{
-			"appid":"wx5b1c6e7cc4dac0e4",
-			"appsecret":"b026103ffebd2291b3edb7a269612112"
+			"appid":"wxdedd73f450993685",
+			"appsecret":"d55898fde0b7887e5fe4660bd2494700"
 		}
 	],
 	"redis":"wxtoken=192.168.3.206:1712"