|
@@ -654,7 +654,7 @@ func GetStoryScoreList(activityID int64, page int64, limit int64) (score []*mode
|
654
|
654
|
//}
|
655
|
655
|
|
656
|
656
|
func SendWxAuthAPI(appID string, appSecret string, grant_type string, code string) (string, error) {
|
657
|
|
- var code2sessionURL = "https://xcx.kuyicloud.com/xcx/api/mobile/getappid?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
|
|
657
|
+ var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
|
658
|
658
|
var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
|
659
|
659
|
fmt.Println("url233232323322323", url)
|
660
|
660
|
resp, err := http.DefaultClient.Get(url)
|
|
@@ -670,3 +670,21 @@ func SendWxAuthAPI(appID string, appSecret string, grant_type string, code strin
|
670
|
670
|
|
671
|
671
|
return wxMap["openid"], nil
|
672
|
672
|
}
|
|
673
|
+
|
|
674
|
+func SendWxAuthAPIOne(appID string, appSecret string, grant_type string, code string) (string, error) {
|
|
675
|
+ var code2sessionURL = "https://api.weixin.qq.com/sns/jscode2session?appid=" + appID + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=" + grant_type
|
|
676
|
+ var url = fmt.Sprintf(code2sessionURL, appID, appSecret, code)
|
|
677
|
+ fmt.Println("url233232323322323", url)
|
|
678
|
+ resp, err := http.DefaultClient.Get(url)
|
|
679
|
+ if err != nil {
|
|
680
|
+ return "", err
|
|
681
|
+ }
|
|
682
|
+ var wxMap map[string]string
|
|
683
|
+ err = json.NewDecoder(resp.Body).Decode(&wxMap)
|
|
684
|
+ if err != nil {
|
|
685
|
+ return "", err
|
|
686
|
+ }
|
|
687
|
+ defer resp.Body.Close()
|
|
688
|
+
|
|
689
|
+ return wxMap["session_key"], nil
|
|
690
|
+}
|