|
@@ -634,29 +634,28 @@ func GetStoryScoreList(activityID int64, page int64, limit int64) (score []*mode
|
634
|
634
|
return score, total, err
|
635
|
635
|
}
|
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) (map[string]string, error) {
|
638
|
638
|
|
639
|
639
|
var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
|
640
|
640
|
var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
|
641
|
641
|
fmt.Println("url233232323322323", url)
|
642
|
642
|
resp, err := http.DefaultClient.Get(code2sessionURL)
|
643
|
643
|
fmt.Println("resp32332232332322", resp)
|
644
|
|
- if err != nil {
|
645
|
|
- return "", err
|
646
|
|
- }
|
|
644
|
+
|
647
|
645
|
var wxMap map[string]string
|
648
|
646
|
err = json.NewDecoder(resp.Body).Decode(&wxMap)
|
649
|
647
|
if err != nil {
|
650
|
|
- return "", err
|
|
648
|
+ return wxMap, err
|
651
|
649
|
}
|
652
|
650
|
defer resp.Body.Close()
|
653
|
651
|
|
654
|
|
- return wxMap["openid"], nil
|
|
652
|
+ return wxMap, err
|
655
|
653
|
}
|
656
|
654
|
|
657
|
655
|
func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code string) (string, error) {
|
658
|
656
|
var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
|
659
|
657
|
var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
|
|
658
|
+ fmt.Println(url)
|
660
|
659
|
resp, err := http.DefaultClient.Get(code2sessionURL)
|
661
|
660
|
if err != nil {
|
662
|
661
|
return "", err
|
|
@@ -667,6 +666,6 @@ func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code st
|
667
|
666
|
return "", err
|
668
|
667
|
}
|
669
|
668
|
defer resp.Body.Close()
|
670
|
|
-
|
|
669
|
+ fmt.Println("2333232232", wxMap)
|
671
|
670
|
return wxMap["session_key"], nil
|
672
|
671
|
}
|