Browse Source

体积小

XMLWAN 3 years ago
parent
commit
5aa839c1e7
1 changed files with 4 additions and 5 deletions
  1. 4 5
      service/xcx_mobile_api_service.go

+ 4 - 5
service/xcx_mobile_api_service.go View File

636
 
636
 
637
 func SendWxAuthAPI(appID string, appSecret string, grant_type string, code string) (string, error) {
637
 func SendWxAuthAPI(appID string, appSecret string, grant_type string, code string) (string, error) {
638
 
638
 
639
-	var code2sessionURL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appID + "&secret=" + appSecret + "&code=" + code + "&grant_type=" + grant_type
639
+	var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
640
 	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
640
 	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
641
 	fmt.Println("url233232323322323", url)
641
 	fmt.Println("url233232323322323", url)
642
-	resp, err := http.DefaultClient.Get(url)
642
+	resp, err := http.DefaultClient.Get(code2sessionURL)
643
 	fmt.Println("resp32332232332322", resp)
643
 	fmt.Println("resp32332232332322", resp)
644
 	if err != nil {
644
 	if err != nil {
645
 		return "", err
645
 		return "", err
655
 }
655
 }
656
 
656
 
657
 func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code string) (string, error) {
657
 func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code string) (string, error) {
658
-	var code2sessionURL = "GET https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
658
+	var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
659
 	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
659
 	var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
660
-	fmt.Println("url233232323322323", url)
661
-	resp, err := http.DefaultClient.Get(url)
660
+	resp, err := http.DefaultClient.Get(code2sessionURL)
662
 	if err != nil {
661
 	if err != nil {
663
 		return "", err
662
 		return "", err
664
 	}
663
 	}