wangshan 5 жил өмнө
parent
commit
dd9d5ac0db

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2020-03-23 17:36:15"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2020-03-23 17:36:15"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2020-03-26 17:11:15"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2020-03-26 17:11:15"}},"marketisstart":true,"marketrate":300}

+ 6 - 1
weixin/src/config.json

@@ -78,5 +78,10 @@
         "tplid": "Q9AUylwZlZJsDjsrwUfwjI401NUBVc7OhY8RO96Eti4",
         "tpltitle": "工商业务办理状态",
         "autorpl": "抱歉当前无在线客服,请稍后咨询。"
-    }
+    },
+	"entServiceReplay":{
+		"title":"河南省郑州市金水区科技局政务服务已上线。<a href='%s'>点击查看</a>",
+		"href":"http://www.baidu.com",
+		"code":"1"
+	}
 }

+ 41 - 1
weixin/src/qfw/weixin/ssohandler.go

@@ -4,13 +4,53 @@ package weixin
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/SKatiyar/qr"
 	"log"
 	"net/http"
 	"qfw/util"
 	"strconv"
+
+	"github.com/SKatiyar/qr"
 )
 
+//生成永久二维码
+func YjHandle_Img(w http.ResponseWriter, r *http.Request) {
+	param := r.RequestURI[12:]
+	if !digitreg.MatchString(param) {
+		return
+	}
+	log.Println("param:", param)
+	//TODO 参数存redis
+	iparam, _ := strconv.Atoi(param)
+	//构造自定义消息文本
+	var msg struct {
+		Name string `json:"action_name"`
+		Info struct {
+			Scene struct {
+				Id int `json:"scene_id"`
+			} `json:"scene"`
+		} `json:"action_info"`
+	}
+	msg.Name = "QR_LIMIT_SCENE"
+	msg.Info.Scene.Id = iparam
+	ret, err := Mux.PostCustomMsg("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=", &msg)
+	if err != nil {
+		log.Println(err.Error())
+	} else {
+		tmp := map[string]interface{}{}
+		json.Unmarshal(ret, &tmp)
+		log.Println(tmp)
+		url := tmp["url"].(string)
+		w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+		w.Header().Set("Pragma", "no-cache")
+		w.Header().Set("Expires", "0")
+		w.Header().Set("Content-Type", "image/png")
+		r, _ := qr.Encode(url, qr.L)
+		pngdat := r.PNG()
+		w.Write(pngdat)
+	}
+
+}
+
 //生成永久二维码
 func YjHandle(w http.ResponseWriter, r *http.Request) {
 	param := r.RequestURI[12:]

+ 3 - 0
weixin/src/qfw/weixin/subscribehandler.go

@@ -67,6 +67,9 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 				go dao.SaveInviteLink(source, r.FromUserName, false)
 				//go dao.UpdateInviteUserCoupon(source)
 			}
+			if source == weixinconfig.SysConfig.EntServiceReplay["code"].(string) {
+				w.PostText(fmt.Sprintf(weixinconfig.SysConfig.EntServiceReplay["title"].(string), weixinconfig.SysConfig.EntServiceReplay["href"].(string)))
+			}
 		} else {
 			w.ReplyText(OWELCOME_MSG) // 有旧人关注,返回欢迎消息
 			if strings.HasPrefix(source, "32") {

+ 2 - 0
weixin/src/qfw/weixin/weixin.go

@@ -69,6 +69,8 @@ func InitWeixinSdk() {
 	//http.HandleFunc("/"+wf.SysConfig.Appcontext+"/paycallback", PayCallback)
 
 	//http.HandleFunc("/"+wf.SysConfig.Appcontext+"/sendmsg", SendMsgAct)
+	//生成永久二维码
+	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/YJH/", YjHandle_Img)
 	//生成推广二维码
 	http.HandleFunc("/"+wf.SysConfig.Appcontext+"/adv/", AdvHandle)
 	//人工识别二维码监控

+ 1 - 0
weixin/src/qfw/weixinconfig/weixinconfig.go

@@ -43,6 +43,7 @@ type wxconfig struct {
 	Kfport                string                            `json:"kfport"`
 	Gs_yw                 map[string]map[string]interface{} `json:"gs_yw"`
 	Gs_push               map[string]interface{}            `json:"gs_push"`
+	EntServiceReplay      map[string]interface{}            `json:"entServiceReplay"`
 }
 
 //系统配置