Răsfoiți Sursa

合并修改

wangshan 8 ani în urmă
părinte
comite
30b64f24fb

+ 0 - 10
weixin/src/main.go

@@ -47,11 +47,6 @@ func main() {
 	rpc.InitTpl()
 	//启动Rpc服务
 	rpc.StartWeixinRpc(weixin.Mux)
-	//启动web服务
-	http.HandleFunc("/wx/token", func(w http.ResponseWriter, r *http.Request) {
-		b := weixin.Mux.GetAccessToken()
-		w.Write([]byte(b))
-	})
 	http.ListenAndServe(":"+wf.SysConfig.Port, nil) // 启动接收微信数据服务器
 	/*
 		endless.ListenAndServe(":"+wf.SysConfig.Port, nil, func() {
@@ -90,10 +85,5 @@ func kf() {
 		w.Write(b)
 	})
 
-	http.HandleFunc("/wenxin/token", func(w http.ResponseWriter, r *http.Request) {
-		b := weixin.Mux.GetAccessToken()
-		w.Write([]byte(b))
-	})
-
 	http.ListenAndServe(":"+wf.SysConfig.Kfport, nil)
 }

+ 10 - 2
weixin/src/qfw/weixin/subscribehandler.go

@@ -32,8 +32,16 @@ func SubscribeHandler(w ResponseWriter, r *Request) {
 		bindweixin, _ = ret["nickname"].(string)
 		//取得用户头像
 		headimgurl, _ := ret["headimgurl"].(string)
-		province, _ = ret["province"].(string)
-		city, _ = ret["city"].(string)
+		if ret["province"] != "" {
+			province, _ = ret["province"].(string)
+		} else {
+			province = ""
+		}
+		if ret["city"] != "" {
+			city, _ = ret["city"].(string)
+		} else {
+			city = ""
+		}
 		log.Println("download userface :", headimgurl)
 		userphoto = downloadUserFace(headimgurl)
 	}

+ 0 - 9
weixin/src/qfw/weixin/weixinsdk.go

@@ -342,10 +342,6 @@ func (wx *Weixin) GetAppId() string {
 	return wx.appId
 }
 
-func (wx *Weixin) GetAccessToken() string {
-	return wx.token
-}
-
 func (wx *Weixin) GetAppSecret() string {
 	return wx.appSecret
 }
@@ -613,11 +609,6 @@ func (wx *Weixin) SetTemplateIndustry(id1 string, id2 string) error {
 	return err
 }
 
-func (wx *Weixin) GetAccessToken() string {
-	token := <-wx.tokenChan
-	return token.token
-}
-
 func (wx *Weixin) AddTemplate(shortid string) (string, error) {
 	var request struct {
 		Shortid string `json:"template_id_short,omitempty"`